Index: .idea/sonarIssues.xml =================================================================== diff -u -r395c2562d2dfd7900c4e263f8ddb5938785405ab -r3bda0a83ee4a2f1a10e14435080f6b2ebb30ad72 --- .idea/sonarIssues.xml (.../sonarIssues.xml) (revision 395c2562d2dfd7900c4e263f8ddb5938785405ab) +++ .idea/sonarIssues.xml (.../sonarIssues.xml) (revision 3bda0a83ee4a2f1a10e14435080f6b2ebb30ad72) @@ -948,11 +948,26 @@ + + + + + + + + + + + + + + + Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/AdminMenuController.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/AdminMenuController.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/AdminMenuController.java (revision 3bda0a83ee4a2f1a10e14435080f6b2ebb30ad72) @@ -0,0 +1,69 @@ +package egovframework.api.rivalWar.menu.controller; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.collect.Maps; +import egovframework.api.rivalWar.menu.service.MenuService; +import egovframework.api.rivalWar.menu.vo.MenuDTO; +import egovframework.com.cmm.annotation.IncludedInfo; +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 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.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; +import java.util.HashMap; +import java.util.List; + +@Controller +@RequestMapping(value = {"/api/rivalWar/ROLE_ADMIN/menu"}) +public class AdminMenuController extends GenericAbstractController { + + @Autowired + private MenuService menuService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 자식노드를 요청한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return String + * @throws JsonProcessingException + */ + @IncludedInfo(name = "RivalWar Admin Menu", listUrl = "/api/rivalWar/ROLE_ADMIN/menu/getJsTreeView.do", order = 7000, gid = 7313) + @ResponseBody + @RequestMapping(value = "/getChildMenu.do", method = RequestMethod.GET) + public ModelAndView getChildMenu(MenuDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) + throws Exception { + + ParameterParser parser = new ParameterParser(request); + + logger.info("jrebel reload test"); + + if (parser.getInt("c_id") <= 0) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setWhere("c_parentid", new Long(parser.get("c_id"))); + List list = menuService.getChildMenu(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", list); + return modelAndView; + } + +} Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/AnonymousMenuController.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/AnonymousMenuController.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/AnonymousMenuController.java (revision 3bda0a83ee4a2f1a10e14435080f6b2ebb30ad72) @@ -0,0 +1,245 @@ +package egovframework.api.rivalWar.menu.controller; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.collect.Maps; +import egovframework.api.rivalWar.menu.service.MenuService; +import egovframework.api.rivalWar.menu.vo.MenuDTO; +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 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.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; +import java.util.HashMap; +import java.util.List; + +@Controller +@RequestMapping(value = {"/api/rivalWar/menu"}) +public class AnonymousMenuController extends GenericAbstractController { + + @Autowired + private MenuService menuService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @ResponseBody + @RequestMapping(value = "/getPaginatedChildMenu.do", method = RequestMethod.GET) + public ModelAndView getPaginatedChildMenu(MenuDTO 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 = menuService.getPaginatedChildMenu(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 = "/getMenu.do", method = RequestMethod.GET) + public ModelAndView getMenu(MenuDTO jsTreeHibernateDTO, ModelMap model, HttpServletRequest request) + throws Exception { + + ParameterParser parser = new ParameterParser(request); + + if (parser.getInt("c_id") <= 0) { + throw new RuntimeException(); + } + + MenuDTO menuDTO = menuService.getMenu(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", menuDTO); + return modelAndView; + } + + /** + * 노드를 검색한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/searchMenu.do", method = RequestMethod.GET) + public ModelAndView searchNode(MenuDTO 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", menuService.searchMenu(jsTreeHibernateDTO)); + return modelAndView; + } + + /** + * 노드를 추가한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + * @throws IllegalAccessException + * @throws InstantiationException + */ + @ResponseBody + @RequestMapping(value = "/addMenu.do", method = RequestMethod.POST) + public ModelAndView addMenu(@Validated(value = AddNode.class) MenuDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", menuService.addMenu(jsTreeHibernateDTO)); + return modelAndView; + } + + /** + * 노드를 삭제한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param bindingResult + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/removeMenu.do", method = RequestMethod.POST) + public ModelAndView removeNode(@Validated(value = RemoveNode.class) MenuDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateDTO.setStatus(menuService.removeMenu(jsTreeHibernateDTO)); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + private void setJsonDefaultSetting(MenuDTO 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 = "/alterMenu.do", method = RequestMethod.POST) + public ModelAndView alterNode(@Validated(value = AlterNode.class) MenuDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateDTO.setC_title(Util_TitleChecker.StringReplace(jsTreeHibernateDTO.getC_title())); + + jsTreeHibernateDTO.setStatus(menuService.alterMenu(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 = "/alterMenuType.do", method = RequestMethod.POST) + public ModelAndView alterNodeType(@Validated(value = AlterNodeType.class) MenuDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + menuService.alterMenuType(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) MenuDTO jsTreeHibernateDTO, + BindingResult bindingResult, ModelMap model, HttpServletRequest request) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + menuService.moveMenu(jsTreeHibernateDTO, request); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/analyzeMenu.do", method = RequestMethod.GET) + public ModelAndView getChildNode(ModelMap model) { + model.addAttribute("analyzeResult", ""); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", "ture"); + return modelAndView; + } +} FishEye: Tag 3bda0a83ee4a2f1a10e14435080f6b2ebb30ad72 refers to a dead (removed) revision in file `standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/MenuController.java'. FishEye: No comparison available. Pass `N' to diff? Index: standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/UserMenuController.java =================================================================== diff -u --- standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/UserMenuController.java (revision 0) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/menu/controller/UserMenuController.java (revision 3bda0a83ee4a2f1a10e14435080f6b2ebb30ad72) @@ -0,0 +1,20 @@ +package egovframework.api.rivalWar.menu.controller; + +import egovframework.api.rivalWar.menu.service.MenuService; +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; + +@Controller +@RequestMapping(value = {"/api/rivalWar/ROLE_USER/menu"}) +public class UserMenuController extends GenericAbstractController { + + @Autowired + private MenuService menuService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + +} Index: standard/project/web/src/main/resources/egovframework/spring/com/context-security.xml =================================================================== diff -u -r395c2562d2dfd7900c4e263f8ddb5938785405ab -r3bda0a83ee4a2f1a10e14435080f6b2ebb30ad72 --- standard/project/web/src/main/resources/egovframework/spring/com/context-security.xml (.../context-security.xml) (revision 395c2562d2dfd7900c4e263f8ddb5938785405ab) +++ standard/project/web/src/main/resources/egovframework/spring/com/context-security.xml (.../context-security.xml) (revision 3bda0a83ee4a2f1a10e14435080f6b2ebb30ad72) @@ -55,8 +55,8 @@ - - + +