-public class ClosedLoopDictionaryController{
-
- private static final Logger LOGGER = FlexLogger.getLogger(ClosedLoopDictionaryController.class);
-
- private static CommonClassDao commonClassDao;
- private static String vsclaction = "vsclaction";
- private static String successMapKey = "successMapKey";
- private static String successMessage = "success";
- private static String operation = "operation";
- private static String getDictionary = "getDictionary";
- private static String dictionaryDBQuery = "dictionaryDBQuery";
- private static String errorMsg = "error";
- private static String vnftype = "vnftype";
- private static String pepName = "pepName";
- private static String varbindName = "varbindName";
- private static String serviceName = "serviceName";
- private static String siteName = "siteName";
- private static String apiflag = "apiflag";
- private static String dictionaryFields = "dictionaryFields";
- private static String update = "update";
- private static String duplicateResponseString = "Duplicate";
- private static String userid = "userid";
- private static String utf8 = "UTF-8";
- private static String applicationJsonContentType = "application / json";
- private static String successMsg = "Success";
-
- @Autowired
- public ClosedLoopDictionaryController(CommonClassDao commonClassDao){
- ClosedLoopDictionaryController.commonClassDao = commonClassDao;
- }
- /*
- * This is an empty constructor
- */
- public ClosedLoopDictionaryController(){}
-
- public UserInfo getUserInfo(String loginId){
- return (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
- }
-
-
- @RequestMapping(value={"/get_VSCLActionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getVSCLActionDictionaryByNameEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VSCLAction.class, vsclaction)));
- 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_VSCLActionData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getVSCLActionDictionaryEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class)));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.addHeader(successMapKey, successMessage);
- 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(errorMsg, dictionaryDBQuery);
- }
- }
-
- @RequestMapping(value={"/get_VNFTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getVNFTypeDictionaryByNameEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VNFType.class, vnftype)));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.addHeader(successMapKey, successMessage);
- response.addHeader(operation, getDictionary);
- response.getWriter().write(j.toString());
- }
- catch (Exception e){
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
- }
-
- @RequestMapping(value={"/get_VNFTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getVNFTypeDictionaryEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VNFType.class)));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.addHeader(successMapKey, successMessage);
- 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(errorMsg, dictionaryDBQuery);
- }
- }
-
- @RequestMapping(value={"/get_PEPOptionsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getPEPOptionsDictionaryByNameEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PEPOptions.class, pepName)));
- 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_PEPOptionsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getPEPOptionsDictionaryEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class)));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.addHeader(successMapKey, successMessage);
- 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(errorMsg, dictionaryDBQuery);
- }
- }
-
- @RequestMapping(value={"/get_VarbindDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getVarbindDictionaryByNameEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VarbindDictionary.class, varbindName)));
- 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_VarbindDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getVarbindDictionaryEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class)));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.addHeader(successMapKey, successMessage);
- 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(errorMsg, dictionaryDBQuery);
- }
- }
-
- @RequestMapping(value={"/get_ClosedLoopServicesDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getClosedLoopServiceDictionaryByNameEntityData(HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopD2Services.class, serviceName)));
- 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);
- }
- }