Package org.alfresco.repo.forms
Class FormData
java.lang.Object
org.alfresco.repo.forms.FormData
- All Implemented Interfaces:
Iterable<FormData.FieldData>
Represents the data going to or coming from a Form.
- Author:
- Gavin Cornwell
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassInner class to represent the value of a field on a form -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFieldData(String fieldName, Object fieldValue) Adds the given data to the form.voidaddFieldData(String fieldName, Object fieldValue, boolean overwrite) Adds the given data to the form.voidaddFieldData(org.springframework.extensions.webscripts.servlet.FormData.FormField field) Adds the given webscript FormField object to the form.getFieldData(String fieldName) Returns the data for the given field.Returns a list of the names of the fields held by this object.intReturns the number of fields data is being held for.booleanhasFieldData(String fieldName) Determines whether field data for the given item exists.iterator()Returns an Iterator over the FieldData objects held by this object.voidremoveFieldData(String fieldName) Removes the data associated with the given field if it exists.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
data
-
-
Constructor Details
-
FormData
public FormData()Default constructor
-
-
Method Details
-
hasFieldData
Determines whether field data for the given item exists.- Parameters:
fieldName- Name of field to look for- Returns:
- true if the field exists, false otherwise
-
getFieldData
Returns the data for the given field.- Parameters:
fieldName- Name of field to look for- Returns:
- FieldData object representing the data for the field or null if it doesn't exist
-
addFieldData
Adds the given data to the form.NOTE: Adding the same named data will append the value and thereafter return a List containing all added values.
- Parameters:
fieldName- The name of the fieldfieldValue- The value of the data
-
addFieldData
public void addFieldData(org.springframework.extensions.webscripts.servlet.FormData.FormField field) Adds the given webscript FormField object to the form.- Parameters:
field- A WebScript FormField object
-
addFieldData
Adds the given data to the form. If data for the field is already present the behaviour is controlled by the overwrite property.If overwrite is true the provided value replaces the existing value whereas false will force the creation of a List (if necessary) and the provided value will be added to the List.
- Parameters:
fieldName- The name of the fieldfieldValue- The value of the dataoverwrite- boolean
-
removeFieldData
Removes the data associated with the given field if it exists.- Parameters:
fieldName- Name of the field to remove
-
getFieldNames
Returns a list of the names of the fields held by this object.- Returns:
- List of String objects
-
getNumberOfFields
public int getNumberOfFields()Returns the number of fields data is being held for.- Returns:
- Number of fields
-
iterator
Returns an Iterator over the FieldData objects held by this object.- Specified by:
iteratorin interfaceIterable<FormData.FieldData>- Returns:
- Iterator of FieldData
-
toString
-