/*
	File : OptionProperty.java
	
	게시판의 사용자 정의 부분 데이타를 갖고 있는 클래스
*/

package com.etri.groupware.bbs;

import com.etri.groupware.Property;

import java.util.*;

public class OptionProperty extends Property
{
	
	private String sortMethod;
	private String firstBoard;
	private int period;
	private int numOfItemsInPage;
	
	private String title;
	private String author;
	private String content;
		
	private String startDate;
	private String endDate;
	
	public OptionProperty() {}

	public OptionProperty(String sortMethod, String firstBoard, int period, int numOfItemsInPage, String title, String author, String content) 	
	{
		this.sortMethod = sortMethod;
		this.firstBoard = firstBoard;
		this.period = period;
		this.numOfItemsInPage = numOfItemsInPage;
		this.title = title;
		this.author = author;
		this.content = content;
	}

	
	public void setSortMethod(String _sortMethod)
	{
		sortMethod = _sortMethod;
	}

	public void setFirstBoard(String _firstBoard)
	{
		firstBoard = _firstBoard;
	}
	
	public void setPeriod(int _period)
	{
		period = _period;
	}
	
	public void setNumOfItemsInPage(int _numOfItemsInPage)
	{
		numOfItemsInPage = _numOfItemsInPage;
	}
	
	public void setTitle(String _title)
	{
		title = _title;
	}
	
	public void setAuthor( String _author)
	{
		author = _author;
	}
	
	public void setContent( String _content)
	{
		content = _content;
	}
	


	public String getSortMethod()
	{
		return sortMethod;
	}
	
	public String getFirstBoard()
	{
		return firstBoard;
	}
		
	public int getPeriod()
	{
		return period;
	}
	
	public int getNumOfItemsInPage()
	{
		return numOfItemsInPage;
	}
	
	public String getTitle()
	{
		return title;
	}
	
	public String getAuthor()
	{
		return author;
	}
	
	public String getContent()
	{
		return content;
	}
	
	public String getStartDate()		
	{		
		Calendar today = Calendar.getInstance();
		int date = period - ( period*2 );
		today.add( Calendar.DATE, date);
		startDate = today.get(Calendar.YEAR) + "/" + (today.get(Calendar.MONTH)+1)  + "/" 
			+ today.get(Calendar.DAY_OF_MONTH);
		return startDate;
	}
	
	public String getEndDate()
	{
		Calendar today = Calendar.getInstance();
		endDate = today.get(Calendar.YEAR) + "/" + (today.get(Calendar.MONTH)+1) +"/" 
			+ today.get(Calendar.DAY_OF_MONTH);
		return endDate;
	}
}