This chapter describes the Java methods available for HIPAA OTDs.
This chapter contains the following topics:
The OTDs in the HIPAA OTD Library contain the Java methods that enable you to set and get the delimiters, which in turn extend the functionality of the HIPAA OTD Library.
The following get and set methods are available under the root node and at the xxx_Outer, xxx_Inner, and xxx levels:
The following methods are available from the loop elements:
getLoopxxx and setLoopxxx
The get and set methods are automatically generated from the bean nodes. On occasion, this means get and set methods may be available that are not beneficial, such as setFGValidationResult.
The OTDs must include some way for delimiters to be defined so that they can be mapped successfully from one OTD to another. The HIPAA delimiters are as follows:
The repetition separator and subelement separator are explicitly specified in the interchange header segment. The other two delimiters are implicitly defined within the structure of the interchange header segment, by their first use. For example, after the fourth character defines the data element separator, the same character is used subsequently to delimit all data elements; and after the 107th character defines the segment terminator, the same character is used subsequently to delimit all segments.
Because the fully-enveloped OTD automatically detects delimiters in an incoming message that has the interchange header segment while unmarshaling, do not specify delimiters for the incoming message. Any delimiters that are set before unmarshaling are ignored, and the unmarshal() method picks up the delimiter used in the ISA segment of the incoming message.
For non-enveloped OTDs, if the incoming message uses non-standard delimiters, set the delimiters on the OTD instance before the unmarshal() method is invoked.
You can set the delimiters in the Java Collaboration Editor using the methods or bean nodes that are provided in the OTDs. Use the following methods to specify delimiters:
If the input data is already in HIPAA format, you can use the get methods to retrieve the delimiters from the input data. For information, refer to Get and Set Methods.
If an OTD outputs ANSI X12 data rather than XML, you must specify the delimiters only if non-standard delimiters are used. If the delimiters are not specified, the industry standard delimiters are used. (For information about which methods to use for delimiter setting, refer to Setting Delimiters)
Note that the interchange-level object is called a fully-enveloped OTD; the message-level object is called a non-enveloped OTD.
For fully-enveloped OTDs, you can also set the subelement separator and repetition separator from the corresponding elements within the ISA segment.
To add the support of serialization i.e. marshalling of non-root level objects such as segments, composites, and segment loops in addition to root level objects i.e. interchange level objects, group level objects and message level objects; each of the non-root level objects now contains a set of delimiters appropriate to its message type which are accessible through a few methods/APIs mentioned below to the user.
The delimiter set for the HIPAA message type consists of the following:
segmentTerminator
elementSeparator
subelementSeparator
repetitionSeparator
segmentCodeSeparator equivalent to elementSeparator
decimalMark
The methods to access the delimiters inside a root-level or non-root-level object are:
getSegmentTerminator
setSegmentTerminator
getElementSeparator
setElementSeparator
getSubelementSeparator
setSubelementSeparator
getRepetitionSeparator
setRepetitionSeparator
getSegmentCodeSeparator
setSegmentCodeSeparator
getDecimalMark
setDecimalMark
setDefaultDelimiters
The delimiters of a root-level or non-root-level object are defaulted to their industry standard values when the delimiter set is created. Each individual delimiter can be changed by the corresponding setter method during initialization or later invocation by the user.
The initialization of the delimiter set can be triggered either by any of the Accessor Methods, or by any the following additional methods:
All segments: marshalToBytes
ISA segment only: setEI10_11_InteContStanIden (X12 version 4010 or lower, or interchange envelope OTD)
ISA segment only: setEI65_11_RepeSepa (X12 version 4020 or higher)
When a fully-enveloped OTD or interchange envelope OTD is used to marshal its content into an outgoing message, the delimiter values in the first delimiter field-containing segment (the ISA segment) can sometimes conflict with the delimiter values specified at the interchange level (that is, at the OTD level). This occurs because the interchange level objects and non-root-level objects can separately allow a user to set delimiters independently in a fully-enveloped OTD.
The delimiter values in the ISA segment, if initialized, take precedence over the delimiter values set for the fully-enveloped OTD or interchange envelope OTD. The precedence order can therefore be represented as follows:
Delimiter set in the ISA segment (if initialized) > Delimiter set in the OTD
The following example method illustrates the precedence of delimiters set in the X12 ISA segment over delimiters set in the root level “com.stc.x12env.runtime.ic.ICEnv” object in an X12 interchange envelope OTD:
public String generateOutput() throws Exception { String encoding = "utf-8"; // (1) Create a new instance of X12 Interchange Envelope OTD com.stc.x12env.runtime.ic.ICEnv icEnvOtd = new com.stc.x12env.runtime.ic.ICEnv(); // (2) Set delimiters in the Interchange Envelope OTD icEnvOtd.setSegmentTerminator(’~’); icEnvOtd.setElementSeparator(’+’); icEnvOtd.setSubelementSeparator(’^’); // (3) Create a new ISA segment object com.stc.x12env.runtime.ic.ISA isaSegment = new com.stc.x12env.runtime.ic.ISA(); // (4) Populate the fields inside the ISA isaSegment.setEI01_1_AuthInfoQual("00"); isaSegment.setEI02_2_AuthInfo(" "); isaSegment.setEI03_3_SecuInfoQual("01"); isaSegment.setEI04_4_SecuInfo(" "); isaSegment.setEI05_5_InteIDQual("13"); isaSegment.setEI06_6_InteSendID("3105451234"); isaSegment.setEI05_7_InteIDQual("16"); isaSegment.setEI07_8_InteReceID("123456789"); com.stc.runtime.dt.Date date = com.stc.otd.runtime.edi.EdiDate.parse8("20070115"); isaSegment.setEI08_9_InteDate(date); com.stc.runtime.dt.Time time = com.stc.otd.runtime.edi.EdiTime.parse4("1647"); isaSegment.setEI09_10_InteTime(time); isaSegment.setEI10_11_InteContStanIden("U"); isaSegment.setEI11_12_InteContVersNumb("00301"); isaSegment.setEI12_13_InteContNumb(905); isaSegment.setEI14_15_UsagIndi("T"); isaSegment.setEI13_14_AcknRequ("1"); isaSegment.setEI15_16_CompElemSepa(":"); // (5) Set the rest of delimiters inside the ISA segment object isaSegment.setSegmentTerminator(’!’); isaSegment.setElementSeparator(’*’); // (6) Set the populated ISA segment object to the Interchange // Envelope OTD icEnvOtd.setISA_InteContHead(isaSegment); // (7) Get the IEA segment object inside the Interchange // Envelope OTD; also creates the IEA segment instance com.stc.x12env.runtime.ic.IEA ieaSegment = icEnvOtd.getIEA_InteContTrai(); // (8) Populate the fields inside the IEA ieaSegment.setEI12_2_InteContNumb(905); ieaSegment.setEI16_1_NumbOfInclFuncGrou(1); // (9) Provide the Functional Group data String funcGrp = " GS*FA*123*321*927003*1203*1112*T*004010!ST*997*0001!AK1*FA*1! AK2*997*0001!AK3*BEG*31**1!AK4*12:4*479*1*98382LKA!AK5*A*1*3*5*1*3! AK9*A*0*433*500006*1*2*5*1*2!SE*8*0001!GE*1*1112!"; // (10) Set the functional group data inside the Interchange // Envelope OTD icEnvOtd.setFunctionalGroup(0, funcGrp.getBytes(encoding)); // (11) Invoke API to generate serialized byte array output // of the Interchange Envelope OTD byte[] results = icEnvOtd.marshalToBytes(); // (12) return as a string return new String(results, encoding); } |
The foregoing example method returns the following string as output:
ISA*00* *01* *13*3105451234 *16*123456789 *051215*1647*U*00301*000000905*1*T*:! GS*FA*123*321*927003*1203*1112*T*004010!ST*997*0001!AK1*FA*1!AK2*9 97*0001!AK3*BEG*31**1!AK4*12:4*479*1*98382LKA!AK5*A*1*3*5*1*3!AK9* A*0*433*500006*1*2*5*1*2!SE*8*0001!GE*1*1112!IEA*1*000000905! |
This section describes the signature and description for each available HIPAA OTD method.
public java.lang.String[] check() |
Validates the content of the OTD data tree at runtime and returns a string array of validation errors for the message body only; validation errors for envelope segments are not included. To include envelope segments, see the checkAll() method below.
The method returns null if there are no validation errors.
None.
public java.lang.String[] checkAll() |
Validates the content of the OTD data tree at runtime and returns a string array of validation errors for the message body and the envelope segments. The checkAll() method is only available for fully-enveloped OTDs.
The method returns null if there are no validation errors.
None.
public java.lang.Object clone() |
Creates and returns a copy of this OTD instance.
java.lang.CloneNotSupportedException
public int countxxx() |
where xxx is the bean name for repeatable nodes.
Counts the repetitions of the node at runtime.
None.
public int countLoopxxx() |
where xxx is the bean node for a repeatable segment loop.
Counts the repetitions of the loop at runtime.
None.
public item getxxx() |
where xxx is the bean name for the node and where item is the Java type for the node.
public item[] getxxx() |
where xxx is the bean name for the repeatable node and where item[] is the Java type for the node.
Returns the node object or the object array for the node.
None.
public java.lang.String[] getAllErrors() |
Returns all the validation errors as a string array. These validation errors include errors encountered during unmarshaling input data and the validation results from both the message and the envelope segments.
None.
public char getElementSeparator() |
Gets the element separator character.
None.
public com.stc.otd.runtime.edi.FGError[] getFGValidationResult() |
Returns the validation errors for the functional group envelope in the format of an FGError array. This method is available only at the Outer and Inner root levels in fully-enveloped OTDs.
None.
public com.stc.otd.runtime.edi.ICError[] getICValidationResult() |
Returns the validation errors for the interchange envelope in the format of an ICError array. This method is available only at the Outer and Inner root levels in fully-enveloped OTDs.
None.
public byte[] getInputSource() |
Returns the byte array of the original input data source.
None.
public item getLoopxxx() |
where Loopxxx is the bean name for the segment loop and where item is the Java type for the segment loop.
public item[] getLoopxxx() |
where Loopxxx is the bean name for the repeatable segment loop and where item[] is the Java type for the repeatable segment loop.
Returns the segment loop object or the object array for the segment loop.
None.
public int getMaxDataError() |
Returns the maximum number of message validation errors held in the msgValidationResult bean node. If this method returns -1 there is no limit of how many errors can be reported.
None.
public int getMaxFreedSegsComsNum() |
Returns the maximum number of segment and composite objects marked to be freed from memory. For more information, refer to On Demand Parsing.
None.
public int getMaxParsedSegsComsNum() |
Returns the maximum number of segments and composite objects to be parsed. For more information, refer to On Demand Parsing.
None.
public com.stc.otd.runtime.check.sef.DataError[] getMsgValidationResult() |
Returns the validation errors for the message body. Use this method after the performValidation() method. For information, refer to performValidation.
This method is only available at the Outer, Inner, and transaction set levels. It is also available at the top root level of non-enveloped OTDs.
None.
public char getRepetitionSeparator() |
Returns the repetition separator character.
None.
public int getSegmentCount() |
Returns the segment count at the current level.
None.
public char getSegmentTerminator() |
Returns the segment terminator character.
None.
public char getSubelementSeparator() |
Returns the subelement/composite element separator character.
None.
public com.stc.otd.runtime.edi.TSError[] getTSValidationResult() |
Returns the validation errors for the message envelope (segments UNH/UIH and UNT/UIT) in the format of an TSError array. This method is available only at the Outer, Inner, and transaction set root levels of fully enveloped OTDs. It is also available at the root level of non-enveloped OTDs.
None.
public com.stc.otd.runtime.check.sef.DataError[] getUnmarshalError() |
Returns the unmarshal errors as an array of the DataError objects. The unmarshal errors are reported from an UnmarshalException generated during unmarshaling. Usually these errors are associated with otd.isUnmarshalComplete=false.
None.
This method is reserved for future use.
public boolean getXmlOutput() |
Verifies whether the X12 OTD will output data in XML format.
None.
x12_4010.x12_4010_850_PurcOrde_Outer myOTD=new x12_4010.x12_4010_850_PurcOrde_Outer(); ...... ...... boolean isXml=myOTD.getXmlOutput(); |
public boolean hasxxx() |
where xxx is the bean name for the node.
Verifies if the node is present in the runtime data.
None.
public boolean hasLoopxxx() |
where Loopxxx is the bean name for the segment loop.
Verifies if the segment loop is present in the runtime data.
None.
public boolean isUnmarshalComplete() |
Flag for whether or not unmarshaling completed successfully. For more information, see On Demand Parsing and Errors and Exceptions.
None.
public void marshal(com.stc.otd.runtime.OtdOutputStream) |
Marshals the internal data tree into an output stream.
java.io.IOException for output problems
com.stc.otd.runtime.MarshalException for an inconsistent internal tree
public byte[] marshalToBytes() |
Marshals the internal data tree into a byte array.
jjava.io.IOException for output problems
com.stc.otd.runtime.MarshalException for an inconsistent internal tree
public java.lang.String marshalToString() |
Marshals the internal data tree into a String.
java.io.IOException for input problems
com.stc.otd.runtime.MarshalException for an inconsistent internal tree
public void performValidation() |
Performs validation on the OTD instance unmarshaled from input data.
You can access the validation results from a list of nodes, such as allErrors, msgValidationResult, and the node for reporting envelope errors (such as ICValidationResult, FGValidationResult, and TSValidationResult). For more information, refer to HIPAA Validation Support.
None.
public void reset() |
Clears out any data and resources held by this OTD instance.
None.
public void setxxx(item) |
where xxx is the bean name for the node and where item is the Java type for the node.
public void setxxx(item[]) |
where xxx is the bean name for the repeatable node and where item[] is the Java type for the node.
Sets the node object or the object array for the node.
None.
public void setDefaultX12Delimiters() |
Sets the current delimiters to the default HIPAA delimiters:
segment terminator = ~
element separator = *
subelement separator = :
repetition separator = +
For more information ,refer to Setting Delimiters.
None.
public void setElementSeparator(char arg0) |
Sets the element separator character. For more information ,refer to Setting Delimiters.
None
public void setLoopxxx(item) |
where Loopxxx is the bean name for the segment loop and where item is the Java type for the segment loop.
public void setLoopxxx(item[]) |
where Loopxxx is the bean name for the repeatable segment loop and where item[] is the Java type for the repeatable segment loop.
Sets the segment loop object or the object array for the segment loop.
None.
public void setMaxDataError(int) |
Returns the maximum number of message validation errors held in the msgValidationResult bean node. If this method returns -1 there is no limit of how many errors can be reported.
None.
public void setMaxFreedSegsComsNum(int) |
Sets the maximum number of segment and composite objects marked to be freed from memory. For more information, refer to On Demand Parsing.
None.
public void setMaxParsedSegsComsNum(int) |
Sets the maximum number of segments and composite objects to be parsed. For more information, refer to On Demand Parsing.
None.
public void setRepetitionSeparator(char) |
Sets the repetition separator character. For more information, refer to Setting Delimiters.
None.
public void setSegmentTerminator(char) |
Sets the segment terminator character. For more information, refer to Setting Delimiters.
None.
public void setSubelementSeparator(char) |
Sets the subelement separator character. For more information, refer to Setting Delimiters.
None.
This method is reserved for future use.
public void setXmlOutput(boolean) |
When used with the parameter set to true, this method causes the HIPAA OTD involved to output XML.
When used with the parameter set to false, this method causes the HIPAA OTD to output ANSI (which is the default output if this method is not used at all).
Use this method when the HIPAA OTD is set to automatic output (the default). If the Collaboration is set to manual output, use marshal (boolean) to achieve the same result.
None.
public void unmarshal(com.stc.otd.runtime.OtdInputStream) |
Unmarshals the given input into an internal data tree.
For more information, refer to in On Demand Parsing and Errors and Exceptions.
java.io.IOException for output problems
com.stc.otd.runtime.UnmarshalException for a lexical or other mismatch
public void unmarshalFromBytes(byte[]) |
Unmarshals the given input byte array into an internal data tree.
java.io.IOException for input problems
com.stc.otd.runtime.UnmarshalException for an inconsistent internal tree
public void unmarshalFromString(java.lang.String) |
Unmarshals (deserializes, parses) the given input string into an internal data tree.
java.io.IOException for input problems
com.stc.otd.runtime.UnmarshalException for an inconsistent internal tree. This typically occurs when the OTD does not recognize the incoming message as X12.