Interface IFormDataAdapter

  • All Superinterfaces:
    Serializable
    All Known Implementing Classes:
    ASaveFormData, GenericSaveFormData

    public interface IFormDataAdapter
    extends Serializable
    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 Detail

      • resolveFieldAlias

        String resolveFieldAlias​(String alias)
      • resolveFieldName

        String resolveFieldName​(String fieldName)
      • getFieldTyp

        EFormFieldTyp getFieldTyp​(String identifier,
                                  boolean asAlias)
        Parameters:
        identifier - The name of a form element.
        asAlias - If true, interpret the given identifier as the alias name of the form element. If false, 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

        Set<String> getFieldAlias()
        Returns:
        A Set consisting of the alias names of all existing form elements.
      • hasAlias

        boolean hasAlias​(String alias)
        Parameters:
        alias - An alias name to check.
        Returns:
        true if a form element with the given alias exists, or false otherwise.
      • getNormName

        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

        boolean valuesMapHasValue​(String fieldName)
      • getStringValue

        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

        List<String[]> getFieldValues​(String fieldName)
        Parameters:
        fieldName - The name of a form element.
        Returns:
        A List of all values for the given form element, or null if the given form element does not exist.
      • hasField

        boolean hasField​(String fieldName)
        ERSTMAL: Liefert true, 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

        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

        String resolveAliasName​(String alias)
        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:
        hasAlias(String)
      • asStringValue

        String asStringValue​(List<String[]> value)
        Parameters:
        value - A List 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

        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

        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 a List of arrays of Strings, this adds the given values to the first entry in the List 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

        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 - A List of values to add to the form element.
        See Also:
        addSingleValue(String, String...)
      • addRequestValue

        void addRequestValue​(String fieldName,
                             List<String> values)
      • normalizeValue

        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

        String[] normalizeValue​(List<String> value)
        Parameters:
        value - A List of values.
        Returns:
        An array with the given values, or an empty array in case null was given.
      • normalizeValues

        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.