public abstract class SubForm extends Object
getXslFilesNames()| Modifier and Type | Field and Description |
|---|---|
static String |
PARAMETER_XSL_BASE_URL |
| Constructor and Description |
|---|
SubForm()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFileItem(javax.servlet.http.HttpServletRequest request,
String strFieldName,
org.apache.commons.fileupload.FileItem fileItem)
Associates a newly uploaded file to the subform.
|
void |
addFileItem(String strIdSession,
String strFieldName,
org.apache.commons.fileupload.FileItem fileItem)
For asynchronous usage
|
void |
addFileItemToUploadedFiles(javax.servlet.http.HttpServletRequest request,
fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field field,
org.apache.commons.fileupload.FileItem fileItem,
FormErrorsList formErrorsList)
Adds file item to uploaded files and field.getFileNames( ).getFileName( )
|
protected void |
addNotices(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements formElements)
Adds notices to the elements
|
void |
appendToChoiceList(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field field,
fr.paris.lutece.util.ReferenceList referenceList)
Add the elements in given reference list to given field's choice list.
|
String |
buildHtmlForm(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements formElements,
Map params)
Build the html code corresponding to the given form elements.
|
void |
clearFormElements(javax.servlet.http.HttpServletRequest request)
Remove the current formelement object from the session, which has an
effect to reinit the later.
|
String |
display(javax.servlet.http.HttpServletRequest request)
This method should display.
|
protected String |
displayForm(javax.servlet.http.HttpServletRequest request)
This method provides a default implementation for the form display
It might be overriden if needed :
to initialize some fields from db (eg. combos)
to pass parameters to the stylesheet
|
String |
displayForMail(javax.servlet.http.HttpServletRequest request,
String strMailTemplate)
This method should display.
|
protected String |
displayHeader(javax.servlet.http.HttpServletRequest request) |
protected abstract String |
displaySummary(javax.servlet.http.HttpServletRequest request)
Displays the summary part of the screen.
|
protected String |
displaySummaryForMail(javax.servlet.http.HttpServletRequest request)
Display the summary for the mail
|
abstract String |
doAction(String strActionName,
javax.servlet.http.HttpServletRequest request)
Performs an action depending on the given action name
and possibly on other parameters in request
|
String |
doUploadAction(javax.servlet.http.HttpServletRequest request,
String strUploadAction)
Performs an upload action.
|
void |
fillFields(javax.servlet.http.HttpServletRequest request)
Fill the fields with the parameters in request.
|
protected String |
getDefaultUrlToExit()
Defines the url used to exit the form
|
fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field |
getFieldFromName(javax.servlet.http.HttpServletRequest request,
String strName)
Get a field of a given name from a given fields element
|
List<org.apache.commons.fileupload.FileItem> |
getFileItems(javax.servlet.http.HttpServletRequest request,
String strFieldName)
Returns the files associated with an upload field of the subform.
|
List<org.apache.commons.fileupload.FileItem> |
getFileItems(String strIdSession,
String strFieldName)
For asynchronous usage.
|
protected String |
getFormattedErrors(javax.servlet.http.HttpServletRequest request)
Returns a default Html code to display filling errors
|
fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements |
getFormElements(javax.servlet.http.HttpServletRequest request)
Returns the fields element associated with that subform.
|
protected String |
getHtml(String strXmlCode,
String strXslFileName)
Util to convert Xml docs into Html docs using XSLT stylesheets
|
protected String |
getHtml(String strXmlCode,
String strXslFileName,
Map params)
Util to convert Xml docs into Html docs using XSLT stylesheets.
|
protected fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements |
getinitializedFormElements()
Create a new fields object initialised with the _initialFields values and
elements
|
boolean |
getIsSubFormAllowed(javax.servlet.http.HttpServletRequest request)
Get the variable in session that states wether
the access to the current subform is allowed
|
String |
getName()
Get the name of the subform
|
SubForm |
getNextSubForm()
Accessor to the next subform.
|
Form |
getParentForm()
Accessor to the parent form.
|
String |
getPortalURI()
Get the protal URI of subForm
|
SubForm |
getPreviousSubForm()
Accessor to the previous subform.
|
Object |
getSessionAttribute(javax.servlet.http.HttpServletRequest request,
String strAttributeName)
Get an attribute in session.
|
String |
getTitle()
Get the title of the subform
|
List<fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field> |
getUploadFields(javax.servlet.http.HttpServletRequest request)
Gets all upload fields for the request
|
String[] |
getXslFilesNames()
Gets all XSL used by this subform.
|
protected abstract String |
getXslFormElementsFileName()
This method should be overriden.
|
void |
initFormElements(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements formElements)
Set the initialFormElements.
|
void |
mergeAsynchronousUploadedFiles(javax.servlet.http.HttpServletRequest request,
String strFieldName)
Merges asynchronous uploaded files with already session bounded ones.
|
void |
mergeAsynchronousUploadedFiles(javax.servlet.http.HttpServletRequest request,
String strFieldName,
FormErrorsList formErrorsList)
Merges asynchronous uploaded files with already session bounded ones.
|
void |
removeFileItem(javax.servlet.http.HttpServletRequest request,
String strFieldName,
int iIndex)
Deletes a file previously associated with the subform.
|
void |
removeSessionAttribute(javax.servlet.http.HttpServletRequest request,
String strAttributeName)
Remove an attribute in session.
|
boolean |
removeUploadedFileItem(javax.servlet.http.HttpServletRequest request,
String strFieldName,
int nIndex)
Removes an uploaded fileitem using its index.
|
protected void |
setBlobStoreFileItemsURL(javax.servlet.http.HttpServletRequest request,
String strFieldName,
List<String> listFilesUrl,
fr.paris.lutece.plugins.blobstore.service.IBlobStoreService IBlobStoreService)
Sets the file items url (stored in blobstore) to the list (which is
cleared).
|
void |
setChoiceList(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field field,
fr.paris.lutece.util.ReferenceList referenceList)
Build the choice list of a field from the given reference list.
|
void |
setFormElements(javax.servlet.http.HttpServletRequest request,
fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements formElements)
Modify the formelements objectt in session
|
void |
setIsSubFormAllowed(javax.servlet.http.HttpServletRequest request,
boolean bIsAllowed)
Add a variable in session to state wether
the access to the current subform is allowed
|
void |
setName(String strName)
Set the name of the subform
|
void |
setNextSubForm(SubForm subFormNext)
setter for the next subform.
|
void |
setParentForm(Form formParent)
setter for the parent form.
|
void |
setPortalURI(String strPortalURI)
Set the protal URI of subForm
|
void |
setPreviousSubForm(SubForm subFormPrevious)
setter for the previous subform.
|
void |
setSessionAttribute(javax.servlet.http.HttpServletRequest request,
String strAttributeName,
Object attribute)
Set a session attribute, with a name formatted to avoid conflicts between
form and subform instances.
|
void |
setTitle(String strTitle)
Set the title of the subform
|
protected boolean |
validate(Object objectToValidate)
Validates an given object.
|
boolean |
validateFields(javax.servlet.http.HttpServletRequest request)
Validate the data stored in the fields element against the checkrules
specified.
|
public static final String PARAMETER_XSL_BASE_URL
protected abstract String getXslFormElementsFileName()
public abstract String doAction(String strActionName, javax.servlet.http.HttpServletRequest request)
strActionName - the action to performrequest - the http requestprotected abstract String displaySummary(javax.servlet.http.HttpServletRequest request)
request - the http requestprotected String displayForm(javax.servlet.http.HttpServletRequest request)
request - the http requestprotected String displayHeader(javax.servlet.http.HttpServletRequest request)
request - The HttpServletRequestpublic String display(javax.servlet.http.HttpServletRequest request) throws fr.paris.lutece.portal.service.security.UserNotSignedException
request - the http requestfr.paris.lutece.portal.service.security.UserNotSignedException - if user is not signed onpublic String displayForMail(javax.servlet.http.HttpServletRequest request, String strMailTemplate) throws fr.paris.lutece.portal.service.security.UserNotSignedException
request - the http requeststrMailTemplate - template for mailfr.paris.lutece.portal.service.security.UserNotSignedException - if user is not signed onprotected String displaySummaryForMail(javax.servlet.http.HttpServletRequest request)
request - the HTTP requestpublic String getTitle()
public void setTitle(String strTitle)
strTitle - the title to setpublic String getName()
public void setName(String strName)
strName - the name to setpublic String getPortalURI()
public void setPortalURI(String strPortalURI)
strPortalURI - the new portal URIpublic void setParentForm(Form formParent)
formParent - The parent Formpublic Form getParentForm()
public void setNextSubForm(SubForm subFormNext)
subFormNext - tje next subformpublic SubForm getNextSubForm()
public void setPreviousSubForm(SubForm subFormPrevious)
subFormPrevious - the previous subformpublic SubForm getPreviousSubForm()
protected String getHtml(String strXmlCode, String strXslFileName, Map params)
strXmlCode - The XmlstrXslFileName - The Xsl stylesheet filename. Note
that the path is retrieved from the getXslDirectoryPath method
of the parent formparams - a map of parameters to pass to the stylesheetprotected String getHtml(String strXmlCode, String strXslFileName)
strXmlCode - The XmlstrXslFileName - The Xsl stylesheet filename. Note
that the path is retrieved from the getXslDirectoryPath method
of the parent formprotected String getFormattedErrors(javax.servlet.http.HttpServletRequest request)
request - The HTTP requesrprotected boolean validate(Object objectToValidate)
objectToValidate - the object on which validation should be
performedpublic void setIsSubFormAllowed(javax.servlet.http.HttpServletRequest request,
boolean bIsAllowed)
request - the http requestbIsAllowed - true to allow access to the form, false otherwisepublic boolean getIsSubFormAllowed(javax.servlet.http.HttpServletRequest request)
request - the http requestpublic void fillFields(javax.servlet.http.HttpServletRequest request)
request - the http requestpublic void mergeAsynchronousUploadedFiles(javax.servlet.http.HttpServletRequest request,
String strFieldName)
request - the requeststrFieldName - the upload field namepublic void mergeAsynchronousUploadedFiles(javax.servlet.http.HttpServletRequest request,
String strFieldName,
FormErrorsList formErrorsList)
request - the requeststrFieldName - the upload field nameformErrorsList - fills the formErrorsList if not null.public boolean validateFields(javax.servlet.http.HttpServletRequest request)
request - the http requestpublic fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements getFormElements(javax.servlet.http.HttpServletRequest request)
request - the http requestpublic void setFormElements(javax.servlet.http.HttpServletRequest request,
fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements formElements)
request - the http requestformElements - the element to add in sessionpublic void clearFormElements(javax.servlet.http.HttpServletRequest request)
request - the http requestpublic void initFormElements(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements formElements)
formElements - the elemnts of formsprotected fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements getinitializedFormElements()
public fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field getFieldFromName(javax.servlet.http.HttpServletRequest request,
String strName)
request - the HttpServletRequeststrName - the name of the field to findpublic void setChoiceList(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field field,
fr.paris.lutece.util.ReferenceList referenceList)
field - the field whose choice list should be setreferenceList - the list containing the data to load into the choice
listpublic void appendToChoiceList(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field field,
fr.paris.lutece.util.ReferenceList referenceList)
field - the field whose choice list should be updatedreferenceList - the list containing the data to load into the choice
listpublic String buildHtmlForm(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements formElements, Map params)
"baseUrl" in params.
Example :
params.put( PARAMETER_XSL_BASE_URL, "https://www.my-host.com/my-webapp/ );
formElements - the fields and buttons to displayparams - additional params that might need to be passed to the
stylesheetPARAMETER_XSL_BASE_URLprotected void addNotices(fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.FormElements formElements)
formElements - the elementsprotected String getDefaultUrlToExit()
public final List<fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field> getUploadFields(javax.servlet.http.HttpServletRequest request)
request - the requestpublic void setSessionAttribute(javax.servlet.http.HttpServletRequest request,
String strAttributeName,
Object attribute)
request - the http requeststrAttributeName - the name of the variable to put in sessionattribute - the object to put in sessionpublic Object getSessionAttribute(javax.servlet.http.HttpServletRequest request, String strAttributeName)
request - The Http RequeststrAttributeName - the name of the variable to retrieve from sessionpublic void removeSessionAttribute(javax.servlet.http.HttpServletRequest request,
String strAttributeName)
request - The HttpServlerRequeststrAttributeName - the name of the variable to remove from sessionpublic String doUploadAction(javax.servlet.http.HttpServletRequest request, String strUploadAction)
request - the HTTP requeststrUploadAction - the name of the upload actionpublic final void addFileItemToUploadedFiles(javax.servlet.http.HttpServletRequest request,
fr.paris.lutece.plugins.formengine.business.jaxb.formdefinition.Field field,
org.apache.commons.fileupload.FileItem fileItem,
FormErrorsList formErrorsList)
request - the requestfield - the fieldfileItem - the file itemformErrorsList - the list of error which is filled if not null.
Usefull for asynchronous upload. Classic validation should set
it
to null since the error list is bound to the
session.public final void addFileItem(javax.servlet.http.HttpServletRequest request,
String strFieldName,
org.apache.commons.fileupload.FileItem fileItem)
request - the HTTP requeststrFieldName - the name of the upload fieldfileItem - the File objectpublic final void addFileItem(String strIdSession, String strFieldName, org.apache.commons.fileupload.FileItem fileItem)
strIdSession - session idstrFieldName - field namefileItem - fileitempublic final List<org.apache.commons.fileupload.FileItem> getFileItems(String strIdSession, String strFieldName)
strIdSession - session idstrFieldName - field namepublic final boolean removeUploadedFileItem(javax.servlet.http.HttpServletRequest request,
String strFieldName,
int nIndex)
request - the requeststrFieldName - the field namenIndex - the indextrue if file is removed, false
otherwise.public final void removeFileItem(javax.servlet.http.HttpServletRequest request,
String strFieldName,
int iIndex)
request - the HTTP requeststrFieldName - the name of the upload fieldiIndex - the index of the file to removepublic final List<org.apache.commons.fileupload.FileItem> getFileItems(javax.servlet.http.HttpServletRequest request, String strFieldName)
request - the HTTP requeststrFieldName - the name of the upload fieldprotected void setBlobStoreFileItemsURL(javax.servlet.http.HttpServletRequest request,
String strFieldName,
List<String> listFilesUrl,
fr.paris.lutece.plugins.blobstore.service.IBlobStoreService IBlobStoreService)
request - the requeststrFieldName - the field namelistFilesUrl - the list of urlIBlobStoreService - the blobstore service where to store/restore
filespublic String[] getXslFilesNames()
getXslFormElementsFileName().
It should be overriden if all XSL is managed by this subform.Copyright © 2016 Mairie de Paris. All Rights Reserved.