Package de.xima.fc.interfaces.form
Interface IFormDataAdapter
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ASaveFormData,GenericSaveFormData
Interface for form data. The
IFormDataAdapter encapsulates the submitted form data and provides several
utility methods for accessing and manipulating that data. This adapter is created before workflow processing starts
and is passed on to the individual workflow actions.- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddMultiValue(String fieldName, List<String[]> values) Adds the given values to the values of the form element.voidaddRequestValue(String fieldName, List<String> values) voidaddSingleValue(String fieldName, String... value) Adds the given values to the values of the form element.aliasValue(String alias) asStringValue(String[] value) asStringValue(List<String[]> value) default Map<String,IFormContainerMetaData> getFieldMetaData(String identifier, boolean asAlias) getFieldTyp(String identifier, boolean asAlias) getFieldValues(String fieldName) getIFieldMetaData(String identifier, boolean asAlias) getNormName(String fieldName) For each element, a name is defined in the designer.getStringValue(String fieldName) Each form element may have multiple values.booleanbooleanERSTMAL: Lieferttrue, wenn das Formular ein Feld mit dem übergebenen Namen besitzt.default voidDeprecated.default voidDeprecated.Useinit(Map, Map, List).default voidinit(Map<String, List<String>> dataMap, Map<String, List<org.apache.commons.fileupload.FileItem>> uploadMap) voidinit(Map<String, List<String>> dataMap, Map<String, List<org.apache.commons.fileupload.FileItem>> uploadMap, List<String> sendElements) booleanisElementLooped(String elementName) A repeated form element (also called dynamic or looped) is a form element of which the user can create multiple copies of as they fill out the form.booleanisQuestionElement(String elementName) intA repeated form element (also called dynamic or looped) is a form element of which the user can create multiple copies of as they fill out the form.voidmergeRequestData(Map<String, List<String>> oldData) String[]normalizeValue(String... value) String[]normalizeValue(List<String> value) normalizeValues(List<String> stringList) resolveAliasName(String alias) resolveFieldAlias(String alias) resolveFieldName(String fieldName) resolveFieldType(String fieldName, boolean asAlias) booleanvaluesMapHasValue(String fieldName)
-
Method Details
-
init
Deprecated.Useinit(Map, Map).- Parameters:
dataMap- Map with form values (non uploads).
-
init
-
init
Deprecated.Useinit(Map, Map, List).- Parameters:
dataMap- Map with form values (non uploads).sendElements- Elements that were rendered.
-
init
-
resolveFieldAlias
-
resolveFieldName
-
getFieldTyp
- Parameters:
identifier- The name of a form element.asAlias- Iftrue, interpret the given identifier as the alias name of the form element. Iffalse, interpret the given identifier as the name of the form element.- Returns:
- The form field type for the given element; or
nullwhen the given element does not exist.
-
getFieldAlias
- Returns:
- A
Setconsisting of the alias names of all existing form elements.
-
getFieldMetaData
-
aliasValue
-
hasAlias
- Parameters:
alias- An alias name to check.- Returns:
trueif a form element with the given alias exists, orfalseotherwise.
-
resolveFieldType
-
getFieldAliasMap
- Returns:
- A
Mapthat maps from the name of a form elements to its alias name. - See Also:
-
getAliasFieldMap
- Returns:
- A
Mapthat maps from the alias name of a form elements to its name. - See Also:
-
getFieldMetaDataMap
Map<String,FormFieldMetaData> getFieldMetaDataMap() -
getDynContainerMap
Map<String,FormContainerMetaData> getDynContainerMap() -
getDynFieldSet
- Returns:
- A
Setthat consists of the names of all form elements which are repeated containers (and are not form elements). - See Also:
-
getFieldNotesRead
-
getFieldNotesUnread
-
getNormName
For each element, a name is defined in the designer. When the element is marked as a repeated elements, the created elements get a name that consists of the original name and a suffix. This method takes a name that may contain such a suffix and returns the original form element name.- Parameters:
fieldName- A form element that may contain suffixes such as the suffix for repeated elements.- Returns:
- The given name, normalized to the form element name as defined in the designer.
-
getSendElements
- Returns:
- A
Setof all elements for which a value was submitted in the (usually POST) request.
-
valuesMapHasValue
-
getStringValue
Each form element may have multiple values. This returns the first value.- Parameters:
fieldName- The name of a form element.- Returns:
- The first value for the given form element, or the empty string when no value or the form element does not exist.
-
getRequestDataMap
-
mergeRequestData
-
getFieldValues
- Parameters:
fieldName- The name of a form element.- Returns:
- A
Listof all values for the given form element, ornullif the given form element does not exist.
-
hasField
ERSTMAL: Lieferttrue, wenn das Formular ein Feld mit dem übergebenen Namen besitzt.- Parameters:
fieldName- the field to check for- Returns:
- Liefert
true, wenn das Formular ein Feld mit dem übergebenen Namen besitzt
-
getFieldValuesMap
- Returns:
- A
Mapthat maps from the name of a form element to its values.
-
isElementLooped
A repeated form element (also called dynamic or looped) is a form element of which the user can create multiple copies of as they fill out the form. This method checks whether the given form element is repeated.- Parameters:
elementName- The name of a form element to check.- Returns:
trueif the form element is a repeated element,falseotherwise (or if the given element does not exist).
-
isQuestionElement
-
loopCount
A repeated form element (also called dynamic or looped) is a form element of which the user can create multiple copies of as they fill out the form. This method returns how many copies were created.- Parameters:
elementName- The name of a form element.- Returns:
- The number of repetitions of the given repeated form element, or
0in case the element is not a repeated element. - See Also:
-
getMetaDataMap
-
resolveAliasName
- Parameters:
alias- The alias of a form element.- Returns:
- The resolved alias, ie. the name of the form element with the given alias. Returns the given alias in case no form element with the given alias exists.
- See Also:
-
getIFieldMetaData
-
asStringValue
- Parameters:
value- AListof values to be converted.- Returns:
- The given values, joined with a comma; or the empty string in case
nullor no values were given.
-
asStringValue
- Parameters:
value- An array of values to be converted.- Returns:
- The given values, joined with a comma; or the empty string in case
nullor no values were given.
-
addSingleValue
Adds the given values to the values of the form element. If one or multiple values exist already for the given form element, they are preserved. Please note that the value of a form element is aListof arrays ofStrings, this adds the given values to the first entry in theListof values.- Parameters:
fieldName- The name of a form element.value- One or multiple values to add for the given element.- See Also:
-
addMultiValue
Adds the given values to the values of the form element. If one or multiple values exist already for the given form element, they are preserved.- Parameters:
fieldName- The name of a form element.values- AListof values to add to the form element.- See Also:
-
addRequestValue
-
getFields
-
normalizeValue
- Parameters:
value- A list of values.- Returns:
- The given list of values, or an empty array in case
nullwas given.
-
normalizeValue
- Parameters:
value- AListof values.- Returns:
- An array with the given values, or an empty array in case
nullwas given.
-
normalizeValues
- Parameters:
stringList- A list of values.- Returns:
- A
Listwith only a single entry, an array containing the given values.
-
createCompleteDynContainerMap
- Returns:
- Similar to the
getDynContainerMap(), but also contains a value for each each element in each repeated container.
-
init(Map, Map).