Class EdiElement

java.lang.Object
com.adaptris.adapter.edistream.model.EdiElement
All Implemented Interfaces:
Serializable, TreeNode
Direct Known Subclasses:
Composite, ElementCode, Field, LoopSegment, Message, Segment, StandardCodes

public abstract class EdiElement extends Object implements TreeNode, Serializable
Abstract Parent class of all Elements that are used to represent Edi Data internally as a tree structure.
The following asci image shows the structure of an EDI document, and this class aims to be the base node for all other nodes that will represent it internally.
The diagram shows a Msg which has four child nodes, the third of which is a Group node that itself has two segment nodes. Segment nodes themselves can be made up of composite and element nodes, that are not shown in the diagram. +--------+ | MSG | | | +----+---+ | v +-------------+--------------+---------------+ v v v v +-----+ +-----+ +-----+ +-----+ | REF | | QTY | |GROUP| | LDD | | M1 | | C5 | | C99 | | M1 | +-----+ +-----+ +-----+ +-----+ + | v +-------------+ v v +-----+ +-----+ | FFF | | TXT | | M1 | | M1 | +-----+ +-----+
See Also:
  • Constructor Details

    • EdiElement

      public EdiElement()
    • EdiElement

      public EdiElement(String name, boolean mandatory, int repetitions)
  • Method Details

    • getName

      public String getName()
    • setName

      public void setName(String name)
    • isMandatory

      public boolean isMandatory()
    • setMandatory

      public void setMandatory(boolean mandatory)
    • getRepetitions

      public int getRepetitions()
    • setRepetitions

      public void setRepetitions(int repetitions)
    • getMaxRepetitions

      public int getMaxRepetitions()
    • setMaxRepetitions

      public void setMaxRepetitions(int maxRepetitions)
    • setSegmentReps

      public static void setSegmentReps(EdiElement elementRule, String repsStr)
      Sets the repetition value for an Element. It is possible for the value to be ">1" So we need to set this appropriately.
      Parameters:
      elementRule -
      repsStr - - original string value from the gxml file
    • getChildren

      public List<EdiElement> getChildren()
    • children

      public Enumeration<EdiElement> children()
      Specified by:
      children in interface TreeNode
    • getChild

      public EdiElement getChild(int position)
    • getIndex

      public int getIndex(TreeNode node)
      Specified by:
      getIndex in interface TreeNode
    • getChildAt

      public TreeNode getChildAt(int childIndex)
      Specified by:
      getChildAt in interface TreeNode
    • setChildren

      public void setChildren(List<EdiElement> children)
    • addChild

      public void addChild(EdiElement child)
    • hasChildren

      public boolean hasChildren()
    • getChildCount

      public int getChildCount()
      Specified by:
      getChildCount in interface TreeNode
    • getAllowsChildren

      public boolean getAllowsChildren()
      Specified by:
      getAllowsChildren in interface TreeNode
    • isLeaf

      public boolean isLeaf()
      Specified by:
      isLeaf in interface TreeNode
    • getParent

      public TreeNode getParent()
      Specified by:
      getParent in interface TreeNode
    • setParent

      public void setParent(EdiElement parent)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equalsStr

      public boolean equalsStr(String str1, String str2)
    • childrenEquals

      protected boolean childrenEquals(EdiElement compareItem)
      Returns true if the children of the given object match this instance's.
      Parameters:
      compareItem -
      Returns:
      true if both sets of children are equal
    • toString

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

      protected String getChildrenAsString()