org.milyn.edi.unedifact.d06b.common.EditingDetails Maven / Gradle / Ivy
/**
* This class was generated by Smooks EJC (http://www.smooks.org).
*/
package org.milyn.edi.unedifact.d06b.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 EditingDetails implements Serializable, EDIWritable {
private static final long serialVersionUID = 1L;
private BigDecimal editFieldLengthMeasure;
private DABigDecimalDecoder editFieldLengthMeasureEncoder;
private String editMaskFormatIdentifier;
private String editMaskRepresentationCode;
private String freeTextFormatCode;
public EditingDetails() {
editFieldLengthMeasureEncoder = new DABigDecimalDecoder();
}
public void write(Writer writer, Delimiters delimiters) throws IOException {
Writer nodeWriter = new StringWriter();
List nodeTokens = new ArrayList();
if(editFieldLengthMeasure != null) {
nodeWriter.write(delimiters.escape(editFieldLengthMeasureEncoder.encode(editFieldLengthMeasure, delimiters)));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(editMaskFormatIdentifier != null) {
nodeWriter.write(delimiters.escape(editMaskFormatIdentifier.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(editMaskRepresentationCode != null) {
nodeWriter.write(delimiters.escape(editMaskRepresentationCode.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(freeTextFormatCode != null) {
nodeWriter.write(delimiters.escape(freeTextFormatCode.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 BigDecimal getEditFieldLengthMeasure() {
return editFieldLengthMeasure;
}
public EditingDetails setEditFieldLengthMeasure(BigDecimal editFieldLengthMeasure) {
this.editFieldLengthMeasure = editFieldLengthMeasure; return this;
}
public String getEditMaskFormatIdentifier() {
return editMaskFormatIdentifier;
}
public EditingDetails setEditMaskFormatIdentifier(String editMaskFormatIdentifier) {
this.editMaskFormatIdentifier = editMaskFormatIdentifier; return this;
}
public String getEditMaskRepresentationCode() {
return editMaskRepresentationCode;
}
public EditingDetails setEditMaskRepresentationCode(String editMaskRepresentationCode) {
this.editMaskRepresentationCode = editMaskRepresentationCode; return this;
}
public String getFreeTextFormatCode() {
return freeTextFormatCode;
}
public EditingDetails setFreeTextFormatCode(String freeTextFormatCode) {
this.freeTextFormatCode = freeTextFormatCode; return this;
}
}