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

import jp.co.sint.config.SIConfig;
import jp.co.sint.tools.SIUtil;

import org.apache.log4j.Category;

/**
 * @version $Id: SIAccesslog.java,v 1.0 Exp $
 * @author  Jinwang Chen
 * <br>Description: カートにある商品と数量を表示するクラスです
 * <p>History</p>
 * <p>Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reason</p>
 * ============&nbsp;&nbsp;&nbsp;==========&nbsp;&nbsp;===========================<br>
 * J.W.Chen       2003/06/25  Original
 */

public class SIAccesslog extends SIBasic{
  //ログ用のインスタンスの生成
  private static Category log=Category.getInstance(SIConfig.SILOG4J_WEBSHOP_CATEGORY_NAME);
 
  //年／月／日
  private String date="";
  
  //時間帯
  private String time="";
  
  //アクセス数
  private String count="0";
  
  //週のアクセス数+合計
  private long[] weekCount = {0,0,0,0,0,0,0,0};
  
  //年
  private String year="";
  
  //月
  private String month="";
  
  //日
  private String day="";
  
  //setter of 年／月／日
  public void setDate(String lDate){
    if (SIUtil.isNull(lDate)) lDate="";
    this.date=lDate.trim();
  }
  
  //setter of 時間帯
  public void setTime(String lTime){
    if (SIUtil.isNull(lTime)) lTime="";
    this.time=lTime.trim();
  }
  
  //setter of アクセス数
  public void setCount(String lCount){
    if (SIUtil.isNull(lCount)) lCount="0";
    this.count=lCount.trim();
  }
  
  //setter of 週のアクセス数+合計
  public void setWeekCount(int lIndex, long lCount){ 
    weekCount[lIndex] = lCount;
  }
  
  //setter of 年
  public void setYear(String lYear){
    if (SIUtil.isNull(lYear)) lYear="";
    this.year=lYear.trim();
  }
  
  //setter of 月
  public void setMonth(String lMonth){
    if (SIUtil.isNull(lMonth)) lMonth="";
    this.month=lMonth.trim();
  }
  
  //setter of 日
  public void setDay(String lDay){
    if (SIUtil.isNull(lDay)) lDay="";
    this.day=lDay.trim();
  }
  
  //getter of 年／月／日
  public String getDate(){
    return this.date;
  }
  
  //getter of 時間帯
  public String getTime(){
    return this.time;
  }
  
  //getter of 時間帯表示
  public String getTimeDisp(){
    if(this.getTime().equals("合計")) return this.getTime();
    else if(this.getTime().equals("23")) return this.getTime()+"-00時";
    else return this.getTime()+"-"+SIUtil.lFillIn(Integer.parseInt(this.getTime())+1,2)+"時";
  }
  
  //getter of アクセス数
  public String getCount(){
    return this.count;
  }
  
  //getter of 週のアクセス数
  public String getWeekCount(int lIndex){
    return String.valueOf(this.weekCount[lIndex]);
  }
  
  //getter of 年
  public String getYear(){
    return this.year;
  }
  
  //getter of 月
  public String getMonth(){
    return this.month;
  }
  
  //getter of 日
  public String getDay(){
    return this.day;
  }
  
  //getter of 年/月/01
  public String getYearMonth(){
    return this.year+"/"+this.month+"/01";
  }
}