Class EdiElement
- java.lang.Object
-
- com.adaptris.adapter.edistream.model.EdiElement
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.tree.TreeNode
- Direct Known Subclasses:
Composite,ElementCode,Field,LoopSegment,Message,Segment,StandardCodes
public abstract class EdiElement extends java.lang.Object implements javax.swing.tree.TreeNode, java.io.SerializableAbstract 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EdiElement()EdiElement(java.lang.String name, boolean mandatory, int repetitions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(EdiElement child)java.util.Enumeration<EdiElement>children()protected booleanchildrenEquals(EdiElement compareItem)Returns true if the children of the given object match this instance's.booleanequals(java.lang.Object obj)booleanequalsStr(java.lang.String str1, java.lang.String str2)booleangetAllowsChildren()EdiElementgetChild(int position)javax.swing.tree.TreeNodegetChildAt(int childIndex)intgetChildCount()java.util.List<EdiElement>getChildren()protected java.lang.StringgetChildrenAsString()intgetIndex(javax.swing.tree.TreeNode node)intgetMaxRepetitions()java.lang.StringgetName()javax.swing.tree.TreeNodegetParent()intgetRepetitions()booleanhasChildren()inthashCode()booleanisLeaf()booleanisMandatory()voidsetChildren(java.util.List<EdiElement> children)voidsetMandatory(boolean mandatory)voidsetMaxRepetitions(int maxRepetitions)voidsetName(java.lang.String name)voidsetParent(EdiElement parent)voidsetRepetitions(int repetitions)static voidsetSegmentReps(EdiElement elementRule, java.lang.String repsStr)Sets the repetition value for an Element.java.lang.StringtoString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.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, java.lang.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 java.util.List<EdiElement> getChildren()
-
children
public java.util.Enumeration<EdiElement> children()
- Specified by:
childrenin interfacejavax.swing.tree.TreeNode
-
getChild
public EdiElement getChild(int position)
-
getIndex
public int getIndex(javax.swing.tree.TreeNode node)
- Specified by:
getIndexin interfacejavax.swing.tree.TreeNode
-
getChildAt
public javax.swing.tree.TreeNode getChildAt(int childIndex)
- Specified by:
getChildAtin interfacejavax.swing.tree.TreeNode
-
setChildren
public void setChildren(java.util.List<EdiElement> children)
-
addChild
public void addChild(EdiElement child)
-
hasChildren
public boolean hasChildren()
-
getChildCount
public int getChildCount()
- Specified by:
getChildCountin interfacejavax.swing.tree.TreeNode
-
getAllowsChildren
public boolean getAllowsChildren()
- Specified by:
getAllowsChildrenin interfacejavax.swing.tree.TreeNode
-
isLeaf
public boolean isLeaf()
- Specified by:
isLeafin interfacejavax.swing.tree.TreeNode
-
getParent
public javax.swing.tree.TreeNode getParent()
- Specified by:
getParentin interfacejavax.swing.tree.TreeNode
-
setParent
public void setParent(EdiElement parent)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
equalsStr
public boolean equalsStr(java.lang.String str1, java.lang.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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getChildrenAsString
protected java.lang.String getChildrenAsString()
-
-