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

org.milyn.edi.unedifact.d02a.common.Package 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.d02a.common;

import java.io.Serializable;    
import org.milyn.smooks.edi.EDIWritable;    
import java.math.BigDecimal;    
import org.milyn.javabean.decoders.DABigDecimalDecoder;    
import org.milyn.edi.unedifact.d02a.common.field.PackagingDetailsC531;    
import org.milyn.edi.unedifact.d02a.common.field.PackageTypeC202;    
import org.milyn.edi.unedifact.d02a.common.field.PackageTypeIdentificationC402;    
import org.milyn.edi.unedifact.d02a.common.field.ReturnablePackageDetailsC532;    
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 Package implements Serializable, EDIWritable {

    private static final long serialVersionUID = 1L;

    private BigDecimal packageQuantity;
    private DABigDecimalDecoder packageQuantityEncoder;
    private PackagingDetailsC531 packagingDetails;
    private PackageTypeC202 packageType;
    private PackageTypeIdentificationC402 packageTypeIdentification;
    private ReturnablePackageDetailsC532 returnablePackageDetails;

    public Package() {
        
        packageQuantityEncoder = new DABigDecimalDecoder();
    }

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

        List nodeTokens = new ArrayList();

        if(packageQuantity != null) {
            nodeWriter.write(delimiters.escape(packageQuantityEncoder.encode(packageQuantity, delimiters)));
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(packagingDetails != null) {
            packagingDetails.write(nodeWriter, delimiters);
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(packageType != null) {
            packageType.write(nodeWriter, delimiters);
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(packageTypeIdentification != null) {
            packageTypeIdentification.write(nodeWriter, delimiters);
            nodeTokens.add(nodeWriter.toString());
            ((StringWriter)nodeWriter).getBuffer().setLength(0);
        }
        nodeWriter.write(delimiters.getField());
        if(returnablePackageDetails != null) {
            returnablePackageDetails.write(nodeWriter, 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 BigDecimal getPackageQuantity() {
        return packageQuantity;
    }

    public Package setPackageQuantity(BigDecimal packageQuantity) {
        this.packageQuantity = packageQuantity;  return this;
    }

    public PackagingDetailsC531 getPackagingDetails() {
        return packagingDetails;
    }

    public Package setPackagingDetails(PackagingDetailsC531 packagingDetails) {
        this.packagingDetails = packagingDetails;  return this;
    }

    public PackageTypeC202 getPackageType() {
        return packageType;
    }

    public Package setPackageType(PackageTypeC202 packageType) {
        this.packageType = packageType;  return this;
    }

    public PackageTypeIdentificationC402 getPackageTypeIdentification() {
        return packageTypeIdentification;
    }

    public Package setPackageTypeIdentification(PackageTypeIdentificationC402 packageTypeIdentification) {
        this.packageTypeIdentification = packageTypeIdentification;  return this;
    }

    public ReturnablePackageDetailsC532 getReturnablePackageDetails() {
        return returnablePackageDetails;
    }

    public Package setReturnablePackageDetails(ReturnablePackageDetailsC532 returnablePackageDetails) {
        this.returnablePackageDetails = returnablePackageDetails;  return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy