Index: core-module/pom.xml =================================================================== diff -u -rced88b02a5aff8f2bf763358634427c89dbd1865 -r7924ec670440498996caf9537aca25bb650c1f10 --- core-module/pom.xml (.../pom.xml) (revision ced88b02a5aff8f2bf763358634427c89dbd1865) +++ core-module/pom.xml (.../pom.xml) (revision 7924ec670440498996caf9537aca25bb650c1f10) @@ -7,7 +7,7 @@ 313devgrp java-service-tree-framework-core-library - 22.07.24 + 22.07.25 ../pom.xml @@ -31,7 +31,7 @@ 313devgrp lib-module - 22.07.24 + 22.07.25 pom Index: core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/controller/SHVAbstractController.java =================================================================== diff -u -rced88b02a5aff8f2bf763358634427c89dbd1865 -r7924ec670440498996caf9537aca25bb650c1f10 --- core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/controller/SHVAbstractController.java (.../SHVAbstractController.java) (revision ced88b02a5aff8f2bf763358634427c89dbd1865) +++ core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/controller/SHVAbstractController.java (.../SHVAbstractController.java) (revision 7924ec670440498996caf9537aca25bb650c1f10) @@ -21,6 +21,7 @@ import egovframework.com.ext.jstree.support.util.ParameterParser; import org.hibernate.criterion.Order; import org.springframework.ui.ModelMap; +import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; @@ -30,12 +31,14 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Field; import java.util.HashMap; import java.util.List; public abstract class SHVAbstractController extends GenericAbstractController { private T jsTreeHibernateService; + private V returnVO; public void setJsTreeHibernateService( T jsTreeHibernateService) { this.jsTreeHibernateService = jsTreeHibernateService; @@ -155,6 +158,20 @@ } @ResponseBody + @RequestMapping(value = "/updateNode.do") + public ModelAndView updateNode(@Validated(value = UpdateNode.class) V jsTreeHibernateSearchDTO, + BindingResult bindingResult, HttpServletRequest request, ModelMap model) throws Exception { + + if (bindingResult.hasErrors()) { + throw new RuntimeException(); + } + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateService.updateNode(jsTreeHibernateSearchDTO)); + return modelAndView; + } + + @ResponseBody @RequestMapping(value = "/alterNode.do") public ModelAndView alterNode(@Validated(value = AlterNode.class) V jsTreeHibernateSearchDTO, BindingResult bindingResult, ModelMap model) throws Exception { Index: core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateService.java =================================================================== diff -u -r3378aeef18251570015a9efbed6402f39cffd95d -r7924ec670440498996caf9537aca25bb650c1f10 --- core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateService.java (.../JsTreeHibernateService.java) (revision 3378aeef18251570015a9efbed6402f39cffd95d) +++ core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateService.java (.../JsTreeHibernateService.java) (revision 7924ec670440498996caf9537aca25bb650c1f10) @@ -10,6 +10,8 @@ public T getNode(T jsTreeHibernateDTO) throws Exception; + public int updateNode(T jsTreeHibernateDTO) throws Exception; + public List getChildNode(T jsTreeHibernateDTO) throws Exception; public List getPaginatedChildNode(T jsTreeHibernateDTO) throws Exception; Index: core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateServiceImpl.java =================================================================== diff -u -re0f7d57532793434d7294dc798aa4d759758ee89 -r7924ec670440498996caf9537aca25bb650c1f10 --- core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateServiceImpl.java (.../JsTreeHibernateServiceImpl.java) (revision e0f7d57532793434d7294dc798aa4d759758ee89) +++ core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/service/JsTreeHibernateServiceImpl.java (.../JsTreeHibernateServiceImpl.java) (revision 7924ec670440498996caf9537aca25bb650c1f10) @@ -15,10 +15,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.ObjectUtils; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import java.lang.reflect.Field; import java.util.*; @Service("JsTreeHibernateService") @@ -280,6 +282,29 @@ @SuppressWarnings("unchecked") @Override @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public int updateNode(T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + T alterTargetNode = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getC_id()); + + for (Field field : jsTreeHibernateDTO.getClass().getDeclaredFields()) { + field.setAccessible(true); + Object value = field.get(jsTreeHibernateDTO); + + if (!ObjectUtils.isEmpty(value)) { + alterTargetNode.getClass().getDeclaredField(field.getName()).setAccessible(true); + alterTargetNode.getClass().getDeclaredField(field.getName()).set(alterTargetNode, value); + } + } + + jsTreeHibernateDao.update(alterTargetNode); + return 1; + + } + + @SuppressWarnings("unchecked") + @Override + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) public int alterNode(T jsTreeHibernateDTO) throws Exception { jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); Index: core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/validation/group/UpdateNode.java =================================================================== diff -u --- core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/validation/group/UpdateNode.java (revision 0) +++ core-module/src/main/java/egovframework/com/ext/jstree/springHibernate/core/validation/group/UpdateNode.java (revision 7924ec670440498996caf9537aca25bb650c1f10) @@ -0,0 +1,7 @@ +package egovframework.com.ext.jstree.springHibernate.core.validation.group; + +import javax.validation.groups.Default; + +public interface UpdateNode extends Default{ + +} Index: lib-module/pom.xml =================================================================== diff -u -rced88b02a5aff8f2bf763358634427c89dbd1865 -r7924ec670440498996caf9537aca25bb650c1f10 --- lib-module/pom.xml (.../pom.xml) (revision ced88b02a5aff8f2bf763358634427c89dbd1865) +++ lib-module/pom.xml (.../pom.xml) (revision 7924ec670440498996caf9537aca25bb650c1f10) @@ -5,7 +5,7 @@ 313devgrp java-service-tree-framework-core-library - 22.07.24 + 22.07.25 ../pom.xml Index: pom.xml =================================================================== diff -u -rced88b02a5aff8f2bf763358634427c89dbd1865 -r7924ec670440498996caf9537aca25bb650c1f10 --- pom.xml (.../pom.xml) (revision ced88b02a5aff8f2bf763358634427c89dbd1865) +++ pom.xml (.../pom.xml) (revision 7924ec670440498996caf9537aca25bb650c1f10) @@ -10,7 +10,7 @@ 4.0.0 313devgrp java-service-tree-framework-core-library - 22.07.24 + 22.07.25 pom java-service-tree-framework-core-library