fr.paris.lutece.plugins.form.service.draft
Class FormDraftBackupService

java.lang.Object
  extended by fr.paris.lutece.plugins.form.service.draft.FormDraftBackupService

public final class FormDraftBackupService
extends java.lang.Object

Static wrapper for DraftBackupService.
Modules implementing DraftBackupService have to set the service using setDraftBackupService(DraftBackupService). Make sure there is only one implementation at runtime, multiple implementation will lead to non predictable behavior.
Does nothing if no implementation is set.


Method Summary
static boolean isDraftSupported()
          Returns true if draft is supported, false otherwise.
static boolean preProcessRequest(javax.servlet.http.HttpServletRequest request, Form form)
          Pre Process Request.
static void saveDraft(javax.servlet.http.HttpServletRequest request, Form form)
          Save the draft.
static void saveDraft(javax.servlet.http.HttpServletRequest request, FormSubmit formSubmit)
          Saves the formSubmit as draft.
static void setDraftBackupService(DraftBackupService draftBackupService)
          Sets the DraftBackupService
static void validateDraft(javax.servlet.http.HttpServletRequest request, Form form)
          Validate a draft.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setDraftBackupService

public static void setDraftBackupService(DraftBackupService draftBackupService)
Sets the DraftBackupService

Parameters:
draftBackupService - the backup service

saveDraft

public static void saveDraft(javax.servlet.http.HttpServletRequest request,
                             Form form)
                      throws fr.paris.lutece.portal.service.message.SiteMessageException
Save the draft. Useful when the user save his form but does not submit it.

Parameters:
request - The HTTP request
form - The Form
Throws:
fr.paris.lutece.portal.service.message.SiteMessageException - if an error occurs

saveDraft

public static void saveDraft(javax.servlet.http.HttpServletRequest request,
                             FormSubmit formSubmit)
                      throws fr.paris.lutece.portal.service.message.SiteMessageException
Saves the formSubmit as draft. Useful after the user submitted his form.

Parameters:
request - the request
formSubmit - formSubmit
Throws:
fr.paris.lutece.portal.service.message.SiteMessageException - if an error occurs

validateDraft

public static void validateDraft(javax.servlet.http.HttpServletRequest request,
                                 Form form)
                          throws fr.paris.lutece.portal.service.message.SiteMessageException
Validate a draft.

Parameters:
request - The HTTP request
form - The form
Throws:
fr.paris.lutece.portal.service.message.SiteMessageException - if an error occurs

preProcessRequest

public static boolean preProcessRequest(javax.servlet.http.HttpServletRequest request,
                                        Form form)
                                 throws fr.paris.lutece.portal.service.message.SiteMessageException
Pre Process Request. Always returns false if no implementation.

Parameters:
request - The HTTP request
form - The form
Returns:
true if the request is processed, false if the process should be continued
Throws:
fr.paris.lutece.portal.service.message.SiteMessageException - if an error occurs

isDraftSupported

public static boolean isDraftSupported()
Returns true if draft is supported, false otherwise.

Returns:
true if draft is supported, false otherwise.


Copyright © 2012 Mairie de Paris. All Rights Reserved.