org.milyn.edi.unedifact.d05a.common.SegmentUsageDetails Maven / Gradle / Ivy
/**
* This class was generated by Smooks EJC (http://www.smooks.org).
*/
package org.milyn.edi.unedifact.d05a.common;
import java.io.Serializable;
import org.milyn.smooks.edi.EDIWritable;
import java.math.BigDecimal;
import org.milyn.javabean.decoders.DABigDecimalDecoder;
import java.io.Writer;
import org.milyn.edisax.model.internal.Delimiters;
import java.io.IOException;
import java.io.StringWriter;
import java.util.List;
import java.util.ArrayList;
import org.milyn.edisax.util.EDIUtils;
import org.milyn.edisax.model.internal.DelimiterType;
public class SegmentUsageDetails implements Serializable, EDIWritable {
private static final long serialVersionUID = 1L;
private String segmentTagIdentifier;
private String requirementDesignatorCode;
private BigDecimal occurrencesMaximumNumber;
private DABigDecimalDecoder occurrencesMaximumNumberEncoder;
private BigDecimal levelNumber;
private DABigDecimalDecoder levelNumberEncoder;
private String sequencePositionIdentifier;
private String messageSectionCode;
private String maintenanceOperationCode;
public SegmentUsageDetails() {
occurrencesMaximumNumberEncoder = new DABigDecimalDecoder();
levelNumberEncoder = new DABigDecimalDecoder();
}
public void write(Writer writer, Delimiters delimiters) throws IOException {
Writer nodeWriter = new StringWriter();
List nodeTokens = new ArrayList();
if(segmentTagIdentifier != null) {
nodeWriter.write(delimiters.escape(segmentTagIdentifier.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(requirementDesignatorCode != null) {
nodeWriter.write(delimiters.escape(requirementDesignatorCode.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(occurrencesMaximumNumber != null) {
nodeWriter.write(delimiters.escape(occurrencesMaximumNumberEncoder.encode(occurrencesMaximumNumber, delimiters)));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(levelNumber != null) {
nodeWriter.write(delimiters.escape(levelNumberEncoder.encode(levelNumber, delimiters)));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(sequencePositionIdentifier != null) {
nodeWriter.write(delimiters.escape(sequencePositionIdentifier.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(messageSectionCode != null) {
nodeWriter.write(delimiters.escape(messageSectionCode.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(maintenanceOperationCode != null) {
nodeWriter.write(delimiters.escape(maintenanceOperationCode.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeTokens.add(nodeWriter.toString());
writer.write(EDIUtils.concatAndTruncate(nodeTokens, DelimiterType.FIELD, delimiters));
writer.write(delimiters.getSegmentDelimiter());
writer.flush();
}
public String getSegmentTagIdentifier() {
return segmentTagIdentifier;
}
public SegmentUsageDetails setSegmentTagIdentifier(String segmentTagIdentifier) {
this.segmentTagIdentifier = segmentTagIdentifier; return this;
}
public String getRequirementDesignatorCode() {
return requirementDesignatorCode;
}
public SegmentUsageDetails setRequirementDesignatorCode(String requirementDesignatorCode) {
this.requirementDesignatorCode = requirementDesignatorCode; return this;
}
public BigDecimal getOccurrencesMaximumNumber() {
return occurrencesMaximumNumber;
}
public SegmentUsageDetails setOccurrencesMaximumNumber(BigDecimal occurrencesMaximumNumber) {
this.occurrencesMaximumNumber = occurrencesMaximumNumber; return this;
}
public BigDecimal getLevelNumber() {
return levelNumber;
}
public SegmentUsageDetails setLevelNumber(BigDecimal levelNumber) {
this.levelNumber = levelNumber; return this;
}
public String getSequencePositionIdentifier() {
return sequencePositionIdentifier;
}
public SegmentUsageDetails setSequencePositionIdentifier(String sequencePositionIdentifier) {
this.sequencePositionIdentifier = sequencePositionIdentifier; return this;
}
public String getMessageSectionCode() {
return messageSectionCode;
}
public SegmentUsageDetails setMessageSectionCode(String messageSectionCode) {
this.messageSectionCode = messageSectionCode; return this;
}
public String getMaintenanceOperationCode() {
return maintenanceOperationCode;
}
public SegmentUsageDetails setMaintenanceOperationCode(String maintenanceOperationCode) {
this.maintenanceOperationCode = maintenanceOperationCode; return this;
}
}