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

org.milyn.edi.unedifact.d06b.common.DataElementUsageDetails 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 DataElementUsageDetails implements Serializable, EDIWritable {

    private static final long serialVersionUID = 1L;

    private String dataElementTagIdentifier;
    private String requirementDesignatorCode;
    private String sequencePositionIdentifier;
    private String maintenanceOperationCode;
    private BigDecimal occurrencesMaximumNumber;
    private DABigDecimalDecoder occurrencesMaximumNumberEncoder;
    private String codeValueSourceCode;
    private String validationCriteriaCode;
    private String dataElementUsageTypeCode;

    public DataElementUsageDetails() {
        
        occurrencesMaximumNumberEncoder = new DABigDecimalDecoder();
    }

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

        List nodeTokens = new ArrayList();

        if(dataElementTagIdentifier != null) {
            nodeWriter.write(delimiters.escape(dataElementTagIdentifier.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(sequencePositionIdentifier != null) {
            nodeWriter.write(delimiters.escape(sequencePositionIdentifier.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(occurrencesMaximumNumber != null) {
            nodeWriter.write(delimiters.escape(occurrencesMaximumNumberEncoder.encode(occurrencesMaximumNumber, delimiters)));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(codeValueSourceCode != null) {
            nodeWriter.write(delimiters.escape(codeValueSourceCode.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(validationCriteriaCode != null) {
            nodeWriter.write(delimiters.escape(validationCriteriaCode.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(dataElementUsageTypeCode != null) {
            nodeWriter.write(delimiters.escape(dataElementUsageTypeCode.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 getDataElementTagIdentifier() {
        return dataElementTagIdentifier;
    }

    public DataElementUsageDetails setDataElementTagIdentifier(String dataElementTagIdentifier) {
        this.dataElementTagIdentifier = dataElementTagIdentifier;  return this;
    }

    public String getRequirementDesignatorCode() {
        return requirementDesignatorCode;
    }

    public DataElementUsageDetails setRequirementDesignatorCode(String requirementDesignatorCode) {
        this.requirementDesignatorCode = requirementDesignatorCode;  return this;
    }

    public String getSequencePositionIdentifier() {
        return sequencePositionIdentifier;
    }

    public DataElementUsageDetails setSequencePositionIdentifier(String sequencePositionIdentifier) {
        this.sequencePositionIdentifier = sequencePositionIdentifier;  return this;
    }

    public String getMaintenanceOperationCode() {
        return maintenanceOperationCode;
    }

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

    public BigDecimal getOccurrencesMaximumNumber() {
        return occurrencesMaximumNumber;
    }

    public DataElementUsageDetails setOccurrencesMaximumNumber(BigDecimal occurrencesMaximumNumber) {
        this.occurrencesMaximumNumber = occurrencesMaximumNumber;  return this;
    }

    public String getCodeValueSourceCode() {
        return codeValueSourceCode;
    }

    public DataElementUsageDetails setCodeValueSourceCode(String codeValueSourceCode) {
        this.codeValueSourceCode = codeValueSourceCode;  return this;
    }

    public String getValidationCriteriaCode() {
        return validationCriteriaCode;
    }

    public DataElementUsageDetails setValidationCriteriaCode(String validationCriteriaCode) {
        this.validationCriteriaCode = validationCriteriaCode;  return this;
    }

    public String getDataElementUsageTypeCode() {
        return dataElementUsageTypeCode;
    }

    public DataElementUsageDetails setDataElementUsageTypeCode(String dataElementUsageTypeCode) {
        this.dataElementUsageTypeCode = dataElementUsageTypeCode;  return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy