Package de.xima.fc.mdl.savedata
Class ASaveFormData
- java.lang.Object
-
- de.xima.fc.mdl.savedata.ASaveFormData
-
- All Implemented Interfaces:
IFormDataAdapter,Serializable
- Direct Known Subclasses:
GenericSaveFormData
public abstract class ASaveFormData extends Object implements IFormDataAdapter
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>aliasFieldMapReverses Mapping zwischen Alias und Feldnameprotected Map<String,IFormContainerMetaData>dynContainerMapprotected Set<String>dynFieldSetA collection that contains all form elements that are repeated elements (dynamic).protected Map<String,String>fieldAliasMapprotected Map<String,IFormContainerMetaData>fieldContainerMapprotected Map<String,IFieldMetaData>fieldMetaDataMapprotected Map<String,List<String>>fieldNotesReadDeprecated.protected Map<String,List<String>>fieldNotesUnreadDeprecated.protected Map<String,List<String[]>>fieldValuesMapprotected Map<String,String>metaDataMapprotected HashSet<String>questionFieldSetprotected Map<String,List<String>>requestDataMapprotected Set<String>sendElements
-
Constructor Summary
Constructors Constructor Description ASaveFormData()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMultiValue(String fieldName, List<String[]> values)Adds the given values to the values of the form element.voidaddSingleValue(String fieldName, String... value)Adds the given values to the values of the form element.ObjectaliasValue(String alias)StringasStringValue(String[] value)StringasStringValue(List<String[]> value)Map<String,String>getAliasFieldMap()Set<String>getDynFieldSets()Set<String>getFieldAlias()Map<String,String>getFieldAliasMap()Map<String,List<String>>getFieldNotesRead()Gets a map with notes for form fields that were already read by a user.Map<String,List<String>>getFieldNotesUnread()Gets a map with notes for form fields that were not yet read by a user.Set<String>getFields()EFormFieldTypgetFieldTyp(String identifier, boolean asAlias)List<String[]>getFieldValues(String fieldName)Map<String,List<String[]>>getFieldValuesMap()Map<String,IFormContainerMetaData>getIDynContainerMap()IFieldMetaDatagetIFieldMetaData(String identifier, boolean asAlias)Map<String,IFieldMetaData>getIFieldMetaDataMap()Map<String,String>getMetaDataMap()StringgetNormName(String fieldName)For each element, a name is defined in the designer.Map<String,List<String>>getRequestDataMap()StringgetStringValue(String fieldName)Each form element may have multiple values.booleanhasAlias(String alias)booleanhasField(String fieldName)ERSTMAL: Lieferttrue, wenn das Formular ein Feld mit dem übergebenen Namen besitzt.booleanisElementLooped(String elemName)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)intloopCount(String elemName)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.String[]normalizeValue(String... value)String[]normalizeValue(List<String> value)List<String[]>normalizeValues(List<String> stringList)StringresolveAliasName(String alias)protected StringresolveDynValueName(String fieldName, Integer index)StringresolveFieldAlias(String alias)StringresolveFieldName(String fieldName)EFormFieldTypresolveFieldType(String fieldName, boolean asAlias)protected voidupdateContainerElements(IFormContainerMetaData container)protected voidupdateValuesMap(IFormContainerMetaData container, String elementName, List<String> value, int index)booleanvaluesMapHasValue(String fieldName)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.interfaces.form.IFormDataAdapter
addRequestValue, createCompleteDynContainerMap, getDynContainerMap, getDynFieldSet, getFieldMetaData, getFieldMetaDataMap, getSendElements, init, init, init, init, mergeRequestData
-
-
-
-
Field Detail
-
aliasFieldMap
protected final Map<String,String> aliasFieldMap
Reverses Mapping zwischen Alias und Feldname
-
fieldMetaDataMap
protected final Map<String,IFieldMetaData> fieldMetaDataMap
-
fieldContainerMap
protected final Map<String,IFormContainerMetaData> fieldContainerMap
-
dynContainerMap
protected final Map<String,IFormContainerMetaData> dynContainerMap
-
dynFieldSet
protected final Set<String> dynFieldSet
A collection that contains all form elements that are repeated elements (dynamic).
-
fieldNotesRead
@Deprecated protected final Map<String,List<String>> fieldNotesRead
Deprecated.
-
fieldNotesUnread
@Deprecated protected final Map<String,List<String>> fieldNotesUnread
Deprecated.
-
-
Method Detail
-
isQuestionElement
public boolean isQuestionElement(String elementName)
- Specified by:
isQuestionElementin interfaceIFormDataAdapter
-
loopCount
public int loopCount(String elemName)
Description copied from interface:IFormDataAdapterA 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.- Specified by:
loopCountin interfaceIFormDataAdapter- Parameters:
elemName- 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:
IFormDataAdapter.isElementLooped(String)
-
getMetaDataMap
public Map<String,String> getMetaDataMap()
- Specified by:
getMetaDataMapin interfaceIFormDataAdapter
-
getFieldValuesMap
public Map<String,List<String[]>> getFieldValuesMap()
- Specified by:
getFieldValuesMapin interfaceIFormDataAdapter- Returns:
- A
Mapthat maps from the name of a form element to its values.
-
getFieldAliasMap
public Map<String,String> getFieldAliasMap()
- Specified by:
getFieldAliasMapin interfaceIFormDataAdapter- Returns:
- A
Mapthat maps from the name of a form elements to its alias name. - See Also:
IFormDataAdapter.getAliasFieldMap()
-
getAliasFieldMap
public Map<String,String> getAliasFieldMap()
- Specified by:
getAliasFieldMapin interfaceIFormDataAdapter- Returns:
- A
Mapthat maps from the alias name of a form elements to its name. - See Also:
IFormDataAdapter.getFieldAliasMap()
-
getIFieldMetaDataMap
public Map<String,IFieldMetaData> getIFieldMetaDataMap()
- Specified by:
getIFieldMetaDataMapin interfaceIFormDataAdapter
-
getIDynContainerMap
public Map<String,IFormContainerMetaData> getIDynContainerMap()
- Specified by:
getIDynContainerMapin interfaceIFormDataAdapter- Returns:
- A map from the
nameof arepeatedcontainer or element to the metadata for that repeated container or element.
-
getDynFieldSets
public Set<String> getDynFieldSets()
- Specified by:
getDynFieldSetsin interfaceIFormDataAdapter- Returns:
- A set that consists of the names of all form elements which are repeated and that have a value.
- See Also:
IFormDataAdapter.isElementLooped(String),IFormDataAdapter.getDynContainerMap()
-
getFieldNotesRead
public Map<String,List<String>> getFieldNotesRead()
Description copied from interface:IFormDataAdapterGets 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.- Specified by:
getFieldNotesReadin interfaceIFormDataAdapter- Returns:
- Am map with all read field notes.
-
getFieldNotesUnread
public Map<String,List<String>> getFieldNotesUnread()
Description copied from interface:IFormDataAdapterGets 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.- Specified by:
getFieldNotesUnreadin interfaceIFormDataAdapter- Returns:
- Am map with all unread field notes.
-
getRequestDataMap
public Map<String,List<String>> getRequestDataMap()
- Specified by:
getRequestDataMapin interfaceIFormDataAdapter
-
updateValuesMap
protected void updateValuesMap(IFormContainerMetaData container, String elementName, List<String> value, int index)
-
updateContainerElements
protected void updateContainerElements(IFormContainerMetaData container)
-
valuesMapHasValue
public boolean valuesMapHasValue(String fieldName)
- Specified by:
valuesMapHasValuein interfaceIFormDataAdapter
-
resolveFieldAlias
public String resolveFieldAlias(String alias)
- Specified by:
resolveFieldAliasin interfaceIFormDataAdapter
-
resolveFieldName
public String resolveFieldName(String fieldName)
- Specified by:
resolveFieldNamein interfaceIFormDataAdapter
-
getFieldTyp
public EFormFieldTyp getFieldTyp(String identifier, boolean asAlias)
- Specified by:
getFieldTypin interfaceIFormDataAdapter- 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
public Set<String> getFieldAlias()
- Specified by:
getFieldAliasin interfaceIFormDataAdapter- Returns:
- A
Setconsisting of the alias names of all existing form elements.
-
getIFieldMetaData
public IFieldMetaData getIFieldMetaData(String identifier, boolean asAlias)
- Specified by:
getIFieldMetaDatain interfaceIFormDataAdapter
-
isElementLooped
public boolean isElementLooped(String elemName)
Description copied from interface:IFormDataAdapterA 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.- Specified by:
isElementLoopedin interfaceIFormDataAdapter- Parameters:
elemName- 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).
-
aliasValue
public Object aliasValue(String alias)
- Specified by:
aliasValuein interfaceIFormDataAdapter
-
hasAlias
public boolean hasAlias(String alias)
- Specified by:
hasAliasin interfaceIFormDataAdapter- Parameters:
alias- An alias name to check.- Returns:
trueif a form element with the given alias exists, orfalseotherwise.
-
hasField
public boolean hasField(String fieldName)
Description copied from interface:IFormDataAdapterERSTMAL: Lieferttrue, wenn das Formular ein Feld mit dem übergebenen Namen besitzt.- Specified by:
hasFieldin interfaceIFormDataAdapter- Parameters:
fieldName- the field to check for- Returns:
- Liefert
true, wenn das Formular ein Feld mit dem übergebenen Namen besitzt
-
resolveFieldType
public EFormFieldTyp resolveFieldType(String fieldName, boolean asAlias)
- Specified by:
resolveFieldTypein interfaceIFormDataAdapter
-
getFieldValues
public List<String[]> getFieldValues(String fieldName)
- Specified by:
getFieldValuesin interfaceIFormDataAdapter- 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.
-
resolveAliasName
public String resolveAliasName(String alias)
- Specified by:
resolveAliasNamein interfaceIFormDataAdapter- 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:
IFormDataAdapter.hasAlias(String)
-
getStringValue
public String getStringValue(String fieldName)
Description copied from interface:IFormDataAdapterEach form element may have multiple values. This returns the first value.- Specified by:
getStringValuein interfaceIFormDataAdapter- 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.
-
normalizeValue
public String[] normalizeValue(String... value)
- Specified by:
normalizeValuein interfaceIFormDataAdapter- Parameters:
value- A list of values.- Returns:
- The given list of values, or an empty array in case
nullwas given.
-
normalizeValue
public String[] normalizeValue(List<String> value)
- Specified by:
normalizeValuein interfaceIFormDataAdapter- Parameters:
value- AListof values.- Returns:
- An array with the given values, or an empty array in case
nullwas given.
-
normalizeValues
public List<String[]> normalizeValues(List<String> stringList)
- Specified by:
normalizeValuesin interfaceIFormDataAdapter- Parameters:
stringList- A list of values.- Returns:
- A
Listwith only a single entry, an array containing the given values.
-
getNormName
public String getNormName(String fieldName)
Description copied from interface:IFormDataAdapterFor 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.- Specified by:
getNormNamein interfaceIFormDataAdapter- 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.
-
asStringValue
public String asStringValue(List<String[]> value)
- Specified by:
asStringValuein interfaceIFormDataAdapter- 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
public String asStringValue(String[] value)
- Specified by:
asStringValuein interfaceIFormDataAdapter- 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
public void addSingleValue(String fieldName, String... value)
Description copied from interface:IFormDataAdapterAdds 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.- Specified by:
addSingleValuein interfaceIFormDataAdapter- Parameters:
fieldName- The name of a form element.value- One or multiple values to add for the given element.- See Also:
IFormDataAdapter.addMultiValue(String, List)
-
addMultiValue
public void addMultiValue(String fieldName, List<String[]> values)
Description copied from interface:IFormDataAdapterAdds 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.- Specified by:
addMultiValuein interfaceIFormDataAdapter- Parameters:
fieldName- The name of a form element.values- AListof values to add to the form element.- See Also:
IFormDataAdapter.addSingleValue(String, String...)
-
getFields
public Set<String> getFields()
- Specified by:
getFieldsin interfaceIFormDataAdapter
-
-