Cf¶
-
public class
Cf
¶ The
Cf
class represents a configuration element. Each Cf instance represents items required to identify a Loop in a X12 transaction. Some Loops can be identified by only the segment id. Others require segment id and additional qualifiers to be able to identify the Loop.Cf
needs to be used in conjunction with X12Parser, to be able to parse a X12 transaction into a loop hierarchy. A X12 Cf can be loaded using many ways: custom code O/X mapping DI or any other way you may find appropriate A Sample 835 hierarchy is shown below. Each row shows a Cf element, in the format(A) - (B) - (C) - (D) (A) - Loop Name (B) - Segment id, that identifies the loop (C) - Segment qualifiers, that are needed to identify the loop. If there are multiple qualifiers they need to be separated by COMMA. (D) - Position in the segment where the qualifiers are present
e.g. In X12 835, Loops 1000A and 1000B have the same segment id (N1), to differentiate them we need additional attributes. The N102 (index 1) element has PR for 1000A loop and PE for 1000B loop.
+--X12 | +--ISA - ISA | | +--GS - GS | | | +--ST - ST - 835, - 1 | | | | +--1000A - N1 - PR, - 1 | | | | +--1000B - N1 - PE, - 1 | | | | +--2000 - LX | | | | | +--2100 - CLP | | | | | | +--2110 - SVC | | | +--SE - SE | | +--GE - GE | +--IEA - IEA
To parse a X12 835 in the above hierarchy, you need to create a Cf object that represent the hierarchy. Here is the sample code to achieve this.
Cf cfX12 = new Cf("X12"); // root node Cf cfISA = cfX12.addChild("ISA", "ISA"); // add as child of X12 Cf cfGS = cfISA.addChild("GS", "GS"); // add as child of ISA Cf cfST = cfGS.addChild("ST", "ST", "835", 1); // add as child of GS cfST.addChild("1000A", "N1", "PR", 1); // add as child of ST cfST.addChild("1000B", "N1", "PE", 1); // add as child of ST Cf cf2000 = cfST.addChild("2000", "LX") Cf cf2100 = cf2000.addChild("2100", "CLP"); cf2100.addChild("2110", "SVC"); cfISA.addChild("GE", "GE"); cfX12.addChild("IEA", "IEA");
Alternate hierarchy for the same transaction. On most occasions a simple hierarchy like below would work. Only when there is more that one loop that is identified by the same segment id and additional qualifiers, you need to put them under the appropriate parent Cf.
+--X12 | +--ISA - ISA | +--GS - GS | +--ST - ST - 835, - 1 | +--1000A - N1 - PR, - 1 | +--1000B - N1 - PE, - 1 | +--2000 - LX | +--2100 - CLP | +--2110 - SVC | +--SE - SE | +--GE - GE | +--IEA - IEA
Author: Prasad Balan
Constructors¶
Cf¶
-
public
Cf
(String name)¶ Constructor for Cf.
Parameters: - name – a
java.lang.String
object.
- name – a
Cf¶
-
public
Cf
(String name, String segment)¶ Constructor for Cf.
Parameters: - name – a
java.lang.String
object. - segment – a
java.lang.String
object.
- name – a
Cf¶
-
public
Cf
(String name, String segment, String segmentQual, Integer segmentQualPos)¶ Constructor for Cf.
Parameters: - name – a
java.lang.String
object. - segment – a
java.lang.String
object. - segmentQual – a
java.lang.String
object. - segmentQualPos – a
java.lang.Integer
object.
- name – a
Methods¶
addChild¶
-
public Cf
addChild
(String name, String segment)¶ addChild.
Parameters: - name – a
java.lang.String
object. - segment – a
java.lang.String
object.
Returns: a
Cf
object.- name – a
addChild¶
-
public Cf
addChild
(String name, String segment, String segmentQual, Integer segmentQualPos)¶ addChild.
Parameters: - name – a
java.lang.String
object. - segment – a
java.lang.String
object. - segmentQual – a
java.lang.String
object. - segmentQualPos – a
java.lang.Integer
object.
Returns: a
Cf
object.- name – a
childList¶
-
public List<Cf>
childList
()¶ childList.
Returns: a java.util.List
object.
getName¶
-
public String
getName
()¶ Getter for the field
name
.Returns: a java.lang.String
object.
getSegment¶
-
public String
getSegment
()¶ Getter for the field
segment
.Returns: a java.lang.String
object.
getSegmentQualPos¶
-
public Integer
getSegmentQualPos
()¶ Getter for the field
segmentQualPos
.Returns: a java.lang.Integer
object.
getSegmentQuals¶
-
public String[]
getSegmentQuals
()¶ Getter for the field
segmentQuals
.Returns: an array of java.lang.String
objects.
setChildren¶
-
public void
setChildren
(List<Cf> cfList)¶ Setter for the field
children
.Parameters: - cfList – a
java.util.List
object.
- cfList – a
setName¶
-
public void
setName
(String name)¶ Setter for the field
name
.Parameters: - name – a
java.lang.String
object.
- name – a
setSegment¶
-
public void
setSegment
(String segment)¶ Setter for the field
segment
.Parameters: - segment – a
java.lang.String
object.
- segment – a
setSegmentQualPos¶
-
public void
setSegmentQualPos
(Integer segmentQualPos)¶ Setter for the field
segmentQualPos
.Parameters: - segmentQualPos – a
java.lang.Integer
object.
- segmentQualPos – a
setSegmentQuals¶
-
public void
setSegmentQuals
(String[] segmentQuals)¶ Setter for the field
segmentQuals
.Parameters: - segmentQuals – an array of
java.lang.String
objects.
- segmentQuals – an array of
toString¶
-
public String
toString
()¶ toString.
Returns: a java.lang.String
object.