/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package kr.co.kihyun.beans.entity.ecross; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.Inheritance; import javax.jdo.annotations.InheritanceStrategy; import javax.jdo.annotations.NullValue; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import kr.co.kihyun.beans.entity.TotDoc; import kr.co.kihyun.beans.entity.TotItem; import kr.co.kihyun.beans.entity.TotItemType; import kr.co.kihyun.beans.entity.util.MPersistenceManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * * @author bhs */ @PersistenceCapable(identityType = IdentityType.APPLICATION) @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) public abstract class ECrossTotItem extends ECross { private static final Logger LOG = LoggerFactory.getLogger(ECrossTotItem.class); @Persistent(nullValue = NullValue.EXCEPTION) private int colNum = 0; @Persistent private String description; @Persistent private String expr; @Persistent private Long id; @Persistent private short inputSize = 10; @Persistent(nullValue = NullValue.EXCEPTION) private String name; @Persistent(nullValue = NullValue.EXCEPTION) private int num = 0; @Persistent(nullValue = NullValue.EXCEPTION) private int rowNum = 0; @Persistent(nullValue = NullValue.EXCEPTION) private short tableNum = 1; @Persistent(nullValue = NullValue.EXCEPTION) private Long totDoc; @Persistent(nullValue = NullValue.EXCEPTION) private TotItemType type = TotItemType.CHAR; public ECrossTotItem(TotItem item) { super(item); this.setColNum(item.getColNum()); this.setDescription(item.getDescription()); this.setExpr(item.getExpr()); this.setId(item.getId()); this.setInputSize(item.getInputSize()); this.setName(item.getName()); this.setNum(item.getNum()); this.setRowNum(item.getRowNum()); this.setTableNum(item.getTableNum()); this.setTotDoc(item.getTotDoc()); this.setType(item.getType()); } @Override protected TotItem setFieldValues(MPersistenceManager pm, TotItem totItem) { totItem.setColNum(colNum); totItem.setDescription(description); totItem.setExpr(expr); totItem.setInputSize(inputSize); totItem.setName(name); totItem.setNum(num); totItem.setRowNum(rowNum); totItem.setTableNum(tableNum); totItem.setTotDoc(totDoc == null ? null : pm.getObjectById(TotDoc.class, totDoc)); totItem.setType(type); return totItem; } public int getColNum() { return this.colNum; } public String getDescription() { return this.description; } public String getExpr() { return this.expr; } /** * @return the id */ public Long getId() { return id; } public short getInputSize() { return this.inputSize; } public String getName() { return this.name; } public int getNum() { return this.num; } public int getRowNum() { return this.rowNum; } public short getTableNum() { return this.tableNum; } public TotItemType getType() { return this.type; } public void setColNum(int num) { this.colNum = num; } public void setDescription(String description) { this.description = description; } public void setExpr(String expr) { this.expr = expr; } /** * @param id * the id to set */ public void setId(Long id) { this.id = id; } public void setInputSize(short inputSize) { this.inputSize = inputSize; } public void setName(String name) { this.name = name; } public void setNum(int num) { this.num = num; } public void setRowNum(int num) { this.rowNum = num; } public void setTableNum(short num) { this.tableNum = num; } public void setTotDoc(TotDoc doc) { this.totDoc = doc == null ? null : doc.getId(); } public void setType(TotItemType t) { this.type = t; } }