childCutMyselfRightFix = jsTreeHibernateDao.getListWithoutPaging(cutMyselfRightFixCriteria);
+ for (T perCutMyselfRightFix : childCutMyselfRightFix) {
+ perCutMyselfRightFix.setC_right(perCutMyselfRightFix.getC_right() - spaceOfTargetNode);
+ jsTreeHibernateDao.update(perCutMyselfRightFix);
+ }
+
+ }
+
+}
Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateBaseDTO.java
===================================================================
diff -u
--- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateBaseDTO.java (revision 0)
+++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateBaseDTO.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e)
@@ -0,0 +1,484 @@
+package egovframework.com.ext.jstree.springHibernate.core.vo;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.lang.builder.ToStringStyle;
+
+@MappedSuperclass
+public abstract class JsTreeHibernateBaseDTO implements Serializable {
+
+ private static final long serialVersionUID = -1686737481473490738L;
+
+ /** 노드의 고유 id, 1부터 시작(Root Node) */
+ private Long c_id;
+
+ /** 노드의 부모 id, 0부터 시작(Root Node) */
+ private Long c_parentid;
+
+ /** Parent의 몇 번째 자식인지를 나타냄. 0부터 시작 */
+ private Long c_position;
+
+ /** 노드의 left 위치, 1부터 시작(Root Node) */
+ private Long c_left;
+
+ /** 노드의 right 위치, 자식이 없다면 left + 1의 값을 가진다. */
+ private Long c_right;
+
+ /** 노드의 depth, 0부터 시작 */
+ private Long c_level;
+
+ /** Node 의 title */
+ private String c_title;
+
+ /**
+ *
+ * 노드의 type
+ * root : root 노드
+ * drive : first child 노드
+ * folder : branch 노드
+ * default : leaf 노드
+ *
+ */
+ private String c_type;
+
+ /*
+ * Common Use Field
+ */
+ /** 참조하고 있는 노드의 id */
+ private long ref;
+
+ /** copy 시 1의 값을 가짐. */
+ private long copy;
+
+ private long multiCounter;
+
+ private long status;
+ /** ajax 처리 결과 메시지 */
+ private String ajaxMessage;
+
+ private String childcount;
+
+ /** 검색시 Keyword */
+ private String searchStr;
+
+ private long idif;
+ private long ldif;
+
+ /** 노드가 차지하는 공간 (right - left + 1) */
+ private long spaceOfTargetNode;
+
+ /** 임의 노드의 자식 노드들의 id만을 저장하는 컬렉션 */
+ private Collection c_idsByChildNodeFromNodeById;
+
+ private long fixCopyId;
+ private long fixCopyPosition;
+
+ /** 참조 노드의 right */
+ private long rightPositionFromNodeByRef;
+
+ private JsTreeHibernateBaseDTO nodeById;
+
+ private long idifLeft;
+ private long idifRight;
+
+ private long id; // moveNode
+ private final HashMap attr;
+ private volatile long hashCode;
+
+ public JsTreeHibernateBaseDTO() {
+ super();
+ attr = new HashMap();
+ }
+
+ public JsTreeHibernateBaseDTO(Long c_id, Long c_parentid, Long c_position, Long c_left,
+ Long c_right, Long c_level, String c_title, String c_type, long ref, long copy, long multiCounter,
+ long status, String ajaxMessage, String childcount, String searchStr, long idif, long ldif,
+ long spaceOfTargetNode, Collection c_idsByChildNodeFromNodeById, long fixCopyId,
+ long fixCopyPosition, long rightPositionFromNodeByRef, JsTreeHibernateBaseDTO nodeById, long idifLeft,
+ long idifRight, long id) {
+ super();
+ this.c_id = c_id;
+ this.c_parentid = c_parentid;
+ this.c_position = c_position;
+ this.c_left = c_left;
+ this.c_right = c_right;
+ this.c_level = c_level;
+ this.c_title = c_title;
+ this.c_type = c_type;
+ this.ref = ref;
+ this.copy = copy;
+ this.multiCounter = multiCounter;
+ this.status = status;
+ this.ajaxMessage = ajaxMessage;
+ this.childcount = childcount;
+ this.searchStr = searchStr;
+ this.idif = idif;
+ this.ldif = ldif;
+ this.spaceOfTargetNode = spaceOfTargetNode;
+ this.c_idsByChildNodeFromNodeById = c_idsByChildNodeFromNodeById;
+ this.fixCopyId = fixCopyId;
+ this.fixCopyPosition = fixCopyPosition;
+ this.rightPositionFromNodeByRef = rightPositionFromNodeByRef;
+ this.nodeById = nodeById;
+ this.idifLeft = idifLeft;
+ this.idifRight = idifRight;
+ this.id = id;
+ attr = new HashMap();
+ }
+
+ @Id
+ @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="JsTreeSequence")
+ @Column(name = "c_id")
+ public Long getC_id() {
+ return c_id;
+ }
+
+ public void setC_id(Long c_id) {
+ this.c_id = c_id;
+ }
+
+ @Column(name = "c_parentid")
+ public Long getC_parentid() {
+ return c_parentid;
+ }
+
+ public void setC_parentid(Long c_parentid) {
+ this.c_parentid = c_parentid;
+ }
+
+ @Column(name = "c_position")
+ public Long getC_position() {
+ return c_position;
+ }
+
+ public void setC_position(Long c_position) {
+ this.c_position = c_position;
+ }
+
+ @Column(name = "c_left")
+ public Long getC_left() {
+ return c_left;
+ }
+
+ public void setC_left(Long c_left) {
+ this.c_left = c_left;
+ }
+
+ @Column(name = "c_right")
+ public Long getC_right() {
+ return c_right;
+ }
+
+ public void setC_right(Long c_right) {
+ this.c_right = c_right;
+ }
+
+ @Column(name = "c_level")
+ public Long getC_level() {
+ return c_level;
+ }
+
+ public void setC_level(Long c_level) {
+ this.c_level = c_level;
+ }
+
+ @Column(name = "c_title")
+ public String getC_title() {
+ return c_title;
+ }
+
+ public void setC_title(String c_title) {
+ this.c_title = c_title;
+ }
+
+ @Column(name = "c_type")
+ public String getC_type() {
+ return c_type;
+ }
+
+ public void setC_type(String c_type) {
+ this.c_type = c_type;
+ }
+
+ @Transient
+ public String getData() {
+ return c_title;
+ }
+
+ @Transient
+ public boolean isCopied() {
+ return this.getCopy() == 1;
+ }
+
+ @Transient
+ public long getRef() {
+ return ref;
+ }
+
+ public void setRef(long ref) {
+ this.ref = ref;
+ }
+
+ @Transient
+ public long getCopy() {
+ return copy;
+ }
+
+ public void setCopy(long copy) {
+ this.copy = copy;
+ }
+
+ @Transient
+ public long getMultiCounter() {
+ return multiCounter;
+ }
+
+ public void setMultiCounter(long multiCounter) {
+ this.multiCounter = multiCounter;
+ }
+
+ @Transient
+ public String getState() {
+ String returnCode = new String();
+
+ if (getChildcount() == null || getChildcount().equals(" ")) {
+ returnCode = "update status";
+ } else if (getChildcount().equals("InChild")) {
+ returnCode = "closed";
+ } else {
+ returnCode = "leafNode";
+ }
+ return returnCode;
+ }
+
+ @Transient
+ public long getStatus() {
+ return status;
+ }
+
+ public void setStatus(long status) {
+ this.status = status;
+ }
+
+ @Transient
+ public String getChildcount() {
+ if((c_right - c_left)>1){
+ return "InChild";
+ }
+ return "NoChild";
+ }
+
+ public void setChildcount(String childcount) {
+ this.childcount = childcount;
+ }
+
+ @Transient
+ public long getFixCopyId() {
+ return fixCopyId;
+ }
+
+ public void setFixCopyId(long fixCopyId) {
+ this.fixCopyId = fixCopyId;
+ }
+
+ @Transient
+ public String getAjaxMessage() {
+ return ajaxMessage;
+ }
+
+ public void setAjaxMessage(String ajaxMessage) {
+ this.ajaxMessage = ajaxMessage;
+ }
+
+ @Transient
+ public String getSearchStr() {
+ return searchStr;
+ }
+
+ public void setSearchStr(String searchStr) {
+ this.searchStr = searchStr;
+ }
+
+ @Transient
+ public long getIdif() {
+ return idif;
+ }
+
+ public void setIdif(long idif) {
+ this.idif = idif;
+ }
+
+ @Transient
+ public long getLdif() {
+ return ldif;
+ }
+
+ public void setLdif(long ldif) {
+ this.ldif = ldif;
+ }
+
+ @Transient
+ public long getSpaceOfTargetNode() {
+ return spaceOfTargetNode;
+ }
+
+ public void setSpaceOfTargetNode(long spaceOfTargetNode) {
+ this.spaceOfTargetNode = spaceOfTargetNode;
+ }
+
+ @Transient
+ public Collection getC_idsByChildNodeFromNodeById() {
+ return c_idsByChildNodeFromNodeById;
+ }
+
+ public void setC_idsByChildNodeFromNodeById(Collection c_idsByChildNodeFromNodeById) {
+ this.c_idsByChildNodeFromNodeById = c_idsByChildNodeFromNodeById;
+ }
+
+ @Transient
+ public long getFixCopyPosition() {
+ return fixCopyPosition;
+ }
+
+ public void setFixCopyPosition(long fixCopyPosition) {
+ this.fixCopyPosition = fixCopyPosition;
+ }
+
+ @Transient
+ public long getRightPositionFromNodeByRef() {
+ return rightPositionFromNodeByRef;
+ }
+
+ public void setRightPositionFromNodeByRef(long rightPositionFromNodeByRef) {
+ this.rightPositionFromNodeByRef = rightPositionFromNodeByRef;
+ }
+
+ @Transient
+ public JsTreeHibernateBaseDTO getNodeById() {
+ return nodeById;
+ }
+
+ public void setNodeById(JsTreeHibernateBaseDTO nodeById) {
+ this.nodeById = nodeById;
+ }
+
+ @Transient
+ public long getIdifLeft() {
+ return idifLeft;
+ }
+
+ public void setIdifLeft(long idifLeft) {
+ this.idifLeft = idifLeft;
+ }
+
+ @Transient
+ public long getIdifRight() {
+ return idifRight;
+ }
+
+ public void setIdifRight(long idifRight) {
+ this.idifRight = idifRight;
+ }
+
+ @Transient
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ @Transient
+ public HashMap getAttr() {
+ attr.put("id", "node_" + c_id);
+ attr.put("rel", c_type);
+ return attr;
+ }
+
+ @Override
+ @Transient
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+ @Override
+ @Transient
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ JsTreeHibernateBaseDTO that = (JsTreeHibernateBaseDTO) o;
+
+ if (c_id != that.c_id)
+ return false;
+ if (c_left != that.c_left)
+ return false;
+ if (c_level != that.c_level)
+ return false;
+ if (c_parentid != that.c_parentid)
+ return false;
+ if (c_position != that.c_position)
+ return false;
+ if (c_right != that.c_right)
+ return false;
+ if (copy != that.copy)
+ return false;
+ if (fixCopyId != that.fixCopyId)
+ return false;
+ if (fixCopyPosition != that.fixCopyPosition)
+ return false;
+ if (hashCode != that.hashCode)
+ return false;
+ if (id != that.id)
+ return false;
+ if (idif != that.idif)
+ return false;
+ if (idifLeft != that.idifLeft)
+ return false;
+ if (idifRight != that.idifRight)
+ return false;
+ if (ldif != that.ldif)
+ return false;
+ if (multiCounter != that.multiCounter)
+ return false;
+ if (ref != that.ref)
+ return false;
+ if (rightPositionFromNodeByRef != that.rightPositionFromNodeByRef)
+ return false;
+ if (spaceOfTargetNode != that.spaceOfTargetNode)
+ return false;
+ if (status != that.status)
+ return false;
+ if (!attr.equals(that.attr))
+ return false;
+ if (c_idsByChildNodeFromNodeById != null ? !c_idsByChildNodeFromNodeById
+ .equals(that.c_idsByChildNodeFromNodeById) : that.c_idsByChildNodeFromNodeById != null)
+ return false;
+ if (c_title != null ? !c_title.equals(that.c_title) : that.c_title != null)
+ return false;
+ if (c_type != null ? !c_type.equals(that.c_type) : that.c_type != null)
+ return false;
+ if (childcount != null ? !childcount.equals(that.childcount) : that.childcount != null)
+ return false;
+ if (nodeById != null ? !nodeById.equals(that.nodeById) : that.nodeById != null)
+ return false;
+ if (searchStr != null ? !searchStr.equals(that.searchStr) : that.searchStr != null)
+ return false;
+
+ return true;
+ }
+
+}
Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateDTO.java
===================================================================
diff -u
--- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateDTO.java (revision 0)
+++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateDTO.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e)
@@ -0,0 +1,65 @@
+package egovframework.com.ext.jstree.springHibernate.core.vo;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.annotations.DynamicInsert;
+import org.hibernate.annotations.DynamicUpdate;
+import org.hibernate.annotations.SelectBeforeUpdate;
+
+@Entity
+@Table(name = "T_COMPREHENSIVETREE_HIBER")
+@SelectBeforeUpdate(value=true)
+@DynamicInsert(value=true)
+@DynamicUpdate(value=true)
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+@SequenceGenerator(name = "JsTreeSequence", sequenceName = "hibernate_sequence", allocationSize = 1)
+public class JsTreeHibernateDTO extends JsTreeHibernateSearchDTO implements Serializable {
+
+ private static final long serialVersionUID = -6859122566734590165L;
+
+ public JsTreeHibernateDTO() {
+ super();
+ }
+
+ public JsTreeHibernateDTO(Boolean copyBooleanValue) {
+ super();
+ this.copyBooleanValue = copyBooleanValue;
+ }
+
+ /*
+ * Extend Bean Field
+ */
+ private Boolean copyBooleanValue;
+
+ @Transient
+ public Boolean getCopyBooleanValue() {
+ copyBooleanValue = false;
+ if (this.getCopy() == 0) {
+ copyBooleanValue = false;
+ } else {
+ copyBooleanValue = true;
+ }
+ return copyBooleanValue;
+ }
+
+ public void setCopyBooleanValue(Boolean copyBooleanValue) {
+ this.copyBooleanValue = copyBooleanValue;
+ }
+
+ @Override
+ public void setFieldFromNewInstance(T paramInstance) {
+
+ if( paramInstance instanceof JsTreeHibernateDTO){
+ this.setC_title("copy_" + this.getC_title());
+ //여기에 추가 필드 셋팅할것.
+ }
+ }
+
+}
Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernatePaginatedDTO.java
===================================================================
diff -u
--- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernatePaginatedDTO.java (revision 0)
+++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernatePaginatedDTO.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e)
@@ -0,0 +1,230 @@
+package egovframework.com.ext.jstree.springHibernate.core.vo;
+
+import java.io.Serializable;
+
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
+
+@MappedSuperclass
+public abstract class JsTreeHibernatePaginatedDTO extends JsTreeHibernateBaseDTO implements Serializable{
+
+ private static final long serialVersionUID = 3465234289025484577L;
+
+
+ /** 검색조건 */
+ @JsonIgnore
+ private String searchCondition = "";
+
+ /** 검색Keyword */
+ @JsonIgnore
+ private String searchKeyword = "";
+
+ /** 검색사용여부 */
+ @JsonIgnore
+ private String searchUseYn = "";
+
+ /** 현재페이지 */
+ @JsonIgnore
+ private int pageIndex = 1;
+
+ /** 페이지갯수 */
+ @JsonIgnore
+ private int pageUnit = 10;
+
+ /** 페이지사이즈 */
+ @JsonIgnore
+ private int pageSize = 10;
+
+ /** firstIndex */
+ @JsonIgnore
+ private int firstIndex = 1;
+
+ /** lastIndex */
+ @JsonIgnore
+ private int lastIndex = 1;
+
+ /** recordCountPerPage */
+ @JsonIgnore
+ private int recordCountPerPage = 10;
+
+ /** 검색KeywordFrom */
+ @JsonIgnore
+ private String searchKeywordFrom = "";
+
+ /** 검색KeywordTo */
+ @JsonIgnore
+ private String searchKeywordTo = "";
+
+ @JsonIgnore
+ PaginationInfo paginationInfo = new PaginationInfo();
+
+ public JsTreeHibernatePaginatedDTO() {
+ super();
+ paginationSetting();
+ }
+
+ public JsTreeHibernatePaginatedDTO(String searchCondition, String searchKeyword, String searchUseYn, int pageIndex,
+ int pageUnit, int pageSize, int firstIndex, int lastIndex, int recordCountPerPage,
+ String searchKeywordFrom, String searchKeywordTo) {
+ super();
+ this.searchCondition = searchCondition;
+ this.searchKeyword = searchKeyword;
+ this.searchUseYn = searchUseYn;
+ this.pageIndex = pageIndex;
+ this.pageUnit = pageUnit;
+ this.pageSize = pageSize;
+ this.firstIndex = firstIndex;
+ this.lastIndex = lastIndex;
+ this.recordCountPerPage = recordCountPerPage;
+ this.searchKeywordFrom = searchKeywordFrom;
+ this.searchKeywordTo = searchKeywordTo;
+ paginationSetting();
+ }
+
+ private void paginationSetting() {
+ paginationInfo.setCurrentPageNo(getPageIndex());
+ paginationInfo.setRecordCountPerPage(getPageUnit());
+ paginationInfo.setPageSize(getPageSize());
+
+ this.setFirstIndex(paginationInfo.getFirstRecordIndex());
+ this.setLastIndex(paginationInfo.getLastRecordIndex());
+ this.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
+ }
+
+
+ @Transient
+ public int getFirstIndex() {
+ return firstIndex;
+ }
+
+ public void setFirstIndex(int firstIndex) {
+ this.firstIndex = firstIndex;
+ }
+
+ @Transient
+ public int getLastIndex() {
+ return lastIndex;
+ }
+
+ public void setLastIndex(int lastIndex) {
+ this.lastIndex = lastIndex;
+ }
+
+ @Transient
+ public int getRecordCountPerPage() {
+ return recordCountPerPage;
+ }
+
+ public void setRecordCountPerPage(int recordCountPerPage) {
+ this.recordCountPerPage = recordCountPerPage;
+ }
+
+ @Transient
+ public String getSearchCondition() {
+ return searchCondition;
+ }
+
+ public void setSearchCondition(String searchCondition) {
+ this.searchCondition = searchCondition;
+ }
+
+ @Transient
+ public String getSearchKeyword() {
+ return searchKeyword;
+ }
+
+ public void setSearchKeyword(String searchKeyword) {
+ this.searchKeyword = searchKeyword;
+ }
+
+ @Transient
+ public String getSearchUseYn() {
+ return searchUseYn;
+ }
+
+ public void setSearchUseYn(String searchUseYn) {
+ this.searchUseYn = searchUseYn;
+ }
+
+ @Transient
+ public int getPageIndex() {
+ return pageIndex;
+ }
+
+ public void setPageIndex(int pageIndex) {
+ this.pageIndex = pageIndex;
+ }
+
+ @Transient
+ public int getPageUnit() {
+ return pageUnit;
+ }
+
+ public void setPageUnit(int pageUnit) {
+ this.pageUnit = pageUnit;
+ }
+
+ @Transient
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ @Transient
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+
+ /**
+ * searchKeywordFrom attribute를 리턴한다.
+ * @return String
+ */
+ @Transient
+ public String getSearchKeywordFrom() {
+ return searchKeywordFrom;
+ }
+
+ /**
+ * searchKeywordFrom attribute 값을 설정한다.
+ * @param searchKeywordFrom String
+ */
+ public void setSearchKeywordFrom(String searchKeywordFrom) {
+ this.searchKeywordFrom = searchKeywordFrom;
+ }
+
+ /**
+ * searchKeywordTo attribute를 리턴한다.
+ * @return String
+ */
+ @Transient
+ public String getSearchKeywordTo() {
+ return searchKeywordTo;
+ }
+
+ /**
+ * searchKeywordTo attribute 값을 설정한다.
+ * @param searchKeywordTo String
+ */
+ public void setSearchKeywordTo(String searchKeywordTo) {
+ this.searchKeywordTo = searchKeywordTo;
+ }
+
+ @Transient
+ public PaginationInfo getPaginationInfo() {
+ return paginationInfo;
+ }
+
+ public void setPaginationInfo(PaginationInfo paginationInfo) {
+ this.paginationInfo = paginationInfo;
+ }
+}
Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateSearchDTO.java
===================================================================
diff -u
--- standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateSearchDTO.java (revision 0)
+++ standard/project/web/src/main/java/egovframework/com/ext/jstree/springHibernate/core/vo/JsTreeHibernateSearchDTO.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e)
@@ -0,0 +1,213 @@
+package egovframework.com.ext.jstree.springHibernate.core.vo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.Transient;
+
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Disjunction;
+import org.hibernate.criterion.MatchMode;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Projection;
+import org.hibernate.criterion.Restrictions;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import egovframework.com.ext.jstree.support.util.StringUtils;
+import egovframework.com.ext.jstree.support.util.Text;
+
+public abstract class JsTreeHibernateSearchDTO extends JsTreeHibernatePaginatedDTO implements Serializable {
+
+ private static final long serialVersionUID = 2591336265806317114L;
+ @JsonIgnore
+ private List order = new ArrayList<>();
+ @JsonIgnore
+ private List criterions = new ArrayList<>();
+ @JsonIgnore
+ private Projection projection;
+ @JsonIgnore
+ private Map whereMap = new HashMap<>();
+ @JsonIgnore
+ private int whereCount = 0;
+
+ public JsTreeHibernateSearchDTO() {
+ super();
+ }
+
+ public JsTreeHibernateSearchDTO(List order, List criterions, Projection projection,
+ Map whereMap, int whereCount) {
+ super();
+ this.order = order;
+ this.criterions = criterions;
+ this.projection = projection;
+ this.whereMap = whereMap;
+ this.whereCount = whereCount;
+ }
+
+ public abstract void setFieldFromNewInstance(T paramInstance);
+
+ @Transient
+ public List getOrder() {
+ return order;
+ }
+
+ public void setOrder(Order order) {
+ this.order.add(order);
+ }
+
+ @Transient
+ public List getCriterions() {
+ return criterions;
+ }
+
+ @Transient
+ public String getWhereMap(String key) {
+ if (this.whereMap.containsKey(key)) {
+ String value = (String) whereMap.get(key);
+
+ return " \"" + StringUtils.replace(value, "\"", "\\\"") + "\"";
+ }
+ return " \"\"";
+ }
+
+ @Transient
+ public int getWhereCount() {
+ return whereCount;
+ }
+
+ public void setWhere(String propertyName, Object value) {
+ if (null == value) {
+ return;
+ }
+
+ this.whereMap.put(propertyName, value);
+ this.whereCount++;
+
+ if (value instanceof String) {
+ String str = (String) value;
+
+ if (!StringUtils.isEmpty(str)) {
+ if (StringUtils.startsWith(str, "*") && StringUtils.endsWith(str, "*")) {
+ str = StringUtils.removeEnd(str, "*");
+ str = StringUtils.removeStart(str, "*");
+ criterions.add(Restrictions.like(propertyName, str, MatchMode.ANYWHERE));
+ } else if (StringUtils.startsWith(str, "*")) {
+ str = StringUtils.removeStart(str, "*");
+ criterions.add(Restrictions.like(propertyName, str, MatchMode.END));
+ } else if (StringUtils.endsWith(str, "*")) {
+ str = StringUtils.removeEnd(str, "*");
+ criterions.add(Restrictions.like(propertyName, str, MatchMode.START));
+ } else if (StringUtils.startsWith(str, "isNotNull")) {
+ criterions.add(Restrictions.isNotNull(propertyName));
+ } else {
+ criterions.add(Restrictions.eq(propertyName, str));
+ }
+ }
+ } else {
+ criterions.add(Restrictions.eq(propertyName, value));
+ }
+ }
+
+ public void setWhereLike(String propertyName, String str) {
+ if (!StringUtils.isEmpty(str)) {
+ if (!StringUtils.startsWith(str, "*")) {
+ str = "*" + str;
+ }
+
+ if (!StringUtils.endsWith(str, "*")) {
+ str = str + "*";
+ }
+
+ setWhere(propertyName, str);
+ }
+ }
+
+ public void setWhereOr(Criterion... criterions) {
+ Disjunction or = Restrictions.disjunction();
+ for (Criterion criterion : criterions) {
+ or.add(criterion);
+ }
+ this.criterions.add(or);
+ }
+
+ public void setWhereOr(List criterions) {
+ Disjunction or = Restrictions.disjunction();
+ for (Criterion criterion : criterions) {
+ or.add(criterion);
+ }
+ this.criterions.add(or);
+ }
+
+ public void setWhere(Criterion criterion) {
+ criterions.add(criterion);
+ }
+
+ public void setWhere(Projection projection) {
+ this.projection = projection;
+ }
+
+ @Transient
+ public Projection getProjection() {
+ return projection;
+ }
+
+ public void setWhereBetween(String propertyName, Object lo, Object hi) {
+ if (null != lo && null != hi) {
+ criterions.add(Restrictions.between(propertyName, lo, hi));
+ }
+ }
+
+ public void setWhereIn(String propertyName, Collection> values) {
+ criterions.add(Restrictions.in(propertyName, values));
+ }
+
+ public void setWhereIn(String propertyName, Object[] values) {
+ criterions.add(Restrictions.in(propertyName, values));
+ }
+
+ public void setWhereIp(String propertyName, String value, String propertyIpStartName, String propertyIpEndName) {
+ if (null == value) {
+ return;
+ }
+
+ boolean flag = Text.isIpv4(value);
+ if (flag) {
+ long[] ipLong = Text.ipToLong2(value);
+ criterions.add(Restrictions.or(
+ Restrictions.eq(propertyName, value),
+ Restrictions.and(Restrictions.le(propertyIpStartName, ipLong[0]),
+ Restrictions.ge(propertyIpEndName, ipLong[1]))));
+ } else {
+ setWhere(propertyName, value);
+ }
+
+ }
+
+ @Transient
+ public List getMembersCriterions(String propertyName, Object value, String seperator) {
+ List criterionLists = new ArrayList<>();
+
+ if (value instanceof String) {
+ String str = (String) value;
+
+ if (!StringUtils.isEmpty(str)) {
+ if (StringUtils.startsWith(str, "*") || StringUtils.endsWith(str, "*")) {
+ str = StringUtils.removeEnd(str, "*");
+ str = StringUtils.removeStart(str, "*");
+ criterionLists.add(Restrictions.like(propertyName, str, MatchMode.ANYWHERE));
+ } else {
+ String strValue = seperator + str + seperator;
+ criterionLists.add(Restrictions.sqlRestriction("'" + seperator + "' || " + propertyName + " || '"
+ + seperator + "' like '%" + strValue + "%'"));
+ }
+ }
+ }
+
+ return criterionLists;
+ }
+}
Index: standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/GenericAbstractController.java
===================================================================
diff -u
--- standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/GenericAbstractController.java (revision 0)
+++ standard/project/web/src/main/java/egovframework/com/ext/jstree/support/mvc/GenericAbstractController.java (revision 29fd864ddfe9ed46b56befbfdb21e46913b2043e)
@@ -0,0 +1,128 @@
+package egovframework.com.ext.jstree.support.mvc;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springmodules.validation.commons.DefaultBeanValidator;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import egovframework.com.cmm.EgovMessageSource;
+import egovframework.com.ext.jstree.support.util.ParameterParser;
+
+public abstract class GenericAbstractController {
+
+ @Resource(name = "egovMessageSource")
+ EgovMessageSource egovMessageSource;
+ @Autowired
+ private DefaultBeanValidator defaultBeanValidator;
+
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ public ParameterParser getParameterParser(HttpServletRequest request){
+ return new ParameterParser(request);
+ }
+
+ public T invokeBeanValidate(T clazz, BindingResult bindingResult) {
+ defaultBeanValidator.validate(clazz, bindingResult);
+ if (bindingResult.hasErrors()) { // 만일 validation 에러가 있으면...
+ logger.error(clazz.getClass() + " validate error");
+ return clazz;
+ }
+ return clazz;
+ }
+
+ @ExceptionHandler(Exception.class)
+ public void defenceException(Exception ex, HttpServletResponse response, HttpServletRequest request)
+ throws IOException {
+ if (logger.isDebugEnabled()) {
+ ex.printStackTrace();
+ }
+
+ response.setHeader("Expires", "-1");
+ response.setHeader("Cache-Control", "must-revalidate, no-store, no-cache");
+ response.addHeader("Cache-Control", "post-check=0, pre-check=0");
+ response.setHeader("Pragma", "no-cache");
+ response.setContentType("application/json; charset=UTF-8");
+ PrintWriter out = response.getWriter();
+ Map map = new HashMap();
+ map.put("status", 0);
+ Gson gson = new GsonBuilder().serializeNulls().create();
+ out.println(gson.toJson(map));
+ out.flush();
+ out.close();
+ return;
+/* if (StringUtils.equals(request.getHeader("customHeader"), "ajax")) {
+ response.setContentType("application/json; charset=UTF-8");
+
+ Map map = new HashMap();
+ map.put("result", false);
+ map.put("status", 0);
+ // map.put("message",
+ // egovMessageSource.getMessage(ex.getMessage(),
+ // ex.getStackTrace(), "", request));
+ map.put("message", egovMessageSource.getMessage(ex.getMessage()));
+
+ Gson gson = new GsonBuilder().serializeNulls().create();
+ out.println(gson.toJson(map));
+ out.flush();
+ out.close();
+ return;
+ } else {
+ response.setContentType("text/html; charset=utf-8");
+
+ out.println("");
+ out.println("");
+ out.println("");
+ out.println("");
+ out.println("");
+ out.println("");
+ } else {
+ out.println("parent.warning(getMessage(\"" + ex.getMessage() + "\"))");
+ out.println("