- @RequestMapping(value={"/get_DescriptiveScopeByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getDescriptiveDictionaryByNameEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(DescriptiveScope.class, "descriptiveScopeName")));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.getWriter().write(j.toString());
- }
- catch (Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
- }
-
- @RequestMapping(value={"/get_DescriptiveScope"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getDescriptiveDictionaryEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("descriptiveScopeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(DescriptiveScope.class)));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.addHeader("successMapKey", "success");
- response.addHeader("operation", "getDictionary");
- response.getWriter().write(j.toString());
- }
- catch (Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- response.addHeader("error", "dictionaryDBQuery");
- }
- }
-
- @RequestMapping(value={"/descriptive_dictionary/save_descriptive"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response)throws UnsupportedEncodingException, IOException{
- try {
- boolean duplicateflag = false;
- boolean isFakeUpdate = false;
- boolean fromAPI = false;
- if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
- fromAPI = true;
- }
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- JsonNode root = mapper.readTree(request.getReader());
+ @Autowired
+ public DescriptiveDictionaryController(CommonClassDao commonClassDao) {
+ DescriptiveDictionaryController.commonClassDao = commonClassDao;
+ }
+
+ public void setCommonClassDao(CommonClassDao commonClassDao) {
+ DescriptiveDictionaryController.commonClassDao = commonClassDao;
+ }
+
+ public DescriptiveDictionaryController() {
+ super();
+ }
+
+ private DictionaryUtils getDictionaryUtilsInstance() {
+ return DictionaryUtils.getDictionaryUtils();
+ }
+
+ @RequestMapping(
+ value = {"/get_DescriptiveScopeByName"},
+ method = {RequestMethod.GET},
+ produces = MediaType.APPLICATION_JSON_VALUE)
+ public void getDescriptiveDictionaryByNameEntityData(HttpServletResponse response) {
+ DictionaryUtils utils = getDictionaryUtilsInstance();
+ utils.getDataByEntity(response, descriptiveDatas, dScopeName, DescriptiveScope.class);
+ }
+
+ @RequestMapping(
+ value = {"/get_DescriptiveScope"},
+ method = {RequestMethod.GET},
+ produces = MediaType.APPLICATION_JSON_VALUE)
+ public void getDescriptiveDictionaryEntityData(HttpServletResponse response) {
+ DictionaryUtils utils = getDictionaryUtilsInstance();
+ utils.getData(response, descriptiveDatas, DescriptiveScope.class);
+ }
+
+ @RequestMapping(value = {"/descriptive_dictionary/save_descriptive"}, method = {RequestMethod.POST})
+ public ModelAndView saveDescriptiveDictionary(HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
+ DictionaryUtils utils = getDictionaryUtilsInstance();
+ try {
+ boolean fromAPI = utils.isRequestFromAPI(request);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());