/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package kr.co.kihyun.beans.entity.ecross; import javax.jdo.PersistenceManager; 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.AcceptanceLimitStrategy; import kr.co.kihyun.beans.entity.TotDocProcess; import kr.co.kihyun.beans.entity.util.MPersistenceManager; /** * * @author bhs */ @PersistenceCapable(identityType = IdentityType.APPLICATION) @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) public abstract class ECrossAcceptanceLimitStrategy extends ECross { @Persistent(nullValue = NullValue.EXCEPTION) private TotDocProcess process = TotDocProcess.REG; @Persistent private Long limitCount; @Persistent private Long id; /** * @param id * the id to set */ public void setId(Long id) { this.id = id; } /** * @return the id */ public Long getId() { return id; } public ECrossAcceptanceLimitStrategy(AcceptanceLimitStrategy strategy) { super(strategy); this.setId(strategy.getId()); this.setLimitCount(strategy.getLimitCount()); this.setProcess(strategy.getProcess()); } @Override protected AcceptanceLimitStrategy getMoumiEntity(PersistenceManager pm, Class clazz) { AcceptanceLimitStrategy strategy; if (getCrud() == CRUD.C) { strategy = AcceptanceLimitStrategy.create("LimitByWriteDateStrategy", limitCount); strategy.setId(id); } else { strategy = pm.getObjectById(AcceptanceLimitStrategy.class, id); } return strategy; } @Override protected AcceptanceLimitStrategy setFieldValues(MPersistenceManager pm, AcceptanceLimitStrategy strategy) { strategy.setProcess(process); return strategy; } public void setLimitCount(Long limitCount) { this.limitCount = limitCount; } public Long getLimitCount() { return limitCount; } public void setProcess(TotDocProcess process) { this.process = process; } protected TotDocProcess getProcess() { return process; } }