java.lang.Object
com.aquima.interactions.composer.model.Element
com.aquima.interactions.composer.model.Field
All Implemented Interfaces:
IElement, IField, Serializable

public class Field extends Element implements IField
This class defines the Field element.
Since:
5.0
Author:
O. Kerpershoek
See Also:
  • Constructor Details

    • Field

      public Field(String name, DataType type, boolean multivalue, IMultilingualText questionText, IMultilingualText explainText)
      Constructs the field with the most common attributes.
      Parameters:
      name - The name of the field (required). This is usually a full attribute name (entity.attribute).
      type - The data type of the field (required).
      multivalue - Boolean indicating if the field can hold multiple values.
      questionText - The text that should be shown for the field (optional).
      explainText - The text that should be shown as explanation for the field (optional).
    • Field

      protected Field(Field other)
  • Method Details

    • duplicate

      public Element duplicate()
      Description copied from interface: IElement
      This method should clone the element and return the cloned element. The duplicate method should usually make a deep copy of the element, with the exception of members that are not mutable (and thus can safely be shared between multiple copies). The properties of an element are considered to be non-mutable, and will thus by default be copied.
      Specified by:
      duplicate in interface IElement
      Returns:
      The cloned (duplicate) element.
    • accept

      public IVisitor accept(IVisitor visitor)
      Description copied from class: Element
      This method will invoke the visitor for this runtime element.
      Specified by:
      accept in interface IElement
      Overrides:
      accept in class Element
      Parameters:
      visitor - The visitor that should be invoked.
      Returns:
      The visitor passed to this method.
    • setRefresh

      public Field setRefresh(boolean refresh)
      This method may be used to indicate that a change in the field should cause a refresh event.
      Parameters:
      refresh - Boolean indicating if a change in the field value should cause a refresh event.
      Returns:
      Pointer to this field element to allow method chaining.
    • isRefreshField

      public boolean isRefreshField()
      Description copied from interface: IField
      This method return a boolean indicating if a change in value should posted.
      Specified by:
      isRefreshField in interface IField
      Returns:
      Boolean indicating if a change in the field should trigger a refresh action.
    • isRequired

      public boolean isRequired()
      Description copied from interface: IField
      This method will return true when the field is required.
      Specified by:
      isRequired in interface IField
      Returns:
      boolean indicating if the field is required.
    • getDisplayLength

      public int getDisplayLength()
      Description copied from interface: IField
      This method return the maximum length for the field.
      Specified by:
      getDisplayLength in interface IField
      Returns:
      The maximum length of the field, or -1 for unlimited.
    • setDisplayLength

      public Field setDisplayLength(int length)
      This method may be used to indicate the maximum length of the field value.
      Parameters:
      length - The maximum number of characters of the field value.
      Returns:
      Pointer to this field element to allow method chaining.
    • getValue

      public IValue getValue()
      Description copied from interface: IField
      This method returns the value of the field.
      Specified by:
      getValue in interface IField
      Returns:
      The current value of the field.
    • setValue

      public Field setValue(IValue fieldValue)
      This method may be used to set the new value for the field. This method is used by the portal engine after processing an event to update the old page.
      Parameters:
      fieldValue - The new value for the field.
      Returns:
      Pointer to this field element to allow method chaining.
    • getDomain

      public IDomainValue[] getDomain()
      Description copied from interface: IField
      This method will return the set of values that are currently valid for this field. When the field is not restricted to a set of values, this method will return the value null.
      Specified by:
      getDomain in interface IField
      Returns:
      Array containing all the values that are allowed for this field.
    • setDomain

      public Field setDomain(IPrimitiveValue[] values)
      This method may be used to set the values that are valid for this field.
      Parameters:
      values - Array of values that are valid for this field.
      Returns:
      Pointer to this field element to allow method chaining.
    • setDomain

      public Field setDomain(IDomain domain)
      This method may be used to set the values that are valid for this field.
      Parameters:
      domain - The domain containing the values.
      Returns:
      Pointer to this field element to allow method chaining.
    • setDomain

      public Field setDomain(IDomainValue[] values)
      This method may be used to set the values that are valid for this field.
      Parameters:
      values - Array of values that are valid for this field.
      Returns:
      Pointer to this field element to allow method chaining.
    • getDomainValues

      public IDomainValue[] getDomainValues()
      Description copied from interface: IField
      This method will return the set of values that are available for this field. The method isCurrentlyValid of the returned values may be used to check if the value should be allowed to be chosen. When the field is not restricted to a set of values, this method will return the value null.
      Specified by:
      getDomainValues in interface IField
      Returns:
      Array containing all the values that are allowed for this field.
    • addMessage

      public boolean addMessage(IMessage message)
      This method may be used to add a message to the field.
      Parameters:
      message - The message that should be added.
      Returns:
      Boolean indicating if the message was actually added (duplicate messages are ignored).
    • getMessages

      public IMessage[] getMessages()
      Description copied from interface: IField
      This method will return the error or waning messages applicable to this field. When there are no messages (either because there has not been a change yet, or the value is valid) this method will return an empty array.
      Specified by:
      getMessages in interface IField
      Returns:
      Error and/or warning messages associated with the field.
    • setMessages

      public Field setMessages(IMessage[] messages)
      This method may be used to set messages for the field. The messages are usually set by the portal engine after the processing of an event has failed.
      Parameters:
      messages - Array of messages for the field.
      Returns:
      Pointer to this field element to allow method chaining.
    • getExplainText

      public IMultilingualText getExplainText()
      Description copied from interface: IField
      Get the explain text for this field.
      Specified by:
      getExplainText in interface IField
      Returns:
      Text object containing an explanation of the field.
    • setExplainText

      public void setExplainText(IMultilingualText textValue)
      This method may be used to override the explain text for the field.
      Parameters:
      textValue - The new explain text for the field.
    • getQuestionText

      public IMultilingualText getQuestionText()
      Description copied from interface: IField
      Get the question text for this field. The question text is usually used in the interface instead of the name of the field.
      Specified by:
      getQuestionText in interface IField
      Returns:
      Text object containing the question text of the field.
    • setQuestionText

      public void setQuestionText(IMultilingualText textValue)
      This method may be used to override the question text for the field.
      Parameters:
      textValue - The new question text for the field.
    • getDataType

      public DataType getDataType()
      Description copied from interface: IField
      Returns the data type of the field.
      Specified by:
      getDataType in interface IField
      Returns:
      The data type of the field.
    • isMultiValue

      public boolean isMultiValue()
      Description copied from interface: IField
      The cardinality of the field.
      Specified by:
      isMultiValue in interface IField
      Returns:
      Boolean indicating if multiple values are allowed for this field.
    • setMultiValue

      public void setMultiValue(boolean isMultiValued)
      This method may be used to override if multiple values are allowed for this field.
      Parameters:
      isMultiValued - boolean indicating if multiple values are allowed for this field.
    • getRejectedValue

      public Serializable getRejectedValue()
      Description copied from interface: IField
      This method will return the rejected value in case there are warnings or errors applicable to this field. When there is no rejected value this method will return a null pointer.
      Specified by:
      getRejectedValue in interface IField
      Returns:
      The value of the field that did not pass the validation(s).
    • setRejectedValue

      public void setRejectedValue(Serializable objValue)
      This method may be used to set the value that was not valid for the field. The rejected value is usually set by the portal engine after the processing of an event has failed due to a conversion or validation error.
      Parameters:
      objValue - The value that was not valid for the field.
    • addValidation

      public boolean addValidation(IFieldValidation validation)
      This method may be used to add a validation to the field.
      Parameters:
      validation - The validation that should be added.
      Returns:
      Boolean indicating if the validation was successfully added.
    • getValidations

      public IFieldValidation[] getValidations()
      Description copied from interface: IField
      This method returns the validations that are defined for this field. The validations may be performed at the client side (for instance using javascript), but will also be performed at the server side.
      Specified by:
      getValidations in interface IField
      Returns:
      the validations that are defined for this field.
    • addParameter

      public void addParameter(IGlobalParameterValue parameter)
    • getParameters

      public IGlobalParameterValue[] getParameters()
      Description copied from interface: IField
      Returns the evaluated parameters of this field.
      Specified by:
      getParameters in interface IField
      Returns:
      an array containing the parameters of this field, may be empty but never null.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Element
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Element