org.aludratest.content.edifact.edifatto
Class EdifattoContent

java.lang.Object
  extended by org.aludratest.content.edifact.edifatto.EdifattoContent
All Implemented Interfaces:
ContentHandler, EdifactContent

public class EdifattoContent
extends Object
implements EdifactContent

Parses and saves EDIFACT and X12 documents from and to streams.

Author:
Volker Bergmann

Constructor Summary
EdifattoContent()
          Constructor.
 
Method Summary
 org.databene.edifatto.model.Interchange createInterchange(String templateUri, org.databene.edifatto.EdiFormatSymbols symbols, Map<String,Object> variables)
          Uses a FreeMarker template to create an EDI message based on the content of a variables map.
 org.databene.edifatto.compare.AggregateDiff diff(org.databene.edifatto.model.Interchange expected, org.databene.edifatto.model.Interchange actual, org.databene.edifatto.ComparisonSettings settings, org.databene.edifatto.compare.ComparisonModel<Element> model)
          Finds out the differences between two EDIFACT or X12 interchanges, ignoring elements that are tolerated by the ComparisonSettings.
 String formatRecursively(org.databene.edifatto.model.Interchange interchange)
          Formats a full interchange structure recursively as String.
 Object queryXML(org.databene.edifatto.model.Interchange interchange, String expression, QName returnType)
          Creates an XML representation of the interchange and performs an XPath query on it.
 org.databene.edifatto.model.Interchange readInterchange(InputStream in)
          Parses an EDIFACT or X12 interchange available in an InputStream.
 void writeInterchange(org.databene.edifatto.model.Interchange interchange, OutputStream out, boolean useLinefeed)
          Writes an EDIFACT or X12 interchange to an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EdifattoContent

public EdifattoContent()
Constructor.

Method Detail

readInterchange

public org.databene.edifatto.model.Interchange readInterchange(InputStream in)
Parses an EDIFACT or X12 interchange available in an InputStream.

Specified by:
readInterchange in interface EdifactContent
Parameters:
in - the InputStream from which to read the EDI document
Returns:
an object representation of the EDI Interchange

writeInterchange

public void writeInterchange(org.databene.edifatto.model.Interchange interchange,
                             OutputStream out,
                             boolean useLinefeed)
Writes an EDIFACT or X12 interchange to an OutputStream.

Specified by:
writeInterchange in interface EdifactContent
Parameters:
interchange - the EDI Interchange to write
out - the OutputStream to write to

createInterchange

public org.databene.edifatto.model.Interchange createInterchange(String templateUri,
                                                                 org.databene.edifatto.EdiFormatSymbols symbols,
                                                                 Map<String,Object> variables)
Description copied from interface: EdifactContent
Uses a FreeMarker template to create an EDI message based on the content of a variables map.

Specified by:
createInterchange in interface EdifactContent
Returns:
an Interchange with the data configured in the variables map

queryXML

public Object queryXML(org.databene.edifatto.model.Interchange interchange,
                       String expression,
                       QName returnType)
Creates an XML representation of the interchange and performs an XPath query on it.

Specified by:
queryXML in interface EdifactContent
Parameters:
interchange - the interchange to query
expression - the XPath query to perform
returnType - determines the type of the returned object: XPathConstants.STRING for a single String, XPathConstants.NODE for a single Element, XPathConstants.NODESET for a NodeList
Returns:
the found nodes of the interchange in the form of XML elements

diff

public org.databene.edifatto.compare.AggregateDiff diff(org.databene.edifatto.model.Interchange expected,
                                                        org.databene.edifatto.model.Interchange actual,
                                                        org.databene.edifatto.ComparisonSettings settings,
                                                        org.databene.edifatto.compare.ComparisonModel<Element> model)
Finds out the differences between two EDIFACT or X12 interchanges, ignoring elements that are tolerated by the ComparisonSettings.

Specified by:
diff in interface EdifactContent
Parameters:
expected -
actual -
Returns:
an AggregateDiff between the documents

formatRecursively

public String formatRecursively(org.databene.edifatto.model.Interchange interchange)
Formats a full interchange structure recursively as String.

Specified by:
formatRecursively in interface EdifactContent
Parameters:
interchange - the Edifact interchange to format
Returns:
a string representation of the interchange


Copyright © 2015 aludratest.org. All rights reserved.