org.hippoecm.hst.component.support.forms
Class FormUtils

java.lang.Object
  extended by org.hippoecm.hst.component.support.forms.FormUtils

public class FormUtils
extends Object


Field Summary
static String DEFAULT_FORMDATA_CONTAINER
           
static String DEFAULT_FORMDATA_TYPE
           
static String DEFAULT_STORED_FORMS_LOCATION
           
static String DEFAULT_UUID_NAME
           
static String HST_CREATIONTIME
           
static String HST_FORM_DATA_NODE
           
static String HST_FORM_FIELD_DATA
           
static String HST_FORM_FIELD_MESSAGES
           
static String HST_FORM_FIELD_NAME
           
static String HST_PREDECESSOR
           
static String HST_SEALED
           
 
Constructor Summary
FormUtils()
           
 
Method Summary
static FormMap getFormMap(javax.servlet.http.HttpServletRequest request)
          Returns a populated FormaMap for some form data node if that node can be found with the u_u_i_d parameter on the request.
static javax.jcr.Session getWritableSession()
           
static void persistFormMap(HstRequest request, HstResponse response, FormMap formMap, StoreFormResult storeFormResult)
          Facility to temporarily store submitted form data which needs to be accessed in the rendering phase again.
static void populate(HstRequest request, FormMap formMap)
          This method tries to repopulate an earlier posted form that was stored in the repository.
static void populate(javax.servlet.http.HttpServletRequest request, FormMap formMap)
          This method tries to repopulate an earlier posted form that was stored in the repository.
static void validateId(String uuid)
          Validates an uuid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_UUID_NAME

public static final String DEFAULT_UUID_NAME
See Also:
Constant Field Values

DEFAULT_STORED_FORMS_LOCATION

public static final String DEFAULT_STORED_FORMS_LOCATION
See Also:
Constant Field Values

DEFAULT_FORMDATA_CONTAINER

public static final String DEFAULT_FORMDATA_CONTAINER
See Also:
Constant Field Values

DEFAULT_FORMDATA_TYPE

public static final String DEFAULT_FORMDATA_TYPE
See Also:
Constant Field Values

HST_CREATIONTIME

public static final String HST_CREATIONTIME
See Also:
Constant Field Values

HST_PREDECESSOR

public static final String HST_PREDECESSOR
See Also:
Constant Field Values

HST_FORM_DATA_NODE

public static final String HST_FORM_DATA_NODE
See Also:
Constant Field Values

HST_FORM_FIELD_DATA

public static final String HST_FORM_FIELD_DATA
See Also:
Constant Field Values

HST_FORM_FIELD_MESSAGES

public static final String HST_FORM_FIELD_MESSAGES
See Also:
Constant Field Values

HST_FORM_FIELD_NAME

public static final String HST_FORM_FIELD_NAME
See Also:
Constant Field Values

HST_SEALED

public static final String HST_SEALED
See Also:
Constant Field Values
Constructor Detail

FormUtils

public FormUtils()
Method Detail

getFormMap

public static FormMap getFormMap(javax.servlet.http.HttpServletRequest request)
Returns a populated FormaMap for some form data node if that node can be found with the u_u_i_d parameter on the request. If no such form data node can be found, an empty FormMap will be returned

Parameters:
request - the HttpServletRequest
Returns:
a populated FormMap for the formdata node belonging to the UUID from request parameter u_u_i_d If there is no formdata for the UUID or no u_u_i_d parameter, just an empty FormMap object will be returned
See Also:
#populate(javax.servlet.http.HttpServletRequest, FormMap)}

populate

public static void populate(javax.servlet.http.HttpServletRequest request,
                            FormMap formMap)
This method tries to repopulate an earlier posted form that was stored in the repository. Only when there is a request parameter containing the correct uuid, it can be re-populated.

Parameters:
request - the HttpServletRequest
formMap - a not yet populated FormMap object (just new FormMap())

populate

public static void populate(HstRequest request,
                            FormMap formMap)
This method tries to repopulate an earlier posted form that was stored in the repository. Only when there is a request parameter containing the correct uuid, you can re-populate it.

Parameters:
request - the current hstRequest
formMap - the formMap that will be populated
See Also:
rather use {@link #populate(javax.servlet.http.HttpServletRequest, FormMap)} instead of this method

persistFormMap

public static void persistFormMap(HstRequest request,
                                  HstResponse response,
                                  FormMap formMap,
                                  StoreFormResult storeFormResult)
                           throws HstComponentException
Facility to temporarily store submitted form data which needs to be accessed in the rendering phase again. This method add the uuid of the newly created jcr node on the response as a render parameter

Parameters:
request - the request
response - the response
formMap - the form names + values to temporarily store
storeFormResult - an object to store some result of the data persisting, for example the uuid of the created node
Throws:
HstComponentException - when the storing of the formdata fails

validateId

public static void validateId(String uuid)
                       throws IllegalArgumentException
Validates an uuid. If invalid uuid is passed, IllegalArgumentException exception will be thrown

Parameters:
uuid - uuid to validate
Throws:
IllegalArgumentException - thrown on invalid uuid

getWritableSession

public static javax.jcr.Session getWritableSession()
                                            throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException


Copyright © 2008-2012 Hippo. All Rights Reserved.