All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.milyn.edi.unedifact.d98a.common.SimpleDataElementDetails Maven / Gradle / Ivy

There is a newer version: 1.7.1.0
Show newest version
/**
 * This class was generated by Smooks EJC (http://www.smooks.org).
 */
package org.milyn.edi.unedifact.d98a.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 SimpleDataElementDetails implements Serializable, EDIWritable {

    private static final long serialVersionUID = 1L;

    private String simpleDataElementTag;
    private String simpleDataElementCharacterRepresentationCoded;
    private String simpleDataElementLengthTypeCoded;
    private BigDecimal simpleDataElementMaximumLength;
    private DABigDecimalDecoder simpleDataElementMaximumLengthEncoder;
    private BigDecimal simpleDataElementMinimumLength;
    private DABigDecimalDecoder simpleDataElementMinimumLengthEncoder;
    private String codeSetIndicatorCoded;
    private String classDesignatorCoded;
    private String maintenanceOperationCoded;

    public SimpleDataElementDetails() {
        
        simpleDataElementMaximumLengthEncoder = new DABigDecimalDecoder();
        simpleDataElementMinimumLengthEncoder = new DABigDecimalDecoder();
    }

    public void write(Writer writer, Delimiters delimiters) throws IOException {
        
        Writer nodeWriter = new StringWriter();

        List nodeTokens = new ArrayList();

        if(simpleDataElementTag != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementTag.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(simpleDataElementCharacterRepresentationCoded != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementCharacterRepresentationCoded.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(simpleDataElementLengthTypeCoded != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementLengthTypeCoded.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(simpleDataElementMaximumLength != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementMaximumLengthEncoder.encode(simpleDataElementMaximumLength, delimiters)));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(simpleDataElementMinimumLength != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementMinimumLengthEncoder.encode(simpleDataElementMinimumLength, delimiters)));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(codeSetIndicatorCoded != null) {
            nodeWriter.write(delimiters.escape(codeSetIndicatorCoded.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(classDesignatorCoded != null) {
            nodeWriter.write(delimiters.escape(classDesignatorCoded.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(maintenanceOperationCoded != null) {
            nodeWriter.write(delimiters.escape(maintenanceOperationCoded.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 getSimpleDataElementTag() {
        return simpleDataElementTag;
    }

    public SimpleDataElementDetails setSimpleDataElementTag(String simpleDataElementTag) {
        this.simpleDataElementTag = simpleDataElementTag;  return this;
    }

    public String getSimpleDataElementCharacterRepresentationCoded() {
        return simpleDataElementCharacterRepresentationCoded;
    }

    public SimpleDataElementDetails setSimpleDataElementCharacterRepresentationCoded(String simpleDataElementCharacterRepresentationCoded) {
        this.simpleDataElementCharacterRepresentationCoded = simpleDataElementCharacterRepresentationCoded;  return this;
    }

    public String getSimpleDataElementLengthTypeCoded() {
        return simpleDataElementLengthTypeCoded;
    }

    public SimpleDataElementDetails setSimpleDataElementLengthTypeCoded(String simpleDataElementLengthTypeCoded) {
        this.simpleDataElementLengthTypeCoded = simpleDataElementLengthTypeCoded;  return this;
    }

    public BigDecimal getSimpleDataElementMaximumLength() {
        return simpleDataElementMaximumLength;
    }

    public SimpleDataElementDetails setSimpleDataElementMaximumLength(BigDecimal simpleDataElementMaximumLength) {
        this.simpleDataElementMaximumLength = simpleDataElementMaximumLength;  return this;
    }

    public BigDecimal getSimpleDataElementMinimumLength() {
        return simpleDataElementMinimumLength;
    }

    public SimpleDataElementDetails setSimpleDataElementMinimumLength(BigDecimal simpleDataElementMinimumLength) {
        this.simpleDataElementMinimumLength = simpleDataElementMinimumLength;  return this;
    }

    public String getCodeSetIndicatorCoded() {
        return codeSetIndicatorCoded;
    }

    public SimpleDataElementDetails setCodeSetIndicatorCoded(String codeSetIndicatorCoded) {
        this.codeSetIndicatorCoded = codeSetIndicatorCoded;  return this;
    }

    public String getClassDesignatorCoded() {
        return classDesignatorCoded;
    }

    public SimpleDataElementDetails setClassDesignatorCoded(String classDesignatorCoded) {
        this.classDesignatorCoded = classDesignatorCoded;  return this;
    }

    public String getMaintenanceOperationCoded() {
        return maintenanceOperationCoded;
    }

    public SimpleDataElementDetails setMaintenanceOperationCoded(String maintenanceOperationCoded) {
        this.maintenanceOperationCoded = maintenanceOperationCoded;  return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy