Index: web-module/pom.xml =================================================================== diff -u -r3c38c2a74fcf0de0aa2147aeaeae9e3b0379c809 -r705db60c7eea6e025d2695816c923ace0ecb49f6 --- web-module/pom.xml (.../pom.xml) (revision 3c38c2a74fcf0de0aa2147aeaeae9e3b0379c809) +++ web-module/pom.xml (.../pom.xml) (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -17,7 +17,7 @@ Web Project by 313 DEV GRP - 22.12.13 + 22.12.16 Index: web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/AdminPdServiceLogController.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/AdminPdServiceLogController.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/AdminPdServiceLogController.java (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -0,0 +1,51 @@ +/* + * @author Dongmin.lee + * @since 2022-11-20 + * @version 22.11.20 + * @see
+ *  Copyright (C) 2007 by 313 DEV GRP, Inc - All Rights Reserved
+ *  Unauthorized copying of this file, via any medium is strictly prohibited
+ *  Proprietary and confidential
+ *  Written by 313 developer group <313@313.co.kr>, December 2010
+ * 
+ */ +package egovframework.api.arms.module_pdservicelog.controller; + +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; +import javax.annotation.PostConstruct; +import javax.servlet.http.HttpServletRequest; +import java.util.Comparator; +import java.util.List; +import java.util.NoSuchElementException; + +import egovframework.com.ext.jstree.springHibernate.core.controller.SHVAbstractController; + +import egovframework.api.arms.module_pdservicelog.model.PdServiceLogDTO; +import egovframework.api.arms.module_pdservicelog.service.PdServiceLog; + +@Slf4j +@Controller +@RequestMapping(value = {"/auth-admin/api/arms/pdServiceLog"}) +public class AdminPdServiceLogController extends SHVAbstractController { + + @Autowired + @Qualifier("pdServiceLog") + private PdServiceLog pdServiceLog; + + @PostConstruct + public void initialize() { + setJsTreeHibernateService(pdServiceLog); + } + +} Index: web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/AnonPdServiceLogController.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/AnonPdServiceLogController.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/AnonPdServiceLogController.java (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -0,0 +1,51 @@ +/* + * @author Dongmin.lee + * @since 2022-11-20 + * @version 22.11.20 + * @see
+ *  Copyright (C) 2007 by 313 DEV GRP, Inc - All Rights Reserved
+ *  Unauthorized copying of this file, via any medium is strictly prohibited
+ *  Proprietary and confidential
+ *  Written by 313 developer group <313@313.co.kr>, December 2010
+ * 
+ */ +package egovframework.api.arms.module_pdservicelog.controller; + +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; +import javax.annotation.PostConstruct; +import javax.servlet.http.HttpServletRequest; +import java.util.Comparator; +import java.util.List; +import java.util.NoSuchElementException; + +import egovframework.com.ext.jstree.springHibernate.core.controller.SHVAbstractController; + +import egovframework.api.arms.module_pdservicelog.model.PdServiceLogDTO; +import egovframework.api.arms.module_pdservicelog.service.PdServiceLog; + +@Slf4j +@Controller +@RequestMapping(value = {"/auth-anon/api/arms/pdServiceLog"}) +public class AnonPdServiceLogController extends SHVAbstractController { + + @Autowired + @Qualifier("pdServiceLog") + private PdServiceLog pdServiceLog; + + @PostConstruct + public void initialize() { + setJsTreeHibernateService(pdServiceLog); + } + +} Index: web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/UserPdServiceLogController.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/UserPdServiceLogController.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_pdservicelog/controller/UserPdServiceLogController.java (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -0,0 +1,53 @@ +/* + * @author Dongmin.lee + * @since 2022-11-20 + * @version 22.11.20 + * @see
+ *  Copyright (C) 2007 by 313 DEV GRP, Inc - All Rights Reserved
+ *  Unauthorized copying of this file, via any medium is strictly prohibited
+ *  Proprietary and confidential
+ *  Written by 313 developer group <313@313.co.kr>, December 2010
+ * 
+ */ +package egovframework.api.arms.module_pdservicelog.controller; + +import lombok.extern.slf4j.Slf4j; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.ModelAndView; +import javax.annotation.PostConstruct; +import javax.servlet.http.HttpServletRequest; +import java.util.Comparator; +import java.util.List; +import java.util.NoSuchElementException; + +import egovframework.com.ext.jstree.springHibernate.core.controller.SHVAbstractController; + +import egovframework.api.arms.module_pdservicelog.model.PdServiceLogDTO; +import egovframework.api.arms.module_pdservicelog.service.PdServiceLog; + +@Slf4j +@Controller +@RequestMapping(value = {"/auth-user/api/arms/pdServiceLog"}) +public class UserPdServiceLogController extends SHVAbstractController { + + @Autowired + @Qualifier("pdServiceLog") + private PdServiceLog pdServiceLog; + + @PostConstruct + public void initialize() { + setJsTreeHibernateService(pdServiceLog); + } + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + +} Index: web-module/src/main/java/egovframework/api/arms/module_pdservicelog/model/PdServiceLogDTO.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_pdservicelog/model/PdServiceLogDTO.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_pdservicelog/model/PdServiceLogDTO.java (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -0,0 +1,71 @@ +/* + * @author Dongmin.lee + * @since 2022-11-20 + * @version 22.11.20 + * @see
+ *  Copyright (C) 2007 by 313 DEV GRP, Inc - All Rights Reserved
+ *  Unauthorized copying of this file, via any medium is strictly prohibited
+ *  Proprietary and confidential
+ *  Written by 313 developer group <313@313.co.kr>, December 2010
+ * 
+ */ +package egovframework.api.arms.module_pdservicelog.model; + +import org.hibernate.annotations.*; +import org.hibernate.annotations.Cache; +import javax.persistence.*; +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateDTO; +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; + +@Entity +@Table(name = "T_ARMS_PDSERVICE_LOG") +@SelectBeforeUpdate(value=true) +@DynamicInsert(value=true) +@DynamicUpdate(value=true) +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +@SequenceGenerator(name = "JsTreeSequence", sequenceName = "S_T_ARMS_PDSERVICE_LOG", allocationSize = 1) +public class PdServiceLogDTO extends JsTreeHibernateSearchDTO implements Serializable { + + public PdServiceLogDTO() { + super(); + } + + public PdServiceLogDTO(Boolean copyBooleanValue) { + super(); + this.copyBooleanValue = copyBooleanValue; + } + + //@Getter @Setter + + /* + * 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){ + if(paramInstance.isCopied()) { + this.setC_title("copy_" + this.getC_title()); + } + } + } +} Index: web-module/src/main/java/egovframework/api/arms/module_pdservicelog/service/PdServiceLog.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_pdservicelog/service/PdServiceLog.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_pdservicelog/service/PdServiceLog.java (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -0,0 +1,20 @@ +/* + * @author Dongmin.lee + * @since 2022-11-20 + * @version 22.11.20 + * @see
+ *  Copyright (C) 2007 by 313 DEV GRP, Inc - All Rights Reserved
+ *  Unauthorized copying of this file, via any medium is strictly prohibited
+ *  Proprietary and confidential
+ *  Written by 313 developer group <313@313.co.kr>, December 2010
+ * 
+ */ +package egovframework.api.arms.module_pdservicelog.service; + +import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateService; + +public interface PdServiceLog extends JsTreeHibernateService { + + + +} \ No newline at end of file Index: web-module/src/main/java/egovframework/api/arms/module_pdservicelog/service/PdServiceLogImpl.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_pdservicelog/service/PdServiceLogImpl.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_pdservicelog/service/PdServiceLogImpl.java (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -0,0 +1,22 @@ +/* + * @author Dongmin.lee + * @since 2022-11-20 + * @version 22.11.20 + * @see
+ *  Copyright (C) 2007 by 313 DEV GRP, Inc - All Rights Reserved
+ *  Unauthorized copying of this file, via any medium is strictly prohibited
+ *  Proprietary and confidential
+ *  Written by 313 developer group <313@313.co.kr>, December 2010
+ * 
+ */ +package egovframework.api.arms.module_pdservicelog.service; + +import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateServiceImpl; +import org.springframework.stereotype.Service; + +@Service("pdServiceLog") +public class PdServiceLogImpl extends JsTreeHibernateServiceImpl implements PdServiceLog{ + + + +} \ No newline at end of file Index: web-module/src/main/java/egovframework/api/arms/module_reqadd/controller/UserReqAddController.java =================================================================== diff -u -r84e1c82407103a9e26b421f2efa3af8931ddf7a5 -r705db60c7eea6e025d2695816c923ace0ecb49f6 --- web-module/src/main/java/egovframework/api/arms/module_reqadd/controller/UserReqAddController.java (.../UserReqAddController.java) (revision 84e1c82407103a9e26b421f2efa3af8931ddf7a5) +++ web-module/src/main/java/egovframework/api/arms/module_reqadd/controller/UserReqAddController.java (.../UserReqAddController.java) (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -88,12 +88,12 @@ @PathVariable(value ="changeReqTableName") String changeReqTableName, ReqAddDTO reqAddDTO, ModelMap model, HttpServletRequest request) throws Exception { - SessionUtil.setAttribute("replaceTableName",changeReqTableName); + SessionUtil.setAttribute("getMonitor",changeReqTableName); reqAddDTO.setOrder(Order.asc("c_left")); List list = this.reqAdd.getChildNode(reqAddDTO); - SessionUtil.removeAttribute("replaceTableName"); + SessionUtil.removeAttribute("getMonitor"); ModelAndView modelAndView = new ModelAndView("jsonView"); modelAndView.addObject("result", list); @@ -115,7 +115,7 @@ throw new RuntimeException(); } else { - SessionUtil.setAttribute("replaceTableName",changeReqTableName); + SessionUtil.setAttribute("getNode",changeReqTableName); V returnVO = reqAdd.getNode(reqAddDTO); if(StringUtils.isNotEmpty(returnVO.getC_version_Link())) { @@ -124,7 +124,7 @@ returnVO.setC_version_Link(replaceTxt); } - SessionUtil.removeAttribute("replaceTableName"); + SessionUtil.removeAttribute("getNode"); ModelAndView modelAndView = new ModelAndView("jsonView"); modelAndView.addObject("result", returnVO); @@ -145,12 +145,12 @@ throw new RuntimeException(); } else { - SessionUtil.setAttribute("replaceTableName",changeReqTableName); + SessionUtil.setAttribute("getChildNode",changeReqTableName); reqAddDTO.setWhere("c_parentid", new Long(parser.get("c_id"))); List list = reqAdd.getChildNode(reqAddDTO); - SessionUtil.removeAttribute("replaceTableName"); + SessionUtil.removeAttribute("getChildNode"); ModelAndView modelAndView = new ModelAndView("jsonView"); modelAndView.addObject("result", list); @@ -171,7 +171,7 @@ throw new RuntimeException(); } else { - SessionUtil.setAttribute("replaceTableName",changeReqTableName); + SessionUtil.setAttribute("getChildNodeWithParent",changeReqTableName); //쿼리 Criterion criterion1 = Restrictions.ge("c_left", reqAddDTO.getC_left()); @@ -182,7 +182,7 @@ reqAddDTO.setC_id(null); List list = reqAdd.getChildNode(reqAddDTO); - SessionUtil.removeAttribute("replaceTableName"); + SessionUtil.removeAttribute("getChildNodeWithParent"); ModelAndView modelAndView = new ModelAndView("jsonView"); modelAndView.addObject("result", list); @@ -204,13 +204,16 @@ throw new RuntimeException(); } else { - SessionUtil.setAttribute("replaceTableName",changeReqTableName); + SessionUtil.setAttribute("addNode",changeReqTableName); - reqAddDTO.setC_title(Util_TitleChecker.StringReplace(reqAddDTO.getC_title())); - ReqAddDTO returnNode = reqAdd.addNode(reqAddDTO); + ReqAddDTO refReqAddDTO = new ReqAddDTO(); + refReqAddDTO.setC_id(reqAddDTO.getRef()); + ReqAddDTO nodeByRef = reqAdd.getNode(refReqAddDTO); - SessionUtil.removeAttribute("replaceTableName"); + ReqAddDTO returnNode = reqAdd.addNodeToSwitchTable(reqAddDTO, nodeByRef); + SessionUtil.removeAttribute("addNode"); + ModelAndView modelAndView = new ModelAndView("jsonView"); modelAndView.addObject("result", returnNode); return modelAndView; @@ -227,12 +230,12 @@ if (bindingResult.hasErrors()) { throw new RuntimeException(); } else { - SessionUtil.setAttribute("replaceTableName",changeReqTableName); + SessionUtil.setAttribute("updateNode",changeReqTableName); ModelAndView modelAndView = new ModelAndView("jsonView"); modelAndView.addObject("result", this.reqAdd.updateNode(reqAddDTO)); - SessionUtil.removeAttribute("replaceTableName"); + SessionUtil.removeAttribute("updateNode"); return modelAndView; } @@ -252,12 +255,16 @@ throw new RuntimeException(); } else { - SessionUtil.setAttribute("replaceTableName",changeReqTableName); + SessionUtil.setAttribute("moveNode",changeReqTableName); - this.reqAdd.moveNode(reqAddDTO, request); + ReqAddDTO refReqAddDTO = new ReqAddDTO(); + refReqAddDTO.setC_id(reqAddDTO.getRef()); + ReqAddDTO nodeByRef = reqAdd.getNode(refReqAddDTO); + + this.reqAdd.moveNodeToSwitchTable(reqAddDTO, nodeByRef, request); super.setJsonDefaultSetting(reqAddDTO); - SessionUtil.removeAttribute("replaceTableName"); + SessionUtil.removeAttribute("moveNode"); ModelAndView modelAndView = new ModelAndView("jsonView"); modelAndView.addObject("result", reqAddDTO); Index: web-module/src/main/java/egovframework/api/arms/module_reqadd/service/ReqAdd.java =================================================================== diff -u -r47623bd6475cdd605786389e3566657d25021224 -r705db60c7eea6e025d2695816c923ace0ecb49f6 --- web-module/src/main/java/egovframework/api/arms/module_reqadd/service/ReqAdd.java (.../ReqAdd.java) (revision 47623bd6475cdd605786389e3566657d25021224) +++ web-module/src/main/java/egovframework/api/arms/module_reqadd/service/ReqAdd.java (.../ReqAdd.java) (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -12,9 +12,14 @@ package egovframework.api.arms.module_reqadd.service; import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateService; +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; +import javax.servlet.http.HttpServletRequest; + public interface ReqAdd extends JsTreeHibernateService { + public T addNodeToSwitchTable(T jsTreeHibernateDTO, T refNode) throws Exception; + public T moveNodeToSwitchTable(T jsTreeHibernateDTO, T refNode , HttpServletRequest request) throws Exception; } \ No newline at end of file Index: web-module/src/main/java/egovframework/api/arms/module_reqadd/service/ReqAddImpl.java =================================================================== diff -u -r47623bd6475cdd605786389e3566657d25021224 -r705db60c7eea6e025d2695816c923ace0ecb49f6 --- web-module/src/main/java/egovframework/api/arms/module_reqadd/service/ReqAddImpl.java (.../ReqAddImpl.java) (revision 47623bd6475cdd605786389e3566657d25021224) +++ web-module/src/main/java/egovframework/api/arms/module_reqadd/service/ReqAddImpl.java (.../ReqAddImpl.java) (revision 705db60c7eea6e025d2695816c923ace0ecb49f6) @@ -11,12 +11,192 @@ */ package egovframework.api.arms.module_reqadd.service; +import egovframework.com.ext.jstree.springHibernate.core.dao.JsTreeHibernateDao; import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateServiceImpl; +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; +import org.apache.commons.collections15.CollectionUtils; +import org.apache.commons.collections15.Transformer; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.DetachedCriteria; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Collection; +import java.util.List; + @Service("reqAdd") public class ReqAddImpl extends JsTreeHibernateServiceImpl implements ReqAdd{ + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @SuppressWarnings("rawtypes") + @Resource(name = "jsTreeHibernateDao") + private JsTreeHibernateDao jsTreeHibernateDao; + @Override + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public T addNodeToSwitchTable(T jsTreeHibernateDTO, T refNode) throws Exception { + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + if (jsTreeHibernateDTO.getRef() < 0) { + throw new RuntimeException("ref is minus"); + } else { + //T nodeByRef = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getRef()); + + if ("default".equals(refNode.getC_type())) { + throw new RuntimeException("nodeByRef is default Type"); + } + + refNode.setWhere("c_parentid", refNode.getC_id()); + final long lastPosiotionOfNodeByRef = jsTreeHibernateDao.getCount(refNode); + + jsTreeHibernateDTO.setC_position(lastPosiotionOfNodeByRef); + + long rightPointFromNodeByRef = refNode.getC_right(); + rightPointFromNodeByRef = Math.max(rightPointFromNodeByRef, 1); + + long spaceOfTargetNode = 2; + + super.stretchLeftRightForMyselfFromJstree(spaceOfTargetNode, rightPointFromNodeByRef, + jsTreeHibernateDTO.getCopy(), null, jsTreeHibernateDTO); + + long targetNodeLevel = jsTreeHibernateDTO.getRef() == 0 ? 0 : refNode.getC_level() + 1; + + jsTreeHibernateDTO.setC_parentid(jsTreeHibernateDTO.getRef()); + jsTreeHibernateDTO.setC_left(rightPointFromNodeByRef); + jsTreeHibernateDTO.setC_right(rightPointFromNodeByRef + 1); + jsTreeHibernateDTO.setC_level(targetNodeLevel); + + long insertSeqResult = (long) jsTreeHibernateDao.insert(jsTreeHibernateDTO); + if (insertSeqResult > 0) { + final long SUCCESS = 1; + jsTreeHibernateDTO.setStatus(SUCCESS); + jsTreeHibernateDTO.setId(insertSeqResult); + } else { + throw new RuntimeException("심각한 오류 발생 - 삽입 노드"); + } + } + return jsTreeHibernateDTO; + } + + @Override + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public T moveNodeToSwitchTable(T jsTreeHibernateDTO, T refNode, HttpServletRequest request) throws Exception { + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + + logger.debug("***********************MoveNode***********************"); + logger.debug("-----------------------getNode 완료-----------------------"); + + T nodeById = getNode(jsTreeHibernateDTO); + if (nodeById == null) { + throw new RuntimeException("nodeById is null"); + } + Long nodeByIdLeft = nodeById.getC_left(); + + logger.debug("-----------------------getChildNodeByLeftRight 완료-----------------------"); + DetachedCriteria getChildNodeByLeftRightCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + Criterion whereChildNodeByLeftRight = Restrictions.ge("c_left", nodeById.getC_left()); + getChildNodeByLeftRightCriteria.add(whereChildNodeByLeftRight); + getChildNodeByLeftRightCriteria.add(Restrictions.and(Restrictions.le("c_right", nodeById.getC_right()))); + getChildNodeByLeftRightCriteria.addOrder(Order.asc("c_left")); + List childNodesFromNodeById = jsTreeHibernateDao.getListWithoutPaging(getChildNodeByLeftRightCriteria); + + logger.debug("-----------------------nodeByRef 완료-----------------------"); + //T nodeByRef = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getRef()); + long rightPointFromNodeByRef = refNode.getC_right(); + + logger.debug("-----------------------childNodesFromNodeByRef 완료-----------------------"); + DetachedCriteria getNodeByRefCriteria = DetachedCriteria.forClass(jsTreeHibernateDTO.getClass()); + Criterion whereNodeByRef = Restrictions.eq("c_parentid", refNode.getC_id()); + getNodeByRefCriteria.add(whereNodeByRef); + List childNodesFromNodeByRef = (List) jsTreeHibernateDao.getListWithoutPaging(getNodeByRefCriteria); + + T t_ComprehensiveTree = newInstance(jsTreeHibernateDTO); + + long spaceOfTargetNode = 2; + Collection c_idsByChildNodeFromNodeById = null; + + logger.debug("-----------------------c_idsByChildNodeFromNodeById 완료-----------------------"); + c_idsByChildNodeFromNodeById = CollectionUtils.collect(childNodesFromNodeById, new Transformer() { + @Override + public Long transform(T childNodePerNodeById) { + return childNodePerNodeById.getC_id(); + } + }); + + if (c_idsByChildNodeFromNodeById.contains(jsTreeHibernateDTO.getRef())) { + throw new RuntimeException("myself contains already refTargetNode"); + } + + spaceOfTargetNode = nodeById.getC_right() - nodeById.getC_left() + 1; + + if (!jsTreeHibernateDTO.isCopied()) { + logger.debug("-----------------------cutMyself 완료-----------------------"); + this.cutMyself(nodeById, spaceOfTargetNode, c_idsByChildNodeFromNodeById); + } + + logger.debug("-----------------------calculatePostion 완료-----------------------"); + this.calculatePostion(jsTreeHibernateDTO, nodeById, childNodesFromNodeByRef, request); + + if (rightPointFromNodeByRef < 1) { + rightPointFromNodeByRef = 1; + } + + if (!jsTreeHibernateDTO.isCopied()) { + logger.debug("-----------------------stretchPositionForMyselfFromJstree 완료-----------------------"); + this.stretchPositionForMyselfFromJstree(c_idsByChildNodeFromNodeById, jsTreeHibernateDTO); + + int selfPosition = (nodeById.getC_parentid() == jsTreeHibernateDTO.getRef() && jsTreeHibernateDTO + .getC_position() > nodeById.getC_position()) ? 1 : 0; + + for (T child : childNodesFromNodeByRef) { + if (child.getC_position() - selfPosition == jsTreeHibernateDTO.getC_position()) { + rightPointFromNodeByRef = child.getC_left(); + break; + } + } + + if (nodeById.getC_left() < rightPointFromNodeByRef) { + rightPointFromNodeByRef -= spaceOfTargetNode; + } + } + + logger.debug("-----------------------stretchLeftRightForMyselfFromJstree 완료-----------------------"); + this.stretchLeftRightForMyselfFromJstree(spaceOfTargetNode, rightPointFromNodeByRef, + jsTreeHibernateDTO.getCopy(), c_idsByChildNodeFromNodeById, jsTreeHibernateDTO); + + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>>>>>>" + rightPointFromNodeByRef); + } + + long targetNodeLevel = nodeById.getC_level() - (refNode.getC_level() + 1); + long comparePoint = nodeByIdLeft - rightPointFromNodeByRef; + + if (logger.isDebugEnabled()) { + logger.debug(">>>>>>>>>>>>>>>>>>>>" + comparePoint); + } + + if (jsTreeHibernateDTO.isCopied()) { + logger.debug("-----------------------pasteMyselfFromJstree 완료-----------------------"); + long insertSeqResult = this + .pasteMyselfFromJstree(jsTreeHibernateDTO.getRef(), comparePoint, spaceOfTargetNode, + targetNodeLevel, c_idsByChildNodeFromNodeById, rightPointFromNodeByRef, nodeById); + t_ComprehensiveTree.setId(insertSeqResult); + logger.debug("-----------------------fixPositionParentIdOfCopyNodes-----------------------"); + this.fixPositionParentIdOfCopyNodes(insertSeqResult, jsTreeHibernateDTO.getC_position(), jsTreeHibernateDTO); + } else { + logger.debug("-----------------------enterMyselfFromJstree 완료-----------------------"); + this.enterMyselfFromJstree(jsTreeHibernateDTO.getRef(), jsTreeHibernateDTO.getC_position(), + jsTreeHibernateDTO.getC_id(), comparePoint, targetNodeLevel, c_idsByChildNodeFromNodeById, + jsTreeHibernateDTO); + enterMyselfFixLeftRight(comparePoint, targetNodeLevel, c_idsByChildNodeFromNodeById, jsTreeHibernateDTO); + } + return t_ComprehensiveTree; + } } \ No newline at end of file