/**
 * Copyright (c) 2003-2005 System Integrator Corporation.
 *                 All Rights Reserved.
 */
package jp.co.sint.basic;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collection;

import jp.co.sint.database.SIDBAccessException;
import jp.co.sint.database.SIDBUtil;
import jp.co.sint.tools.SIUtil;

public class SIColor extends SIBasic {
  //色コード
  private String colorCode = "";
  
  //色名称
  private String colorName = "";
  
  //紐付け商品
  private String cmdtyCount = "0";
  
  //getter of 色コード
  public String getColorCode() {
    return colorCode;
  }
  
  //getter of 色名称
  public String getColorName() {
    return colorName;
  }
  
  //getter of 紐付け商品
  public String getCmdtyCount(){
    return this.cmdtyCount;
  }
  
  //setter of 色コード
  public void setColorCode(String lColorCode) {
    if (SIUtil.isNull(lColorCode)) lColorCode = "";
    this.colorCode = SIUtil.changeTo(lColorCode.trim(),this.encode);
  }
  
  //setter of 色名称
  public void setColorName(String lColorName) {
    if (SIUtil.isNull(lColorName)) lColorName = "";
    this.colorName = SIUtil.changeTo(lColorName.trim(),this.encode);
  }
  
  //setter of 紐付け商品
  public void setCmdtyCount(String lCmdtyCount){
    if (SIUtil.isNull(lCmdtyCount)) lCmdtyCount = "";
    this.cmdtyCount=SIUtil.changeTo(lCmdtyCount.trim(),this.encode);
  }
  
  /**
   * <b>getNameCollection</b>
   * 色一覧を取得
   * @param  Connection
   * @param  custCode
   * @return Collection
   * @throws なし
   */
  public static Collection getNameCollection(Connection lConnection){
    Collection lResultColl=new ArrayList();
    
    try {
      lResultColl=SIDBUtil.getCollection(lConnection,"SELECT colorname,colorcode FROM colortbl ORDER BY colorName",true);
    } catch (SIDBAccessException e) {
      e.printStackTrace();
    }
    return lResultColl;
  }
}
