You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
4.4 KiB
183 lines
4.4 KiB
/* |
|
* To change this template, choose Tools | Templates |
|
* and open the template in the editor. |
|
*/ |
|
package kr.co.kihyun.beans.entity.ecross; |
|
|
|
import java.util.Date; |
|
import javax.jdo.JDOObjectNotFoundException; |
|
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.MDept; |
|
import kr.co.kihyun.beans.entity.MUser; |
|
import kr.co.kihyun.beans.entity.Memo; |
|
import kr.co.kihyun.beans.entity.TotDoc; |
|
import kr.co.kihyun.beans.entity.TotReport; |
|
import kr.co.kihyun.beans.entity.util.MPersistenceManager; |
|
|
|
/** |
|
* |
|
* @author bhs |
|
*/ |
|
@PersistenceCapable(identityType = IdentityType.APPLICATION) |
|
@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) |
|
public abstract class ECrossMemo extends ECross<Memo> { |
|
|
|
@Persistent |
|
private String contents; |
|
@Persistent |
|
private String groupId; |
|
@Persistent |
|
private Long id; |
|
@Persistent |
|
private String requestDept; |
|
@Persistent |
|
private String requestUser; |
|
@Persistent |
|
private String responseDept; |
|
@Persistent |
|
private String responseUser; |
|
@Persistent |
|
private Long totDoc; |
|
@Persistent |
|
private Long totReport; |
|
@Persistent(customValueStrategy = "timestamp", nullValue = NullValue.EXCEPTION) |
|
private Date writeDate; |
|
|
|
public ECrossMemo(Memo memo) { |
|
super(memo); |
|
this.setContents(memo.getContents()); |
|
this.setGroupId(memo.getGroupId()); |
|
this.setId(memo.getId()); |
|
this.setRequestDept(memo.getRequestDept()); |
|
this.setRequestUser(null); |
|
this.setResponseDept(memo.getResponseDept()); |
|
this.setResponseUser(null); |
|
this.setTotDoc(memo.getTotDoc()); |
|
this.setTotReport(memo.getTotReport()); |
|
this.setWriteDate(memo.getWriteDate()); |
|
} |
|
|
|
@Override |
|
protected Memo setFieldValues(MPersistenceManager pm, Memo memo) { |
|
memo.setContents(contents); |
|
memo.setGroupId(groupId); |
|
memo.setRequestDept(requestDept == null ? null : pm.getObjectById(MDept.class, requestDept)); |
|
memo.setRequestUser(null); |
|
memo.setResponseDept(responseDept == null ? null : pm.getObjectById(MDept.class, responseDept)); |
|
memo.setResponseUser(null); |
|
memo.setTotDoc(totDoc == null ? null : pm.getObjectById(TotDoc.class, totDoc)); |
|
memo.setTotReport(totReport == null ? null : pm.getObjectById(TotReport.class, totReport)); |
|
memo.setWriteDate(writeDate); |
|
|
|
return memo; |
|
} |
|
|
|
public String getContents() { |
|
return this.contents; |
|
} |
|
|
|
public String getGroupId() { |
|
return this.groupId; |
|
} |
|
|
|
/** |
|
* @return the id |
|
*/ |
|
public Long getId() { |
|
return id; |
|
} |
|
|
|
public MDept getRequestDept(PersistenceManager pm) { |
|
try { |
|
return pm.getObjectById(MDept.class, this.requestDept); |
|
} catch (JDOObjectNotFoundException jonfe) { |
|
return null; |
|
} |
|
} |
|
|
|
public MUser getRequestUser(PersistenceManager pm) { |
|
try { |
|
return pm.getObjectById(MUser.class, this.requestUser); |
|
} catch (JDOObjectNotFoundException jonfe) { |
|
return null; |
|
} |
|
} |
|
|
|
public MDept getResponseDept(PersistenceManager pm) { |
|
try { |
|
return pm.getObjectById(MDept.class, this.responseDept); |
|
} catch (JDOObjectNotFoundException jonfe) { |
|
return null; |
|
} |
|
} |
|
|
|
public MUser getResponseUser(PersistenceManager pm) { |
|
try { |
|
return pm.getObjectById(MUser.class, this.responseUser); |
|
} catch (JDOObjectNotFoundException jonfe) { |
|
return null; |
|
} |
|
} |
|
|
|
public Date getWriteDate() { |
|
return this.writeDate; |
|
} |
|
|
|
public void setContents(String contents) { |
|
this.contents = contents; |
|
} |
|
|
|
public void setGroupId(String gid) { |
|
this.groupId = gid; |
|
} |
|
|
|
/** |
|
* @param id |
|
* the id to set |
|
*/ |
|
public void setId(Long id) { |
|
this.id = id; |
|
} |
|
|
|
public void setRequestDept(String requestDept) { |
|
this.requestDept = requestDept; |
|
} |
|
|
|
public void setRequestUser(MUser mUser) { |
|
if (requestUser == null) { |
|
this.requestUser = null; |
|
} else { |
|
this.requestUser = mUser.getId(); |
|
} |
|
} |
|
|
|
public void setResponseDept(String responseDept) { |
|
this.responseDept = responseDept; |
|
} |
|
|
|
public void setResponseUser(MUser mUser) { |
|
if (responseUser == null) { |
|
this.responseUser = null; |
|
} else { |
|
this.responseUser = mUser.getId(); |
|
} |
|
} |
|
|
|
public void setTotDoc(TotDoc doc) { |
|
this.totDoc = doc == null ? null : doc.getId(); |
|
} |
|
|
|
public void setTotReport(TotReport totReport) { |
|
this.totReport = totReport == null ? null : totReport.getId(); |
|
} |
|
|
|
public void setWriteDate(Date writeDate) { |
|
this.writeDate = writeDate; |
|
} |
|
}
|
|
|