@NotThreadSafe public class DataForm extends PacketExtension
addReportedField(String,String,FormField.Type) to set the columns of the report whilst
the report's rows can be configured using addItemFields(Map).| Modifier and Type | Class and Description |
|---|---|
static class |
DataForm.Type
Type-safe enumeration to represent the type of the Data forms.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ELEMENT_NAME
Element name of the packet extension.
|
static String |
NAMESPACE
Namespace of the packet extension.
|
docFactory, element, registeredExtensions| Constructor and Description |
|---|
DataForm(DataForm.Type type) |
DataForm(org.dom4j.Element element) |
| Modifier and Type | Method and Description |
|---|---|
FormField |
addField()
Adds a new field as part of the form.
|
FormField |
addField(String variable,
String label,
FormField.Type type)
Adds a new field as part of the form.
|
void |
addInstruction(String instruction)
Adds a new instruction to the list of instructions that explain how to fill out the form
and what the form is about.
|
void |
addItemFields(Map<String,Object> fields)
Adds a new row of items of reported data.
|
void |
addReportedField(String variable,
String label,
FormField.Type type)
Adds a field to the list of fields that will be returned from a search.
|
void |
clearInstructions()
Clears all the stored instructions in this packet extension.
|
DataForm |
createCopy()
Creates a deep copy of this packet extension.
|
FormField |
getField(String variable)
Returns the field whose variable matches the specified variable.
|
List<FormField> |
getFields()
Returns the fields that are part of the form.
|
List<String> |
getInstructions()
Returns an unmodifiable list of instructions that explain how to fill out the form and
what the form is about.
|
String |
getTitle()
Returns the description of the data form.
|
DataForm.Type |
getType()
Returns the type of this data form.
|
static boolean |
parseBoolean(String booleanString) |
static Date |
parseDate(String date)
Returns the Date obtained by parsing the specified date representation.
|
boolean |
removeField(String variable)
Removes the field whose variable matches the specified variable.
|
void |
setTitle(String title)
Sets the description of the data.
|
getElement, getExtensionClasspublic static final String ELEMENT_NAME
public static final String NAMESPACE
public DataForm(DataForm.Type type)
public DataForm(org.dom4j.Element element)
public static Date parseDate(String date) throws ParseException
date - date representation in the UTC GMT+0 format.ParseException - if an error occurs while parsing the date representation.public static boolean parseBoolean(String booleanString) throws ParseException
ParseExceptionpublic DataForm.Type getType()
DataForm.Typepublic void setTitle(String title)
title - description of the data.public String getTitle()
public List<String> getInstructions()
public void addInstruction(String instruction)
Nothing will be set, if the provided argument is null or an empty String.
instruction - the new instruction that explain how to fill out the form.public void clearInstructions()
public FormField addField()
public FormField addField(String variable, String label, FormField.Type type)
variable - the unique identifier of the field in the context of the
form. Optional parameter.type - an indicative of the format for the data. Optional parameter.label - the label of the question. Optional parameter.public List<FormField> getFields()
public FormField getField(String variable)
variable - the variable name of the field to search.public boolean removeField(String variable)
variable - the variable name of the field to remove.public void addReportedField(String variable, String label, FormField.Type type)
variable - variable name of the new column. This value will be used in
addItemFields(java.util.Map<java.lang.String, java.lang.Object>) when adding reported items.label - label that corresponds to the new column. Optional parameter.type - indicates the type of field of the new column. Optional parameter.public void addItemFields(Map<String,Object> fields)
Collection. Since the value is of type Object it
is possible to include any type of object as a value. The actual value to include in the
data form is the result of the encode(Object) method.fields - list of public DataForm createCopy()
PacketExtensioncreateCopy in class PacketExtensionCopyright © 2009–2017 Ignite Realtime. All rights reserved.