summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java7
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java106
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java1
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java15
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyController.java1283
5 files changed, 703 insertions, 709 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java
index 8a3d27890..be660c803 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyAdapter.java
@@ -43,9 +43,6 @@ public class PolicyAdapter {
private static final Logger LOGGER = FlexLogger.getLogger(PolicyAdapter.class);
public void configure(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- if(extendedOptions(policyAdapter, entity)){
- return;
- }
String policyNameValue = policyAdapter.getPolicyName().substring(0, policyAdapter.getPolicyName().indexOf('_'));
String configPolicyName = getConfigPolicyName(policyAdapter);
policyAdapter.setPolicyType(policyNameValue);
@@ -116,10 +113,6 @@ public class PolicyAdapter {
}
}
- private boolean extendedOptions(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
- return false;
- }
-
public static PolicyAdapter getInstance() {
try {
Class<?> policyAdapter = Class.forName(XACMLProperties.getProperty("policyAdapter.impl.className", PolicyAdapter.class.getName()));
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
index d94274242..de83b045b 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java
@@ -93,6 +93,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class PolicyManagerServlet extends HttpServlet {
private static final Logger LOGGER = FlexLogger.getLogger(PolicyManagerServlet.class);
private static final long serialVersionUID = -8453502699403909016L;
+ private static final String VERSION = "version";;
+ private static final String NAME = "name";
+ private static final String DATE = "date";
+ private static final String SIZE = "size";
+ private static final String TYPE = "type";
+ private static final String CREATED_BY = "createdBy";
+ private static final String MODIFIED_BY = "modifiedBy";
private enum Mode {
LIST, RENAME, COPY, DELETE, EDITFILE, ADDFOLDER, DESCRIBEPOLICYFILE, VIEWPOLICY, ADDSUBSCOPE, SWITCHVERSION, EXPORT, SEARCHLIST
@@ -207,7 +214,6 @@ public class PolicyManagerServlet extends HttpServlet {
//Policy Import Functionality
private void uploadFile(HttpServletRequest request, HttpServletResponse response) throws ServletException {
try {
- String newFile;
Map<String, InputStream> files = new HashMap<>();
List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
@@ -385,13 +391,13 @@ public class PolicyManagerServlet extends HttpServlet {
for(int i =0; i < policyData.size(); i++){
PolicyVersion policy = (PolicyVersion) policyData.get(i);
JSONObject el = new JSONObject();
- el.put("name", policy.getPolicyName().replace(File.separator, "/"));
- el.put("date", policy.getModifiedDate());
- el.put("version", policy.getActiveVersion());
- el.put("size", "");
- el.put("type", "file");
- el.put("createdBy", getUserName(policy.getCreatedBy()));
- el.put("modifiedBy", getUserName(policy.getModifiedBy()));
+ el.put(NAME, policy.getPolicyName().replace(File.separator, "/"));
+ el.put(DATE, policy.getModifiedDate());
+ el.put(VERSION, policy.getActiveVersion());
+ el.put(SIZE, "");
+ el.put(TYPE, "file");
+ el.put(CREATED_BY, getUserName(policy.getCreatedBy()));
+ el.put(MODIFIED_BY, getUserName(policy.getModifiedBy()));
resultList.add(el);
}
}
@@ -403,18 +409,18 @@ public class PolicyManagerServlet extends HttpServlet {
String policyVersionQuery = "From PolicyVersion where policy_name = :policyName and active_version = :version and id >0";
SimpleBindings pvParams = new SimpleBindings();
pvParams.put("policyName", policyName);
- pvParams.put("version", version);
+ pvParams.put(VERSION, version);
List<Object> activeData = controller.getDataByQuery(policyVersionQuery, pvParams);
if(!activeData.isEmpty()){
PolicyVersion policy = (PolicyVersion) activeData.get(0);
JSONObject el = new JSONObject();
- el.put("name", policy.getPolicyName().replace(File.separator, "/"));
- el.put("date", policy.getModifiedDate());
- el.put("version", policy.getActiveVersion());
- el.put("size", "");
- el.put("type", "file");
- el.put("createdBy", getUserName(policy.getCreatedBy()));
- el.put("modifiedBy", getUserName(policy.getModifiedBy()));
+ el.put(NAME, policy.getPolicyName().replace(File.separator, "/"));
+ el.put(DATE, policy.getModifiedDate());
+ el.put(VERSION, policy.getActiveVersion());
+ el.put(SIZE, "");
+ el.put(TYPE, "file");
+ el.put(CREATED_BY, getUserName(policy.getCreatedBy()));
+ el.put(MODIFIED_BY, getUserName(policy.getModifiedBy()));
resultList.add(el);
}
}
@@ -602,12 +608,12 @@ public class PolicyManagerServlet extends HttpServlet {
PolicyEditorScopes scope = (PolicyEditorScopes) list;
if(!(scope.getScopeName().contains(File.separator))){
JSONObject el = new JSONObject();
- el.put("name", scope.getScopeName());
- el.put("date", scope.getModifiedDate());
- el.put("size", "");
- el.put("type", "dir");
- el.put("createdBy", scope.getUserCreatedBy().getUserName());
- el.put("modifiedBy", scope.getUserModifiedBy().getUserName());
+ el.put(NAME, scope.getScopeName());
+ el.put(DATE, scope.getModifiedDate());
+ el.put(SIZE, "");
+ el.put(TYPE, "dir");
+ el.put(CREATED_BY, scope.getUserCreatedBy().getUserName());
+ el.put(MODIFIED_BY, scope.getUserModifiedBy().getUserName());
resultList.add(el);
}
}
@@ -617,12 +623,12 @@ public class PolicyManagerServlet extends HttpServlet {
List<Object> scopesList = queryPolicyEditorScopes(scope.toString());
if(!scopesList.isEmpty()){
PolicyEditorScopes scopeById = (PolicyEditorScopes) scopesList.get(0);
- el.put("name", scopeById.getScopeName());
- el.put("date", scopeById.getModifiedDate());
- el.put("size", "");
- el.put("type", "dir");
- el.put("createdBy", scopeById.getUserCreatedBy().getUserName());
- el.put("modifiedBy", scopeById.getUserModifiedBy().getUserName());
+ el.put(NAME, scopeById.getScopeName());
+ el.put(DATE, scopeById.getModifiedDate());
+ el.put(SIZE, "");
+ el.put(TYPE, "dir");
+ el.put(CREATED_BY, scopeById.getUserCreatedBy().getUserName());
+ el.put(MODIFIED_BY, scopeById.getUserModifiedBy().getUserName());
resultList.add(el);
}
}
@@ -703,12 +709,12 @@ public class PolicyManagerServlet extends HttpServlet {
}
if(scopeName.equalsIgnoreCase(checkScope)){
JSONObject el = new JSONObject();
- el.put("name", scope);
- el.put("date", scopeById.getModifiedDate());
- el.put("size", "");
- el.put("type", "dir");
- el.put("createdBy", scopeById.getUserCreatedBy().getUserName());
- el.put("modifiedBy", scopeById.getUserModifiedBy().getUserName());
+ el.put(NAME, scope);
+ el.put(DATE, scopeById.getModifiedDate());
+ el.put(SIZE, "");
+ el.put(TYPE, "dir");
+ el.put(CREATED_BY, scopeById.getUserCreatedBy().getUserName());
+ el.put(MODIFIED_BY, scopeById.getUserModifiedBy().getUserName());
resultList.add(el);
}
}
@@ -725,24 +731,24 @@ public class PolicyManagerServlet extends HttpServlet {
}
if(scopeNameValue.equals(scopeNameCheck)){
JSONObject el = new JSONObject();
- el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1));
- el.put("date", policy.getModifiedDate());
- el.put("version", policy.getActiveVersion());
- el.put("size", "");
- el.put("type", "file");
- el.put("createdBy", getUserName(policy.getCreatedBy()));
- el.put("modifiedBy", getUserName(policy.getModifiedBy()));
+ el.put(NAME, policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1));
+ el.put(DATE, policy.getModifiedDate());
+ el.put(VERSION, policy.getActiveVersion());
+ el.put(SIZE, "");
+ el.put(TYPE, "file");
+ el.put(CREATED_BY, getUserName(policy.getCreatedBy()));
+ el.put(MODIFIED_BY, getUserName(policy.getModifiedBy()));
resultList.add(el);
}
}else if(!scopes.isEmpty() && scopes.contains(scopeNameValue)){
JSONObject el = new JSONObject();
- el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1));
- el.put("date", policy.getModifiedDate());
- el.put("version", policy.getActiveVersion());
- el.put("size", "");
- el.put("type", "file");
- el.put("createdBy", getUserName(policy.getCreatedBy()));
- el.put("modifiedBy", getUserName(policy.getModifiedBy()));
+ el.put(NAME, policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1));
+ el.put(DATE, policy.getModifiedDate());
+ el.put(VERSION, policy.getActiveVersion());
+ el.put(SIZE, "");
+ el.put(TYPE, "file");
+ el.put(CREATED_BY, getUserName(policy.getCreatedBy()));
+ el.put(MODIFIED_BY, getUserName(policy.getModifiedBy()));
resultList.add(el);
}
}
@@ -1496,10 +1502,10 @@ public class PolicyManagerServlet extends HttpServlet {
name = params.getString("path").replace("/", File.separator) + File.separator +params.getString("subScopename");
}
}else{
- name = params.getString("name");
+ name = params.getString(NAME);
}
}catch(Exception e){
- name = params.getString("name");
+ name = params.getString(NAME);
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Exception Occured While Adding Scope"+e);
}
String validateName;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java
index d2c5a3ba7..c791910ad 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
index b908c75d9..2a52335e5 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java
@@ -298,15 +298,12 @@ public class PolicyRestController extends RestrictedBaseController{
Object obj = mapper1.treeToValue(root, Object.class);
String json = mapper1.writeValueAsString(obj);
- Object content = new ByteArrayInputStream(json.getBytes());
-
- if (content instanceof InputStream) {
- // send current configuration
- try (OutputStream os = connection.getOutputStream()) {
- int count = IOUtils.copy((InputStream) content, os);
- if (policyLogger.isDebugEnabled()) {
- policyLogger.debug("copied to output, bytes=" + count);
- }
+ // send current configuration
+ try(InputStream content = new ByteArrayInputStream(json.getBytes());
+ OutputStream os = connection.getOutputStream()) {
+ int count = IOUtils.copy(content, os);
+ if (policyLogger.isDebugEnabled()) {
+ policyLogger.debug("copied to output, bytes=" + count);
}
}
}else{
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyController.java
index ae473f34f..2200eae99 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyController.java
@@ -3,6 +3,7 @@
* ONAP Policy Engine
* ================================================================================
* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -71,663 +72,659 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Controller
@RequestMapping("/")
public class PolicyController extends RestrictedBaseController {
- private static final Logger policyLogger = FlexLogger.getLogger(PolicyController.class);
-
- private static CommonClassDao commonClassDao;
- //
- // The PAP Engine
- //
- private static PAPPolicyEngine papEngine;
-
- private static String logTableLimit;
- private static String systemAlertTableLimit;
- protected static Map<String, String> dropDownMap = new HashMap<>();
- public static Map<String, String> getDropDownMap() {
- return dropDownMap;
- }
-
- public static void setDropDownMap(Map<String, String> dropDownMap) {
- PolicyController.dropDownMap = dropDownMap;
- }
-
- public static String getDomain() {
- return XACMLProperties.getProperty(XACMLRestProperties.PROP_ADMIN_DOMAIN, "urn");
- }
-
- private static final Object mapAccess = new Object();
- private static Map<Datatype, List<FunctionDefinition>> mapDatatype2Function = null;
- private static Map<String, FunctionDefinition> mapID2Function = null;
-
- //Constant variables used across Policy-sdk
- private static final String policyData = "policyData";
- private static final String characterEncoding = "UTF-8";
- private static final String contentType = "application/json";
- private static final String file = "file";
-
- //Smtp Java Mail Properties
- private static String smtpHost = null;
- private static String smtpPort = null;
- private static String smtpUsername = null;
- private static String smtpPassword = null;
- private static String smtpApplicationName = null;
- private static String smtpEmailExtension = null;
- //log db Properties
- private static String logdbDriver = null;
- private static String logdbUrl = null;
- private static String logdbUserName = null;
- private static String logdbPassword = null;
- private static String logdbDialect = null;
- //Xacml db properties
- private static String xacmldbUrl = null;
- private static String xacmldbUserName = null;
- private static String xacmldbPassword = null;
-
- //AutoPush feature.
- private static String autoPushAvailable;
- private static String autoPushDSClosedLoop;
- private static String autoPushDSFirewall;
- private static String autoPushDSMicroservice;
- private static String autoPushPDPGroup;
-
- //papURL
- private static String papUrl;
-
- //MicroService Model Properties
- private static String msOnapName;
- private static String msPolicyName;
-
- //WebApp directories
- private static String configHome;
- private static String actionHome;
-
- //File upload size
- private static long fileSizeLimit;
-
- private static boolean jUnit = false;
-
-
- public static boolean isjUnit() {
- return jUnit;
- }
-
- public static void setjUnit(boolean jUnit) {
- PolicyController.jUnit = jUnit;
- }
-
- @Autowired
- private PolicyController(CommonClassDao commonClassDao){
- PolicyController.commonClassDao = commonClassDao;
- }
-
- public PolicyController() {
- // Empty constructor
- }
-
- @PostConstruct
- public void init(){
- Properties prop = new Properties();
- InputStream input = null;
- try {
- if(jUnit){
- File file = new File(new File(".").getCanonicalPath() + File.separator + "src"+ File.separator + "test" + File.separator + "resources" + File.separator + "JSONConfig.json");
- input = new FileInputStream(file);
- }else{
- input = new FileInputStream("xacml.admin.properties");
- }
- // load a properties file
- prop.load(input);
- //file upload size limit property
- setFileSizeLimit(prop.getProperty("file.size.limit"));
- //pap url
- setPapUrl(prop.getProperty("xacml.rest.pap.url"));
- // get the property values
- setSmtpHost(prop.getProperty("onap.smtp.host"));
- setSmtpPort(prop.getProperty("onap.smtp.port"));
- setSmtpUsername(prop.getProperty("onap.smtp.userName"));
- setSmtpPassword(prop.getProperty("onap.smtp.password"));
- setSmtpApplicationName(prop.getProperty("onap.application.name"));
- setSmtpEmailExtension(prop.getProperty("onap.smtp.emailExtension"));
- //Log Database Properties
- setLogdbDriver(prop.getProperty("xacml.log.db.driver"));
- setLogdbUrl(prop.getProperty("xacml.log.db.url"));
- setLogdbUserName(prop.getProperty("xacml.log.db.user"));
- setLogdbPassword(prop.getProperty("xacml.log.db.password"));
- setLogdbDialect(prop.getProperty("onap.dialect"));
- //Xacml Database Properties
- setXacmldbUrl(prop.getProperty("javax.persistence.jdbc.url"));
- setXacmldbUserName(prop.getProperty("javax.persistence.jdbc.user"));
- setXacmldbPassword(prop.getProperty("javax.persistence.jdbc.password"));
- //AutoPuh
- setAutoPushAvailable(prop.getProperty("xacml.automatic.push"));
- setAutoPushDSClosedLoop(prop.getProperty("xacml.autopush.closedloop"));
- setAutoPushDSFirewall(prop.getProperty("xacml.autopush.firewall"));
- setAutoPushDSMicroservice(prop.getProperty("xacml.autopush.microservice"));
- setAutoPushPDPGroup(prop.getProperty("xacml.autopush.pdpGroup"));
- //Micro Service Properties
- setMsOnapName(prop.getProperty("xacml.policy.msOnapName"));
- if(getMsOnapName() == null){
- setMsOnapName(prop.getProperty("xacml.policy.msEcompName"));
- }
- policyLogger.info("getMsOnapName => " + getMsOnapName());
- setMsPolicyName(prop.getProperty("xacml.policy.msPolicyName"));
- policyLogger.info("setMsPolicyName => " + getMsPolicyName());
- //WebApp directories
- setConfigHome(prop.getProperty("xacml.rest.config.webapps") + "Config");
- setActionHome(prop.getProperty("xacml.rest.config.webapps") + "Action");
- //Get the Property Values for Dashboard tab Limit
- try{
- setLogTableLimit(prop.getProperty("xacml.onap.dashboard.logTableLimit"));
- setSystemAlertTableLimit(prop.getProperty("xacml.onap.dashboard.systemAlertTableLimit"));
- }catch(Exception e){
- policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Dashboard tab Property fields are missing" +e);
- setLogTableLimit("5000");
- setSystemAlertTableLimit("2000");
- }
- System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.admin.properties");
- } catch (IOException ex) {
- policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured while reading the Smtp properties from xacml.admin.properties file" +ex);
- } finally {
- if (input != null) {
- try {
- input.close();
- } catch (IOException e) {
- policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured while Closing the xacml.admin.properties file" +e);
- }
- }
- }
-
- //Initialize the FunctionDefinition table at Server Start up
- Map<Datatype, List<FunctionDefinition>> functionMap = getFunctionDatatypeMap();
- for ( Entry<Datatype, List<FunctionDefinition>> entry : functionMap.entrySet()) {
- List<FunctionDefinition> functionDefinations = entry.getValue();
- for (FunctionDefinition functionDef : functionDefinations) {
- dropDownMap.put(functionDef.getShortname(),functionDef.getXacmlid());
- }
- }
-
- }
-
- public static Map<Datatype, List<FunctionDefinition>> getFunctionDatatypeMap() {
- synchronized(mapAccess) {
- if (mapDatatype2Function == null) {
- buildFunctionMaps();
- }
- }
- return mapDatatype2Function;
- }
-
- public static Map<String, FunctionDefinition> getFunctionIDMap() {
- synchronized(mapAccess) {
- if (mapID2Function == null) {
- buildFunctionMaps();
- }
- }
- return mapID2Function;
- }
-
- private static void buildFunctionMaps() {
- mapDatatype2Function = new HashMap<>();
- mapID2Function = new HashMap<>();
- List<Object> functiondefinitions = commonClassDao.getData(FunctionDefinition.class);
- for (int i = 0; i < functiondefinitions.size(); i ++) {
- FunctionDefinition value = (FunctionDefinition) functiondefinitions.get(i);
- mapID2Function.put(value.getXacmlid(), value);
- if (!mapDatatype2Function.containsKey(value.getDatatypeBean())) {
- mapDatatype2Function.put(value.getDatatypeBean(), new ArrayList<FunctionDefinition>());
- }
- mapDatatype2Function.get(value.getDatatypeBean()).add(value);
- }
- }
-
- @RequestMapping(value={"/get_FunctionDefinitionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getFunctionDefinitionData(HttpServletRequest request, HttpServletResponse response){
- try{
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("functionDefinitionDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FunctionDefinition.class, "shortname")));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.getWriter().write(j.toString());
- }
- catch (Exception e){
- policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE +"Error while retriving the Function Definition data"+e);
- }
- }
-
- public PolicyEntity getPolicyEntityData(String scope, String policyName){
- String key = scope + ":" + policyName;
- List<Object> data = commonClassDao.getDataById(PolicyEntity.class, "scope:policyName", key);
- return (PolicyEntity) data.get(0);
- }
-
- public static Map<String, Roles> getUserRoles(String userId) {
- Map<String, Roles> scopes = new HashMap<>();
- List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
- if (roles != null && !roles.isEmpty()) {
- for (Object role : roles) {
- scopes.put(((Roles) role).getScope(), (Roles) role);
- }
- }
- return scopes;
- }
-
- public List<String> getRolesOfUser(String userId) {
- List<String> rolesList = new ArrayList<>();
- List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
- for (Object role: roles) {
- rolesList.add(((Roles) role).getRole());
- }
- return rolesList;
- }
-
- public List<Object> getRoles(String userId) {
- return commonClassDao.getDataById(Roles.class, "loginId", userId);
- }
-
- //Get List of User Roles
- @RequestMapping(value={"/get_UserRolesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
- public void getUserRolesEntityData(HttpServletRequest request, HttpServletResponse response){
- try{
- String userId = UserUtils.getUserSession(request).getOrgUserId();
- Map<String, Object> model = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- model.put("userRolesDatas", mapper.writeValueAsString(getRolesOfUser(userId)));
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
- JSONObject j = new JSONObject(msg);
- response.getWriter().write(j.toString());
- }
- catch (Exception e){
- policyLogger.error("Exception Occured"+e);
- }
- }
-
- //Policy tabs Model and View
+ private static final Logger policyLogger = FlexLogger.getLogger(PolicyController.class);
+
+ private static CommonClassDao commonClassDao;
+ //
+ // The PAP Engine
+ //
+ private static PAPPolicyEngine papEngine;
+
+ private static String logTableLimit;
+ private static String systemAlertTableLimit;
+ protected static Map<String, String> dropDownMap = new HashMap<>();
+ public static Map<String, String> getDropDownMap() {
+ return dropDownMap;
+ }
+
+ public static void setDropDownMap(Map<String, String> dropDownMap) {
+ PolicyController.dropDownMap = dropDownMap;
+ }
+
+ public static String getDomain() {
+ return XACMLProperties.getProperty(XACMLRestProperties.PROP_ADMIN_DOMAIN, "urn");
+ }
+
+ private static final Object mapAccess = new Object();
+ private static Map<Datatype, List<FunctionDefinition>> mapDatatype2Function = null;
+ private static Map<String, FunctionDefinition> mapID2Function = null;
+
+ //Constant variables used across Policy-sdk
+ private static final String policyData = "policyData";
+ private static final String characterEncoding = "UTF-8";
+ private static final String contentType = "application/json";
+ private static final String file = "file";
+
+ //Smtp Java Mail Properties
+ private static String smtpHost = null;
+ private static String smtpPort = null;
+ private static String smtpUsername = null;
+ private static String smtpPassword = null;
+ private static String smtpApplicationName = null;
+ private static String smtpEmailExtension = null;
+ //log db Properties
+ private static String logdbDriver = null;
+ private static String logdbUrl = null;
+ private static String logdbUserName = null;
+ private static String logdbPassword = null;
+ private static String logdbDialect = null;
+ //Xacml db properties
+ private static String xacmldbUrl = null;
+ private static String xacmldbUserName = null;
+ private static String xacmldbPassword = null;
+
+ //AutoPush feature.
+ private static String autoPushAvailable;
+ private static String autoPushDSClosedLoop;
+ private static String autoPushDSFirewall;
+ private static String autoPushDSMicroservice;
+ private static String autoPushPDPGroup;
+
+ //papURL
+ private static String papUrl;
+
+ //MicroService Model Properties
+ private static String msOnapName;
+ private static String msPolicyName;
+
+ //WebApp directories
+ private static String configHome;
+ private static String actionHome;
+
+ //File upload size
+ private static long fileSizeLimit;
+
+ private static boolean jUnit = false;
+
+
+ public static boolean isjUnit() {
+ return jUnit;
+ }
+
+ public static void setjUnit(boolean jUnit) {
+ PolicyController.jUnit = jUnit;
+ }
+
+ @Autowired
+ private PolicyController(CommonClassDao commonClassDao){
+ PolicyController.commonClassDao = commonClassDao;
+ }
+
+ public PolicyController() {
+ // Empty constructor
+ }
+
+ @PostConstruct
+ public void init(){
+ Properties prop = new Properties();
+
+ try {
+ String fileName;
+ if(jUnit){
+ fileName = new File(".").getCanonicalPath() + File.separator + "src"+ File.separator + "test" + File.separator + "resources" + File.separator + "JSONConfig.json";
+ } else {
+ fileName = "xacml.admin.properties";
+ }
+
+ try(InputStream input = new FileInputStream(fileName)) {
+ // load a properties file
+ prop.load(input);
+ }
+
+ //file upload size limit property
+ setFileSizeLimit(prop.getProperty("file.size.limit"));
+ //pap url
+ setPapUrl(prop.getProperty("xacml.rest.pap.url"));
+ // get the property values
+ setSmtpHost(prop.getProperty("onap.smtp.host"));
+ setSmtpPort(prop.getProperty("onap.smtp.port"));
+ setSmtpUsername(prop.getProperty("onap.smtp.userName"));
+ setSmtpPassword(prop.getProperty("onap.smtp.password"));
+ setSmtpApplicationName(prop.getProperty("onap.application.name"));
+ setSmtpEmailExtension(prop.getProperty("onap.smtp.emailExtension"));
+ //Log Database Properties
+ setLogdbDriver(prop.getProperty("xacml.log.db.driver"));
+ setLogdbUrl(prop.getProperty("xacml.log.db.url"));
+ setLogdbUserName(prop.getProperty("xacml.log.db.user"));
+ setLogdbPassword(prop.getProperty("xacml.log.db.password"));
+ setLogdbDialect(prop.getProperty("onap.dialect"));
+ //Xacml Database Properties
+ setXacmldbUrl(prop.getProperty("javax.persistence.jdbc.url"));
+ setXacmldbUserName(prop.getProperty("javax.persistence.jdbc.user"));
+ setXacmldbPassword(prop.getProperty("javax.persistence.jdbc.password"));
+ //AutoPuh
+ setAutoPushAvailable(prop.getProperty("xacml.automatic.push"));
+ setAutoPushDSClosedLoop(prop.getProperty("xacml.autopush.closedloop"));
+ setAutoPushDSFirewall(prop.getProperty("xacml.autopush.firewall"));
+ setAutoPushDSMicroservice(prop.getProperty("xacml.autopush.microservice"));
+ setAutoPushPDPGroup(prop.getProperty("xacml.autopush.pdpGroup"));
+ //Micro Service Properties
+ setMsOnapName(prop.getProperty("xacml.policy.msOnapName"));
+ if(getMsOnapName() == null){
+ setMsOnapName(prop.getProperty("xacml.policy.msEcompName"));
+ }
+ policyLogger.info("getMsOnapName => " + getMsOnapName());
+ setMsPolicyName(prop.getProperty("xacml.policy.msPolicyName"));
+ policyLogger.info("setMsPolicyName => " + getMsPolicyName());
+ //WebApp directories
+ setConfigHome(prop.getProperty("xacml.rest.config.webapps") + "Config");
+ setActionHome(prop.getProperty("xacml.rest.config.webapps") + "Action");
+ //Get the Property Values for Dashboard tab Limit
+ try{
+ setLogTableLimit(prop.getProperty("xacml.onap.dashboard.logTableLimit"));
+ setSystemAlertTableLimit(prop.getProperty("xacml.onap.dashboard.systemAlertTableLimit"));
+ }catch(Exception e){
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Dashboard tab Property fields are missing" +e);
+ setLogTableLimit("5000");
+ setSystemAlertTableLimit("2000");
+ }
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.admin.properties");
+ } catch (IOException ex) {
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured while reading the Smtp properties from xacml.admin.properties file" +ex);
+ }
+
+ //Initialize the FunctionDefinition table at Server Start up
+ Map<Datatype, List<FunctionDefinition>> functionMap = getFunctionDatatypeMap();
+ for ( Entry<Datatype, List<FunctionDefinition>> entry : functionMap.entrySet()) {
+ List<FunctionDefinition> functionDefinations = entry.getValue();
+ for (FunctionDefinition functionDef : functionDefinations) {
+ dropDownMap.put(functionDef.getShortname(),functionDef.getXacmlid());
+ }
+ }
+
+ }
+
+ public static Map<Datatype, List<FunctionDefinition>> getFunctionDatatypeMap() {
+ synchronized(mapAccess) {
+ if (mapDatatype2Function == null) {
+ buildFunctionMaps();
+ }
+ }
+ return mapDatatype2Function;
+ }
+
+ public static Map<String, FunctionDefinition> getFunctionIDMap() {
+ synchronized(mapAccess) {
+ if (mapID2Function == null) {
+ buildFunctionMaps();
+ }
+ }
+ return mapID2Function;
+ }
+
+ private static void buildFunctionMaps() {
+ mapDatatype2Function = new HashMap<>();
+ mapID2Function = new HashMap<>();
+ List<Object> functiondefinitions = commonClassDao.getData(FunctionDefinition.class);
+ for (int i = 0; i < functiondefinitions.size(); i ++) {
+ FunctionDefinition value = (FunctionDefinition) functiondefinitions.get(i);
+ mapID2Function.put(value.getXacmlid(), value);
+ if (!mapDatatype2Function.containsKey(value.getDatatypeBean())) {
+ mapDatatype2Function.put(value.getDatatypeBean(), new ArrayList<FunctionDefinition>());
+ }
+ mapDatatype2Function.get(value.getDatatypeBean()).add(value);
+ }
+ }
+
+ @RequestMapping(value={"/get_FunctionDefinitionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+ public void getFunctionDefinitionData(HttpServletRequest request, HttpServletResponse response){
+ try{
+ Map<String, Object> model = new HashMap<>();
+ ObjectMapper mapper = new ObjectMapper();
+ model.put("functionDefinitionDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FunctionDefinition.class, "shortname")));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ }
+ catch (Exception e){
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE +"Error while retriving the Function Definition data"+e);
+ }
+ }
+
+ public PolicyEntity getPolicyEntityData(String scope, String policyName){
+ String key = scope + ":" + policyName;
+ List<Object> data = commonClassDao.getDataById(PolicyEntity.class, "scope:policyName", key);
+ return (PolicyEntity) data.get(0);
+ }
+
+ public static Map<String, Roles> getUserRoles(String userId) {
+ Map<String, Roles> scopes = new HashMap<>();
+ List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
+ if (roles != null && !roles.isEmpty()) {
+ for (Object role : roles) {
+ scopes.put(((Roles) role).getScope(), (Roles) role);
+ }
+ }
+ return scopes;
+ }
+
+ public List<String> getRolesOfUser(String userId) {
+ List<String> rolesList = new ArrayList<>();
+ List<Object> roles = commonClassDao.getDataById(Roles.class, "loginId", userId);
+ for (Object role: roles) {
+ rolesList.add(((Roles) role).getRole());
+ }
+ return rolesList;
+ }
+
+ public List<Object> getRoles(String userId) {
+ return commonClassDao.getDataById(Roles.class, "loginId", userId);
+ }
+
+ //Get List of User Roles
+ @RequestMapping(value={"/get_UserRolesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
+ public void getUserRolesEntityData(HttpServletRequest request, HttpServletResponse response){
+ try{
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ Map<String, Object> model = new HashMap<>();
+ ObjectMapper mapper = new ObjectMapper();
+ model.put("userRolesDatas", mapper.writeValueAsString(getRolesOfUser(userId)));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+ }
+ catch (Exception e){
+ policyLogger.error("Exception Occured"+e);
+ }
+ }
+
+ //Policy tabs Model and View
@RequestMapping(value= {"/policy", "/policy/Editor" } , method = RequestMethod.GET)
- public ModelAndView view(HttpServletRequest request){
- String myRequestURL = request.getRequestURL().toString();
- try {
- //
- // Set the URL for the RESTful PAP Engine
- //
- setPapEngine((PAPPolicyEngine) new RESTfulPAPEngine(myRequestURL));
- new PDPGroupContainer((PAPPolicyEngine) new RESTfulPAPEngine(myRequestURL));
- } catch (Exception e) {
- policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Exception Occured while loading PAP"+e);
- }
- Map<String, Object> model = new HashMap<>();
- return new ModelAndView("policy_Editor","model", model);
- }
-
- public PAPPolicyEngine getPapEngine() {
- return papEngine;
- }
-
- public static void setPapEngine(PAPPolicyEngine papEngine) {
- PolicyController.papEngine = papEngine;
- }
-
- public String getUserName(String createdBy) {
- String loginId = createdBy;
- List<Object> data = commonClassDao.getDataById(UserInfo.class, "loginId", loginId);
- return data.get(0).toString();
- }
-
- public static boolean getActivePolicy(String query) {
- if(!commonClassDao.getDataByQuery(query, new SimpleBindings()).isEmpty()){
- return true;
- }else{
- return false;
- }
- }
-
- public void executeQuery(String query) {
- commonClassDao.updateQuery(query);
- }
-
- public void saveData(Object cloneEntity) {
- commonClassDao.save(cloneEntity);
- }
-
- public void updateData(Object entity) {
- commonClassDao.update(entity);
- }
-
- public void deleteData(Object entity) {
- commonClassDao.delete(entity);
- }
-
- public List<Object> getData(@SuppressWarnings("rawtypes") Class className){
- return commonClassDao.getData(className);
- }
-
- public PolicyVersion getPolicyEntityFromPolicyVersion(String query){
- return (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", query);
- }
-
- public List<Object> getDataByQuery(String query, SimpleBindings params){
- return commonClassDao.getDataByQuery(query, params);
- }
-
-
- @SuppressWarnings("rawtypes")
- public Object getEntityItem(Class className, String columname, String key){
- return commonClassDao.getEntityItem(className, columname, key);
- }
-
-
- public void watchPolicyFunction(PolicyVersion entity, String policyName, String mode){
- PolicyNotificationMail email = new PolicyNotificationMail();
- try {
- email.sendMail(entity, policyName, mode, commonClassDao);
- } catch (MessagingException e) {
- policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Excepton Occured while Renaming/Deleting a Policy or Scope" + e);
- }
- }
-
- //Switch Version
- public JSONObject switchVersionPolicyContent(String policyName) {
- String dbCheckName = policyName.replace("/", ".");
- if(dbCheckName.contains("Config_")){
- dbCheckName = dbCheckName.replace(".Config_", ":Config_");
- }else if(dbCheckName.contains("Action_")){
- dbCheckName = dbCheckName.replace(".Action_", ":Action_");
- }else if(dbCheckName.contains("Decision_")){
- dbCheckName = dbCheckName.replace(".Decision_", ":Decision_");
- }
- String[] splitDBCheckName = dbCheckName.split(":");
- String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
- SimpleBindings params = new SimpleBindings();
- params.put("splitDBCheckName1", splitDBCheckName[1] + "%");
- params.put("splitDBCheckName0", splitDBCheckName[0]);
- List<Object> policyEntity = commonClassDao.getDataByQuery(query, params);
- List<String> av = new ArrayList<>();
- for(Object entity : policyEntity){
- PolicyEntity pEntity = (PolicyEntity) entity;
- String removeExtension = pEntity.getPolicyName().replace(".xml", "");
- String version = removeExtension.substring(removeExtension.lastIndexOf('.')+1);
- av.add(version);
- }
- if(policyName.contains("/")){
- policyName = policyName.replace("/", File.separator);
- }
- PolicyVersion entity = (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", policyName);
- JSONObject el = new JSONObject();
- el.put("activeVersion", entity.getActiveVersion());
- el.put("availableVersions", av);
- el.put("highestVersion", entity.getHigherVersion());
- return el;
- }
-
- public static String getLogTableLimit() {
- return logTableLimit;
- }
-
- public static void setLogTableLimit(String logTableLimit) {
- PolicyController.logTableLimit = logTableLimit;
- }
-
- public static String getSystemAlertTableLimit() {
- return systemAlertTableLimit;
- }
-
- public static void setSystemAlertTableLimit(String systemAlertTableLimit) {
- PolicyController.systemAlertTableLimit = systemAlertTableLimit;
- }
-
- public static CommonClassDao getCommonClassDao() {
- return commonClassDao;
- }
-
- public static void setCommonClassDao(CommonClassDao commonClassDao) {
- PolicyController.commonClassDao = commonClassDao;
- }
-
- public static Map<Datatype, List<FunctionDefinition>> getMapDatatype2Function() {
- return mapDatatype2Function;
- }
-
- public static void setMapDatatype2Function(Map<Datatype, List<FunctionDefinition>> mapDatatype2Function) {
- PolicyController.mapDatatype2Function = mapDatatype2Function;
- }
-
- public static Map<String, FunctionDefinition> getMapID2Function() {
- return mapID2Function;
- }
-
- public static void setMapID2Function(Map<String, FunctionDefinition> mapID2Function) {
- PolicyController.mapID2Function = mapID2Function;
- }
-
- public static String getSmtpHost() {
- return smtpHost;
- }
-
- public static void setSmtpHost(String smtpHost) {
- PolicyController.smtpHost = smtpHost;
- }
-
- public static String getSmtpPort() {
- return smtpPort;
- }
-
- public static void setSmtpPort(String smtpPort) {
- PolicyController.smtpPort = smtpPort;
- }
-
- public static String getSmtpUsername() {
- return smtpUsername;
- }
-
- public static void setSmtpUsername(String smtpUsername) {
- PolicyController.smtpUsername = smtpUsername;
- }
-
- public static String getSmtpPassword() {
- return smtpPassword;
- }
-
- public static void setSmtpPassword(String smtpPassword) {
- PolicyController.smtpPassword = smtpPassword;
- }
-
- public static String getSmtpApplicationName() {
- return smtpApplicationName;
- }
-
- public static void setSmtpApplicationName(String smtpApplicationName) {
- PolicyController.smtpApplicationName = smtpApplicationName;
- }
-
- public static String getSmtpEmailExtension() {
- return smtpEmailExtension;
- }
-
- public static void setSmtpEmailExtension(String smtpEmailExtension) {
- PolicyController.smtpEmailExtension = smtpEmailExtension;
- }
-
- public static String getLogdbDriver() {
- return logdbDriver;
- }
-
- public static void setLogdbDriver(String logdbDriver) {
- PolicyController.logdbDriver = logdbDriver;
- }
+ public ModelAndView view(HttpServletRequest request){
+ String myRequestURL = request.getRequestURL().toString();
+ try {
+ //
+ // Set the URL for the RESTful PAP Engine
+ //
+ setPapEngine((PAPPolicyEngine) new RESTfulPAPEngine(myRequestURL));
+ new PDPGroupContainer((PAPPolicyEngine) new RESTfulPAPEngine(myRequestURL));
+ } catch (Exception e) {
+ policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Exception Occured while loading PAP"+e);
+ }
+ Map<String, Object> model = new HashMap<>();
+ return new ModelAndView("policy_Editor","model", model);
+ }
+
+ public PAPPolicyEngine getPapEngine() {
+ return papEngine;
+ }
+
+ public static void setPapEngine(PAPPolicyEngine papEngine) {
+ PolicyController.papEngine = papEngine;
+ }
+
+ public String getUserName(String createdBy) {
+ String loginId = createdBy;
+ List<Object> data = commonClassDao.getDataById(UserInfo.class, "loginId", loginId);
+ return data.get(0).toString();
+ }
+
+ public static boolean getActivePolicy(String query) {
+ if(!commonClassDao.getDataByQuery(query, new SimpleBindings()).isEmpty()){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
+ public void executeQuery(String query) {
+ commonClassDao.updateQuery(query);
+ }
+
+ public void saveData(Object cloneEntity) {
+ commonClassDao.save(cloneEntity);
+ }
+
+ public void updateData(Object entity) {
+ commonClassDao.update(entity);
+ }
+
+ public void deleteData(Object entity) {
+ commonClassDao.delete(entity);
+ }
+
+ public List<Object> getData(@SuppressWarnings("rawtypes") Class className){
+ return commonClassDao.getData(className);
+ }
+
+ public PolicyVersion getPolicyEntityFromPolicyVersion(String query){
+ return (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", query);
+ }
+
+ public List<Object> getDataByQuery(String query, SimpleBindings params){
+ return commonClassDao.getDataByQuery(query, params);
+ }
+
+
+ @SuppressWarnings("rawtypes")
+ public Object getEntityItem(Class className, String columname, String key){
+ return commonClassDao.getEntityItem(className, columname, key);
+ }
+
+
+ public void watchPolicyFunction(PolicyVersion entity, String policyName, String mode){
+ PolicyNotificationMail email = new PolicyNotificationMail();
+ try {
+ email.sendMail(entity, policyName, mode, commonClassDao);
+ } catch (MessagingException e) {
+ policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Excepton Occured while Renaming/Deleting a Policy or Scope" + e);
+ }
+ }
+
+ //Switch Version
+ public JSONObject switchVersionPolicyContent(String policyName) {
+ String dbCheckName = policyName.replace("/", ".");
+ if(dbCheckName.contains("Config_")){
+ dbCheckName = dbCheckName.replace(".Config_", ":Config_");
+ }else if(dbCheckName.contains("Action_")){
+ dbCheckName = dbCheckName.replace(".Action_", ":Action_");
+ }else if(dbCheckName.contains("Decision_")){
+ dbCheckName = dbCheckName.replace(".Decision_", ":Decision_");
+ }
+ String[] splitDBCheckName = dbCheckName.split(":");
+ String query = "FROM PolicyEntity where policyName like :splitDBCheckName1 and scope = :splitDBCheckName0";
+ SimpleBindings params = new SimpleBindings();
+ params.put("splitDBCheckName1", splitDBCheckName[1] + "%");
+ params.put("splitDBCheckName0", splitDBCheckName[0]);
+ List<Object> policyEntity = commonClassDao.getDataByQuery(query, params);
+ List<String> av = new ArrayList<>();
+ for(Object entity : policyEntity){
+ PolicyEntity pEntity = (PolicyEntity) entity;
+ String removeExtension = pEntity.getPolicyName().replace(".xml", "");
+ String version = removeExtension.substring(removeExtension.lastIndexOf('.')+1);
+ av.add(version);
+ }
+ if(policyName.contains("/")){
+ policyName = policyName.replace("/", File.separator);
+ }
+ PolicyVersion entity = (PolicyVersion) commonClassDao.getEntityItem(PolicyVersion.class, "policyName", policyName);
+ JSONObject el = new JSONObject();
+ el.put("activeVersion", entity.getActiveVersion());
+ el.put("availableVersions", av);
+ el.put("highestVersion", entity.getHigherVersion());
+ return el;
+ }
+
+ public static String getLogTableLimit() {
+ return logTableLimit;
+ }
+
+ public static void setLogTableLimit(String logTableLimit) {
+ PolicyController.logTableLimit = logTableLimit;
+ }
+
+ public static String getSystemAlertTableLimit() {
+ return systemAlertTableLimit;
+ }
+
+ public static void setSystemAlertTableLimit(String systemAlertTableLimit) {
+ PolicyController.systemAlertTableLimit = systemAlertTableLimit;
+ }
+
+ public static CommonClassDao getCommonClassDao() {
+ return commonClassDao;
+ }
+
+ public static void setCommonClassDao(CommonClassDao commonClassDao) {
+ PolicyController.commonClassDao = commonClassDao;
+ }
+
+ public static Map<Datatype, List<FunctionDefinition>> getMapDatatype2Function() {
+ return mapDatatype2Function;
+ }
+
+ public static void setMapDatatype2Function(Map<Datatype, List<FunctionDefinition>> mapDatatype2Function) {
+ PolicyController.mapDatatype2Function = mapDatatype2Function;
+ }
+
+ public static Map<String, FunctionDefinition> getMapID2Function() {
+ return mapID2Function;
+ }
+
+ public static void setMapID2Function(Map<String, FunctionDefinition> mapID2Function) {
+ PolicyController.mapID2Function = mapID2Function;
+ }
+
+ public static String getSmtpHost() {
+ return smtpHost;
+ }
+
+ public static void setSmtpHost(String smtpHost) {
+ PolicyController.smtpHost = smtpHost;
+ }
+
+ public static String getSmtpPort() {
+ return smtpPort;
+ }
+
+ public static void setSmtpPort(String smtpPort) {
+ PolicyController.smtpPort = smtpPort;
+ }
+
+ public static String getSmtpUsername() {
+ return smtpUsername;
+ }
+
+ public static void setSmtpUsername(String smtpUsername) {
+ PolicyController.smtpUsername = smtpUsername;
+ }
+
+ public static String getSmtpPassword() {
+ return smtpPassword;
+ }
+
+ public static void setSmtpPassword(String smtpPassword) {
+ PolicyController.smtpPassword = smtpPassword;
+ }
+
+ public static String getSmtpApplicationName() {
+ return smtpApplicationName;
+ }
+
+ public static void setSmtpApplicationName(String smtpApplicationName) {
+ PolicyController.smtpApplicationName = smtpApplicationName;
+ }
+
+ public static String getSmtpEmailExtension() {
+ return smtpEmailExtension;
+ }
+
+ public static void setSmtpEmailExtension(String smtpEmailExtension) {
+ PolicyController.smtpEmailExtension = smtpEmailExtension;
+ }
+
+ public static String getLogdbDriver() {
+ return logdbDriver;
+ }
+
+ public static void setLogdbDriver(String logdbDriver) {
+ PolicyController.logdbDriver = logdbDriver;
+ }
- public static String getLogdbUrl() {
- return logdbUrl;
- }
+ public static String getLogdbUrl() {
+ return logdbUrl;
+ }
- public static void setLogdbUrl(String logdbUrl) {
- PolicyController.logdbUrl = logdbUrl;
- }
+ public static void setLogdbUrl(String logdbUrl) {
+ PolicyController.logdbUrl = logdbUrl;
+ }
- public static String getLogdbUserName() {
- return logdbUserName;
- }
+ public static String getLogdbUserName() {
+ return logdbUserName;
+ }
- public static void setLogdbUserName(String logdbUserName) {
- PolicyController.logdbUserName = logdbUserName;
- }
+ public static void setLogdbUserName(String logdbUserName) {
+ PolicyController.logdbUserName = logdbUserName;
+ }
- public static String getLogdbPassword() {
- return logdbPassword;
- }
+ public static String getLogdbPassword() {
+ return logdbPassword;
+ }
- public static void setLogdbPassword(String logdbPassword) {
- PolicyController.logdbPassword = logdbPassword;
- }
+ public static void setLogdbPassword(String logdbPassword) {
+ PolicyController.logdbPassword = logdbPassword;
+ }
- public static String getLogdbDialect() {
- return logdbDialect;
- }
+ public static String getLogdbDialect() {
+ return logdbDialect;
+ }
- public static void setLogdbDialect(String logdbDialect) {
- PolicyController.logdbDialect = logdbDialect;
- }
+ public static void setLogdbDialect(String logdbDialect) {
+ PolicyController.logdbDialect = logdbDialect;
+ }
- public static String getXacmldbUrl() {
- return xacmldbUrl;
- }
+ public static String getXacmldbUrl() {
+ return xacmldbUrl;
+ }
- public static void setXacmldbUrl(String xacmldbUrl) {
- PolicyController.xacmldbUrl = xacmldbUrl;
- }
+ public static void setXacmldbUrl(String xacmldbUrl) {
+ PolicyController.xacmldbUrl = xacmldbUrl;
+ }
- public static String getXacmldbUserName() {
- return xacmldbUserName;
- }
+ public static String getXacmldbUserName() {
+ return xacmldbUserName;
+ }
- public static void setXacmldbUserName(String xacmldbUserName) {
- PolicyController.xacmldbUserName = xacmldbUserName;
- }
+ public static void setXacmldbUserName(String xacmldbUserName) {
+ PolicyController.xacmldbUserName = xacmldbUserName;
+ }
- public static String getXacmldbPassword() {
- return xacmldbPassword;
- }
+ public static String getXacmldbPassword() {
+ return xacmldbPassword;
+ }
- public static void setXacmldbPassword(String xacmldbPassword) {
- PolicyController.xacmldbPassword = xacmldbPassword;
- }
+ public static void setXacmldbPassword(String xacmldbPassword) {
+ PolicyController.xacmldbPassword = xacmldbPassword;
+ }
- public static String getAutoPushAvailable() {
- return autoPushAvailable;
- }
-
- public static void setAutoPushAvailable(String autoPushAvailable) {
- PolicyController.autoPushAvailable = autoPushAvailable;
- }
-
- public static String getAutoPushDSClosedLoop() {
- return autoPushDSClosedLoop;
- }
-
- public static void setAutoPushDSClosedLoop(String autoPushDSClosedLoop) {
- PolicyController.autoPushDSClosedLoop = autoPushDSClosedLoop;
- }
-
- public static String getAutoPushDSFirewall() {
- return autoPushDSFirewall;
- }
-
- public static void setAutoPushDSFirewall(String autoPushDSFirewall) {
- PolicyController.autoPushDSFirewall = autoPushDSFirewall;
- }
-
- public static String getAutoPushDSMicroservice() {
- return autoPushDSMicroservice;
- }
-
- public static void setAutoPushDSMicroservice(String autoPushDSMicroservice) {
- PolicyController.autoPushDSMicroservice = autoPushDSMicroservice;
- }
-
- public static String getAutoPushPDPGroup() {
- return autoPushPDPGroup;
- }
-
- public static void setAutoPushPDPGroup(String autoPushPDPGroup) {
- PolicyController.autoPushPDPGroup = autoPushPDPGroup;
- }
-
- public static String getPapUrl() {
- return papUrl;
- }
-
- public static void setPapUrl(String papUrl) {
- PolicyController.papUrl = papUrl;
- }
-
- public static String getMsOnapName() {
- return msOnapName;
- }
-
- public static void setMsOnapName(String msOnapName) {
- PolicyController.msOnapName = msOnapName;
- }
-
- public static String getMsPolicyName() {
- return msPolicyName;
- }
-
- public static void setMsPolicyName(String msPolicyName) {
- PolicyController.msPolicyName = msPolicyName;
- }
-
- public static String getConfigHome() {
- return configHome;
- }
-
- public static void setConfigHome(String configHome) {
- PolicyController.configHome = configHome;
- }
-
- public static String getActionHome() {
- return actionHome;
- }
-
- public static void setActionHome(String actionHome) {
- PolicyController.actionHome = actionHome;
- }
-
- public static Object getMapaccess() {
- return mapAccess;
- }
-
- public static String getPolicydata() {
- return policyData;
- }
-
- public static String getCharacterencoding() {
- return characterEncoding;
- }
-
- public static String getContenttype() {
- return contentType;
- }
-
- public static String getFile() {
- return file;
- }
-
- public static void setFileSizeLimit(String uploadSize) {
- //Default size limit is 30MB
- if (uploadSize == null || uploadSize.isEmpty()) {
- fileSizeLimit = 30000000;
- }
- else {
- fileSizeLimit = Long.parseLong(uploadSize);
- }
- }
-
- public static long getFileSizeLimit() {
- return fileSizeLimit;
- }
- public String convertDate(String dateTTL) {
- String formateDate = null;
- if(dateTTL.contains("-")){
- formateDate = dateTTL.replace("-", "/");
- }
- return formateDate;
- }
+ public static String getAutoPushAvailable() {
+ return autoPushAvailable;
+ }
+
+ public static void setAutoPushAvailable(String autoPushAvailable) {
+ PolicyController.autoPushAvailable = autoPushAvailable;
+ }
+
+ public static String getAutoPushDSClosedLoop() {
+ return autoPushDSClosedLoop;
+ }
+
+ public static void setAutoPushDSClosedLoop(String autoPushDSClosedLoop) {
+ PolicyController.autoPushDSClosedLoop = autoPushDSClosedLoop;
+ }
+
+ public static String getAutoPushDSFirewall() {
+ return autoPushDSFirewall;
+ }
+
+ public static void setAutoPushDSFirewall(String autoPushDSFirewall) {
+ PolicyController.autoPushDSFirewall = autoPushDSFirewall;
+ }
+
+ public static String getAutoPushDSMicroservice() {
+ return autoPushDSMicroservice;
+ }
+
+ public static void setAutoPushDSMicroservice(String autoPushDSMicroservice) {
+ PolicyController.autoPushDSMicroservice = autoPushDSMicroservice;
+ }
+
+ public static String getAutoPushPDPGroup() {
+ return autoPushPDPGroup;
+ }
+
+ public static void setAutoPushPDPGroup(String autoPushPDPGroup) {
+ PolicyController.autoPushPDPGroup = autoPushPDPGroup;
+ }
+
+ public static String getPapUrl() {
+ return papUrl;
+ }
+
+ public static void setPapUrl(String papUrl) {
+ PolicyController.papUrl = papUrl;
+ }
+
+ public static String getMsOnapName() {
+ return msOnapName;
+ }
+
+ public static void setMsOnapName(String msOnapName) {
+ PolicyController.msOnapName = msOnapName;
+ }
+
+ public static String getMsPolicyName() {
+ return msPolicyName;
+ }
+
+ public static void setMsPolicyName(String msPolicyName) {
+ PolicyController.msPolicyName = msPolicyName;
+ }
+
+ public static String getConfigHome() {
+ return configHome;
+ }
+
+ public static void setConfigHome(String configHome) {
+ PolicyController.configHome = configHome;
+ }
+
+ public static String getActionHome() {
+ return actionHome;
+ }
+
+ public static void setActionHome(String actionHome) {
+ PolicyController.actionHome = actionHome;
+ }
+
+ public static Object getMapaccess() {
+ return mapAccess;
+ }
+
+ public static String getPolicydata() {
+ return policyData;
+ }
+
+ public static String getCharacterencoding() {
+ return characterEncoding;
+ }
+
+ public static String getContenttype() {
+ return contentType;
+ }
+
+ public static String getFile() {
+ return file;
+ }
+
+ public static void setFileSizeLimit(String uploadSize) {
+ //Default size limit is 30MB
+ if (uploadSize == null || uploadSize.isEmpty()) {
+ fileSizeLimit = 30000000;
+ }
+ else {
+ fileSizeLimit = Long.parseLong(uploadSize);
+ }
+ }
+
+ public static long getFileSizeLimit() {
+ return fileSizeLimit;
+ }
+ public String convertDate(String dateTTL) {
+ String formateDate = null;
+ if(dateTTL.contains("-")){
+ formateDate = dateTTL.replace("-", "/");
+ }
+ return formateDate;
+ }
}