  /**
   * Generate time : 2009-09-17 6:19:30
   * Version : 1.0.1.V20070717
   */
package com.baosight.sts.st.cw.domain;

import java.math.BigDecimal;
import com.baosight.iplat4j.util.NumberUtils;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.ep.DaoEPBase;
import java.util.HashMap;
import java.util.Map;
import com.baosight.iplat4j.util.StringUtils;
/**
 * STCW1601 
 *  
 */
public class STCW1601 extends DaoEPBase {

	private String customerId = " ";		
	private String custName = " ";		
	private String contractId = " ";		
	private Double contractAmount = new Double(0);		
	private BigDecimal totalQty = new BigDecimal("0");		
	private Float buAmount = new Float(0);		
	private Float peiAmount = new Float(0);		

	/**
	 * initialize the metadata 
	 */
	public void initMetaData() {
		EiColumn eiColumn;
		
	eiColumn = new EiColumn("customerId");
	eiColumn.setFieldLength(10);	
	eiColumn.setDescName("");
	eiMetadata.addMeta(eiColumn);
	
	eiColumn = new EiColumn("custName");
	eiColumn.setFieldLength(100);	
	eiColumn.setDescName("");
	eiMetadata.addMeta(eiColumn);
	
	eiColumn = new EiColumn("contractId");
	eiColumn.setFieldLength(20);	
	eiColumn.setDescName("");
	eiMetadata.addMeta(eiColumn);
	
	eiColumn = new EiColumn("contractAmount");
	eiColumn.setType("N");
	eiColumn.setScaleLength(2);
	eiColumn.setFieldLength(14);
	eiColumn.setDescName("");
	eiMetadata.addMeta(eiColumn);
	
	eiColumn = new EiColumn("totalQty");
	eiColumn.setType("N");
	eiColumn.setScaleLength(6);
	eiColumn.setFieldLength(18);
	eiColumn.setDescName("");
	eiMetadata.addMeta(eiColumn);
	
	eiColumn = new EiColumn("buAmount");
	eiColumn.setType("N");
	eiColumn.setScaleLength(6);
	eiColumn.setFieldLength(18);
	eiColumn.setDescName("");
	eiMetadata.addMeta(eiColumn);
	
	eiColumn = new EiColumn("peiAmount");
	eiColumn.setType("N");
	eiColumn.setScaleLength(6);
	eiColumn.setFieldLength(18);
	eiColumn.setDescName("");
	eiMetadata.addMeta(eiColumn);
	

	}
	/**
	 * the constructor
	 */
	public STCW1601() {
		initMetaData();
	}
	
	/**
	 * get the customerId 
	 * @return the customerId
	 */
	public String getCustomerId() {
		return this.customerId;
	}
	
	/**
	 * set the customerId 
	 */
	public void setCustomerId(String customerId) {
		this.customerId = customerId;
	}
	
	/**
	 * get the custName 
	 * @return the custName
	 */
	public String getCustName() {
		return this.custName;
	}
	
	/**
	 * set the custName 
	 */
	public void setCustName(String custName) {
		this.custName = custName;
	}
	
	/**
	 * get the contractId 
	 * @return the contractId
	 */
	public String getContractId() {
		return this.contractId;
	}
	
	/**
	 * set the contractId 
	 */
	public void setContractId(String contractId) {
		this.contractId = contractId;
	}
	
	/**
	 * get the contractAmount 
	 * @return the contractAmount
	 */
	public Double getContractAmount() {
		return this.contractAmount;
	}
	
	/**
	 * set the contractAmount 
	 */
	public void setContractAmount(Double contractAmount) {
		this.contractAmount = contractAmount;
	}
	
	/**
	 * get the totalQty 
	 * @return the totalQty
	 */
	public BigDecimal getTotalQty() {
		return this.totalQty;
	}
	
	/**
	 * set the totalQty 
	 */
	public void setTotalQty(BigDecimal totalQty) {
		this.totalQty = totalQty;
	}
	
	/**
	 * get the buAmount 
	 * @return the buAmount
	 */
	public Float getBuAmount() {
		return this.buAmount;
	}
	
	/**
	 * set the buAmount 
	 */
	public void setBuAmount(Float buAmount) {
		this.buAmount = buAmount;
	}
	
	/**
	 * get the peiAmount 
	 * @return the peiAmount
	 */
	public Float getPeiAmount() {
		return this.peiAmount;
	}
	
	/**
	 * set the peiAmount 
	 */
	public void setPeiAmount(Float peiAmount) {
		this.peiAmount = peiAmount;
	}
	
	/**
	 * get the value from Map
	 */
	public void fromMap(Map map) {
	
		setCustomerId(StringUtils.defaultIfEmpty(((String)map.get("customerId")), customerId));
		setCustName(StringUtils.defaultIfEmpty(((String)map.get("custName")), custName));
		setContractId(StringUtils.defaultIfEmpty(((String)map.get("contractId")), contractId));
		setContractAmount(NumberUtils.toDouble(((String)map.get("contractAmount")), contractAmount));
		setTotalQty(NumberUtils.toBigDecimal(((String)map.get("totalQty")), totalQty));
		setBuAmount(NumberUtils.toFloat(((String)map.get("buAmount")), buAmount));
		setPeiAmount(NumberUtils.toFloat(((String)map.get("peiAmount")), peiAmount));
	}
	
	/**
	 * set the value to Map
	 */
	public Map toMap() {
		
		Map map = new HashMap();
			map.put("customerId",StringUtils.toString(customerId, eiMetadata.getMeta("customerId").getFieldLength(), eiMetadata.getMeta("customerId").getScaleLength()));	
			map.put("custName",StringUtils.toString(custName, eiMetadata.getMeta("custName").getFieldLength(), eiMetadata.getMeta("custName").getScaleLength()));	
			map.put("contractId",StringUtils.toString(contractId, eiMetadata.getMeta("contractId").getFieldLength(), eiMetadata.getMeta("contractId").getScaleLength()));	
			map.put("contractAmount",StringUtils.toString(contractAmount, eiMetadata.getMeta("contractAmount").getFieldLength(), eiMetadata.getMeta("contractAmount").getScaleLength()));	
			map.put("totalQty",StringUtils.toString(totalQty, eiMetadata.getMeta("totalQty").getFieldLength(), eiMetadata.getMeta("totalQty").getScaleLength()));	
			map.put("buAmount",StringUtils.toString(buAmount, eiMetadata.getMeta("buAmount").getFieldLength(), eiMetadata.getMeta("buAmount").getScaleLength()));	
			map.put("peiAmount",StringUtils.toString(peiAmount, eiMetadata.getMeta("peiAmount").getFieldLength(), eiMetadata.getMeta("peiAmount").getScaleLength()));	
			
		return map;
	
	}
}