public abstract class JcmsFormHandler extends JcmsJspContext implements JcmsConstants
To implement a custom form handler :
processAction()
to check for any operation, validate precondition and perform action,The following example demonstrate uses of a form handler to receive a firstname as an input and when validated display a Hello World message to the user
Java filecom.example.jcmsplugin.hello.HelloWorldHandler.java
:
package com.example.jcmsplugin.hello; import java.io.IOException; import com.jalios.jcms.HttpUtil; import com.jalios.jcms.context.JcmsMessage; import com.jalios.jcms.context.JcmsMessage.Level; import com.jalios.jcms.handler.JcmsFormHandler; import com.jalios.util.Util; public class HelloWorldHandler extends JcmsFormHandler { // Possible operations private boolean opSayHello = false; private boolean opCancel = false; // Member variables private String firstname = null; @Override public boolean processAction() throws IOException { if (validateSayHello()) { return performSayHello(); } if (validateCancel()) { return performCancel(); } return false; } // --------------------------------------------------------------- // Say Hello // --------------------------------------------------------------- public boolean validateSayHello() { if (!opSayHello) { return false; } if (Util.isEmpty(this.firstname)) { addMsg(new JcmsMessage(Level.WARN, glp("jcmsplugin.myplugin.myhandler.missing-firsname"))); return false; } return true; } public boolean performSayHello() throws IOException { // In I18N properties : // jcmsplugin.myplugin.myhandler.say-hello: Hello {0} ! // addMsgSession(request, new JcmsMessage(Level.INFO, glp("jcmsplugin.myplugin.myhandler.say-hello", HttpUtil.encodeForHTML(firstname)))); return false; } // --------------------------------------------------------------- // Cancel // --------------------------------------------------------------- public boolean validateCancel() { return opCancel; } public boolean performCancel() throws IOException { sendRedirect(Util.notEmpty(redirect) ? redirect : "index.jsp"); return true; } // --------------------------------------------------------------- // Setters // --------------------------------------------------------------- public void setOpSayHello(String opSayHello) { this.opSayHello = true; } public void setOpCancel(String opCancel) { this.opCancel = true; } public String getFirstname() { return this.firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } }JSP
sayHello.jsp
:
<%@ include file='/jcore/doInitPage.jspf' %><% %><jsp:useBean id="formHandler" scope="page" class="com.example.jcmsplugin.hello.HelloWorldHandler"><% %><jsp:setProperty name="formHandler" property="request" value="<%= request %>" /><% %><jsp:setProperty name="formHandler" property="response" value="<%= response %>" /><% %><jsp:setProperty name="formHandler" property="*" /><% %></jsp:useBean><% if (formHandler.validate()) { return; } %><%@ include file='/jcore/doEmptyHeader.jspf' %><% %><%@ include file='/jcore/doMessageBox.jspf' %> <div id='hello'> <form action="sayHello.jsp" name="sayHelloForm" method="post"> <%-- Inputs --%> <jalios:field name="firstname" formHandler="<%= formHandler %>"> <jalios:control /> </jalios:field> <%-- Hidden Inputs --%> <% if (Util.notEmpty(formHandler.getRedirect())) { %> <input type="hidden" name="redirect" value="<%= encodeForHTMLAttribute(formHandler.getRedirect()) %>" /> <% } %> <%-- Buttons --%> <%= WidgetUtil.printHtmlButton("opSayHello", glp("jcmsplugin.btn.sayhello"), true, null, true) %> <%= WidgetUtil.printHtmlButton("opCancel", glp("ui.com.btn.cancel"), true, null, false) %> </form> </div>Data Handlers (handlers inheriting from
EditDataHandler
) must perform
additionnal operation, see corresponding JavaDoc.Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<java.lang.String,java.lang.Object> |
contextMap |
protected java.util.HashSet<java.lang.String> |
editFieldSet |
protected int |
formStep |
protected boolean |
noRedirect |
protected boolean |
noSendRedirect |
protected boolean |
popupEdition |
protected java.lang.String |
redirect |
protected boolean |
redirectOnClosePopup |
static java.lang.String |
REVISION |
protected boolean |
workspaceForced |
AJAX_REQUEST_ATTRIBUTES, BODY_HEADER, CSS_FOOTER, CSS_HEADER, cssboMap, cssfoMap, CUSTOM_HEADER, editIcon, HTTPEQUIV_HEADER, httpequivMap, HTTPNAME_HEADER, httpnameMap, initEditIcon, JAVASCRIPT_CODE_SET_ATTRIBUTE, JAVASCRIPT_SET_ATTRIBUTE, jsboSet, jsfoSet, out, pageContext, SHOW_EDIT_ICON, STYLE_HEADER
browser, caddy, channel, inFO, initDone, initWorkspace, isAdmin, isAjaxRequest, isDBMember, isDebug, isLogged, loggedMember, request, response, userCountry, userLang, userLocale, workspace
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, AJAX_MODE_ATTR, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, COUNTRY_SPRITE, 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, GLYPH_ICON_PREFIX, ICON_ARCHIVE, ICON_ICON_PREFIX, ICON_LOCK, ICON_LOCK_STRONG, ICON_PREFIX_PROP, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JCMS_TOASTR_COLLECTION, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LANG_SPRITE, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_CREATE_STR, OP_DEEP_COPY, OP_DEEP_COPY_STR, OP_DEEP_DELETE, OP_DEEP_DELETE_STR, OP_DELETE, OP_DELETE_STR, OP_MERGE, OP_MERGE_STR, OP_UPDATE, OP_UPDATE_STR, ORGANIZATION_ROOT_GROUP_PROP, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_PROP_PREFIX, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_PROP_PREFIX, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_PROP_PREFIX, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_PROP_PREFIX, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_PROP_PREFIX, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, SPRITE_ICON_PREFIX, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, SUCCESS_MSG, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, TTCARD_MEDIA_HEIGHT, TTCARD_MEDIA_WIDTH, TYPES_ICON_ALT_PROP, TYPES_ICON_SUFFIX_PROP, TYPES_ICON_TITLE_PROP, TYPES_PREFIX_PROP, TYPES_THUMB_SUFFIX_PROP, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
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 and Description |
---|
JcmsFormHandler() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
afterValidation(boolean result) |
protected boolean |
checkMissingField(java.lang.Object obj,
java.lang.String prop) |
java.lang.String |
getAvailableMainLanguage() |
protected java.lang.String |
getClosePopupUrl() |
protected java.util.HashMap<java.lang.String,java.lang.Object> |
getControllerContext()
Build a controller context.
|
java.util.HashSet<java.lang.String> |
getEditFieldSet() |
int |
getFormStep()
Retrieve the current step of edition when invoking this form handler.
|
int |
getFormStepCount()
Retrieve the total number of steps used for edition when invoking this form handler.
|
java.lang.String |
getFormStepFinishLabel() |
java.lang.String |
getFormStepHiddenFields() |
java.lang.String[] |
getFormStepLabels(java.lang.String userLang)
Returns the label array for the steps.
|
java.lang.String |
getFormStepPrefixProp() |
java.lang.String |
getHiddenField(java.lang.String name,
boolean value) |
java.lang.String |
getHiddenField(java.lang.String name,
boolean[] array) |
java.lang.String |
getHiddenField(java.lang.String name,
Data value) |
java.lang.String |
getHiddenField(java.lang.String name,
Data[] datas) |
java.lang.String |
getHiddenField(java.lang.String name,
java.util.Date value) |
java.lang.String |
getHiddenField(java.lang.String name,
java.util.Date[] array) |
java.lang.String |
getHiddenField(java.lang.String name,
double value) |
java.lang.String |
getHiddenField(java.lang.String name,
double[] array) |
java.lang.String |
getHiddenField(java.lang.String name,
int value) |
java.lang.String |
getHiddenField(java.lang.String name,
int[] array) |
java.lang.String |
getHiddenField(java.lang.String name,
long value) |
java.lang.String |
getHiddenField(java.lang.String name,
long[] array) |
<T extends Data> |
getHiddenField(java.lang.String name,
java.util.Set<T> set) |
java.lang.String |
getHiddenField(java.lang.String name,
java.lang.String value) |
java.lang.String |
getHiddenField(java.lang.String name,
java.lang.String[] array) |
java.lang.String |
getHiddenFieldML(java.lang.String name,
java.util.HashMap<java.lang.String,java.lang.String> map) |
protected java.lang.String |
getMainLangValue(java.lang.String[] array,
boolean trim,
boolean escape)
|
protected java.lang.String[] |
getMainLangValueArray(java.lang.String[] array,
boolean trim,
boolean escape)
Deprecated.
|
protected java.util.HashMap<java.lang.String,java.lang.String> |
getMLMap(java.lang.String[] array,
boolean trim,
boolean escape)
Deprecated.
|
protected java.util.HashMap<java.lang.String,java.lang.String[]> |
getMLMapArray(java.lang.String[] array,
boolean trim,
boolean escape)
Deprecated.
|
java.lang.String |
getModalRedirect()
Get the redirect value to be used in the modals with modalRedirect.jspf and the request attribute 'modal.redirect'.
|
protected static java.lang.String |
getMonolingualValue(TypeFieldEntry tfe,
java.lang.String[] array)
Return the first value from the given array, properly sanitized for usage
in the specified field.
|
protected static java.lang.String[] |
getMonolingualValueArray(TypeFieldEntry tfe,
java.lang.String[] array)
Return the values from the given array, properly sanitized for usage
in the specified field.
|
protected static java.lang.String |
getMultilingualMainValue(TypeFieldEntry tfe,
java.lang.String[] array)
Return the main value (ie: value of main site language) from the given array,
properly sanitized for usage in the specified multilingual field.
|
protected static java.lang.String[] |
getMultilingualMainValueArray(TypeFieldEntry tfe,
java.lang.String[] array)
Return the main values (ie: values of main site language) from the given array,
properly sanitized for usage in the specified multilingual field.
|
protected static java.util.HashMap<java.lang.String,java.lang.String> |
getMultilingualMLMap(TypeFieldEntry tfe,
java.lang.String[] array)
Return a language map (ISO-639 language code to value) of all values but the value
corresponding main site language, extracted from the specified array,
and properly sanitized for usage in the specified multilingual field.
|
protected static java.util.HashMap<java.lang.String,java.lang.String[]> |
getMultilingualMLMapArray(TypeFieldEntry tfe,
java.lang.String[] array)
Return a language map (ISO-639 language code to values) of all values but the value
corresponding main site language, extracted from the specified array,
and properly sanitized for usage in the specified multilingual field.
|
java.lang.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.
|
protected void |
init()
Method to implement if you need to initialize your handler from parameter received,
prior to all security validation.
|
boolean |
isFieldEdition(java.lang.String field) |
protected boolean |
isFieldMissing(java.lang.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 static java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> |
mapStringArrayToMapStringList(java.util.Map<java.lang.String,java.lang.String[]> map)
Convert a map contaning Array of String, into to a map containg List of String.
|
protected static java.util.HashMap<java.lang.String,java.lang.String[]> |
mapStringListToMapStringArray(java.util.Map<java.lang.String,java.util.List<java.lang.String>> map)
Convert a map contaning List of String, into to a map containg Array of String.
|
boolean |
processAction()
Method to be implemented to check/validate action to be performed and process them.
|
protected boolean |
processStatus(ControllerStatus status)
Process the ControllerStatus: do nothing if OK, or send on
forbidden, or put a warning message in the request.
|
static java.lang.String |
sanitize(TypeFieldEntry tfe,
java.lang.String unsafeInput)
Sanitize the specified input string for the usage of the specified field.
|
static java.lang.String[] |
sanitize(TypeFieldEntry tfe,
java.lang.String[] unsafeInput)
Sanitize the specified input strings for the usage of the specified field.
|
void |
sendRedirect(java.lang.String url)
Redirect current request to given URL.
Overrides JcmsContext.sendRedirect(String) to use behavior
provided by sendRedirect(String, boolean) . |
void |
sendRedirect(java.lang.String url,
boolean checkRedirect)
Set the redirect in the response.
|
void |
setEditField(java.lang.String[] v) |
void |
setFormStep(int step)
Set the current step of edition when invoking this form handler.
|
void |
setNoRedirect(boolean noRedirect)
Set the value of noRedirect.
|
void |
setNoSendRedirect(boolean noSendRedirect)
Set the value of noSendRedirect.
|
void |
setPopupEdition(boolean v)
Set where this form handler is being invoked in a popup.
|
void |
setRedirect(java.lang.String url)
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(java.lang.String v) |
boolean |
showCancelButton()
Check if the "Cancel" button should be displayed in step modal form.
|
boolean |
showFinishButton()
Check if the "Finish" button should be displayed in step modal form.
|
boolean |
showNextButton()
Check if the "Next" button should be displayed in step modal form.
|
boolean |
showPreviousButton()
Check if the "Previous" button should be displayed in step modal form.
|
protected java.lang.String |
updateUploadedField(java.lang.String fieldName,
java.lang.String value,
boolean isFileDocument,
boolean override)
Perform upload then, return value of the real File realtive path.
|
protected void |
updateUploadedFields(java.lang.String fieldName,
java.lang.String[] values,
boolean isFileDocument,
boolean override)
Perform upload then, replace all values with value MultipartRequest.MULTIPART_UPLOAD
with the real File realtive path.
|
boolean |
validate()
Method invoked by JSP to validate all conditions (authorization, parameters, ...),
and eventualy trigger the action that was requested to the handler.
|
addBodyAttributes, addCSSHeader, addCSSHeader, addCSSHeader, addCSSHeader, addCustomHeader, addHttpEquivHeader, addHttpNameHeader, addJavaScript, addJavaScript, addJavaScript, addJavaScriptCode, addPrefetchHeader, addStyleHeader, addStyleHeader, checkAccess, checkAccess, checkCSRF, debugDisplayContext, disablePacker, forceEditIcon, forceUpdate, getAjaxRequestAttribute, getAjaxRequestId, getAllHeadersDiffMap, getAllHeadersMap, getBackOfficeCSSHeader, getBackOfficeJavaScriptSet, getBodyAttributes, getContentForm, getCSSHeaders, getCtxCategories, getCurrentCategory, getCustomHeaders, getDocType, getFinalCSSFooterMap, getFinalCSSMap, getFinalJavaScriptSet, getFrontOfficeCSSHeader, getFrontOfficeJavaScriptSet, getHttpEquivHeaders, getHttpNameHeaders, getJavaScriptCodeSet, getJavaScriptSet, getJSONBridge, getPageContext, getPageTitle, getPageZone, getPortal, getPortalCategory, getPortlet, getPublication, getStyleHeaders, getTemplateUsage, internalSetupEmptyHeader, isEditIcon, isEditIcon, isEditIconForPublish, isEditIconForPublish, isPrintView, registerDisplayContext, removeAjaxRequestAttribute, setAjaxRequestAttribute, setAjaxRequestId, setAllHeadersDiffMap, setDocType, setEditIcon, setPageContext, setPageTitle, setPageZone, setShowEditIcon, setTemplateUsage, showEditIcon, showEditIcon, showEditIcon, workaroundBrowserBaseHrefBug
addCookie, addMsg, addMsg, addMsgSession, addMsgSession, addToastr, addToastr, addToastrSession, addToastrSession, applySelector, forceWorkspaceUpdate, getBaseUrl, getBrowser, getCaddy, getContextPath, getErrorMsg, getErrorMsgList, getErrorMsgSession, getErrorMsgSessionList, getInfoMsg, getInfoMsgList, getInfoMsgSession, getInfoMsgSessionList, getLoggedMember, getMsgList, getMsgSessionList, getRequest, getResponse, getSession, getSuccessMsg, getSuccessMsgList, getSuccessMsgSession, getSuccessMsgSessionList, getToastrCollection, getToastrSessionCollection, getUploadedFile, getUploadedFileList, getUrlWithCommonUpdatedParams, getUserCountry, getUserLang, getUserLocale, getWarningMsg, getWarningMsgList, getWarningMsgSession, getWarningMsgSessionList, glp, isAdmin, isAjaxRequest, isDBMember, isDebug, isInFrontOffice, isLogged, isWebdavAccess, removeMessage, removeMessage, retrieveUploadedFile, select, sendForbidden, sendForbidden, sendRedirect, sendRedirect, sendRedirect, setErrorMsg, setErrorMsg, setErrorMsgSession, setErrorMsgSession, setInfoMsg, setInfoMsg, setInfoMsgSession, setInfoMsgSession, setLoggedMember, setRequest, setResponse, setSuccessMsg, setSuccessMsg, setSuccessMsgSession, setSuccessMsgSession, setWarningMsg, setWarningMsg, setWarningMsgSession, setWarningMsgSession, validateRegexp, validateSchedule
public static final java.lang.String REVISION
protected java.lang.String redirect
protected boolean noRedirect
protected boolean noSendRedirect
protected boolean redirectOnClosePopup
protected boolean workspaceForced
protected boolean popupEdition
protected java.util.HashSet<java.lang.String> editFieldSet
protected java.util.HashMap<java.lang.String,java.lang.Object> contextMap
protected int formStep
protected void init()
You must absolutely not perform any action which modify data or site configuration.
Therefore it is strongly recommend NOT TO implement this method, or use very wisely.
public final boolean validate() throws java.io.IOException
Override processAction()
if you need to provide custom actions.
java.io.IOException
- if error occured during validateprotected boolean afterValidation(boolean result) throws java.io.IOException
java.io.IOException
public boolean processAction() throws java.io.IOException
Default implementation is to return false. No need to call super method.
This method may NOT be invoked at all if security validation are not met.
You must ensure your handler and JSP can work properly without any code invoked
in this method.
java.io.IOException
- IO Exceptionpublic java.lang.String getAvailableMainLanguage()
public boolean showCancelButton()
The default implementation of this method is to always return true.
You can provide a custom FormHandler to override this behavior.
See jcore/doStepButtons.jspf for use of this method.
public boolean showNextButton()
The default implementation of this method is to return true
unless the finish button is being displayed
by method showFinishButton()
.
You can provide a custom FormHandler to override this behavior.
See jcore/doStepButtons.jspf for use of this method.
public boolean showPreviousButton()
The default implementation of this method is to return true
if the current step (as returned by getFormStep()
is higher than 0.
You can provide a custom FormHandler to override this behavior.
See jcore/doStepButtons.jspf for use of this method.
public boolean showFinishButton()
The default implementation of this method is to return true
if the current step (as returned by getFormStep()
is
the last one (as compared with getFormStepCount()
.
You can provide a custom FormHandler to override this behavior.
See jcore/doStepButtons.jspf for use of this method.
public int getFormStepCount()
The default implementation of this method is to return 1, corresponding to one step (which means only 1 screen being displayed).
You can provide a custom FormHandler to override this behavior.
See jcore/doSteps.jspf for use of this method.
public java.lang.String getFormStepPrefixProp()
public java.lang.String getFormStepFinishLabel()
public java.lang.String[] getFormStepLabels(java.lang.String userLang)
userLang
- the languagepublic java.lang.String getFormStepHiddenFields()
public int getFormStep()
See jcore/doSteps.jspf for use of this method.
getFormStepCount()
- 1
)public void setFormStep(int step)
step
- the current step (0 being the first one and getFormStepCount()
- 1
being the last one)public Workspace getWorkspace()
JcmsContext
getWorkspace
in class JcmsContext
public boolean isWorkspaceForced()
public void setWorkspace(Workspace wspc)
public void setWs(java.lang.String v)
public void sendRedirect(java.lang.String url, boolean checkRedirect) throws java.io.IOException
url
- the url to redirect to.checkRedirect
- if true and if redirect attribute has been set, redirect on this urljava.io.IOException
- IO Exceptionprotected java.lang.String getClosePopupUrl()
public void sendRedirect(java.lang.String url) throws java.io.IOException
JcmsContext.sendRedirect(String)
to use behavior
provided by sendRedirect(String, boolean)
.sendRedirect
in class JcmsContext
url
- the url to redirect to.java.io.IOException
- if an error occured while writing in response headersJcmsContext.sendRedirect(String, HttpServletRequest, HttpServletResponse)
public java.lang.String getRedirect()
public void setRedirect(java.lang.String url)
url
- Value to assign to redirect.public java.lang.String getModalRedirect()
public void setNoRedirect(boolean noRedirect)
noRedirect
- Value to assign to noRedirect.public void setNoSendRedirect(boolean noSendRedirect)
noSendRedirect
- Value to assign to noSendRedirect.public final void setRedirectOnClosePopup(boolean redirectOnClosePopup)
setPopupEdition(boolean)
).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.public final boolean getRedirectOnClosePopup()
setRedirect(String)
)
will be provided to closePopup.jsp to redirect the opener. false,
if the popup will simply be closed and the opener refreshed.protected boolean processStatus(ControllerStatus status) throws java.io.IOException
status
- the ControllerStatus to be processedjava.io.IOException
- if an error occursprotected java.util.HashMap<java.lang.String,java.lang.Object> getControllerContext()
protected boolean isFieldMissing(java.lang.String field)
field
- the field to be checkedpublic void setPopupEdition(boolean v)
v
- true if handler is invoked in popup, false otherwisepublic boolean isPopupEdition()
public void setEditField(java.lang.String[] v)
v
- a set of field names to editpublic java.util.HashSet<java.lang.String> getEditFieldSet()
public boolean isFieldEdition(java.lang.String field)
field
- field namegetEditFieldSet()
public boolean isPartialFieldEdition()
protected java.lang.String updateUploadedField(java.lang.String fieldName, java.lang.String value, boolean isFileDocument, boolean override)
fieldName
- the field namevalue
- the field fake valueisFileDocument
- is file documentoverride
- override fileprotected void updateUploadedFields(java.lang.String fieldName, java.lang.String[] values, boolean isFileDocument, boolean override)
fieldName
- the field namevalues
- the field fake valuesisFileDocument
- is file documentoverride
- override fileprotected java.lang.String getMainLangValue(java.lang.String[] array, boolean trim, boolean escape)
getMonolingualValue(TypeFieldEntry, String[])
or getMultilingualMainValue(TypeFieldEntry, String[])
array
- the arraytrim
- if true trim the valueescape
- if true escape the valueprotected java.util.HashMap<java.lang.String,java.lang.String> getMLMap(java.lang.String[] array, boolean trim, boolean escape)
getMultilingualMLMap(TypeFieldEntry, String[])
array
- the arraytrim
- if true trim the valuesescape
- if true escape the valuesprotected java.lang.String[] getMainLangValueArray(java.lang.String[] array, boolean trim, boolean escape)
getMultilingualMainValueArray(TypeFieldEntry, String[])
array
- the arraytrim
- if true trim the valuesescape
- if true escape the valuesprotected java.util.HashMap<java.lang.String,java.lang.String[]> getMLMapArray(java.lang.String[] array, boolean trim, boolean escape)
getMultilingualMLMapArray(TypeFieldEntry, String[])
array
- the arraytrim
- if true trim the valuesescape
- if true escape the valuespublic static final java.lang.String[] sanitize(TypeFieldEntry tfe, java.lang.String[] unsafeInput)
Current implementation is as follow :
WysiwygManager.cleanHtml(String, Map)
if it contains HTML (as detected by JHTMLUtils.isJHTML(TypeFieldEntry, String)
JcmsUtil.escapeHtml(String)
othewiseJcmsUtil.escapeHtml(String)
tfe
- the TypeFieldEntry of the data field for which input is being read. Set to null when working with field of non generated type.unsafeInput
- the unsafe input strings to be sanitizedpublic static final java.lang.String sanitize(TypeFieldEntry tfe, java.lang.String unsafeInput)
Current implementation is as follow :
WysiwygManager.cleanHtml(String, Map)
if it contains HTML (as detected by JHTMLUtils.isJHTML(TypeFieldEntry, String)
JcmsUtil.escapeHtml(String)
othewiseJcmsUtil.escapeHtml(String)
tfe
- the TypeFieldEntry of the data field for which input is being read. Set to null when working with field of non generated type.unsafeInput
- the unsafe input string to be sanitizedprotected static java.lang.String getMonolingualValue(TypeFieldEntry tfe, java.lang.String[] array)
This method must only be used for monolingual and monovalued field.
Example :
TypeFieldEntry myfieldTFE = channel.getTypeFieldEntry(MyType.class, "myfield", true); String myfield; public void setMyMonolingualAndMonovaluedField(String[] input) { myfield = getMonolingualValue(myfieldTFE, input); }
tfe
- the TypeFieldEntry of the data field for which input is being read. Set to null when working with field of non generated type.array
- the arraygetMonolingualValueArray(TypeFieldEntry, String[])
,
getMultilingualMainValue(TypeFieldEntry, String[])
,
getMultilingualMainValueArray(TypeFieldEntry, String[])
protected static java.lang.String[] getMonolingualValueArray(TypeFieldEntry tfe, java.lang.String[] array)
Traling empty or null values are removed from array.
This method must only be used for monolingual and monovalued field.
Example :
TypeFieldEntry myfieldTFE = channel.getTypeFieldEntry(MyType.class, "myfield", true); String[] myfield; public void setMyMonolingualAndMultivaluedField(String[] input) { myfield = getMonolingualValueArray(myfieldTFE, input); }
tfe
- the TypeFieldEntry of the data field for which input is being read. Set to null when working with field of non generated type.array
- the arraygetMonolingualValue(TypeFieldEntry, String[])
,
getMultilingualMainValue(TypeFieldEntry, String[])
,
getMultilingualMainValueArray(TypeFieldEntry, String[])
protected static java.lang.String getMultilingualMainValue(TypeFieldEntry tfe, java.lang.String[] array)
This method must only be used for multilingual and monovalued field.
It must be used along with getMultilingualMLMap(TypeFieldEntry, String[])
.
Example :
TypeFieldEntry myfieldTFE = channel.getTypeFieldEntry(MyType.class, "myfield", true); String myfield; // main value MapmyfieldMLMap; // ISO-639 language code to value public void setMyMultilingualAndMonovaluedField(String[] input) { myfield = getMultilingualMainValue(myfieldTFE, input); myfieldMLMap = getMultilingualMLMap(myfieldTFE, input); }
tfe
- the TypeFieldEntry of the data field for which input is being read. Set to null when working with field of non generated type.array
- the string array input received from the end usergetMonolingualValue(TypeFieldEntry, String[])
,
getMonolingualValueArray(TypeFieldEntry, String[])
,
getMultilingualMainValueArray(TypeFieldEntry, String[])
protected static java.util.HashMap<java.lang.String,java.lang.String> getMultilingualMLMap(TypeFieldEntry tfe, java.lang.String[] array)
This method must only be used for multilingual and monovalued field.
See complete example in
tfe
- the TypeFieldEntry of the data field for which input is being read. Set to null when working with field of non generated type.array
- the string array input received from the end usergetMultilingualMainValue(TypeFieldEntry, String[])
protected static java.lang.String[] getMultilingualMainValueArray(TypeFieldEntry tfe, java.lang.String[] array)
This method must only be used for multilingual and multivalued field.
It must be used along with getMultilingualMLMapArray(TypeFieldEntry, String[])
.
Example :
TypeFieldEntry myfieldTFE = channel.getTypeFieldEntry(MyType.class, "myfield", true); String[] myfield; // main values MapmyfieldMLMap; // ISO-639 language code to values public void setMyMultilingualAndMultivaluedField(String[] input) { myfield = getMultilingualMainValueArray(myfieldTFE, input); myfieldMLMap = getMultilingualMLMapArray(myfieldTFE, input); }
tfe
- the TypeFieldEntry of the data field for which input is being read. Set to null when working with field of non generated type.array
- the string array input received from the end usergetMonolingualValue(TypeFieldEntry, String[])
,
getMonolingualValueArray(TypeFieldEntry, String[])
,
getMultilingualMainValue(TypeFieldEntry, String[])
protected static java.util.HashMap<java.lang.String,java.lang.String[]> getMultilingualMLMapArray(TypeFieldEntry tfe, java.lang.String[] array)
This method must only be used for multilingual and monovalued field.
See complete example in
tfe
- the TypeFieldEntry of the data field for which input is being read. Set to null when working with field of non generated type.array
- the string array input received from the end usergetMultilingualMainValueArray(TypeFieldEntry, String[])
protected static java.util.HashMap<java.lang.String,java.util.List<java.lang.String>> mapStringArrayToMapStringList(java.util.Map<java.lang.String,java.lang.String[]> map)
map
- to convertprotected static java.util.HashMap<java.lang.String,java.lang.String[]> mapStringListToMapStringArray(java.util.Map<java.lang.String,java.util.List<java.lang.String>> map)
map
- to convertpublic java.lang.String getHiddenField(java.lang.String name, java.lang.String value)
public java.lang.String getHiddenFieldML(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.String> map)
public java.lang.String getHiddenField(java.lang.String name, Data value)
public java.lang.String getHiddenField(java.lang.String name, boolean value)
public java.lang.String getHiddenField(java.lang.String name, int value)
public java.lang.String getHiddenField(java.lang.String name, double value)
public java.lang.String getHiddenField(java.lang.String name, long value)
public java.lang.String getHiddenField(java.lang.String name, java.util.Date value)
public java.lang.String getHiddenField(java.lang.String name, Data[] datas)
public java.lang.String getHiddenField(java.lang.String name, boolean[] array)
public java.lang.String getHiddenField(java.lang.String name, int[] array)
public java.lang.String getHiddenField(java.lang.String name, long[] array)
public java.lang.String getHiddenField(java.lang.String name, double[] array)
public java.lang.String getHiddenField(java.lang.String name, java.lang.String[] array)
public java.lang.String getHiddenField(java.lang.String name, java.util.Date[] array)
public <T extends Data> java.lang.String getHiddenField(java.lang.String name, java.util.Set<T> set)
protected boolean checkMissingField(java.lang.Object obj, java.lang.String prop)
Copyright © 2001-2017 Jalios SA. All Rights Reserved.