package kr.co.kihyun.beans.entity;

import javax.jdo.PersistenceManager;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.NullValue;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import kr.co.kihyun.beans.entity.ecross.IRemotePersistable;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class TotItem extends LongEntity implements IRemotePersistable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 4629181986141199574L;

	@Persistent(nullValue = NullValue.EXCEPTION)
	private TotDoc totDoc; // COLUNN: doc_id

	@Persistent(nullValue = NullValue.EXCEPTION)
	private short tableNum = 1;

	@Persistent(nullValue = NullValue.EXCEPTION)
	private int num = 0;

	@Persistent(nullValue = NullValue.EXCEPTION)
	private String name;

	@Persistent
	private String description;

	@Persistent
	private short inputSize = 10;

	@Persistent
	private String expr;

	@Persistent(nullValue = NullValue.EXCEPTION)
	private TotItemType type = TotItemType.CHAR;

	@Persistent(nullValue = NullValue.EXCEPTION)
	private int colNum = 0;

	@Persistent(nullValue = NullValue.EXCEPTION)
	private int rowNum = 0;

	public TotItem() {
	}

	public TotItem(TotDoc totDoc) {
		this.setTotDoc(totDoc);
	}

	public TotItem(TotDoc totDoc, String name) {
		this.setTotDoc(totDoc);
		this.setName(name);
	}

	public TotDoc getTotDoc() {
		return this.totDoc;
	}

	public void setTotDoc(TotDoc doc) {
		this.totDoc = doc;
	}

	public short getTableNum() {
		return this.tableNum;
	}

	public void setTableNum(short num) {
		this.tableNum = num;
	}

	public int getNum() {
		return this.num;
	}

	public void setNum(int num) {
		this.num = num;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public short getInputSize() {
		return this.inputSize;
	}

	public void setInputSize(short inputSize) {
		this.inputSize = inputSize;
	}

	public String getExpr() {
		return this.expr;
	}

	public void setExpr(String expr) {
		this.expr = expr;
	}

	public TotItemType getType() {
		return this.type;
	}

	public void setType(TotItemType t) {
		this.type = t;
	}

	public int getColNum() {
		return this.colNum;
	}

	public void setColNum(int num) {
		this.colNum = num;
	}

	public int getRowNum() {
		return this.rowNum;
	}

	public void setRowNum(int num) {
		this.rowNum = num;
	}

	public MDept getOwnerParty(PersistenceManager pm) {
		return this.getTotDoc().getDept(pm).getRootDept(pm);
	}

}
