Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add handling for REF03 and REF04 #143

Merged
merged 1 commit into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@

/**
*
* Purpose: To specify pertinent dates and times
* Purpose: Reference Information
*
* Contains 4 data elements, the 4th can hold multiple values and is
* usually delimited by a ">" but which can be specified to be
* a different character in the ISA segment
*
* REF*PK*1234**BM>4321
*
* This object will hold the entire REF04 value in the
* attribute `additionalReferenceIdentification`
* expecting a separate process to manage parsing it
* into its parts
*
*/
public class REFReferenceInformation {
Expand All @@ -30,6 +41,12 @@ public class REFReferenceInformation {

// REF02
private String referenceIdentification;

// REF03
private String description;

// REF04
private String additionalReferenceIdentification;

public String getReferenceIdentificationQualifier() {
return referenceIdentificationQualifier;
Expand All @@ -47,4 +64,20 @@ public void setReferenceIdentification(String referenceIdentification) {
this.referenceIdentification = referenceIdentification;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public String getAdditionalReferenceIdentification() {
return additionalReferenceIdentification;
}

public void setAdditionalReferenceIdentification(String additionalReferenceIdentification) {
this.additionalReferenceIdentification = additionalReferenceIdentification;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public static REFReferenceInformation parse(X12Segment segment) {
ref = new REFReferenceInformation();
ref.setReferenceIdentificationQualifier(segment.getElement(1));
ref.setReferenceIdentification(segment.getElement(2));
ref.setDescription(segment.getElement(3));
ref.setAdditionalReferenceIdentification(segment.getElement(4));
}
}
return ref;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ public void test_parse_empty_segment() {

@Test
public void test_parse_segment() {
X12Segment segment = new X12Segment("REF*UCB*711170010491361");
X12Segment segment = new X12Segment("REF*UCB*711170010491361*TEST*BM>1234");
REFReferenceInformation ref = REFReferenceInformationParser.parse(segment);
assertNotNull(ref);
assertEquals("UCB", ref.getReferenceIdentificationQualifier());
assertEquals("711170010491361", ref.getReferenceIdentification());
assertEquals("TEST", ref.getDescription());
assertEquals("BM>1234", ref.getAdditionalReferenceIdentification());
}
}