Class Composer

java.lang.Object
com.aquima.interactions.composer.model.Composer
All Implemented Interfaces:
IComposer

public class Composer extends Object implements IComposer
Composer implementation that contains the logic to expand definitions to runtime elements.
Since:
7.0
Author:
O. Kerpershoek, Jon van Leuven
  • Constructor Details

    • Composer

      public Composer(DefinitionStore definitions)
      Constructs the composer using the definitions object.
      Parameters:
      definitions - Object containing all the element definitions.
  • Method Details

    • getElementNames

      public String[] getElementNames(ElementType type)
      Description copied from interface: IComposer
      This method returns all the available names for a specified type.
      Specified by:
      getElementNames in interface IComposer
      Parameters:
      type - The element type, may not be null.
      Returns:
      The element names, never null.
    • composePage

      public IPage composePage(IComposerHandler handler, InferenceContext context, String pageName)
      Description copied from interface: IComposer
      This method will expand the page with the specified name, and add all the values and messages to the expanded page.
      Specified by:
      composePage in interface IComposer
      Parameters:
      handler - The page handler that should be used.
      context - The context that should be used during expansion.
      pageName - The name of the page that should be composed.
      Returns:
      Full page model containing values and messages for all the fields on the page.
    • composeDocument

      public IDocument composeDocument(IComposerHandler handler, InferenceContext context, String documentName)
      Description copied from interface: IComposer
      Composes a document model which can be transformed to other formats at a later stage.
      Specified by:
      composeDocument in interface IComposer
      Parameters:
      handler - The handler that should be used to evaluate context specific information.
      context - The context that should be used to generate the document with.
      documentName - The name of the document that should be composed.
      Returns:
      The composed document, should never be null.
    • composeElement

      public Element composeElement(IComposerHandler handler, InferenceContext context, String elementName)
      Specified by:
      composeElement in interface IComposer
    • composeText

      public IMultilingualText composeText(InferenceContext context, String textName)
      Specified by:
      composeText in interface IComposer
    • expandReference

      public Element[] expandReference(IComposerHandler handler, InferenceContext context, AbstractReference reference)
      Description copied from interface: IComposer
      This method will expand the elements referenced by the abstract reference.
      Specified by:
      expandReference in interface IComposer
      Parameters:
      handler - The page handler that should be used.
      context - The context that should be used during expansion.
      reference - The reference to the elements that should be expanded.
      Returns:
      The expanded elements, never null
    • expandReference

      public Element[] expandReference(IComposerHandler handler, IComposerContext context, AbstractReference reference)
      Description copied from interface: IComposer
      This method will expand the elements referenced by the abstract reference.
      Specified by:
      expandReference in interface IComposer
      Parameters:
      handler - The page handler that should be used.
      context - The context that should be used during expansion.
      reference - The reference to the elements that should be expanded.
      Returns:
      The expanded elements, never null
    • getButton

      public ButtonDefinition getButton(String name)
      Description copied from interface: IComposer
      Looks up the button definition for the specified name and returns the definition model.
      Specified by:
      getButton in interface IComposer
      Parameters:
      name - The name of the button as defined in studio.
      Returns:
      A button definition model which is never null
    • getField

      public FieldDefinition getField(String name)
      Description copied from interface: IComposer
      Looks up the field definition for the specified entity name and attribute name and returns the definition model.
      Specified by:
      getField in interface IComposer
      Parameters:
      name - The full attribute name (entity.attribute) of the field requested.
      Returns:
      A field definition model which is never null
    • getContainer

      public ContainerDefinition getContainer(String name)
      Description copied from interface: IComposer
      looks up the text definition for the specified name and returns the definition model.
      Specified by:
      getContainer in interface IComposer
      Parameters:
      name - The name of the container as defined in studio.
      Returns:
      A container definition model which is never null
    • getPage

      public PageDefinition getPage(String name)
      Description copied from interface: IComposer
      Looks up the page definition for the specified name and returns the definition model.
      Specified by:
      getPage in interface IComposer
      Parameters:
      name - The name of the page as defined in studio.
      Returns:
      A page definition model which is never null
    • getAsset

      public AssetDefinition getAsset(String name)
      Description copied from interface: IComposer
      Looks up the text definition (also called an asset) for the specified name and returns the definition model.
      Specified by:
      getAsset in interface IComposer
      Parameters:
      name - The name of the text as defined in studio.
      Returns:
      A text definition model which is never null
    • getContent

      public ContentDefinition getContent(String name)
      Description copied from interface: IComposer
      Looks up the content definition for the specified name and returns the definition model.
      Specified by:
      getContent in interface IComposer
      Parameters:
      name - The name of the content as defined in studio.
      Returns:
      A content definition model which is never null
    • getText

      public TextDefinition getText(String name)
      Description copied from interface: IComposer
      Looks up the text definition for the specified name and returns the definition model.
      Specified by:
      getText in interface IComposer
      Parameters:
      name - The name of the text as defined in studio.
      Returns:
      A text definition model which is never null
    • getDocument

      public DocumentDefinition getDocument(String name)
      Description copied from interface: IComposer
      looks up the document definition for the specified name and returns the definition model.
      Specified by:
      getDocument in interface IComposer
      Parameters:
      name - The name of the document as defined in studio.
      Returns:
      A document definition model which is never null
    • getImage

      public ImageDefinition getImage(String name)
      Description copied from interface: IComposer
      looks up the image definition for the specified name and returns the definition model.
      Specified by:
      getImage in interface IComposer
      Parameters:
      name - The name of the image as defined in studio.
      Returns:
      An image definition model which is never null
    • expandFieldRef

      protected Field[] expandFieldRef(IComposerHandler handler, ComposerContext context, AbstractReference reference)
    • expandButtonRef

      protected Button[] expandButtonRef(ComposerContext context, AbstractReference reference)
    • expandContainerRef

      protected Element[] expandContainerRef(IComposerHandler handler, ComposerContext context, AbstractReference reference)
    • expandPageRef

      protected Page[] expandPageRef(IComposerHandler handler, ComposerContext context, AbstractReference reference)
    • expandAssetRef

      protected Asset[] expandAssetRef(ComposerContext context, AbstractReference elementReference)
    • expandTextRef

      protected TextItem[] expandTextRef(IComposerHandler handler, AbstractReference reference, ComposerContext context)
    • expandImageRef

      protected Image[] expandImageRef(AbstractReference reference, ComposerContext context)
    • expandContentRef

      protected List<ContentItem> expandContentRef(IComposerHandler handler, AbstractReference reference, ComposerContext context)