org.milyn.edi.unedifact.d96a.common.BeginningOfMessage Maven / Gradle / Ivy
/**
* This class was generated by Smooks EJC (http://www.smooks.org).
*/
package org.milyn.edi.unedifact.d96a.common;
import java.io.Serializable;
import org.milyn.smooks.edi.EDIWritable;
import org.milyn.edi.unedifact.d96a.common.field.DocumentMessageNameC002;
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 BeginningOfMessage implements Serializable, EDIWritable {
private static final long serialVersionUID = 1L;
private DocumentMessageNameC002 documentMessageName;
private String documentMessageNumber;
private String messageFunctionCoded;
private String responseTypeCoded;
public void write(Writer writer, Delimiters delimiters) throws IOException {
Writer nodeWriter = new StringWriter();
List nodeTokens = new ArrayList();
if(documentMessageName != null) {
documentMessageName.write(nodeWriter, delimiters);
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(documentMessageNumber != null) {
nodeWriter.write(delimiters.escape(documentMessageNumber.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(messageFunctionCoded != null) {
nodeWriter.write(delimiters.escape(messageFunctionCoded.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(responseTypeCoded != null) {
nodeWriter.write(delimiters.escape(responseTypeCoded.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 DocumentMessageNameC002 getDocumentMessageName() {
return documentMessageName;
}
public BeginningOfMessage setDocumentMessageName(DocumentMessageNameC002 documentMessageName) {
this.documentMessageName = documentMessageName; return this;
}
public String getDocumentMessageNumber() {
return documentMessageNumber;
}
public BeginningOfMessage setDocumentMessageNumber(String documentMessageNumber) {
this.documentMessageNumber = documentMessageNumber; return this;
}
public String getMessageFunctionCoded() {
return messageFunctionCoded;
}
public BeginningOfMessage setMessageFunctionCoded(String messageFunctionCoded) {
this.messageFunctionCoded = messageFunctionCoded; return this;
}
public String getResponseTypeCoded() {
return responseTypeCoded;
}
public BeginningOfMessage setResponseTypeCoded(String responseTypeCoded) {
this.responseTypeCoded = responseTypeCoded; return this;
}
}