Class ContainerDefinition

java.lang.Object
com.aquima.interactions.composer.model.definition.ElementDefinition
com.aquima.interactions.composer.model.definition.ContainerDefinition
All Implemented Interfaces:
IElementDefinition, Serializable
Direct Known Subclasses:
PageDefinition

public class ContainerDefinition extends ElementDefinition
This class holds a static container definition.
Since:
5.0
Author:
O. Kerpershoek
See Also:
  • Field Details

    • DEFAULT_CONTAINER_CONTENT_STYLE

      public static final ContentStyle DEFAULT_CONTAINER_CONTENT_STYLE
      This member defines the default content style for container elements.
  • Constructor Details

  • Method Details

    • isVisibleFor

      public boolean isVisibleFor(Channel channel, IUserData user)
      This method checks if the container should be visible for the active roles and channel. The container will be visible when either the active role and channel match the required roles and/or channels of the container, or when the container does not require any role and/or channel to be active.
      Parameters:
      channel - The active channel from the client.
      user - The current user of the client.
      Returns:
      Boolean indicating if the container should be visible.
    • getTypeName

      public String getTypeName()
      This method returns the type name of the container.
      Returns:
      the type name of the container.
    • getDisplayText

      public IDynamicText getDisplayText()
      This method returns the display text of the container.
      Returns:
      the display text of the container.
    • getEntityInstanceId

      public EntityValue getEntityInstanceId()
      This method returns the ID of the instance should be active when processing this container.
      Returns:
      the ID of the instance should be active when processing this container.
    • getRelationAttribute

      public String getRelationAttribute()
      This method returns the name of the attribute through which the container was included by it's parent.
      Returns:
      the name of the attribute through which the container was included by it's parent.
    • getType

      public ElementType getType()
      Description copied from interface: IElementDefinition
      This method returns the type of the element.
      Returns:
      The type of the element the definition represents.
    • isDynamic

      public boolean isDynamic()
      This method returns a boolean indicating if the container represents a dynamic element. Dynamic containers will be rendered by the composer using the implementation provided by the container factory for the typeName of this container.
      Returns:
      a boolean indicating if the container represents a dynamic element.
    • isContextImmutable

      public boolean isContextImmutable()
      This method returns a boolean indicating if the container considers the context read-only. As changing the context during the expand of a container can have unpredictable behavior, it is recommended that all container implementations do not modify the context, and return true for this method. A container that defines the context as immutable will not be allowed to make any changes to the context during an expand.
      Returns:
      Boolean indicating if the container considers the context read-only.
    • isEmpty

      public boolean isEmpty()
      This method returns a boolean indicating if no content references are defined for this container definition.
      Returns:
      boolean indicating if the container definition does not have any references to child elements.
    • getContainmentCount

      public int getContainmentCount()
      This method returns the number of content elements (references) that are defined in this container definition.
      Returns:
      the number of content elements (references) that are defined in this container definition.
    • insertReference

      protected void insertReference(int index, AbstractReference reference)
      This method may be used to insert content to the container definition at the specified index by adding a reference to said content.
      Parameters:
      index - The index at which the reference should be inserted.
      reference - The reference to the content that should be added to this container definition.
    • addReference

      protected void addReference(AbstractReference reference)
      This method may be used to add content to the container definition by adding a reference to said content. Currently there are 2 different methods of adding a reference to a container.

      1. The first and most used is by using InlineReference. When the caller already has an ElementDefinition like FieldDefinition 'f' a call to addReference will look like this:

       container.addReference(new InlineReference(f));
       

      2. The other method is by using an ElementReference, this method of adding can be useful when adding a container for which we know the container exists in the studio model. This method will ensure the container is expanded by the composer itself.

       container.addReference(new ElementReference("mydefinedcontainer", ElementType.CONTAINER));
       
      Parameters:
      reference - The reference to the content that should be added to this container definition.
      See Also:
    • getContainmentAt

      public AbstractReference getContainmentAt(int index)
      This method returns the reference to the child element at the specified position.
      Parameters:
      index - The position of the reference that is requested.
      Returns:
      The reference definition at the specified position.
    • getProperty

      public String getProperty(String key)
      This method returns the property for the specified property key. When there is no property defined for the key, a null value will be returned. The property key is not case sensitive.
      Parameters:
      key - The property key for which the value is requested (mandatory).
      Returns:
      The value for the specified property key (may be null).
    • getPropertyNames

      public String[] getPropertyNames()
      This method returns an array containing all property keys defined for this container. When there are no additional properties defined, this method will return an empty array.
      Returns:
      Array containing all the property names.
    • getExitEvents

      public String[] getExitEvents()
      This method returns the possible exit events that can be fired by this page/container.
      Returns:
      The possible exit events, never null.
    • setExitEvents

      protected void setExitEvents(String[] exitEvents)
      This method may be used to override the exit events of the container.
      Parameters:
      exitEvents - The new exit events for the container.
    • getMappedExitEvents

      public Map<String,MappedExitEventDefinition> getMappedExitEvents()
      This method returns a map containing all event definitions that are mapped to flow events for this container. When there are no mappings defined, this method will return an empty map.
      Returns:
      Map containing all the properties of mapped event definitions.
    • getExitEvent

      public String getExitEvent(String containerEventName)
      This method returns the exit event name for the specified container event. If there is a mapping between the container event and the flow event, the flow event is returned, else a null value is returned.

      The container event name is not case sensitive.

      An example how to use with a button in a dynamic container when there is a mapping between the container events and flow events. With this approach the developer of the dynamic container does not need to worry about how the events are called in the used flows in studio and vice versa.

      Example where the container "add" event can be mapped to a flow event like "AddUser"

       Button button = new Button("addButton", new MultilingualText("Add User"));
       button.setEventName(containerDefinition.getExitEvent("add"));
       
      Parameters:
      containerEventName - The name of the container event (cannot be null or an empty string).
      Returns:
      The exit event name of the flow event mapped to the container event name, or null if no mapping exists.
    • getContentStyle

      public ContentStyle getContentStyle()
      This method returns the content style of the container.
      Returns:
      The content style of the container.
    • getContentStyle

      protected ContentStyle getContentStyle(ContentStyle defaultStyle)
    • setContentStyle

      protected void setContentStyle(ContentStyle style)
    • updateFields

      protected void updateFields(DefinitionStore definitionStore)