Package de.xima.fc.interfaces.form
Interface IFormDataAdapter
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ASaveFormData
,FormDataAdapterWrapper
,GenericSaveFormData
public interface IFormDataAdapter extends Serializable
Interface for form data. TheIFormDataAdapter
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
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default void
addMultiValue(String fieldName, List<String[]> values)
Adds the given values to the values of the form element.void
addRequestValue(String fieldName, List<String> values)
default void
addSingleValue(String fieldName, String... value)
Adds the given values to the values of the form element.default Object
aliasValue(String alias)
default String
asStringValue(String[] value)
default String
asStringValue(List<String[]> value)
default Map<String,IFormContainerMetaData>
createCompleteDynContainerMap()
Map<String,String>
getAliasFieldMap()
default Map<String,FormContainerMetaData>
getDynContainerMap()
Deprecated.default HashSet<String>
getDynFieldSet()
Deprecated.UsegetDynFieldSets()
.Set<String>
getDynFieldSets()
default Set<String>
getFieldAlias()
Map<String,String>
getFieldAliasMap()
default FormFieldMetaData
getFieldMetaData(String identifier, boolean asAlias)
Deprecated.default Map<String,FormFieldMetaData>
getFieldMetaDataMap()
Deprecated.Map<String,List<String>>
getFieldNotesRead()
Deprecated.Field notes do not exist anymore.Map<String,List<String>>
getFieldNotesUnread()
Deprecated.Field notes do not exist anymore.default Set<String>
getFields()
default EFormFieldTyp
getFieldTyp(String identifier, boolean asAlias)
default List<String[]>
getFieldValues(String fieldName)
Map<String,List<String[]>>
getFieldValuesMap()
Map<String,IFormContainerMetaData>
getIDynContainerMap()
default IFieldMetaData
getIFieldMetaData(String identifier, boolean asAlias)
Map<String,IFieldMetaData>
getIFieldMetaDataMap()
Map<String,String>
getMetaDataMap()
default String
getNormName(String fieldName)
For each element, a name is defined in the designer.Map<String,List<String>>
getRequestDataMap()
Set<String>
getSendElements()
default String
getStringValue(String fieldName)
Each form element may have multiple values.default boolean
hasAlias(String alias)
default boolean
hasField(String fieldName)
ERSTMAL: Lieferttrue
, wenn das Formular ein Feld mit dem übergebenen Namen besitzt.default void
init(Map<String,List<String>> dataMap)
Deprecated.Useinit(Map, Map)
.default void
init(Map<String,List<String>> dataMap, List<String> sendElements)
Deprecated.Useinit(Map, Map, List)
.default void
init(Map<String,List<String>> dataMap, Map<String,List<org.apache.commons.fileupload.FileItem>> uploadMap)
void
init(Map<String,List<String>> dataMap, Map<String,List<org.apache.commons.fileupload.FileItem>> uploadMap, List<String> sendElements)
default boolean
isElementLooped(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.boolean
isQuestionElement(String elementName)
int
loopCount(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.void
mergeRequestData(Map<String,List<String>> oldData)
default String[]
normalizeValue(String... value)
default String[]
normalizeValue(List<String> value)
default List<String[]>
normalizeValues(List<String> stringList)
default String
resolveAliasName(String alias)
default String
resolveFieldAlias(String alias)
default String
resolveFieldName(String fieldName)
default EFormFieldTyp
resolveFieldType(String fieldName, boolean asAlias)
default boolean
valuesMapHasValue(String fieldName)
-
-
-
Method Detail
-
init
@Deprecated default void init(Map<String,List<String>> dataMap)
Deprecated.Useinit(Map, Map)
.- Parameters:
dataMap
- Map with form values (non uploads).
-
init
default void init(Map<String,List<String>> dataMap, Map<String,List<org.apache.commons.fileupload.FileItem>> uploadMap)
-
init
@Deprecated default void init(Map<String,List<String>> dataMap, List<String> sendElements)
Deprecated.Useinit(Map, Map, List)
.- Parameters:
dataMap
- Map with form values (non uploads).sendElements
- Elements that were rendered.
-
init
void init(Map<String,List<String>> dataMap, Map<String,List<org.apache.commons.fileupload.FileItem>> uploadMap, List<String> sendElements)
-
getFieldTyp
default EFormFieldTyp getFieldTyp(String identifier, boolean asAlias)
- 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
null
when the given element does not exist.
-
getFieldAlias
default Set<String> getFieldAlias()
- Returns:
- A
Set
consisting of the alias names of all existing form elements.
-
getFieldMetaData
@Deprecated default FormFieldMetaData getFieldMetaData(String identifier, boolean asAlias)
Deprecated.- Parameters:
identifier
- Identifier, either a name or alias.asAlias
- Whether the identifier is a field name or a field alias.- Returns:
- The metadata for the given field.
-
hasAlias
default boolean hasAlias(String alias)
- Parameters:
alias
- An alias name to check.- Returns:
true
if a form element with the given alias exists, orfalse
otherwise.
-
resolveFieldType
default EFormFieldTyp resolveFieldType(String fieldName, boolean asAlias)
-
getFieldAliasMap
Map<String,String> getFieldAliasMap()
- Returns:
- A
Map
that maps from the name of a form elements to its alias name. - See Also:
getAliasFieldMap()
-
getAliasFieldMap
Map<String,String> getAliasFieldMap()
- Returns:
- A
Map
that maps from the alias name of a form elements to its name. - See Also:
getFieldAliasMap()
-
getFieldMetaDataMap
@Deprecated default Map<String,FormFieldMetaData> getFieldMetaDataMap()
Deprecated.- Returns:
- A map with the metadata for each element. The key is the field name, e.g.
tf1
-
getIFieldMetaDataMap
Map<String,IFieldMetaData> getIFieldMetaDataMap()
-
getDynContainerMap
@Deprecated default Map<String,FormContainerMetaData> getDynContainerMap()
Deprecated.
-
getIDynContainerMap
Map<String,IFormContainerMetaData> getIDynContainerMap()
-
getDynFieldSet
@Deprecated default HashSet<String> getDynFieldSet()
Deprecated.UsegetDynFieldSets()
.- Returns:
- A set that consists of the names of all form elements which are repeated and that have a value.
- See Also:
isElementLooped(String)
,getDynContainerMap()
-
getDynFieldSets
Set<String> getDynFieldSets()
- Returns:
- A set that consists of the names of all form elements which are repeated and that have a value.
- See Also:
isElementLooped(String)
,getDynContainerMap()
-
getFieldNotesRead
@Deprecated Map<String,List<String>> getFieldNotesRead()
Deprecated.Field notes do not exist anymore.Gets a map with notes for form fields that were already read by a user. The key is the name of the field, e.g.tf1
.- Returns:
- Am map with all read field notes.
-
getFieldNotesUnread
@Deprecated Map<String,List<String>> getFieldNotesUnread()
Deprecated.Field notes do not exist anymore.Gets a map with notes for form fields that were not yet read by a user. The key is the name of the field, e.g.tf1
.- Returns:
- Am map with all unread field notes.
-
getNormName
default String getNormName(String fieldName)
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
Set<String> getSendElements()
- Returns:
- A
Set
of all elements for which a value was submitted in the (usually POST) request.
-
valuesMapHasValue
default boolean valuesMapHasValue(String fieldName)
-
getStringValue
default String getStringValue(String fieldName)
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.
-
getFieldValues
default List<String[]> getFieldValues(String fieldName)
- Parameters:
fieldName
- The name of a form element.- Returns:
- A
List
of all values for the given form element, ornull
if the given form element does not exist.
-
hasField
default boolean hasField(String fieldName)
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
Map<String,List<String[]>> getFieldValuesMap()
- Returns:
- A
Map
that maps from the name of a form element to its values.
-
isElementLooped
default boolean isElementLooped(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. This method checks whether the given form element is repeated.- Parameters:
elementName
- The name of a form element to check.- Returns:
true
if the form element is a repeated element,false
otherwise (or if the given element does not exist).
-
isQuestionElement
boolean isQuestionElement(String elementName)
-
loopCount
int loopCount(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. 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
0
in case the element is not a repeated element. - See Also:
isElementLooped(String)
-
resolveAliasName
default String resolveAliasName(String alias)
- Parameters:
alias
- The alias of a form element.- Returns:
- The resolved alias, i.e. 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:
hasAlias(String)
-
getIFieldMetaData
default IFieldMetaData getIFieldMetaData(String identifier, boolean asAlias)
-
asStringValue
default String asStringValue(List<String[]> value)
- Parameters:
value
- AList
of values to be converted.- Returns:
- The given values, joined with a comma; or the empty string in case
null
or no values were given.
-
asStringValue
default String asStringValue(String[] value)
- Parameters:
value
- An array of values to be converted.- Returns:
- The given values, joined with a comma; or the empty string in case
null
or no values were given.
-
addSingleValue
default void addSingleValue(String fieldName, String... value)
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 aList
of arrays ofString
s, this adds the given values to the first entry in theList
of values.- Parameters:
fieldName
- The name of a form element.value
- One or multiple values to add for the given element.- See Also:
addMultiValue(String, List)
-
addMultiValue
default void addMultiValue(String fieldName, List<String[]> values)
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
- AList
of values to add to the form element.- See Also:
addSingleValue(String, String...)
-
normalizeValue
default String[] normalizeValue(String... value)
- Parameters:
value
- A list of values.- Returns:
- The given list of values, or an empty array in case
null
was given.
-
normalizeValue
default String[] normalizeValue(List<String> value)
- Parameters:
value
- AList
of values.- Returns:
- An array with the given values, or an empty array in case
null
was given.
-
normalizeValues
default List<String[]> normalizeValues(List<String> stringList)
- Parameters:
stringList
- A list of values.- Returns:
- A
List
with only a single entry, an array containing the given values.
-
createCompleteDynContainerMap
default Map<String,IFormContainerMetaData> createCompleteDynContainerMap()
- Returns:
- Similar to the
getDynContainerMap()
, but also contains a value for each valuable element (not container elements etc.) in each repeated container.
-
-