/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package kr.co.kihyun.service.vo; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.jdo.PersistenceManager; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.Serialized; import kr.co.kihyun.beans.entity.Board; import kr.co.kihyun.beans.entity.TotReport; import kr.co.kihyun.io.IUploadable; /** * * @author Kts */ public class BoardVO { private String popupYn; //팝업여부 private Long id; //게시판ID private Date writeDate; //작성일 private String title; //제목 private String contents; //제목 private String userName; //작성자명 private String deptName; //부서명 private Integer visit; //방문자수 private Long rowNo; //레코드행번호 private String isAttachments; //레코드행번호 @Serialized private Map> attachmentsMap; public String getPopupYn() { return popupYn; } public void setPopupYn(String popupYn) { this.popupYn = popupYn; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Date getWriteDate() { return writeDate; } public void setWriteDate(Date writeDate) { this.writeDate = writeDate; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getDeptName() { return deptName; } public void setDeptName(String deptName) { this.deptName = deptName; } public Integer getVisit() { return visit; } public void setVisit(Integer visit) { this.visit = visit; } public Long getRowNo() { return rowNo; } public void setRowNo(Long rowNo) { this.rowNo = rowNo; } public String getIsAttachments() { return isAttachments; } public void setIsAttachments(String isAttachments) { this.isAttachments = isAttachments; } public Map> getAttachmentsMap(PersistenceManager pm) { // LOG.debug("attachments: {}", attachments); // if(this.attachments == null) { // this.attachmentsMap = Collections.unmodifiableMap(new HashMap>()); // } else { // Long reportID = this.id; // IUploadable uploadable = null; // // uploadable = pm.getObjectById(TotReport.class, reportID); //// LOG.debug("reportID: {}, attachments: {}", reportID, uploadable.getAttachments()); // this.attachmentsMap = uploadable.getAttachments(); // } if("Y".equals(this.isAttachments)) { Long boardID = this.id; IUploadable uploadable = pm.getObjectById(Board.class, boardID); // LOG.debug("reportID: {}, attachments: {}", reportID, uploadable.getAttachments()); this.attachmentsMap = uploadable.getAttachments(); } else { this.attachmentsMap = Collections.unmodifiableMap(new HashMap>()); } return attachmentsMap; } public String getContents() { return contents; } public void setContents(String contents) { this.contents = contents; } }