com.jalios.jcms.handler
Class JcmsFormHandler

java.lang.Object
  extended by com.jalios.jcms.context.JcmsContext
      extended by com.jalios.jcms.context.JcmsJspContext
          extended by com.jalios.jcms.handler.JcmsFormHandler
All Implemented Interfaces:
JcmsConstants, JaliosConstants
Direct Known Subclasses:
AbstractCaddyManagerHandler, AbstractQueryHandler, AdminSearchEnginesHandler, AuthKeyGeneratorHandler, CacheManagerHandler, DeployManagerDownloadHandler, DeployManagerUpgradeHandler, DeployManagerUpgradeUploadHandler, DisplayPluginHandler, EditDataHandler, EditImageHandler, EditPluginHandler, ExportRawStatDataHandler, FileHandler, FileProcessorAdminHandler, FriendlyURLsHandler, ImportCatListHandler, ImportConflictHandler, ImportManagerHandler, JSyncManagerHandler, LegacyWitnessFileImportHandler, LoadJcms5DataHandler, MailEditHandler, MemberListHandler, ProfilerHandler, PropertiesHandler, PubBrowserHandler, StoreCleanerHandler, SwitchAccessibilityContextHandler, SyncLdapHandler, TypeEditorHandler, TypeListEditorHandler, UpgradeManagerHandler, WFEditorHandler, WorkReportHandler, WorkspaceWizardHandler, ZipFilesHandler

public abstract class JcmsFormHandler
extends JcmsJspContext
implements JcmsConstants

This abstract class is the super class of all the Form Handler classes (i.e. JavaBean classes used in JSP pages for processing form).

Version:
$Revision: 30196 $
Author:
Olivier Dedieu

Field Summary
protected  HashMap<String,Object> contextMap
           
protected  HashSet editFieldSet
           
protected  boolean noRedirect
           
protected  boolean noSendRedirect
           
protected  boolean popupEdition
           
protected  String redirect
           
protected  boolean redirectOnClosePopup
           
static String REVISION
           
protected  boolean workspaceForced
           
 
Fields inherited from class com.jalios.jcms.context.JcmsJspContext
AJAX_REQUEST_ATTRIBUTES, BODY_HEADER, CSS_HEADER, cssboMap, cssfoMap, CUSTOM_HEADER, editIcon, HTTPEQUIV_HEADER, httpequivMap, HTTPNAME_HEADER, httpnameMap, initEditIcon, JAVASCRIPT_CODE_SET_ATTRIBUTE, JAVASCRIPT_SET_ATTRIBUTE, JS_HEADER, jsboMap, jsboSet, jsfoMap, jsfoSet, out, pageContext, SHOW_EDIT_ICON, STYLE_HEADER
 
Fields inherited from class com.jalios.jcms.context.JcmsContext
browser, caddy, channel, inFO, initDone, initWorkspace, isAdmin, isAjaxRequest, isDBMember, isDebug, isLogged, loggedMember, request, response, userLang, userLocale, workspace
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CRYPT_MD5, CRYPT_UNDEFINED, CRYPT_UNIX, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
 
Constructor Summary
JcmsFormHandler()
           
 
Method Summary
protected  boolean checkMissingField(Object obj, String prop)
           
protected  HashMap<String,Object> getControllerContext()
          Build a controller context.
 HashSet getEditFieldSet()
           
 String getHiddenField(String name, boolean value)
           
 String getHiddenField(String name, boolean[] array)
           
 String getHiddenField(String name, Data value)
           
 String getHiddenField(String name, Data[] datas)
           
 String getHiddenField(String name, Date value)
           
 String getHiddenField(String name, Date[] array)
           
 String getHiddenField(String name, double value)
           
 String getHiddenField(String name, double[] array)
           
 String getHiddenField(String name, int value)
           
 String getHiddenField(String name, int[] array)
           
 String getHiddenField(String name, long value)
           
 String getHiddenField(String name, long[] array)
           
 String getHiddenField(String name, String value)
           
 String getHiddenField(String name, String[] array)
           
 String getHiddenFieldML(String name, HashMap<String,String> map)
           
protected  String getMainLangValue(String[] array, boolean trim, boolean escape)
          Returns the first value (i.e.
protected  String[] getMainLangValueArray(String[] array, boolean trim, boolean escape)
          Returns the first values (i.e.
protected  HashMap<String,String> getMLMap(String[] array, boolean trim, boolean escape)
          Returns the ML map (i.e.
protected  HashMap<String,String[]> getMLMapArray(String[] array, boolean trim, boolean escape)
          Returns the ML map (i.e.
 String getRedirect()
          Get the value of redirect.
 boolean getRedirectOnClosePopup()
          Return the value indicating whether the redirect value should be applied to the opener when closing the popup edition.
 Workspace getWorkspace()
          Retrieve the current Workspace variable for this context either from request if inFO or from session if in back office.
 boolean isFieldEdition(String field)
           
protected  boolean isFieldMissing(String field)
          Check if the given parameter is present in the query parameters
 boolean isPartialFieldEdition()
          Returns true if this is a partial field edition (i.e.
 boolean isPopupEdition()
           
 boolean isWorkspaceForced()
           
protected  boolean processStatus(ControllerStatus status)
          Process the ControllerStatus: do nothing if OK, or send on forbidden, or put a warning message in the request.
 void sendRedirect(String url)
          Redirect current request to given URL.
Overrides JcmsContext.sendRedirect(String) to use behavior provided by sendRedirect(String, boolean).
 void sendRedirect(String url, boolean checkRedirect)
          Set the redirect in the response.
 void setEditField(String[] v)
           
 void setNoRedirect(boolean noRedirect)
          Set the value of noRedirect.
 void setNoSendRedirect(boolean noSendRedirect)
          Set the value of noSendRedirect.
 void setPopupEdition(boolean v)
           
 void setRedirect(String v)
          Set the value of redirect.
 void setRedirectOnClosePopup(boolean redirectOnClosePopup)
          Set whether the redirect value should be applied to the opener when closing the popup edition.
The value set by this method will be used only when using popup edition (setPopupEdition(boolean)).
 void setWorkspace(Workspace wspc)
           
 void setWs(String v)
           
protected  String updateUploadedField(String fieldName, String value, boolean isFileDocument, boolean override)
          Perform upload then, return value of the real File realtive path.
protected  void updateUploadedFields(String fieldName, String[] values, boolean isFileDocument, boolean override)
          Perform upload then, replace all values with value MultipartRequest.MULTIPART_UPLOAD with the real File realtive path.
 
Methods inherited from class com.jalios.jcms.context.JcmsJspContext
addBodyAttributes, addCSSHeader, addCSSHeader, addCSSHeader, addCSSHeader, addCustomHeader, addHttpEquivHeader, addHttpNameHeader, addJavaScript, addJavaScript, addJavaScript, addJavaScriptCode, addJSHeader, addJSHeader, addJSHeader, addJSHeader, addStyleHeader, addStyleHeader, checkAccess, checkAccess, debugDisplayContext, forceEditIcon, forceUpdate, getAjaxRequestAttribute, getAjaxRequestId, getAllHeadersDiffMap, getAllHeadersMap, getBackOfficeCSSHeader, getBackOfficeJavaScriptSet, getBackOfficeJSHeader, getBodyAttributes, getContentForm, getCSSHeaders, getCtxCategories, getCurrentCategory, getCustomHeaders, getDocType, getFinalCSSMap, getFinalJavaScriptSet, getFormElementCount, getFrontOfficeCSSHeader, getFrontOfficeJavaScriptSet, getFrontOfficeJSHeader, getHttpEquivHeaders, getHttpNameHeaders, getJavaScriptCodeSet, getJavaScriptSet, getJSHeaders, getJSONBridge, getPackVersion, getPageContext, getPageTitle, getPageZone, getPortal, getPortalCategory, getPortlet, getPublication, getStyleHeaders, getTemplateUsage, internalSetupEmptyHeader, isEditIcon, isPrintView, registerDisplayContext, removeAjaxRequestAttribute, setAjaxRequestAttribute, setAjaxRequestId, setAllHeadersDiffMap, setDocType, setEditIcon, setFormElementCount, setPageContext, setPageTitle, setPageZone, setShowEditIcon, setTemplateUsage, showEditIcon, workaroundBrowserBaseHrefBug
 
Methods inherited from class com.jalios.jcms.context.JcmsContext
addCookie, addMsg, addMsg, addMsgSession, applySelector, forceWorkspaceUpdate, getBaseUrl, getBrowser, getCaddy, getContextPath, getErrorMsg, getErrorMsgList, getErrorMsgSession, getErrorMsgSessionList, getInfoMsg, getInfoMsgList, getInfoMsgSession, getInfoMsgSessionList, getLoggedMember, getMsgList, getMsgSessionList, getRequest, getResponse, getSession, getUploadedFile, getUploadedFileList, getUrlWithCommonUpdatedParams, getUserLang, getUserLocale, getWarningMsg, getWarningMsgList, getWarningMsgSession, getWarningMsgSessionList, glp, isAdmin, isAjaxRequest, isDBMember, isDebug, isInFrontOffice, isLogged, isWebdavAccess, removeMessage, removeMessage, retrieveUploadedFile, select, sendForbidden, sendForbidden, sendRedirect, sendRedirect, setErrorMsg, setErrorMsg, setErrorMsgSession, setErrorMsgSession, setInfoMsg, setInfoMsg, setInfoMsgSession, setInfoMsgSession, setLoggedMember, setRequest, setResponse, setWarningMsg, setWarningMsg, setWarningMsgSession, setWarningMsgSession, validateRegexp, validateSchedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

redirect

protected String redirect

noRedirect

protected boolean noRedirect

noSendRedirect

protected boolean noSendRedirect

redirectOnClosePopup

protected boolean redirectOnClosePopup

workspaceForced

protected boolean workspaceForced

popupEdition

protected boolean popupEdition

editFieldSet

protected HashSet editFieldSet

contextMap

protected HashMap<String,Object> contextMap
Constructor Detail

JcmsFormHandler

public JcmsFormHandler()
Method Detail

getWorkspace

public Workspace getWorkspace()
Description copied from class: JcmsContext
Retrieve the current Workspace variable for this context either from request if inFO or from session if in back office. Fast: this method is cached using initDone (it is recomputed only on forceUpdate() or setRequest()).

Overrides:
getWorkspace in class JcmsContext
Returns:
the workspace (the one set by doInitPage.jsp)

isWorkspaceForced

public boolean isWorkspaceForced()

setWorkspace

public void setWorkspace(Workspace wspc)

setWs

public void setWs(String v)

sendRedirect

public void sendRedirect(String url,
                         boolean checkRedirect)
                  throws IOException
Set the redirect in the response. If noRedirect has been set, this method set no redirection. If noSendRedirect has been set, put the request attribute "redirect" but do not call response.sendRedirect(). This may be useful when redirecting from a dynamically included JSP in the front-office (some AppServer throw an exception when setting/getting request attribute once the redirect has been put.)

Parameters:
url - the url to redirect to.
checkRedirect - if true and if redirect attribute has been set, redirect on this url
Throws:
IOException
Since:
jcms-4.0

sendRedirect

public void sendRedirect(String url)
                  throws IOException
Redirect current request to given URL.
Overrides JcmsContext.sendRedirect(String) to use behavior provided by sendRedirect(String, boolean).

Overrides:
sendRedirect in class JcmsContext
Parameters:
url - the url to redirect to.
Throws:
IOException - if an error occured while writing in response headers
Since:
jcms-4.0
See Also:
JcmsContext.sendRedirect(String, HttpServletRequest, HttpServletResponse)

getRedirect

public String getRedirect()
Get the value of redirect.

Returns:
Value of redirect.

setRedirect

public void setRedirect(String v)
Set the value of redirect.

Parameters:
v - Value to assign to redirect.

setNoRedirect

public void setNoRedirect(boolean noRedirect)
Set the value of noRedirect.

Parameters:
noRedirect - Value to assign to noRedirect.
Since:
jcms-4.0

setNoSendRedirect

public void setNoSendRedirect(boolean noSendRedirect)
Set the value of noSendRedirect.

Parameters:
noSendRedirect - Value to assign to noSendRedirect.
Since:
jcms-4.0

setRedirectOnClosePopup

public final void setRedirectOnClosePopup(boolean redirectOnClosePopup)
Set whether the redirect value should be applied to the opener when closing the popup edition.
The value set by this method will be used only when using popup edition (setPopupEdition(boolean)).

Parameters:
redirectOnClosePopup - if true, the redirect value (setRedirect(String)) will be provided to closePopup.jsp to redirect the opener. if false, the popup will simply be closed and the opener refreshed.
Since:
jcms-5.7

getRedirectOnClosePopup

public final boolean getRedirectOnClosePopup()
Return the value indicating whether the redirect value should be applied to the opener when closing the popup edition.

Returns:
true, when redirect value (setRedirect(String)) will be provided to closePopup.jsp to redirect the opener. false, if the popup will simply be closed and the opener refreshed.
Since:
jcms-5.7

processStatus

protected boolean processStatus(ControllerStatus status)
                         throws IOException
Process the ControllerStatus: do nothing if OK, or send on forbidden, or put a warning message in the request.

Parameters:
status - the ControllerStatus to be processed
Throws:
IOException
Since:
jcms-5.0.0

getControllerContext

protected HashMap<String,Object> getControllerContext()
Build a controller context. I.E. add request, response and loggedMember.

Returns:
the HashMap which contains the context
Since:
jcms-5.0.0

isFieldMissing

protected boolean isFieldMissing(String field)
Check if the given parameter is present in the query parameters

Parameters:
field - the field to be checked
Returns:
true if this field is present in the query parameters
Since:
jcms-5.0.0

setPopupEdition

public void setPopupEdition(boolean v)
Since:
jcms-5.0.0

isPopupEdition

public boolean isPopupEdition()
Since:
jcms-5.0.0

setEditField

public void setEditField(String[] v)
Since:
jcms-5.0.0

getEditFieldSet

public HashSet getEditFieldSet()
Since:
jcms-5.0.0

isFieldEdition

public boolean isFieldEdition(String field)
Since:
jcms-5.0.0

isPartialFieldEdition

public boolean isPartialFieldEdition()
Returns true if this is a partial field edition (i.e. front edition)

Returns:
true if this is a partial field edition.
Since:
jcms-5.5.0

updateUploadedField

protected String updateUploadedField(String fieldName,
                                     String value,
                                     boolean isFileDocument,
                                     boolean override)
Perform upload then, return value of the real File realtive path. if value is equal to MultipartRequest.MULTIPART_UPLOAD

Parameters:
fieldName - the field name
value - the field fake value
Since:
jcms-5.7.0

updateUploadedFields

protected void updateUploadedFields(String fieldName,
                                    String[] values,
                                    boolean isFileDocument,
                                    boolean override)
Perform upload then, replace all values with value MultipartRequest.MULTIPART_UPLOAD with the real File realtive path.

Parameters:
fieldName - the field name
values - the field fake values
Since:
jcms-5.7.0

getMainLangValue

protected String getMainLangValue(String[] array,
                                  boolean trim,
                                  boolean escape)
Returns the first value (i.e. the main language value) from the given array (monovalued ML fields).

Parameters:
array - the array
trim - if true trim the value
escape - if true escape the value
Returns:
the first value from the array.
Since:
jcms-6.0.0

getMLMap

protected HashMap<String,String> getMLMap(String[] array,
                                          boolean trim,
                                          boolean escape)
Returns the ML map (i.e. the additionnal languages) filled with the values contained in the given array (monovalued ML fields).

Parameters:
array - the array
trim - if true trim the values
escape - if true escape the values
Returns:
the ML map filled with the values contained in the given array.
Since:
jcms-6.0.0

getMainLangValueArray

protected String[] getMainLangValueArray(String[] array,
                                         boolean trim,
                                         boolean escape)
Returns the first values (i.e. the main language value) from the given array (multivalued ML fields).

Parameters:
array - the array
trim - if true trim the values
escape - if true escape the values
Returns:
the first values from the array (i.e. the main language value) from the given array.
Since:
jcms-6.0.0

getMLMapArray

protected HashMap<String,String[]> getMLMapArray(String[] array,
                                                 boolean trim,
                                                 boolean escape)
Returns the ML map (i.e. the additionnal languages) filled with the values contained in the given array (multivalued ML fields).

Parameters:
array - the array
trim - if true trim the values
escape - if true escape the values
Returns:
the ML map filled with the values contained in the given array.
Since:
jcms-6.0.0

getHiddenField

public String getHiddenField(String name,
                             String value)

getHiddenFieldML

public String getHiddenFieldML(String name,
                               HashMap<String,String> map)

getHiddenField

public String getHiddenField(String name,
                             Data value)

getHiddenField

public String getHiddenField(String name,
                             boolean value)

getHiddenField

public String getHiddenField(String name,
                             int value)

getHiddenField

public String getHiddenField(String name,
                             double value)

getHiddenField

public String getHiddenField(String name,
                             long value)

getHiddenField

public String getHiddenField(String name,
                             Date value)

getHiddenField

public String getHiddenField(String name,
                             Data[] datas)

getHiddenField

public String getHiddenField(String name,
                             boolean[] array)

getHiddenField

public String getHiddenField(String name,
                             int[] array)

getHiddenField

public String getHiddenField(String name,
                             long[] array)

getHiddenField

public String getHiddenField(String name,
                             double[] array)

getHiddenField

public String getHiddenField(String name,
                             String[] array)

getHiddenField

public String getHiddenField(String name,
                             Date[] array)

checkMissingField

protected boolean checkMissingField(Object obj,
                                    String prop)


Copyright © 2001-2010 Jalios SA. All Rights Reserved.