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

org.milyn.edi.unedifact.d05a.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.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 SimpleDataElementDetails implements Serializable, EDIWritable {

    private static final long serialVersionUID = 1L;

    private String simpleDataElementTagIdentifier;
    private String simpleDataElementCharacterRepresentationCode;
    private String lengthTypeCode;
    private BigDecimal simpleDataElementMaximumLengthMeasure;
    private DABigDecimalDecoder simpleDataElementMaximumLengthMeasureEncoder;
    private BigDecimal simpleDataElementMinimumLengthMeasure;
    private DABigDecimalDecoder simpleDataElementMinimumLengthMeasureEncoder;
    private String codeSetIndicatorCode;
    private String designatedClassCode;
    private String maintenanceOperationCode;
    private BigDecimal significantDigitsQuantity;
    private DABigDecimalDecoder significantDigitsQuantityEncoder;

    public SimpleDataElementDetails() {
        
        simpleDataElementMaximumLengthMeasureEncoder = new DABigDecimalDecoder();
        simpleDataElementMinimumLengthMeasureEncoder = new DABigDecimalDecoder();
        significantDigitsQuantityEncoder = new DABigDecimalDecoder();
    }

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

        List nodeTokens = new ArrayList();

        if(simpleDataElementTagIdentifier != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementTagIdentifier.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(simpleDataElementCharacterRepresentationCode != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementCharacterRepresentationCode.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(lengthTypeCode != null) {
            nodeWriter.write(delimiters.escape(lengthTypeCode.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(simpleDataElementMaximumLengthMeasure != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementMaximumLengthMeasureEncoder.encode(simpleDataElementMaximumLengthMeasure, delimiters)));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(simpleDataElementMinimumLengthMeasure != null) {
            nodeWriter.write(delimiters.escape(simpleDataElementMinimumLengthMeasureEncoder.encode(simpleDataElementMinimumLengthMeasure, delimiters)));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(codeSetIndicatorCode != null) {
            nodeWriter.write(delimiters.escape(codeSetIndicatorCode.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(designatedClassCode != null) {
            nodeWriter.write(delimiters.escape(designatedClassCode.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);
        }
        nodeWriter.write(delimiters.getField());
        if(significantDigitsQuantity != null) {
            nodeWriter.write(delimiters.escape(significantDigitsQuantityEncoder.encode(significantDigitsQuantity, delimiters)));
            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 getSimpleDataElementTagIdentifier() {
        return simpleDataElementTagIdentifier;
    }

    public SimpleDataElementDetails setSimpleDataElementTagIdentifier(String simpleDataElementTagIdentifier) {
        this.simpleDataElementTagIdentifier = simpleDataElementTagIdentifier;  return this;
    }

    public String getSimpleDataElementCharacterRepresentationCode() {
        return simpleDataElementCharacterRepresentationCode;
    }

    public SimpleDataElementDetails setSimpleDataElementCharacterRepresentationCode(String simpleDataElementCharacterRepresentationCode) {
        this.simpleDataElementCharacterRepresentationCode = simpleDataElementCharacterRepresentationCode;  return this;
    }

    public String getLengthTypeCode() {
        return lengthTypeCode;
    }

    public SimpleDataElementDetails setLengthTypeCode(String lengthTypeCode) {
        this.lengthTypeCode = lengthTypeCode;  return this;
    }

    public BigDecimal getSimpleDataElementMaximumLengthMeasure() {
        return simpleDataElementMaximumLengthMeasure;
    }

    public SimpleDataElementDetails setSimpleDataElementMaximumLengthMeasure(BigDecimal simpleDataElementMaximumLengthMeasure) {
        this.simpleDataElementMaximumLengthMeasure = simpleDataElementMaximumLengthMeasure;  return this;
    }

    public BigDecimal getSimpleDataElementMinimumLengthMeasure() {
        return simpleDataElementMinimumLengthMeasure;
    }

    public SimpleDataElementDetails setSimpleDataElementMinimumLengthMeasure(BigDecimal simpleDataElementMinimumLengthMeasure) {
        this.simpleDataElementMinimumLengthMeasure = simpleDataElementMinimumLengthMeasure;  return this;
    }

    public String getCodeSetIndicatorCode() {
        return codeSetIndicatorCode;
    }

    public SimpleDataElementDetails setCodeSetIndicatorCode(String codeSetIndicatorCode) {
        this.codeSetIndicatorCode = codeSetIndicatorCode;  return this;
    }

    public String getDesignatedClassCode() {
        return designatedClassCode;
    }

    public SimpleDataElementDetails setDesignatedClassCode(String designatedClassCode) {
        this.designatedClassCode = designatedClassCode;  return this;
    }

    public String getMaintenanceOperationCode() {
        return maintenanceOperationCode;
    }

    public SimpleDataElementDetails setMaintenanceOperationCode(String maintenanceOperationCode) {
        this.maintenanceOperationCode = maintenanceOperationCode;  return this;
    }

    public BigDecimal getSignificantDigitsQuantity() {
        return significantDigitsQuantity;
    }

    public SimpleDataElementDetails setSignificantDigitsQuantity(BigDecimal significantDigitsQuantity) {
        this.significantDigitsQuantity = significantDigitsQuantity;  return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy