Class Root

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.slf4j.Logger log  
    • Constructor Summary

      Constructors 
      Constructor Description
      Root()
      Creates a new instance of Root
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChild​(ContainerPart child)
      adds a child ContainerPart to this one.
      void doAction​(java.lang.String queryString, Action action, ContainerPart output)
      Method to perform an XPATH style query on the ContainerPart heirarchy.
      void document​(java.lang.StringBuffer sb, int indent)
      write out an XML representation of this ContainerPart and all sub-parts
      ContainerPart getChild​(int index)
      gets a child ContainerPart.
      int getChildCount()
      gets the number of child elements
      java.util.ArrayList getChildList​(java.lang.String type, java.lang.String id)
      Method to retrieve child elements keyed by Type and ID values
      java.lang.String getId()
      returns the ID of this container part
      ContainerPart getParent()
      This method always throws a ContainerException as it is not possible for the root element to have a parent
      ContainerPart getRoot()
      returns the root ContainerPart in this tree structure
      java.lang.String getType()
      returns the ID of this ContainerPart.
      protected java.lang.String replaceEntity​(java.lang.String input)  
      void setId​(java.lang.String id)
      sets the ID of this ContainerPart.
      void setParent​(ContainerPart parent)
      This method always throws a ContainerException as it is not possible for the root element to have a parent
      void setRoot​(ContainerPart root)
      sets the root ContainerPart of this ContainerPart tree.
      void writeXML​(java.io.OutputStream out, int indent)
      write out an XML representation of this ContainerPart and all sub-parts
      void writeXML​(java.io.Writer out, int indent)
      write out an XML representation of this ContainerPart and all sub-parts
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        protected transient org.slf4j.Logger log
    • Constructor Detail

      • Root

        public Root()
        Creates a new instance of Root
    • Method Detail

      • addChild

        public void addChild​(ContainerPart child)
        adds a child ContainerPart to this one. Parts are added in list order and cannot be re-ordered at this time.
        Specified by:
        addChild in interface ContainerPart
        Parameters:
        child - the child ContainerPart
      • getChild

        public ContainerPart getChild​(int index)
        gets a child ContainerPart.
        Specified by:
        getChild in interface ContainerPart
        Parameters:
        index - the index of the child ContainerPart (starting from 0 and up to getChildCount() - 1)
        Returns:
        the ContainerPart referenced
        See Also:
        ContainerPart.getChildCount()
      • getChildCount

        public int getChildCount()
        gets the number of child elements
        Specified by:
        getChildCount in interface ContainerPart
        Returns:
        the number of child elements held by this ContainerPart
      • getId

        public java.lang.String getId()
        returns the ID of this container part
        Specified by:
        getId in interface ContainerPart
        Specified by:
        getId in interface SearchableListItem
        Returns:
        the ID String
      • getRoot

        public ContainerPart getRoot()
        returns the root ContainerPart in this tree structure
        Specified by:
        getRoot in interface ContainerPart
        Returns:
        root ContainerPart
      • getType

        public java.lang.String getType()
        returns the ID of this ContainerPart. Will correspond to the static types array in com.adaptris.edi.model.DataModelPart
        Specified by:
        getType in interface ContainerPart
        Specified by:
        getType in interface SearchableListItem
        Returns:
        String type
        See Also:
        DataModelPart
      • setId

        public void setId​(java.lang.String id)
        sets the ID of this ContainerPart. Should correspond to static types array in com.adaptris.edi.model.DataModelPart.
        Specified by:
        setId in interface ContainerPart
        Parameters:
        id -
        See Also:
        DataModelPart
      • setRoot

        public void setRoot​(ContainerPart root)
        sets the root ContainerPart of this ContainerPart tree. Will recursively set the root ContainerPart through all child Parts. Thus only needs to be called once per tree structure and always ensures that all ContainerParts reference the same root Part.
        Specified by:
        setRoot in interface ContainerPart
        Parameters:
        root -
      • writeXML

        public void writeXML​(java.io.OutputStream out,
                             int indent)
                      throws EdiException,
                             java.io.IOException
        Description copied from interface: ContainerPart
        write out an XML representation of this ContainerPart and all sub-parts
        Specified by:
        writeXML in interface ContainerPart
        Throws:
        EdiException - wrapping other exceptions
        java.io.IOException
      • getChildList

        public java.util.ArrayList getChildList​(java.lang.String type,
                                                java.lang.String id)
                                         throws ContainerException
        Method to retrieve child elements keyed by Type and ID values
        Specified by:
        getChildList in interface ContainerPart
        Parameters:
        type - the type of element to retrieve
        id - the id of the element to retrieve
        Returns:
        ArrayList containing the retrieved elements
        Throws:
        ContainerException
      • doAction

        public void doAction​(java.lang.String queryString,
                             Action action,
                             ContainerPart output)
                      throws EdiException
        Method to perform an XPATH style query on the ContainerPart heirarchy. Syntax rules to follow...
        Specified by:
        doAction in interface ContainerPart
        Parameters:
        queryString - the string containing the query to be processed
        action - the action to run
        output - the ContainerPart which will be the parent of the result
        Throws:
        EdiException - wrapping other exceptions.
      • replaceEntity

        protected java.lang.String replaceEntity​(java.lang.String input)