Index: .idea/sonarIssues.xml =================================================================== diff -u -r399bdde680ce154c19752cafa8957922af5ad0fe -r8155383b5a954001eb91ba7151ecf51f036296f8 --- .idea/sonarIssues.xml (.../sonarIssues.xml) (revision 399bdde680ce154c19752cafa8957922af5ad0fe) +++ .idea/sonarIssues.xml (.../sonarIssues.xml) (revision 8155383b5a954001eb91ba7151ecf51f036296f8) @@ -1148,11 +1148,26 @@ + + + + + + + + + + + + + + + Index: standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/AdminDirectChatController.java =================================================================== diff -u -rdfba2018c887cdc75e11cd4f8021fa4657a3e339 -r8155383b5a954001eb91ba7151ecf51f036296f8 --- standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/AdminDirectChatController.java (.../AdminDirectChatController.java) (revision dfba2018c887cdc75e11cd4f8021fa4657a3e339) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/AdminDirectChatController.java (.../AdminDirectChatController.java) (revision 8155383b5a954001eb91ba7151ecf51f036296f8) @@ -1,7 +1,174 @@ package egovframework.api.rivalWar.directChat.controller; +import com.fasterxml.jackson.core.JsonProcessingException; +import egovframework.api.rivalWar.directChat.service.DirectChatService; +import egovframework.api.rivalWar.directChat.vo.DirectChatDTO; +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-09-24. */ -public class AdminDirectChatController { +@Controller +@RequestMapping(value = {"/api/rivalWar/ROLE_ADMIN/directChat"}) +public class AdminDirectChatController extends GenericAbstractController { + + @Autowired + private DirectChatService directChatService; + + 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) DirectChatDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", directChatService.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) DirectChatDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + jsTreeHibernateDTO.setStatus(directChatService.removeNode(jsTreeHibernateDTO)); + setJsonDefaultSetting(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", jsTreeHibernateDTO); + return modelAndView; + } + + private void setJsonDefaultSetting(DirectChatDTO 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) DirectChatDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) { + throw new RuntimeException(); + } + + jsTreeHibernateDTO.setC_title(Util_TitleChecker.StringReplace(jsTreeHibernateDTO.getC_title())); + + jsTreeHibernateDTO.setStatus(directChatService.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) DirectChatDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + directChatService.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) DirectChatDTO jsTreeHibernateDTO, BindingResult bindingResult, ModelMap model, HttpServletRequest request) throws Exception { + if (bindingResult.hasErrors()) { + throw new RuntimeException(); + } + directChatService.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/directChat/controller/AnonymousDirectChatController.java =================================================================== diff -u -rdfba2018c887cdc75e11cd4f8021fa4657a3e339 -r8155383b5a954001eb91ba7151ecf51f036296f8 --- standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/AnonymousDirectChatController.java (.../AnonymousDirectChatController.java) (revision dfba2018c887cdc75e11cd4f8021fa4657a3e339) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/AnonymousDirectChatController.java (.../AnonymousDirectChatController.java) (revision 8155383b5a954001eb91ba7151ecf51f036296f8) @@ -1,7 +1,154 @@ package egovframework.api.rivalWar.directChat.controller; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.collect.Maps; +import egovframework.api.rivalWar.directChat.service.DirectChatService; +import egovframework.api.rivalWar.directChat.vo.DirectChatDTO; +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-09-24. */ -public class AnonymousDirectChatController { +@Controller +@RequestMapping(value = {"/api/rivalWar/directChat"}) +public class AnonymousDirectChatController extends GenericAbstractController { + + @Autowired + private DirectChatService directChatService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @IncludedInfo(name = "RivalWar Admin DirectChat", listUrl = "/api/rivalWar/direcctChat/getJsTreeView.do", order = 7006, gid = 7313) + @RequestMapping("/getJsTreeView.do") + public String getRivalWarCompareSpecJstreeView() { + return "egovframework/api/rivalWar/directChat/JsTreeView"; + } + + /** + * 노드를 검색한다. + * + * @param jsTreeHibernateDTO + * @param model + * @param request + * @return + * @throws JsonProcessingException + */ + @ResponseBody + @RequestMapping(value = "/searchNode.do", method = RequestMethod.GET) + public ModelAndView searchNode(DirectChatDTO 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", directChatService.searchNode(jsTreeHibernateDTO)); + return modelAndView; + } + + + @ResponseBody + @RequestMapping(value = "/getPaginatedChildNode.do", method = RequestMethod.GET) + public ModelAndView getPaginatedChildNode(DirectChatDTO 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 = directChatService.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(DirectChatDTO 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(); + } + } + + DirectChatDTO selectedJsTreeHibernateDTO = directChatService.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(DirectChatDTO 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(directChatService.getNode(jsTreeHibernateDTO)); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", list); + return modelAndView; + } + + @ResponseBody + @RequestMapping(value = "/getChildNode.do", method = RequestMethod.GET) + public ModelAndView getChildNode(DirectChatDTO 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 = directChatService.getChildNode(jsTreeHibernateDTO); + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", list); + return modelAndView; + } } FishEye: Tag 8155383b5a954001eb91ba7151ecf51f036296f8 refers to a dead (removed) revision in file `standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/DirectChatController.java'. FishEye: No comparison available. Pass `N' to diff? Index: standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/UserDirectChatController.java =================================================================== diff -u -rdfba2018c887cdc75e11cd4f8021fa4657a3e339 -r8155383b5a954001eb91ba7151ecf51f036296f8 --- standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/UserDirectChatController.java (.../UserDirectChatController.java) (revision dfba2018c887cdc75e11cd4f8021fa4657a3e339) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/controller/UserDirectChatController.java (.../UserDirectChatController.java) (revision 8155383b5a954001eb91ba7151ecf51f036296f8) @@ -1,7 +1,23 @@ package egovframework.api.rivalWar.directChat.controller; +import egovframework.api.rivalWar.compareSpec.service.CompareSpecService; +import egovframework.api.rivalWar.directChat.service.DirectChatService; +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-09-24. */ -public class UserDirectChatController { +@Controller +@RequestMapping(value = {"/api/rivalWar/ROLE_USER/directChat"}) +public class UserDirectChatController extends GenericAbstractController { + + @Autowired + private DirectChatService directChatService; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); } Index: standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/service/DirectChatService.java =================================================================== diff -u -r395c2562d2dfd7900c4e263f8ddb5938785405ab -r8155383b5a954001eb91ba7151ecf51f036296f8 --- standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/service/DirectChatService.java (.../DirectChatService.java) (revision 395c2562d2dfd7900c4e263f8ddb5938785405ab) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/service/DirectChatService.java (.../DirectChatService.java) (revision 8155383b5a954001eb91ba7151ecf51f036296f8) @@ -6,23 +6,22 @@ import java.util.List; public interface DirectChatService { - - public T getDirectChat(T jsTreeHibernateDTO) throws Exception; - - public List getChildDirectChat(T jsTreeHibernateDTO) throws Exception; - - public List getPaginatedChildDirectChat(T jsTreeHibernateDTO) throws Exception; - - public List searchDirectChat(T jsTreeHibernateDTO) throws Exception; - - public T addDirectChat(T jsTreeHibernateDTO) throws Exception; - - public int removeDirectChat(T jsTreeHibernateDTO) throws Exception; - - public int alterDirectChat(T jsTreeHibernateDTO) throws Exception; - - public int alterDirectChatType(T jsTreeHibernateDTO) throws Exception; - - public T moveDirectChat(T jsTreeHibernateDTO, HttpServletRequest request) throws Exception; + public T getNode(T jsTreeHibernateDTO) throws Exception; + + public List getChildNode(T jsTreeHibernateDTO) throws Exception; + + public List getPaginatedChildNode(T jsTreeHibernateDTO) throws Exception; + + public List searchNode(T jsTreeHibernateDTO) throws Exception; + + public T addNode(T jsTreeHibernateDTO) throws Exception; + + public int removeNode(T jsTreeHibernateDTO) throws Exception; + + public int alterNode(T jsTreeHibernateDTO) throws Exception; + + public int alterNodeType(T jsTreeHibernateDTO) throws Exception; + + public T moveNode(T jsTreeHibernateDTO, HttpServletRequest request) throws Exception; } Index: standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/service/DirectChatServiceImpl.java =================================================================== diff -u -r395c2562d2dfd7900c4e263f8ddb5938785405ab -r8155383b5a954001eb91ba7151ecf51f036296f8 --- standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/service/DirectChatServiceImpl.java (.../DirectChatServiceImpl.java) (revision 395c2562d2dfd7900c4e263f8ddb5938785405ab) +++ standard/project/web/src/main/java/egovframework/api/rivalWar/directChat/service/DirectChatServiceImpl.java (.../DirectChatServiceImpl.java) (revision 8155383b5a954001eb91ba7151ecf51f036296f8) @@ -13,49 +13,49 @@ @Autowired private JsTreeHibernateService jsTreeHibernateService; - + @Override - public T getDirectChat(T jsTreeHibernateDTO) throws Exception { + public T getNode(T jsTreeHibernateDTO) throws Exception { return jsTreeHibernateService.getNode(jsTreeHibernateDTO); } - + @Override - public List getPaginatedChildDirectChat(T jsTreeHibernateDTO) throws Exception { - return jsTreeHibernateService.getPaginatedChildNode(jsTreeHibernateDTO); + public List getChildNode(T jsTreeHibernateDTO) throws Exception { + return jsTreeHibernateService.getChildNode(jsTreeHibernateDTO); } @Override - public List getChildDirectChat(T jsTreeHibernateDTO) throws Exception { - return jsTreeHibernateService.getChildNode(jsTreeHibernateDTO); + public List getPaginatedChildNode(T jsTreeHibernateDTO) throws Exception { + return jsTreeHibernateService.getPaginatedChildNode(jsTreeHibernateDTO); } @Override - public List searchDirectChat(T jsTreeHibernateDTO) throws Exception { + public List searchNode(T jsTreeHibernateDTO) throws Exception { return jsTreeHibernateService.searchNode(jsTreeHibernateDTO); } @Override - public T addDirectChat(T jsTreeHibernateDTO) throws Exception { + public T addNode(T jsTreeHibernateDTO) throws Exception { return jsTreeHibernateService.addNode(jsTreeHibernateDTO); } @Override - public int removeDirectChat(T jsTreeHibernateDTO) throws Exception { + public int removeNode(T jsTreeHibernateDTO) throws Exception { return jsTreeHibernateService.removeNode(jsTreeHibernateDTO); } @Override - public int alterDirectChat(T jsTreeHibernateDTO) throws Exception { + public int alterNode(T jsTreeHibernateDTO) throws Exception { return jsTreeHibernateService.alterNode(jsTreeHibernateDTO); } @Override - public int alterDirectChatType(T jsTreeHibernateDTO) throws Exception { + public int alterNodeType(T jsTreeHibernateDTO) throws Exception { return jsTreeHibernateService.alterNodeType(jsTreeHibernateDTO); } @Override - public T moveDirectChat(T jsTreeHibernateDTO, HttpServletRequest request) + public T moveNode(T jsTreeHibernateDTO, HttpServletRequest request) throws Exception { return jsTreeHibernateService.moveNode(jsTreeHibernateDTO, request); }