Class EDIInputFactory

    • Field Detail

      • EDI_VALIDATE_CONTROL_CODE_VALUES

        public static final String EDI_VALIDATE_CONTROL_CODE_VALUES
        When set to false, enumerated code values of control structure elements will be ignore. Element size and type validation will still occur.
        See Also:
        Constant Field Values
      • XML_DECLARE_TRANSACTION_XMLNS

        public static final String XML_DECLARE_TRANSACTION_XMLNS
        When set to true, XMLStreamReader instances created from an EDIInputFactory will generate XMLNS attributes on the TRANSACTION element in addition to the INTERCHANGE element.
        See Also:
        Constant Field Values
      • XML_WRAP_TRANSACTION_CONTENTS

        public static final String XML_WRAP_TRANSACTION_CONTENTS
        When set to true, XMLStreamReader instances created from an EDIInputFactory will generate an element wrapper around the transaction's content element. The wrapper will not contain the elements representing the transaction's header and trailer segments. The wrapper element will be in the LOOPS XML name space and the local name will be constructed as follows:
        <Standard Name> + '-' + <Transaction Code> + '-' + <Transaction Version String>
        Since:
        1.16
        See Also:
        Constant Field Values
      • EDI_IGNORE_EXTRANEOUS_CHARACTERS

        public static final String EDI_IGNORE_EXTRANEOUS_CHARACTERS
        When set to true, non-graphical, control characters will be ignored in the EDI input stream. This includes characters ranging from 0x00 through 0x1F and 0x7F.
        Since:
        1.13
        See Also:
        Constant Field Values
      • EDI_NEST_HIERARCHICAL_LOOPS

        public static final String EDI_NEST_HIERARCHICAL_LOOPS
        When set to true, hierarchical loops will be nested in the EDI input stream. The nesting structure is determined by the linkage specified by the EDI data itself using pointers given in the EDI schema for a loop. For example, the hierarchical information given by the X12 HL segment. Default value: true
        Since:
        1.18
        See Also:
        Constant Field Values
      • JSON_NULL_EMPTY_ELEMENTS

        public static final String JSON_NULL_EMPTY_ELEMENTS
        When set to true, simple data elements not containing data will be represented via the JSON parsers as a null value. Default value: false
        Since:
        1.14
        See Also:
        Constant Field Values
      • JSON_OBJECT_ELEMENTS

        public static final String JSON_OBJECT_ELEMENTS
        When set to true, simple data elements will be represented via the JSON parsers as JSON objects. When false, simple elements will be JSON primitive values (string, number) in the data array of their containing structures. Default value: false
        Since:
        1.14
        See Also:
        Constant Field Values
    • Constructor Detail

      • EDIInputFactory

        public EDIInputFactory()
    • Method Detail

      • newFactory

        public static EDIInputFactory newFactory()
        Create a new instance of the factory. This static method creates a new factory instance. Once an application has obtained a reference to an EDIInputFactory it can use the factory to configure and obtain stream instances.
        Returns:
        the factory implementation
      • createEDIStreamReader

        public abstract EDIStreamReader createEDIStreamReader​(InputStream stream,
                                                              Schema schema)
        Creates a new EDIStreamReader using the given InputStream (with default encoding) which uses the Schema for validation of the input's control structures (interchange, group, transaction). Note that a separate schema for validation of messages/transactions may be passed directly to the EDIStreamReader once the type and version of the messages is known.
        Parameters:
        stream - InputStream from which the EDI data will be read
        schema - Schema for control structure validation
        Returns:
        a new EDIStreamReader which reads from the stream
      • createEDIStreamReader

        public abstract EDIStreamReader createEDIStreamReader​(InputStream stream,
                                                              String encoding,
                                                              Schema schema)
                                                       throws EDIStreamException
        Creates a new EDIStreamReader using the given InputStream and encoding which uses the Schema for validation of the input's control structures (interchange, group, transaction). The encoding must be a valid Charset. Note that a separate schema for validation of messages/transactions may be passed directly to the EDIStreamReader once the type and version of the messages is known.
        Parameters:
        stream - InputStream from which the EDI data will be read
        encoding - character encoding of the stream, must be a valid Charset.
        schema - Schema for control structure validation
        Returns:
        a new EDIStreamReader which reads from the stream
        Throws:
        EDIStreamException - when encoding is not supported
      • createXMLStreamReader

        public abstract XMLStreamReader createXMLStreamReader​(EDIStreamReader reader)
                                                       throws XMLStreamException
        Creates a new XMLStreamReader that uses the given reader as its data source. The reader should be positioned before the start of an interchange or at the start of an interchange. XML generated by the XMLStreamReader consist exclusively of elements in the namespaces declared by the constants in EDINamespaces. The names of the elements will be as follows:
        EDI Event Namespace Cross Reference
        Event Element Local Name Element Namespace
        Start/End of interchange INTERCHANGE EDINamespaces.LOOPS
        Start/End of functional group GROUP EDINamespaces.LOOPS
        Start/End of message/transaction TRANSACTION EDINamespaces.LOOPS
        Start/End of loop Loop code from EDI schema EDINamespaces.LOOPS
        Start/End of segment Segment tag from EDI data EDINamespaces.SEGMENTS
        Start/End of composite Segment tag plus two digit element position from EDI data EDINamespaces.COMPOSITES
        Start/End of simple element Segment tag plus two digit element position from EDI data EDINamespaces.ELEMENTS
        Start/End of component element in a composite Segment tag plus two digit element position from EDI data plus hyphen plus two digit component position EDINamespaces.ELEMENTS
        Errors encountered in the EDI data will result in an XMLStreamException with a message describing the error.
        Parameters:
        reader - the reader to wrap
        Returns:
        a new XMLStreamReader
        Throws:
        XMLStreamException - when the reader encounters an error in creation
        See Also:
        EDINamespaces
      • createJsonParser

        public abstract <J> J createJsonParser​(EDIStreamReader reader,
                                               Class<J> type)
        Creates a new JSON parser of type J that uses the given reader as its data source. The reader should be positioned before the start of an interchange or at the start of an interchange.
        Type Parameters:
        J - the type of the parser being created
        Parameters:
        reader - the reader to wrap
        type - the type of the parser being created
        Returns:
        a new JSON parser of type J
        Throws:
        IllegalArgumentException - when type is an unsupported parser type
        Since:
        1.14
      • getEDIReporter

        @Deprecated
        public abstract EDIReporter getEDIReporter()
        Deprecated.
        use getErrorReporter() instead
        Retrieves the reporter that will be set on any EDIStreamReader created by this factory instance.
        Returns:
        the reporter that will be set on any EDIStreamReader created by this factory instance
        Throws:
        ClassCastException - when reporter is not an instance of EDIReporter
        Since:
        1.4
      • setEDIReporter

        @Deprecated
        public abstract void setEDIReporter​(EDIReporter reporter)
        The reporter that will be set on any EDIStreamReader created by this factory instance. NOTE: When using an EDIReporter, errors found in the data stream that are reported to the reporter will not appear in the stream of events returned by the EDIStreamReader.
        Parameters:
        reporter - the resolver to use to report non fatal errors
        Since:
        1.4
      • getErrorReporter

        public abstract EDIInputErrorReporter getErrorReporter()
        Retrieves the reporter that will be set on any EDIStreamReader created by this factory instance.
        Returns:
        the reporter that will be set on any EDIStreamReader created by this factory instance
        Since:
        1.9
      • setErrorReporter

        public abstract void setErrorReporter​(EDIInputErrorReporter reporter)
        The reporter that will be set on any EDIStreamReader created by this factory instance. NOTE: When using an EDIReporter, errors found in the data stream that are reported to the reporter will not appear in the stream of events returned by the EDIStreamReader.
        Parameters:
        reporter - the resolver to use to report non fatal errors
        Since:
        1.9