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

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

    private static final long serialVersionUID = 1L;

    private String paymentTermsTypeCodeQualifier;
    private PaymentTermsC019 paymentTerms;
    private String eventTimeReferenceCode;
    private String termsTimeRelationCode;
    private String periodTypeCode;
    private BigDecimal periodCountQuantity;
    private DABigDecimalDecoder periodCountQuantityEncoder;

    public PaymentTerms() {
        
        periodCountQuantityEncoder = new DABigDecimalDecoder();
    }

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

        List nodeTokens = new ArrayList();

        if(paymentTermsTypeCodeQualifier != null) {
            nodeWriter.write(delimiters.escape(paymentTermsTypeCodeQualifier.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(paymentTerms != null) {
            paymentTerms.write(nodeWriter, delimiters);
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(eventTimeReferenceCode != null) {
            nodeWriter.write(delimiters.escape(eventTimeReferenceCode.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(termsTimeRelationCode != null) {
            nodeWriter.write(delimiters.escape(termsTimeRelationCode.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(periodTypeCode != null) {
            nodeWriter.write(delimiters.escape(periodTypeCode.toString()));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(periodCountQuantity != null) {
            nodeWriter.write(delimiters.escape(periodCountQuantityEncoder.encode(periodCountQuantity, 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 getPaymentTermsTypeCodeQualifier() {
        return paymentTermsTypeCodeQualifier;
    }

    public PaymentTerms setPaymentTermsTypeCodeQualifier(String paymentTermsTypeCodeQualifier) {
        this.paymentTermsTypeCodeQualifier = paymentTermsTypeCodeQualifier;  return this;
    }

    public PaymentTermsC019 getPaymentTerms() {
        return paymentTerms;
    }

    public PaymentTerms setPaymentTerms(PaymentTermsC019 paymentTerms) {
        this.paymentTerms = paymentTerms;  return this;
    }

    public String getEventTimeReferenceCode() {
        return eventTimeReferenceCode;
    }

    public PaymentTerms setEventTimeReferenceCode(String eventTimeReferenceCode) {
        this.eventTimeReferenceCode = eventTimeReferenceCode;  return this;
    }

    public String getTermsTimeRelationCode() {
        return termsTimeRelationCode;
    }

    public PaymentTerms setTermsTimeRelationCode(String termsTimeRelationCode) {
        this.termsTimeRelationCode = termsTimeRelationCode;  return this;
    }

    public String getPeriodTypeCode() {
        return periodTypeCode;
    }

    public PaymentTerms setPeriodTypeCode(String periodTypeCode) {
        this.periodTypeCode = periodTypeCode;  return this;
    }

    public BigDecimal getPeriodCountQuantity() {
        return periodCountQuantity;
    }

    public PaymentTerms setPeriodCountQuantity(BigDecimal periodCountQuantity) {
        this.periodCountQuantity = periodCountQuantity;  return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy