Package com.adaptris.edi.container
Class Root
- java.lang.Object
-
- com.adaptris.edi.container.Root
-
- All Implemented Interfaces:
ContainerPart,SearchableListItem
public class Root extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Loggerlog
-
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 voidaddChild(ContainerPart child)adds a child ContainerPart to this one.voiddoAction(java.lang.String queryString, Action action, ContainerPart output)Method to perform an XPATH style query on the ContainerPart heirarchy.voiddocument(java.lang.StringBuffer sb, int indent)write out an XML representation of this ContainerPart and all sub-partsContainerPartgetChild(int index)gets a child ContainerPart.intgetChildCount()gets the number of child elementsjava.util.ArrayListgetChildList(java.lang.String type, java.lang.String id)Method to retrieve child elements keyed by Type and ID valuesjava.lang.StringgetId()returns the ID of this container partContainerPartgetParent()This method always throws a ContainerException as it is not possible for the root element to have a parentContainerPartgetRoot()returns the root ContainerPart in this tree structurejava.lang.StringgetType()returns the ID of this ContainerPart.protected java.lang.StringreplaceEntity(java.lang.String input)voidsetId(java.lang.String id)sets the ID of this ContainerPart.voidsetParent(ContainerPart parent)This method always throws a ContainerException as it is not possible for the root element to have a parentvoidsetRoot(ContainerPart root)sets the root ContainerPart of this ContainerPart tree.voidwriteXML(java.io.OutputStream out, int indent)write out an XML representation of this ContainerPart and all sub-partsvoidwriteXML(java.io.Writer out, int indent)write out an XML representation of this ContainerPart and all sub-parts
-
-
-
Method Detail
-
getParent
public ContainerPart getParent() throws ContainerException
This method always throws a ContainerException as it is not possible for the root element to have a parent- Specified by:
getParentin interfaceContainerPart- Returns:
- parent ContainerPart
- Throws:
ContainerException
-
setParent
public void setParent(ContainerPart parent) throws ContainerException
This method always throws a ContainerException as it is not possible for the root element to have a parent- Specified by:
setParentin interfaceContainerPart- Throws:
ContainerException
-
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:
addChildin interfaceContainerPart- Parameters:
child- the child ContainerPart
-
getChild
public ContainerPart getChild(int index)
gets a child ContainerPart.- Specified by:
getChildin interfaceContainerPart- 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:
getChildCountin interfaceContainerPart- 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:
getIdin interfaceContainerPart- Specified by:
getIdin interfaceSearchableListItem- Returns:
- the ID String
-
getRoot
public ContainerPart getRoot()
returns the root ContainerPart in this tree structure- Specified by:
getRootin interfaceContainerPart- 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:
getTypein interfaceContainerPart- Specified by:
getTypein interfaceSearchableListItem- 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:
setIdin interfaceContainerPart- 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:
setRootin interfaceContainerPart- Parameters:
root-
-
document
public void document(java.lang.StringBuffer sb, int indent)Description copied from interface:ContainerPartwrite out an XML representation of this ContainerPart and all sub-parts- Specified by:
documentin interfaceContainerPart- See Also:
ContainerPart.document(java.lang.StringBuffer, int)
-
writeXML
public void writeXML(java.io.OutputStream out, int indent) throws EdiException, java.io.IOExceptionDescription copied from interface:ContainerPartwrite out an XML representation of this ContainerPart and all sub-parts- Specified by:
writeXMLin interfaceContainerPart- Throws:
EdiException- wrapping other exceptionsjava.io.IOException
-
writeXML
public void writeXML(java.io.Writer out, int indent) throws EdiException, java.io.IOExceptionDescription copied from interface:ContainerPartwrite out an XML representation of this ContainerPart and all sub-parts- Specified by:
writeXMLin interfaceContainerPart- Throws:
EdiException- wrapping other exceptionsjava.io.IOException- See Also:
ContainerPart.writeXML(java.io.Writer, int)
-
getChildList
public java.util.ArrayList getChildList(java.lang.String type, java.lang.String id) throws ContainerExceptionMethod to retrieve child elements keyed by Type and ID values- Specified by:
getChildListin interfaceContainerPart- Parameters:
type- the type of element to retrieveid- 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 EdiExceptionMethod to perform an XPATH style query on the ContainerPart heirarchy. Syntax rules to follow...- Specified by:
doActionin interfaceContainerPart- Parameters:
queryString- the string containing the query to be processedaction- the action to runoutput- 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)
-
-