Class Container

All Implemented Interfaces:
ICompositeElement, IContainer, IElement, Serializable
Direct Known Subclasses:
AnsweredContainer, ButtonContainer, FailedElement, Page, QuestionsContainer, SolutionsContainer, TableElement, TreeListContainer

public class Container extends CompositeElement implements IContainer
This class defines the composite container element.
Since:
5.0
Author:
O. Kerpershoek, F. van der Meer
See Also:
  • Constructor Details

    • Container

      public Container(String name)
      Constructs an empty container with only a name.
      Parameters:
      name - The name of the container.
    • Container

      public Container(String name, ContentStyle contentStyle)
      Constructs an empty container with a name and content style.
      Parameters:
      name - The name of the container.
      contentStyle - The content style of the container (may be null)
    • Container

      public Container(InferenceContext context, ContainerDefinition definition)
      Constructs a container from a definition using the provided context to evaluate dynamic text elements.

      Note: This constructor will not add any child elements.

      Parameters:
      context - The context that should be used to evaluate dynamic text elements.
      definition - The definition of the container.
      Throws:
      RuleEngineException - This exception is thrown when the dynamic text elements could not be evaluated.
    • Container

      protected Container(Container other, boolean duplicateContents)
      Copy constructor that creates a container based on another container. The duplicateContents parameter may be used to specify if all contents should be duplicated. Note: Duplicating a container can be quite expensive depending on the amount of content that is present on the container. If the duplicate contents is false the children of the container are not copied or used thus creating an empty container. This constructor is mainly available for implementations of the duplicate method.
      Parameters:
      other - The container which should be imitated.
      duplicateContents - A boolean indicating it should create copies of the contents of the other container, or when false to ignore the other containers children.
  • Method Details

    • duplicate

      public Element duplicate()
      This method duplicates the container element.
      Specified by:
      duplicate in interface IElement
      Returns:
      A clone of this element.
    • clearMessages

      public void clearMessages()
      This method may be used to clear any messages that were added to the container.
    • addMessage

      public void addMessage(IMessage message)
      This method may be used to add a message to the container.
      Parameters:
      message - The message that should be added.
    • getMessages

      public IMessage[] getMessages(boolean includeChildren)
      Description copied from interface: IContainer
      This method returns all the messages that were reported during the expand of this container.
      Specified by:
      getMessages in interface IContainer
      Parameters:
      includeChildren - Boolean indicating if messages reported by child containers should also be returned.
      Returns:
      Array of messages that were reported during the expand of the container.
    • collectMessages

      protected List<IMessage> collectMessages(List<IMessage> result)
    • setEntityContext

      public void setEntityContext(EntityValue instanceId)
      This method can be used to specify the entity context for the container. The entity context will be used to determine which instance should be active when expanding and evaluating the container.
      Parameters:
      instanceId - The ID of the instance that should be active for this container.
    • getEntityInstanceId

      public EntityValue getEntityInstanceId()
      Description copied from interface: IContainer
      This method may return an instance ID indicating the instance that should be active when processing this container.
      Specified by:
      getEntityInstanceId in interface IContainer
      Returns:
      Entity context associated with the container.
    • getReferenceAttribute

      public String getReferenceAttribute()
      This method returns the name of the attribute through which the container was included by it's parent. When the container was not included by a parent and a relation the result will be null.
      Returns:
      the name of the attribute through which the container was included by it's parent.
    • setReferenceAttribute

      protected void setReferenceAttribute(String attribute)
    • getDisplayText

      public IMultilingualText getDisplayText()
      Description copied from interface: IContainer
      This method returns the optional display text that should be used for this container. If there is no display text defined for the container, this method will return a null value.
      Specified by:
      getDisplayText in interface IContainer
      Returns:
      Display text for the runtime container.
    • setDisplayText

      public void setDisplayText(IMultilingualText displayText)
      This method can be used to set the display text of the container.
      Parameters:
      displayText - The display text that should be used for the container.
    • getTypeName

      public String getTypeName()
      Description copied from interface: IContainer
      Method returning the name of the container type.
      Specified by:
      getTypeName in interface IContainer
      Returns:
      The type name of the container.
    • setTypeName

      public void setTypeName(String type)
      This method may be used to set the type name of the container.
      Parameters:
      type - The type name for the container.
    • getProperty

      public Serializable getProperty(String key)
      Description copied from interface: IElement
      This method returns the property for the specified key. If no property was defined for the specified key, a null value will be returned.
      Specified by:
      getProperty in interface IElement
      Overrides:
      getProperty in class Element
      Parameters:
      key - The key for which the property value is requested.
      Returns:
      The property value for the specified key, or null if no property was added for that key.
    • setProperty

      public Serializable setProperty(String key, Serializable propertyValue)
      Description copied from interface: IElement
      This method will add the property value for the specified property key. If the property value is null, any existing property for that key will be removed.
      Specified by:
      setProperty in interface IElement
      Overrides:
      setProperty in class Element
      Parameters:
      key - The key for which the property value should be set.
      propertyValue - The property value that should be set.
      Returns:
      The previous value that was present for the specified key.
    • toString

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

      public boolean equals(Object obj)
      Compare this container to another (not its elements, @see CompositeElement.equalsContent(com.aquima.interactions.composer.ICompositeElement) to compare its elements).
      Overrides:
      equals in class CompositeElement
      Parameters:
      obj - The object this instance should be compared to.
      Returns:
      boolean indicating if the object is considered equal to this instance.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class CompositeElement