import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.rest.dao.CommonClassDao;
import org.openecomp.policy.rest.jpa.PolicyEditorScopes;
import org.openecomp.policy.rest.jpa.PolicyRoles;
@RequestMapping("/")
public class PolicyRolesController extends RestrictedBaseController{
+ private static final Logger LOGGER = FlexLogger.getLogger(PolicyRolesController.class);
+
@Autowired
CommonClassDao commonClassDao;
@RequestMapping(value={"/get_RolesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPolicyRolesEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- Map<String, Object> model = new HashMap<String, Object>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
model.put("rolesDatas", mapper.writeValueAsString(commonClassDao.getUserRoles()));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
response.getWriter().write(j.toString());
}
catch (Exception e){
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
}
out.write(j.toString());
}
catch (Exception e){
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
return null;
}
@RequestMapping(value={"/get_PolicyRolesScopeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
public void getPolicyScopesEntityData(HttpServletRequest request, HttpServletResponse response){
try{
- scopelist = new ArrayList<String>();
- Map<String, Object> model = new HashMap<String, Object>();
+ scopelist = new ArrayList<>();
+ Map<String, Object> model = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
List<String> scopesData = commonClassDao.getDataByColumn(PolicyEditorScopes.class, "scopeName");
response.getWriter().write(j.toString());
}
catch (Exception e){
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
}
}