Index: .idea/inspectionProfiles/Project_Default.xml =================================================================== diff -u --- .idea/inspectionProfiles/Project_Default.xml (revision 0) +++ .idea/inspectionProfiles/Project_Default.xml (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -0,0 +1,9 @@ + + + + \ No newline at end of file Index: .idea/inspectionProfiles/profiles_settings.xml =================================================================== diff -u --- .idea/inspectionProfiles/profiles_settings.xml (revision 0) +++ .idea/inspectionProfiles/profiles_settings.xml (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -0,0 +1,7 @@ + + + + \ No newline at end of file Index: .idea/sonarIssues.xml =================================================================== diff -u -r6002d2a87002bdc63bed63cadcca70734e7158dd -rab75504e01d2637d6caed5809db4dc598757a90f --- .idea/sonarIssues.xml (.../sonarIssues.xml) (revision 6002d2a87002bdc63bed63cadcca70734e7158dd) +++ .idea/sonarIssues.xml (.../sonarIssues.xml) (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -1228,6 +1228,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1368,6 +1398,11 @@ + + + + + Index: standard/project/web/src/main/java/egovframework/api/rivalWar/compareItem/service/CompareItemService.java =================================================================== diff -u -re8502f51eef7a4a743c8772d536738c1ba4d5362 -rab75504e01d2637d6caed5809db4dc598757a90f --- standard/project/web/src/main/java/egovframework/api/rivalWar/compareItem/service/CompareItemService.java (.../CompareItemService.java) (revision e8502f51eef7a4a743c8772d536738c1ba4d5362) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/compareItem/service/CompareItemService.java (.../CompareItemService.java) (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -1,11 +1,7 @@ package egovframework.api.rivalWar.compareItem.service; import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateService; -import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; -import javax.servlet.http.HttpServletRequest; -import java.util.List; - /** * Created by Administrator on 2017-10-08. */ Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/AdminMenuCompareItemController.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/AdminMenuCompareItemController.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/AdminMenuCompareItemController.java (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -0,0 +1,178 @@ +package egovframework.api.rivalWar.menuCompareItem.controller; + +import com.fasterxml.jackson.core.JsonProcessingException; +import egovframework.api.rivalWar.menuCompareItem.service.MenuCompareItemService; +import egovframework.api.rivalWar.menuCompareItem.vo.MenuCompareItemDTO; +import egovframework.com.ext.jstree.springiBatis.core.util.Util_TitleChecker; +import egovframework.com.ext.jstree.springiBatis.core.validation.group.*; +import egovframework.com.ext.jstree.support.mvc.GenericAbstractController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +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.servlet.http.HttpServletRequest; + +/** + * Created by Administrator on 2017-10-23. + */ +@Controller +@RequestMapping(value = {"/api/rivalWar/ROLE_ADMIN/menuCompareItem"}) +public class AdminMenuCompareItemController extends GenericAbstractController { + + @Autowired + private MenuCompareItemService menuCompareItemService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 노드를 추가한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + * @throws IllegalAccessException + * @throws InstantiationException + */ + @ResponseBody + @RequestMapping(value = "/addNode.do", method = RequestMethod.POST) + public ModelAndView addNode(@Validated(value = AddNode.class) MenuCompareItemDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", menuCompareItemService.addNode(jsTreeHibernateDTO)); + return modelAndView; + } + + /** + * 노드를 삭제한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/removeNode.do", method = RequestMethod.POST) + public ModelAndView removeNode(@Validated(value = RemoveNode.class) MenuCompareItemDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateDTO.setStatus(menuCompareItemService.removeNode(jsTreeHibernateDTO)); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + private void setJsonDefaultSetting(MenuCompareItemDTO jsTreeHibernateDTO) { + long defaultSettingValue = 0; + jsTreeHibernateDTO.setC_parentid(defaultSettingValue); + jsTreeHibernateDTO.setC_position(defaultSettingValue); + jsTreeHibernateDTO.setC_left(defaultSettingValue); + jsTreeHibernateDTO.setC_right(defaultSettingValue); + jsTreeHibernateDTO.setC_level(defaultSettingValue); + jsTreeHibernateDTO.setRef(defaultSettingValue); + } + + /** + * 노드를 변경한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/alterNode.do", method = RequestMethod.POST) + public ModelAndView alterNode(@Validated(value = AlterNode.class) MenuCompareItemDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()){ + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setC_title(Util_TitleChecker.StringReplace(jsTreeHibernateDTO.getC_title())); + + jsTreeHibernateDTO.setStatus(menuCompareItemService.alterNode(jsTreeHibernateDTO)); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + + /** + * 노드의 타입을 변경한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/alterNodeType.do", method = RequestMethod.POST) + public ModelAndView alterNodeType(@Validated(value = AlterNodeType.class) MenuCompareItemDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + menuCompareItemService.alterNodeType(jsTreeHibernateDTO); + setJsonDefaultSetting(jsTreeHibernateDTO); + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + /** + * 노드를 이동한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return + * @throws JsonProcessingException + * @throws ReflectiveOperationException + * @throws IllegalAccessException + * @throws InstantiationException + */ + @ResponseBody + @RequestMapping(value = "/moveMenu.do", method = RequestMethod.POST) + public ModelAndView moveNode(@Validated(value = MoveNode.class) MenuCompareItemDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model, HttpServletRequest request) throws Exception { + if (bindingResult.hasErrors()) { + throw new RuntimeException(); + } + menuCompareItemService.moveNode(jsTreeHibernateDTO, request); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/analyzeNode.do", method = RequestMethod.GET) + public ModelAndView getChildNode(ModelMap model) { + model.addAttribute("analyzeResult", ""); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", "true"); + return modelAndView; + }} Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/AnonymousMenuCompareItemController.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/AnonymousMenuCompareItemController.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/AnonymousMenuCompareItemController.java (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -0,0 +1,158 @@ +package egovframework.api.rivalWar.menuCompareItem.controller; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.collect.Maps; +import egovframework.api.rivalWar.menuCompareItem.service.MenuCompareItemService; +import egovframework.api.rivalWar.menuCompareItem.vo.MenuCompareItemDTO; +import egovframework.com.cmm.annotation.IncludedInfo; +import egovframework.com.ext.jstree.support.mvc.GenericAbstractController; +import egovframework.com.ext.jstree.support.util.ParameterParser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.util.StringUtils; +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.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * Created by Administrator on 2017-10-23. + */ +@Controller +@RequestMapping(value = {"/api/rivalWar/menuCompareItem"}) +public class AnonymousMenuCompareItemController extends GenericAbstractController { + + @Autowired + private MenuCompareItemService menuCompareItemService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @IncludedInfo(name = "RivalWar Admin CompareItem", listUrl = "/api/rivalWar/compareItem/getJsTreeView.do", order = 7005, gid = 7313) + @RequestMapping("/getJsTreeView.do") + public String getRivalWarCompareItemJstreeView() { + return "egovframework/api/rivalWar/compareItem/JsTreeView"; + } + + /** + * 노드를 검색한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/searchNode.do", method = RequestMethod.GET) + public ModelAndView searchNode(MenuCompareItemDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) + throws Exception { + + ParameterParser parser = new ParameterParser(request); + + if (!StringUtils.hasText(request.getParameter("searchString"))) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhereLike("c_title", parser.get("parser")); + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", menuCompareItemService.searchNode(jsTreeHibernateDTO)); + return modelAndView; + } + + + @ResponseBody + @RequestMapping(value = "/getPaginatedChildNode.do", method = RequestMethod.GET) + public ModelAndView getPaginatedChildNode(MenuCompareItemDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) + throws Exception { + + if (jsTreeHibernateDTO.getC_id() <= 0 || jsTreeHibernateDTO.getPageIndex() <= 0 + || jsTreeHibernateDTO.getPageUnit() <= 0 || jsTreeHibernateDTO.getPageSize() <= 0) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhere("c_parentid", jsTreeHibernateDTO.getC_id()); + List list = menuCompareItemService.getPaginatedChildNode(jsTreeHibernateDTO); + jsTreeHibernateDTO.getPaginationInfo().setTotalRecordCount(list.size()); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + HashMap resultMap = Maps.newHashMap(); + resultMap.put("paginationInfo", jsTreeHibernateDTO.getPaginationInfo()); + resultMap.put("result", list); + modelAndView.addObject("result", resultMap); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/getNode.do", method = {RequestMethod.GET, RequestMethod.POST}) + public ModelAndView getNode(MenuCompareItemDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) + throws Exception { + + if(request.getMethod().equals("GET")){ + ParameterParser parser = new ParameterParser(request); + + if (parser.getInt("c_id") <= 0 ) { + throw new RuntimeException(); + } + }else{ + if(jsTreeHibernateDTO.getC_id() <= 0){ + throw new RuntimeException(); + } + } + + MenuCompareItemDTO selectedJsTreeHibernateDTO = menuCompareItemService.getNode(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", selectedJsTreeHibernateDTO); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/getNodeForDatatable.do", method = {RequestMethod.GET, RequestMethod.POST}) + public ModelAndView getNodeForDatatable(MenuCompareItemDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) + throws Exception { + + if(request.getMethod().equals("GET")){ + ParameterParser parser = new ParameterParser(request); + + if (parser.getInt("c_id") <= 0 ) { + throw new RuntimeException(); + } + }else{ + if(jsTreeHibernateDTO.getC_id() <= 0){ + throw new RuntimeException(); + } + } + List list = new ArrayList(); + list.add(menuCompareItemService.getNode(jsTreeHibernateDTO)); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", list); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/getChildNode.do", method = RequestMethod.GET) + public ModelAndView getChildNode(MenuCompareItemDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) throws Exception { + + ParameterParser parser = new ParameterParser(request); + + if (parser.getInt("c_id") <= 0) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhere("c_parentid", new Long(parser.get("c_id"))); + List list = menuCompareItemService.getChildNode(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", list); + return modelAndView; + } +} Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/UserMenuCompareItemController.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/UserMenuCompareItemController.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/controller/UserMenuCompareItemController.java (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -0,0 +1,23 @@ +package egovframework.api.rivalWar.menuCompareItem.controller; + +import egovframework.api.rivalWar.compareItem.service.CompareItemService; +import egovframework.api.rivalWar.menuCompareItem.service.MenuCompareItemService; +import egovframework.com.ext.jstree.support.mvc.GenericAbstractController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Created by Administrator on 2017-10-23. + */ +@Controller +@RequestMapping(value = {"/api/rivalWar/ROLE_USER/menuCompareItem"}) +public class UserMenuCompareItemController extends GenericAbstractController { + + @Autowired + private MenuCompareItemService menuCompareItemService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); +} Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/service/MenuCompareItemService.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/service/MenuCompareItemService.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/service/MenuCompareItemService.java (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -0,0 +1,9 @@ +package egovframework.api.rivalWar.menuCompareItem.service; + +import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateService; + +/** + * Created by Administrator on 2017-10-23. + */ +public interface MenuCompareItemService extends JsTreeHibernateService { +} Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/service/MenuCompareItemServiceImpl.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/service/MenuCompareItemServiceImpl.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/service/MenuCompareItemServiceImpl.java (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -0,0 +1,13 @@ +package egovframework.api.rivalWar.menuCompareItem.service; + +import egovframework.api.rivalWar.compareItem.service.CompareItemService; +import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateServiceImpl; +import org.springframework.stereotype.Service; + +/** + * Created by Administrator on 2017-10-23. + */ +@Service("MenuCompareItemService") +public class MenuCompareItemServiceImpl extends JsTreeHibernateServiceImpl implements MenuCompareItemService { + +} Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/vo/MenuCompareItemDTO.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/vo/MenuCompareItemDTO.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menuCompareItem/vo/MenuCompareItemDTO.java (revision ab75504e01d2637d6caed5809db4dc598757a90f) @@ -0,0 +1,82 @@ +package egovframework.api.rivalWar.menuCompareItem.vo; + +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; +import org.hibernate.annotations.Cache; +import org.hibernate.annotations.*; + +import javax.persistence.*; +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; + +/** + * Created by Administrator on 2017-10-23. + */ +@Entity +@Table(name = "T_M_MENU_COMPAREITEM") +@SelectBeforeUpdate(value = true) +@DynamicInsert(value = true) +@DynamicUpdate(value = true) +@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +@SequenceGenerator(name = "JsTreeSequence", sequenceName = "S_M_MENU_COMPAREITEM", allocationSize = 1) +public class MenuCompareItemDTO extends JsTreeHibernateSearchDTO implements Serializable { + + private static final long serialVersionUID = 4641920581390357332L; + + public MenuCompareItemDTO() { + super(); + } + + public MenuCompareItemDTO(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; + } + + private Long menuCID; + @Column(name = "MENU_CID") + public Long getMenuCID() { + return menuCID; + } + + public void setMenuCID(Long menuCID) { + this.menuCID = menuCID; + } + + private Long compardItemCID; + @Column(name = "COMPAREITEM_CID") + public Long getCompardItemCID() { + return compardItemCID; + } + + public void setCompardItemCID(Long compardItemCID) { + this.compardItemCID = compardItemCID; + } + + @Override + public void setFieldFromNewInstance(T paramInstance) { + if (paramInstance instanceof MenuCompareItemDTO) { + + } + } + +}