-@Controller
-public class BRMSDictionaryController{
-
- private static final Logger LOGGER = FlexLogger.getLogger(BRMSDictionaryController.class);
-
-
- private static CommonClassDao commonClassDao;
-
- @Autowired
- public BRMSDictionaryController(CommonClassDao commonClassDao){
- BRMSDictionaryController.commonClassDao = commonClassDao;
- }
-
- public BRMSDictionaryController() {}
-
- private String rule;
-
- public UserInfo getUserInfo(String loginId){
- UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
- return name;
- }
-
- @RequestMapping(value={"/get_BRMSParamDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getBRMSParamDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(BRMSParamTemplate.class, "ruleName")));
- 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_BRMSParamData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getBRMSParamDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("brmsParamDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(BRMSParamTemplate.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={"/brms_dictionary/set_BRMSParamData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public void SetRuleData(HttpServletRequest request, HttpServletResponse response) throws IOException{
- StringWriter writer = new StringWriter();
- IOUtils.copy(request.getInputStream() , writer, StandardCharsets.UTF_8);
- String cleanStreamBoundary = writer.toString().replaceFirst("------(.*)(?s).*octet-stream", "");
- rule = cleanStreamBoundary.substring(0, cleanStreamBoundary.lastIndexOf("end")+4);
- }
-
- @RequestMapping(value={"/brms_dictionary/save_BRMSParam"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView saveBRMSParamDictionary(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException, IOException {
- try {
- boolean duplicateflag = 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());
-