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.
472 lines
13 KiB
472 lines
13 KiB
package kr.co.kihyun.beans.entity; |
|
|
|
import java.util.ArrayList; |
|
import java.util.Collections; |
|
import java.util.Date; |
|
import java.util.HashMap; |
|
import java.util.List; |
|
import java.util.Map; |
|
|
|
import javax.jdo.JDOObjectNotFoundException; |
|
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; |
|
import kr.co.kihyun.io.IUploadable; |
|
|
|
import org.slf4j.Logger; |
|
import org.slf4j.LoggerFactory; |
|
|
|
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true") |
|
public class TotReport2 extends AbstractPublicDocument implements IUploadable, IRemotePersistable { |
|
/** |
|
* |
|
*/ |
|
private static final long serialVersionUID = 8955275337415625177L; |
|
private static final Logger LOG = LoggerFactory.getLogger(TotReport2.class); |
|
|
|
//v2. 5.static final 필드 변조 가능성 : Update by KWON,HAN |
|
// public static final String COL_DELIMITER = "!#"; |
|
// public static final String ROW_DELIMITER = "!%"; |
|
// public static final String TABLE_DELIMITER = "!`!"; |
|
// |
|
// public static final int PROCESS_ACCEPT = TotReportProcess.ACCEPT.ordinal(); |
|
// public static final int PROCESS_REASSIGN = TotReportProcess.REASSIGN.ordinal(); |
|
// public static final int PROCESS_ASSIGN = TotReportProcess.ASSIGN.ordinal(); |
|
// public static final int PROCESS_RETURN = TotReportProcess.RETURN.ordinal(); |
|
// public static final int PROCESS_TEMP = TotReportProcess.TEMP.ordinal(); |
|
// public static final int PROCESS_APPROVE = TotReportProcess.APPROVE.ordinal(); |
|
// public static final int PROCESS_COMP = TotReportProcess.COMP.ordinal(); |
|
// public static final int PROCESS_END = TotReportProcess.END.ordinal(); |
|
// public static final int PROCESS_READ = TotReportProcess.READ.ordinal(); |
|
// public static final int PROCESS_CANCEL = TotReportProcess.CANCEL.ordinal(); |
|
// public static final int PROCESS_ALL = TotReportProcess.ALL.ordinal(); |
|
// public static final int PROCESS_NOT = TotReportProcess.NOT.ordinal(); |
|
// |
|
// public static final int TYPE_REPORT = TotReportType.REPORT.ordinal(); |
|
// public static final int TYPE_NOT_REPORT = TotReportType.NOT_REPORT.ordinal(); |
|
// public static final int TYPE_NOT_REPORT_REQ = TotReportType.NOT_REPORT_REQ.ordinal(); |
|
// |
|
// public static final int RECOG_NOT = Recog.NOT_RECOG.ordinal(); |
|
// public static final int RECOG_PRSS = Recog.PRSS.ordinal(); |
|
// public static final int RECOG_COMP = Recog.COMP.ordinal(); |
|
// public static final int RECOG_RETURN = Recog.RETURN_RECOG.ordinal(); |
|
// public static final int RECOG_ARBITRARY = Recog.ARBITRARY.ordinal(); |
|
// public static final int RECOG_FINAL_RECOG = Recog.FINAL_RECOG.ordinal(); |
|
|
|
|
|
private static final String COL_DELIMITER = "!#"; |
|
private static final String ROW_DELIMITER = "!%"; |
|
private static final String TABLE_DELIMITER = "!`!"; |
|
|
|
private static final int PROCESS_ACCEPT = TotReportProcess.ACCEPT.ordinal(); |
|
private static final int PROCESS_REASSIGN = TotReportProcess.REASSIGN.ordinal(); |
|
private static final int PROCESS_ASSIGN = TotReportProcess.ASSIGN.ordinal(); |
|
private static final int PROCESS_RETURN = TotReportProcess.RETURN.ordinal(); |
|
private static final int PROCESS_TEMP = TotReportProcess.TEMP.ordinal(); |
|
private static final int PROCESS_APPROVE = TotReportProcess.APPROVE.ordinal(); |
|
private static final int PROCESS_COMP = TotReportProcess.COMP.ordinal(); |
|
private static final int PROCESS_END = TotReportProcess.END.ordinal(); |
|
private static final int PROCESS_READ = TotReportProcess.READ.ordinal(); |
|
private static final int PROCESS_CANCEL = TotReportProcess.CANCEL.ordinal(); |
|
private static final int PROCESS_ALL = TotReportProcess.ALL.ordinal(); |
|
private static final int PROCESS_NOT = TotReportProcess.NOT.ordinal(); |
|
|
|
private static final int TYPE_REPORT = TotReportType.REPORT.ordinal(); |
|
private static final int TYPE_NOT_REPORT = TotReportType.NOT_REPORT.ordinal(); |
|
private static final int TYPE_NOT_REPORT_REQ = TotReportType.NOT_REPORT_REQ.ordinal(); |
|
|
|
private static final int RECOG_NOT = Recog.NOT_RECOG.ordinal(); |
|
private static final int RECOG_PRSS = Recog.PRSS.ordinal(); |
|
private static final int RECOG_COMP = Recog.COMP.ordinal(); |
|
private static final int RECOG_RETURN = Recog.RETURN_RECOG.ordinal(); |
|
private static final int RECOG_ARBITRARY = Recog.ARBITRARY.ordinal(); |
|
private static final int RECOG_FINAL_RECOG = Recog.FINAL_RECOG.ordinal(); |
|
//========================================================== |
|
|
|
@Persistent(nullValue = NullValue.EXCEPTION) |
|
private TotDoc totDoc; |
|
|
|
@Persistent |
|
private String acceptanceCode; |
|
|
|
@Persistent |
|
private String acptDoc; |
|
|
|
@Persistent(nullValue = NullValue.EXCEPTION) |
|
private Integer tableNum = 1; |
|
|
|
@Persistent |
|
private String num; |
|
|
|
@Persistent |
|
private String mDept; |
|
|
|
@Persistent |
|
private String mUser; |
|
|
|
@Persistent(customValueStrategy = "timestamp") |
|
private Date regDate; |
|
|
|
@Persistent |
|
private Date submitDate; |
|
|
|
@Persistent |
|
private String data; |
|
|
|
@Persistent |
|
private String totData; |
|
|
|
@Persistent |
|
private Map<String, List<Byte>> attachments; |
|
|
|
@Persistent |
|
private Integer appro = 0; |
|
|
|
@Persistent |
|
private Recog recog = Recog.NOT_RECOG; |
|
|
|
@Persistent |
|
private String note; |
|
|
|
@Persistent(nullValue = NullValue.EXCEPTION) |
|
private Boolean isDeleted = false; // COLUMN: del_type |
|
|
|
@Persistent(nullValue = NullValue.EXCEPTION) |
|
private TotReportType type = TotReportType.REPORT; |
|
|
|
@Persistent(nullValue = NullValue.EXCEPTION) |
|
private TotReportProcess process = TotReportProcess.ACCEPT; // COLUMN: prss |
|
|
|
@Persistent |
|
private TotDoc slaveTotDoc; // COLUMN: down_doc_id |
|
|
|
@Persistent |
|
private TotDoc repTotDoc; // COLUMN: rep_doc_id |
|
|
|
@Persistent |
|
private AssignType assignType = AssignType.ASSIGN_TO_DEPT; // COLUMN: doc_type |
|
|
|
@Persistent(mappedBy = "totReport2") |
|
private List<TotReportHistory> totReportHistories = new ArrayList<TotReportHistory>(); |
|
|
|
@Persistent(mappedBy = "totReport2") |
|
private List<Memo> memos = new ArrayList<Memo>(); |
|
|
|
@Persistent(mappedBy = "totReport2") |
|
private List<Repoadm> repoadms = new ArrayList<Repoadm>(); |
|
|
|
@Persistent |
|
private Repoadm currentRepoadm = null; |
|
|
|
public TotReport2(TotDoc totDoc, MDept dept) { |
|
this.setTotDoc(totDoc); |
|
this.setDept(dept); |
|
} |
|
|
|
public TotReport2() { |
|
} |
|
|
|
public TotDoc getTotDoc() { |
|
return this.totDoc; |
|
} |
|
|
|
public final void setTotDoc(TotDoc doc) { |
|
this.totDoc = doc; |
|
} |
|
|
|
public final AcceptanceCode getAcceptanceCode() { |
|
try { |
|
if (acceptanceCode != null) |
|
return AcceptanceCode.valueOf(acceptanceCode); |
|
else |
|
return new AcceptanceCode(acceptanceCode, null); |
|
} catch (Exception e) { |
|
LOG.error("Unable to parse acceptance code for {}", acceptanceCode); |
|
return new AcceptanceCode(acceptanceCode, null); |
|
} |
|
} |
|
|
|
public final void setAcceptanceCode(AcceptanceCode acceptanceCode) { |
|
this.acceptanceCode = acceptanceCode == null ? null : acceptanceCode.toString(); |
|
} |
|
//문서번호 |
|
public final AcptDoc getActDoc() { |
|
try { |
|
if (acptDoc != null) |
|
return AcptDoc.valueOf(acptDoc); |
|
else |
|
return new AcptDoc(acptDoc, null); |
|
} catch (Exception e) { |
|
LOG.error("Unable to parse acptDoc code for {}", acptDoc); |
|
return new AcptDoc(acptDoc, null); |
|
} |
|
} |
|
|
|
public final void setAcptDoc(AcptDoc acptDoc) { |
|
this.acptDoc = acptDoc == null ? null : acptDoc.toString(); |
|
} |
|
|
|
public int getTableNum() { |
|
return this.tableNum; |
|
} |
|
|
|
public void setTableNum(int num) { |
|
this.tableNum = num; |
|
} |
|
|
|
public String getNum() { |
|
return this.num; |
|
} |
|
|
|
public void setNum(String num) { |
|
this.num = num; |
|
} |
|
|
|
public String getDept() { |
|
return this.mDept; |
|
} |
|
|
|
public MDept getDept(PersistenceManager pm) { |
|
try { |
|
//LOG.debug("mDept: {}", this.mDept); |
|
return pm.getObjectById(MDept.class, this.mDept); |
|
} catch (JDOObjectNotFoundException jonfe) { |
|
return null; |
|
} |
|
} |
|
|
|
public final void setDept(MDept mDept) { |
|
if (mDept == null) |
|
this.mDept = null; |
|
else |
|
this.mDept = mDept.getId(); |
|
} |
|
|
|
public MUser getUser(PersistenceManager pm) { |
|
try { |
|
return pm.getObjectById(MUser.class, this.mUser); |
|
} catch (JDOObjectNotFoundException jonfe) { |
|
MUser nullUser = new MUser(); |
|
nullUser.setId(this.mUser); |
|
return nullUser; |
|
} |
|
} |
|
|
|
public void setUser(MUser mUser) { |
|
if (mUser == null) { |
|
this.mUser = null; |
|
setOwnerEmail(null); |
|
setOwnerName(null); |
|
setOwnerPhone(null); |
|
} else { |
|
this.mUser = mUser.getId(); |
|
setOwnerEmail(mUser.getEmail()); |
|
setOwnerName(mUser.getEncName()); |
|
setOwnerPhone(mUser.getPhone()); |
|
} |
|
} |
|
|
|
public Date getRegDate() { |
|
return this.regDate == null ? null : new Date(this.regDate.getTime()); |
|
} |
|
|
|
public void setRegDate(Date regDate) { |
|
this.regDate = regDate == null ? null : new Date(regDate.getTime()); |
|
} |
|
|
|
public Date getSubmitDate() { |
|
return this.submitDate == null ? null : new Date(this.submitDate.getTime()); |
|
} |
|
|
|
public void setSubmitDate(Date submitDate) { |
|
this.submitDate = submitDate == null ? null : new Date(submitDate.getTime()); |
|
} |
|
|
|
public String getData() { |
|
return this.data; |
|
} |
|
|
|
public void setData(String data) { |
|
this.data = data; |
|
} |
|
|
|
public String getTotData() { |
|
return this.totData; |
|
} |
|
|
|
public void setTotData(String data) { |
|
this.totData = data; |
|
} |
|
|
|
public Map<String, List<Byte>> getAttachments() { |
|
if (this.attachments == null) |
|
return Collections.unmodifiableMap(new HashMap<String, List<Byte>>()); |
|
else |
|
return Collections.unmodifiableMap(attachments); |
|
} |
|
|
|
public void addAttachment(String key, List<Byte> value) { |
|
if (this.attachments == null ) |
|
this.attachments = new HashMap<String, List<Byte>>(); |
|
this.attachments.put(key, value); |
|
} |
|
|
|
public List<Byte> removeAttachment(String key) { |
|
return this.attachments.remove(key); |
|
} |
|
|
|
public int getAppro() { |
|
return this.appro; |
|
} |
|
|
|
public void setAppro(int a) { |
|
this.appro = a; |
|
} |
|
|
|
public Recog getRecog() { |
|
return this.recog; |
|
} |
|
|
|
public void setRecog(Recog r) { |
|
this.recog = r; |
|
} |
|
|
|
public String getNote() { |
|
return this.note; |
|
} |
|
|
|
public void setNote(String note) { |
|
this.note = note; |
|
} |
|
|
|
public boolean isDeleted() { |
|
return this.isDeleted; |
|
} |
|
|
|
public void setDeleted(boolean isDeleted) { |
|
this.isDeleted = isDeleted; |
|
} |
|
|
|
public TotReportType getType() { |
|
return this.type; |
|
} |
|
|
|
public void setType(TotReportType t) { |
|
this.type = t; |
|
} |
|
|
|
public TotReportProcess getProcess() { |
|
return this.process; |
|
} |
|
|
|
public void setProcess(TotReportProcess p) { |
|
if (p.ordinal() < TotReportProcess.COMP.ordinal()) |
|
this.setSubmitDate(null); |
|
else if (p == TotReportProcess.COMP) |
|
this.setSubmitDate(new Date()); |
|
|
|
if (p == TotReportProcess.RETURN && this.getSlaveTotDoc() != null) // NEIS-57 |
|
this.process = TotReportProcess.TEMP; |
|
else |
|
this.process = p; |
|
} |
|
|
|
public TotDoc getSlaveTotDoc() { |
|
return this.slaveTotDoc; |
|
} |
|
|
|
public void setSlaveTotDoc(TotDoc doc) { |
|
this.slaveTotDoc = doc; |
|
} |
|
|
|
public TotDoc getRepTotDoc() { |
|
return this.repTotDoc; |
|
} |
|
|
|
public void setRepTotDoc(TotDoc doc) { |
|
this.repTotDoc = doc; |
|
} |
|
|
|
public AssignType getAssignType() { |
|
return this.assignType; |
|
} |
|
|
|
public void setAssignType(AssignType t) { |
|
this.assignType = t; |
|
} |
|
|
|
public void addHistory(TotReportHistory history) { |
|
this.totReportHistories.add(history); |
|
} |
|
|
|
public void removeHistory(TotReportHistory history) { |
|
this.totReportHistories.remove(history); |
|
} |
|
|
|
public List<TotReportHistory> getHistories() { |
|
return Collections.unmodifiableList(totReportHistories); |
|
} |
|
|
|
public void addMemo(Memo memo) { |
|
this.memos.add(memo); |
|
} |
|
|
|
public void removeMemo(Memo memo) { |
|
this.memos.remove(memo); |
|
} |
|
|
|
public List<Memo> getMemos() { |
|
return Collections.unmodifiableList(memos); |
|
} |
|
|
|
public void setRepoadms(List<Repoadm> repoadms) { |
|
this.repoadms = repoadms; |
|
} |
|
|
|
public List<Repoadm> getRepoadms() { |
|
return repoadms; |
|
} |
|
|
|
public void setCurrentRepoadm(Repoadm currentRepoadm) { |
|
this.currentRepoadm = currentRepoadm; |
|
} |
|
|
|
public Repoadm getCurrentRepoadm() { |
|
return currentRepoadm; |
|
} |
|
|
|
public TotReportHistory getRecentHistory() { |
|
TotReportHistory recentHistory = null; |
|
if (!this.getHistories().isEmpty()) |
|
recentHistory = this.getHistories().get(this.getHistories().size() - 1); |
|
return recentHistory; |
|
} |
|
|
|
public int getRowCount() { |
|
return (getData().length() - getData().replaceAll(ROW_DELIMITER, "").length()) / ROW_DELIMITER.length(); |
|
} |
|
|
|
@Override |
|
public String toString() { |
|
List<String> fieldList = new ArrayList<String>(); |
|
if (totDoc != null) |
|
fieldList.add(totDoc.toString()); |
|
if (mDept != null) |
|
fieldList.add(mDept.toString()); |
|
if (mUser != null) |
|
fieldList.add(mUser.toString()); |
|
if (slaveTotDoc != null) |
|
fieldList.add("slaveTotDoc::" + slaveTotDoc); |
|
if (repTotDoc != null) |
|
fieldList.add("repTotDoc::" + repTotDoc); |
|
StringBuilder str = new StringBuilder(100).append(super.toString()).append(fieldList); |
|
return str.toString(); |
|
} |
|
|
|
public MDept getOwnerParty(PersistenceManager pm) { |
|
return this.getDept(pm).getRootDept(pm); |
|
} |
|
}
|
|
|