summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP')
-rw-r--r--POLICY-SDK-APP/pom.xml2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyManagerServlet.java27
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyNotificationMail.java3
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyRestController.java48
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyUserInfoController.java6
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java6
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java9
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java20
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java62
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java158
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java17
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java4
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java31
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyController.java13
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyExportAndImportController.java6
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java4
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java9
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyValidationController.java6
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/model/Roles.java (renamed from POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/Roles.java)2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js10
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js4
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js33
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js33
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js62
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js28
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ExportPolicyController.js29
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html8
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ExportPolicyTemplate.html13
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css4
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html7
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java2
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java4
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java4
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java13
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java2
45 files changed, 463 insertions, 239 deletions
diff --git a/POLICY-SDK-APP/pom.xml b/POLICY-SDK-APP/pom.xml
index 5cd0429d3..60bc1c12d 100644
--- a/POLICY-SDK-APP/pom.xml
+++ b/POLICY-SDK-APP/pom.xml
@@ -49,7 +49,7 @@
</build>
<properties>
<encoding>UTF-8</encoding>
- <epsdk.version>1.3.1</epsdk.version>
+ <epsdk.version>2.1.0-SNAPSHOT</epsdk.version>
<springframework.version>4.2.0.RELEASE</springframework.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<skipassembly>true</skipassembly>
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 d65d1da8a..cb373a1bd 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
@@ -33,9 +33,11 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -67,6 +69,7 @@ import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.components.HumanPolicyComponent;
import org.onap.policy.controller.PolicyController;
import org.onap.policy.controller.PolicyExportAndImportController;
+import org.onap.policy.model.Roles;
import org.onap.policy.rest.XACMLRest;
import org.onap.policy.rest.XACMLRestProperties;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
@@ -79,8 +82,7 @@ import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.utils.PolicyUtils;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.util.XACMLPolicyScanner;
-import org.openecomp.policy.model.Roles;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.web.support.UserUtils;
import com.att.research.xacml.util.XACMLProperties;
import com.fasterxml.jackson.databind.JsonNode;
@@ -272,6 +274,12 @@ public class PolicyManagerServlet extends HttpServlet {
JSONObject jObj = new JSONObject(sb.toString());
JSONObject params = jObj.getJSONObject("params");
Mode mode = Mode.valueOf(params.getString("mode"));
+
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ LOGGER.info("****************************************Logging UserID while doing actions on Editor tab*******************************************");
+ LOGGER.info("UserId: " + userId + "Action Mode: "+ mode.toString() + "Action Params: "+params.toString());
+ LOGGER.info("***********************************************************************************************************************************");
+
switch (mode) {
case ADDFOLDER:
case ADDSUBSCOPE:
@@ -623,7 +631,7 @@ public class PolicyManagerServlet extends HttpServlet {
if(!(scope.getScopeName().contains(File.separator))){
JSONObject el = new JSONObject();
el.put("name", scope.getScopeName());
- el.put("date", scope.getCreatedDate());
+ el.put("date", scope.getModifiedDate());
el.put("size", "");
el.put("type", "dir");
el.put("createdBy", scope.getUserCreatedBy().getUserName());
@@ -638,7 +646,7 @@ public class PolicyManagerServlet extends HttpServlet {
if(!scopesList.isEmpty()){
PolicyEditorScopes scopeById = (PolicyEditorScopes) scopesList.get(0);
el.put("name", scopeById.getScopeName());
- el.put("date", scopeById.getCreatedDate());
+ el.put("date", scopeById.getModifiedDate());
el.put("size", "");
el.put("type", "dir");
el.put("createdBy", scopeById.getUserCreatedBy().getUserName());
@@ -1149,6 +1157,7 @@ public class PolicyManagerServlet extends HttpServlet {
entityItem.setPolicyName(policyName);
entityItem.setCreatedBy(userId);
entityItem.setModifiedBy(userId);
+ entityItem.setModifiedDate(new Date());
controller.saveData(entityItem);
}
@@ -1212,9 +1221,9 @@ public class PolicyManagerServlet extends HttpServlet {
if(!policyEntityobjects.isEmpty()){
for(Object object : policyEntityobjects){
policyEntity = (PolicyEntity) object;
- String groupEntityquery = "from PolicyGroupEntity where policyid = :policyId";
+ String groupEntityquery = "from PolicyGroupEntity where policyid ='"+policyEntity.getPolicyId()+"'";
SimpleBindings pgeParams = new SimpleBindings();
- pgeParams.put("policyId", policyEntity.getPolicyId());
+ //pgeParams.put("policyIdValue", policyEntity.getPolicyId());
List<Object> groupobject = controller.getDataByQuery(groupEntityquery, pgeParams);
if(!groupobject.isEmpty()){
pdpCheck = true;
@@ -1226,8 +1235,10 @@ public class PolicyManagerServlet extends HttpServlet {
//Delete the entity from Policy Entity table
controller.deleteData(policyEntity);
if(policyNamewithoutExtension.contains("Config_")){
+ Files.deleteIfExists(Paths.get(PolicyController.getConfigHome() + File.separator + policyEntity.getConfigurationData().getConfigurationName()));
controller.deleteData(policyEntity.getConfigurationData());
}else if(policyNamewithoutExtension.contains("Action_")){
+ Files.deleteIfExists(Paths.get(PolicyController.getActionHome() + File.separator + policyEntity.getActionBodyEntity().getActionBodyName()));
controller.deleteData(policyEntity.getActionBodyEntity());
}
}
@@ -1279,8 +1290,10 @@ public class PolicyManagerServlet extends HttpServlet {
//Delete the entity from Policy Entity table
controller.deleteData(policyEntity);
if(policyNamewithoutExtension.contains("Config_")){
+ Files.deleteIfExists(Paths.get(PolicyController.getConfigHome() + File.separator + policyEntity.getConfigurationData().getConfigurationName()));
controller.deleteData(policyEntity.getConfigurationData());
}else if(policyNamewithoutExtension.contains("Action_")){
+ Files.deleteIfExists(Paths.get(PolicyController.getActionHome() + File.separator + policyEntity.getActionBodyEntity().getActionBodyName()));
controller.deleteData(policyEntity.getActionBodyEntity());
}
@@ -1337,8 +1350,10 @@ public class PolicyManagerServlet extends HttpServlet {
controller.deleteData(policyEntity);
policyNamewithoutExtension = policyEntity.getPolicyName();
if(policyNamewithoutExtension.contains("Config_")){
+ Files.deleteIfExists(Paths.get(PolicyController.getConfigHome() + File.separator + policyEntity.getConfigurationData().getConfigurationName()));
controller.deleteData(policyEntity.getConfigurationData());
}else if(policyNamewithoutExtension.contains("Action_")){
+ Files.deleteIfExists(Paths.get(PolicyController.getActionHome() + File.separator + policyEntity.getActionBodyEntity().getActionBodyName()));
controller.deleteData(policyEntity.getActionBodyEntity());
}
}
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 2326a9fb7..67d9c8813 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
@@ -108,6 +108,9 @@ public class PolicyNotificationMail{
}
String policyFileName = entityItem.getPolicyName();
String checkPolicyName = policyName;
+ if(checkPolicyName.endsWith(".xml") || checkPolicyName.contains(".")){
+ checkPolicyName = checkPolicyName.substring(0, checkPolicyName.indexOf("."));
+ }
if(policyFileName.contains("/")){
policyFileName = policyFileName.substring(0, policyFileName.indexOf("/"));
policyFileName = policyFileName.replace("/", File.separator);
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 08f80304c..f38f3e266 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
@@ -52,8 +52,8 @@ import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.PolicyVersion;
import org.onap.policy.utils.PolicyUtils;
import org.onap.policy.xacml.api.XACMLErrorConstants;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -108,7 +108,11 @@ public class PolicyRestController extends RestrictedBaseController{
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try{
JsonNode root = mapper.readTree(request.getReader());
-
+
+ policyLogger.info("****************************************Logging UserID while Create/Update Policy**************************************************");
+ policyLogger.info("UserId: " + userId + "Policy Data Object: "+ root.get(PolicyController.getPolicydata()).get("policy").toString());
+ policyLogger.info("***********************************************************************************************************************************");
+
PolicyRestAdapter policyData = mapper.readValue(root.get(PolicyController.getPolicydata()).get("policy").toString(), PolicyRestAdapter.class);
if("file".equals(root.get(PolicyController.getPolicydata()).get(modal).get("type").toString().replace("\"", ""))){
@@ -204,9 +208,13 @@ public class PolicyRestController extends RestrictedBaseController{
HttpEntity<?> requestEntity = new HttpEntity<>(body, headers);
ResponseEntity<?> result = null;
HttpClientErrorException exception = null;
-
+ String uri = requestURI;
+ if(uri.startsWith("/")){
+ uri = uri.substring(uri.indexOf('/')+1);
+ }
+ uri = "onap" + uri.substring(uri.indexOf('/'));
try{
- result = restTemplate.exchange(papUrl + requestURI, method, requestEntity, String.class);
+ result = restTemplate.exchange(papUrl + uri, method, requestEntity, String.class);
}catch(Exception e){
policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while connecting to " + papUrl, e);
exception = new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());
@@ -378,11 +386,21 @@ public class PolicyRestController extends RestrictedBaseController{
@RequestMapping(value={"/saveDictionary/*/*"}, method={RequestMethod.POST})
public ModelAndView saveDictionaryController(HttpServletRequest request, HttpServletResponse response) throws IOException{
+ String userId = "";
String uri = request.getRequestURI().replace("/saveDictionary", "");
+ if(uri.startsWith("/")){
+ uri = uri.substring(uri.indexOf('/')+1);
+ }
+ uri = "/onap" + uri.substring(uri.indexOf('/'));
if(uri.contains(importDictionary)){
- String userId = UserUtils.getUserSession(request).getOrgUserId();
+ userId = UserUtils.getUserSession(request).getOrgUserId();
uri = uri+ "?userId=" +userId;
}
+
+ policyLogger.info("****************************************Logging UserID while Saving Dictionary*****************************************************");
+ policyLogger.info("UserId: " + userId);
+ policyLogger.info("***********************************************************************************************************************************");
+
String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim());
response.getWriter().write(body);
return null;
@@ -391,6 +409,16 @@ public class PolicyRestController extends RestrictedBaseController{
@RequestMapping(value={"/deleteDictionary/*/*"}, method={RequestMethod.POST})
public ModelAndView deletetDictionaryController(HttpServletRequest request, HttpServletResponse response) throws IOException {
String uri = request.getRequestURI().replace("/deleteDictionary", "");
+ if(uri.startsWith("/")){
+ uri = uri.substring(uri.indexOf('/')+1);
+ }
+ uri = "/onap" + uri.substring(uri.indexOf('/'));
+
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ policyLogger.info("****************************************Logging UserID while Deleting Dictionary*****************************************************");
+ policyLogger.info("UserId: " + userId);
+ policyLogger.info("*************************************************************************************************************************************");
+
String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim());
response.getWriter().write(body);
return null;
@@ -400,6 +428,10 @@ public class PolicyRestController extends RestrictedBaseController{
public ModelAndView searchDictionaryController(HttpServletRequest request, HttpServletResponse response) throws IOException {
Object resultList = null;
String uri = request.getRequestURI();
+ if(uri.startsWith("/")){
+ uri = uri.substring(uri.indexOf('/')+1);
+ }
+ uri = "/onap" + uri.substring(uri.indexOf('/'));
try{
String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim());
if(body.contains("CouldNotConnectException")){
@@ -429,6 +461,10 @@ public class PolicyRestController extends RestrictedBaseController{
public ModelAndView searchPolicy(HttpServletRequest request, HttpServletResponse response) throws IOException{
Object resultList = null;
String uri = request.getRequestURI()+"?action=search";
+ if(uri.startsWith("/")){
+ uri = uri.substring(uri.indexOf('/')+1);
+ }
+ uri = "/onap" + uri.substring(uri.indexOf('/'));
String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim());
JSONObject json = new JSONObject(body);
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyUserInfoController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyUserInfoController.java
index 5020662c8..96205c5b1 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyUserInfoController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/PolicyUserInfoController.java
@@ -28,9 +28,9 @@ import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java
index c8b7a9630..0f66a45e6 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java
@@ -29,9 +29,11 @@ import java.util.Map;
import javax.xml.bind.JAXBElement;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.jpa.PolicyEntity;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -48,8 +50,6 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressionsType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
@Controller
@RequestMapping({ "/" })
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java
index 3b88f8472..1a43c7646 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AdminTabController.java
@@ -34,8 +34,9 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.GlobalRoleSettings;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@@ -91,6 +92,10 @@ public class AdminTabController extends RestrictedBaseController{
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ LOGGER.info("****************************************Logging UserID for Application Lockdown Function*****************************************");
+ LOGGER.info("UserId: " + userId);
+ LOGGER.info("*********************************************************************************************************************************");
JsonNode root = mapper.readTree(request.getReader());
GlobalRoleSettings globalRole = mapper.readValue(root.get("lockdowndata").toString(), GlobalRoleSettings.class);
globalRole.setRole("super-admin");
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java
index c1468e365..d308e7eda 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java
@@ -47,6 +47,7 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.model.PDPGroupContainer;
import org.onap.policy.model.PDPPolicyContainer;
+import org.onap.policy.model.Roles;
import org.onap.policy.rest.adapter.AutoPushTabAdapter;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.PolicyEntity;
@@ -55,10 +56,9 @@ import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.api.pap.OnapPDPGroup;
import org.onap.policy.xacml.std.pap.StdPDPGroup;
import org.onap.policy.xacml.std.pap.StdPDPPolicy;
-import org.openecomp.policy.model.Roles;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@@ -187,6 +187,12 @@ public class AutoPushController extends RestrictedBaseController{
this.container = new PDPGroupContainer(controller.getPapEngine());
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
+
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ logger.info("****************************************Logging UserID while Pushing Policy to PDP Group*****************************************");
+ logger.info("UserId: " + userId + "Push Policy Data: "+ root.get("pushTabData").toString());
+ logger.info("***********************************************************************************************************************************");
+
AutoPushTabAdapter adapter = mapper.readValue(root.get("pushTabData").toString(), AutoPushTabAdapter.class);
for (Object pdpGroupId : adapter.getPdpDatas()) {
LinkedHashMap<?, ?> selectedPDP = (LinkedHashMap<?, ?>)pdpGroupId;
@@ -344,6 +350,12 @@ public class AutoPushController extends RestrictedBaseController{
JsonNode root = mapper.readTree(request.getReader());
StdPDPGroup group = (StdPDPGroup)mapper.readValue(root.get("activePdpGroup").toString(), StdPDPGroup.class);
JsonNode removePolicyData = root.get("data");
+
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ logger.info("****************************************Logging UserID while Removing Policy from PDP Group*****************************************");
+ logger.info("UserId: " + userId + "PDP Group Data: "+ root.get("activePdpGroup").toString() + "Remove Policy Data: "+root.get("data"));
+ logger.info("***********************************************************************************************************************************");
+
policyContainer = new PDPPolicyContainer(group);
if(removePolicyData.size() > 0){
for(int i = 0 ; i < removePolicyData.size(); i++){
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
index 4dc45425a..33c58837e 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateBRMSParamController.java
@@ -44,7 +44,7 @@ import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.BRMSParamTemplate;
import org.onap.policy.rest.jpa.PolicyEntity;
import org.onap.policy.xacml.api.XACMLErrorConstants;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
index 7a8212c7e..839a79f29 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
@@ -39,7 +39,7 @@ import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.OnapName;
import org.onap.policy.rest.jpa.PolicyEntity;
import org.onap.policy.rest.jpa.VarbindDictionary;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
index 43b62b0c0..a40b48aa2 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
@@ -73,7 +73,6 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.controller.PolicyController;
import org.onap.policy.rest.XACMLRestProperties;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.dao.CommonClassDao;
@@ -83,8 +82,8 @@ import org.onap.policy.rest.jpa.PolicyEntity;
import org.onap.policy.rest.util.MSAttributeObject;
import org.onap.policy.rest.util.MSModelUtils;
import org.onap.policy.rest.util.MSModelUtils.MODEL_TYPE;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@@ -141,6 +140,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
Set<String> uniqueDataKeys= new HashSet<>();
StringBuilder dataListBuffer=new StringBuilder();
List<String> dataConstraints= new ArrayList <>();
+ Set<String> allManyTrueKeys= new HashSet <>();
public static final String DATATYPE = "data_types.policy.data.";
public static final String PROPERTIES=".properties.";
@@ -708,17 +708,25 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
//The "." in the value determines if its a string or a user defined type.
if (!value.contains(".")){
//This is string
- constraints.add(keyValues.get(key));
+ if(StringUtils.isNumeric(key) ){ //only integer key for the value of Constrains
+ constraints.add(keyValues.get(key));
+ }
}else{
- //This is userdefined string
+ //This is user defined string
String trimValue=value.substring(value.lastIndexOf('.')+1);
StringBuilder referenceIndividualStringBuilder= new StringBuilder();
referenceIndividualStringBuilder.append(keySetString+"="+trimValue+":MANY-true");
referenceStringBuilder.append(referenceIndividualStringBuilder+",");
}
- }
+ }
+
}
+ if(keyValues.get("type").equalsIgnoreCase(LIST)){
+ if(constraints == null || constraints.isEmpty()){
+ referenceStringBuilder.append(keySetString+"=MANY-true"+",");
+ }
+ }
}else{
//User defined Datatype.
String value=keyValues.get("type");
@@ -991,11 +999,13 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
MicroServiceModels returnModel = getAttributeObject(servicename, version);
- //get all keys with "MANY-true" defined in their value from subAttribute
+ //Get all keys with "MANY-true" defined in their value from subAttribute
Set<String> allkeys = null;
if(returnModel.getSub_attributes() != null && !returnModel.getSub_attributes().isEmpty()){
- JSONObject json = new JSONObject(returnModel.getSub_attributes());
- allkeys = getAllKeys(json);
+ JSONObject json = new JSONObject(returnModel.getSub_attributes());
+ getAllKeys(json);
+ allkeys = allManyTrueKeys;
+ allManyTrueKeys = new HashSet <>();
LOGGER.info("allkeys : " + allkeys);
}
@@ -1012,7 +1022,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
if(allkeys != null){
Iterator<String> iter = allkeys.iterator();
while(iter.hasNext()){
- //convert to array values for MANY-true keys
+ //Convert to array values for MANY-true keys
finalJsonObject = convertToArrayElement(jsonObject, iter.next());
}
}
@@ -1034,7 +1044,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
if(finalJsonObject != null){
LOGGER.info(finalJsonObject.toString());
- jsonModel = finalJsonObject.toString();
+ jsonModel = finalJsonObject.toString();
}
}
@@ -1044,7 +1054,12 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
List<Object> list = new ArrayList<>();
PrintWriter out = response.getWriter();
String responseString = mapper.writeValueAsString(returnModel);
- JSONObject j = new JSONObject("{dcaeModelData: " + responseString + ",jsonValue: " + jsonModel + ",allManyTrueKeys: " + allManyTrueKeys+ "}");
+ JSONObject j = null;
+ if("".equals(allManyTrueKeys)){
+ j = new JSONObject("{dcaeModelData: " + responseString + ",jsonValue: " + jsonModel + "}");
+ }else{
+ j = new JSONObject("{dcaeModelData: " + responseString + ",jsonValue: " + jsonModel + ",allManyTrueKeys: " + allManyTrueKeys+ "}");
+ }
list.add(j);
out.write(list.toString());
return null;
@@ -1153,19 +1168,6 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
return object;
}
- //call this method to check if the key is in the many-true key set
- private boolean isKeyFound(Set<String> allManyTruekeys, String key){
-
- if(allManyTruekeys != null && key != null){
- Iterator<String> iter = allManyTruekeys.iterator();
- while(iter.hasNext()){
- if(key.equals(iter.next())){
- return true;
- }
- }
- }
- return false;
- }
public static JSONObject convertToArrayElement(JSONObject json, String keyValue) {
return convertToArrayElement(json, new HashSet<>(), keyValue);
@@ -1239,7 +1241,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
if(obj instanceof String && ((String) obj).contains("MANY-true")){
LOGGER.info("key : " + key);
LOGGER.info("obj : " + obj);
- keys.addAll(json.keySet());
+ allManyTrueKeys.add(key);
}
if (obj instanceof JSONObject) keys.addAll(getAllKeys(json.getJSONObject(key)));
if (obj instanceof JSONArray) keys.addAll(getAllKeys(json.getJSONArray(key)));
@@ -1568,10 +1570,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
else {
this.newModel.setVersion(this.newFile.toString().split("-v")[1].replace(".xmi", ""));
}
- }else{
- errorMsg = "Upload error: The file name should contain '-v', such as xxx-v1802.yml";
- }
-
+ }
}catch(Exception e){
LOGGER.error("Upload error : ", e);
errorMsg = "Upload error:" + e.getMessage();
@@ -1588,14 +1587,13 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
response.setContentType("application / json");
request.setCharacterEncoding("UTF-8");
- ObjectMapper mapper = new ObjectMapper();
JSONObject j = new JSONObject();
j.put("errorMsg", errorMsg);
out.write(j.toString());
return;
}
- List<File> fileList = new ArrayList<>();;
+ List<File> fileList = new ArrayList<>();
this.directory = "model";
if (zip){
extractFolder(this.newFile);
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
index 9832f5803..a4b758924 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
@@ -39,6 +39,7 @@ import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.adapter.AddressGroupJson;
import org.onap.policy.rest.adapter.AddressJson;
import org.onap.policy.rest.adapter.AddressMembers;
+import org.onap.policy.rest.adapter.AddressMembersJson;
import org.onap.policy.rest.adapter.DeployNowJson;
import org.onap.policy.rest.adapter.IdMap;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
@@ -62,12 +63,15 @@ import org.onap.policy.rest.jpa.SecurityZone;
import org.onap.policy.rest.jpa.ServiceList;
import org.onap.policy.rest.jpa.TermList;
import org.onap.policy.xacml.api.XACMLErrorConstants;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
@@ -84,6 +88,8 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
@RequestMapping("/")
public class CreateFirewallController extends RestrictedBaseController {
private static Logger policyLogger = FlexLogger.getLogger(CreateFirewallController.class);
+ private static final String ANY="ANY";
+ private static final String GROUP="Group_";
@Autowired
SessionFactory sessionFactory;
@@ -99,7 +105,7 @@ public class CreateFirewallController extends RestrictedBaseController {
}
private List<String> tagCollectorList;
- private String jsonBody;
+
List<String> expandablePrefixIPList = new ArrayList<>();
List<String> expandableServicesList= new ArrayList<>();
@Autowired
@@ -109,14 +115,14 @@ public class CreateFirewallController extends RestrictedBaseController {
public CreateFirewallController(){}
private List<String> termCollectorList;
- private ArrayList<Object> attributeList;
+
public PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter policyData){
-
- termCollectorList = new ArrayList<>();
- tagCollectorList = new ArrayList<>();
- if(!policyData.getAttributes().isEmpty()){
+ String jsonBody="";
+ termCollectorList = new ArrayList <>();
+ tagCollectorList = new ArrayList <>();
+ if(policyData.getAttributes().size() > 0){
for(Object attribute : policyData.getAttributes()){
if(attribute instanceof LinkedHashMap<?, ?>){
String key = ((LinkedHashMap<?, ?>) attribute).get("key").toString();
@@ -139,14 +145,16 @@ public class CreateFirewallController extends RestrictedBaseController {
}
private List<String> mapping(String expandableList) {
+ String value = null;
+ String desc = null;
List <String> valueDesc= new ArrayList<>();
List<Object> prefixListData = commonClassDao.getData(PrefixList.class);
for (int i = 0; i< prefixListData.size(); i++) {
PrefixList prefixList = (PrefixList) prefixListData.get(i);
if (prefixList.getPrefixListName().equals(expandableList)) {
- String value = prefixList.getPrefixListValue();
+ value = prefixList.getPrefixListValue();
valueDesc.add(value);
- String desc= prefixList.getDescription();
+ desc= prefixList.getDescription();
valueDesc.add(desc);
break;
}
@@ -193,6 +201,7 @@ public class CreateFirewallController extends RestrictedBaseController {
}
public void prePopulateFWPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
+ ArrayList<Object> attributeList;
attributeList = new ArrayList<>();
if (policyAdapter.getPolicyData() instanceof PolicyType) {
Object policyData = policyAdapter.getPolicyData();
@@ -221,7 +230,7 @@ public class CreateFirewallController extends RestrictedBaseController {
String data=null;
SecurityZone jpaSecurityZone;
data = entity.getConfigurationData().getConfigBody();
- tc1 = (TermCollector)mapper.readValue(data, TermCollector.class);
+ tc1 = mapper.readValue(data, TermCollector.class);
List<Object> securityZoneData = commonClassDao.getData(SecurityZone.class);
for (int i = 0; i < securityZoneData.size() ; i++) {
jpaSecurityZone = (SecurityZone) securityZoneData.get(i);
@@ -238,7 +247,7 @@ public class CreateFirewallController extends RestrictedBaseController {
Map<String, String> termTagMap=null;
if(tc1 != null){
for(int i=0;i<tc1.getFirewallRuleList().size();i++){
- termTagMap = new HashMap<String, String>();
+ termTagMap = new HashMap <>();
String ruleName= tc1.getFirewallRuleList().get(i).getRuleName();
String tagPickerName=tc1.getRuleToTag().get(i).getTagPickerName();
termTagMap.put("key", ruleName);
@@ -277,16 +286,16 @@ public class CreateFirewallController extends RestrictedBaseController {
String value = (String) attributeValue.getContent().get(0);
AttributeDesignatorType designator = match.getAttributeDesignator();
String attributeId = designator.getAttributeId();
- if (attributeId.equals("ConfigName")) {
+ if (("ConfigName").equals(attributeId)) {
policyAdapter.setConfigName(value);
}
- if (attributeId.equals("RiskType")){
+ if (("RiskType").equals(attributeId)){
policyAdapter.setRiskType(value);
}
- if (attributeId.equals("RiskLevel")){
+ if (("RiskLevel").equals(attributeId)){
policyAdapter.setRiskLevel(value);
}
- if (attributeId.equals("guard")){
+ if (("guard").equals(attributeId)){
policyAdapter.setGuard(value);
}
if (attributeId.equals("TTLDate") && !value.contains("NA")){
@@ -305,14 +314,14 @@ public class CreateFirewallController extends RestrictedBaseController {
}
@RequestMapping(value={"/policyController/ViewFWPolicyRule.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public void setFWViewRule(HttpServletRequest request, HttpServletResponse response){
+ public ModelAndView setFWViewRule(HttpServletRequest request, HttpServletResponse response){
try {
termCollectorList = new ArrayList<>();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
- PolicyRestAdapter policyData = (PolicyRestAdapter)mapper.readValue(root.get("policyData").toString(), PolicyRestAdapter.class);
- if(!policyData.getAttributes().isEmpty()){
+ PolicyRestAdapter policyData = mapper.readValue(root.get("policyData").toString(), PolicyRestAdapter.class);
+ if(policyData.getAttributes().size() > 0){
for(Object attribute : policyData.getAttributes()){
if(attribute instanceof LinkedHashMap<?, ?>){
String key = ((LinkedHashMap<?, ?>) attribute).get("key").toString();
@@ -332,13 +341,13 @@ public class CreateFirewallController extends RestrictedBaseController {
List<Object> tmList = commonClassDao.getDataById(TermList.class, "termName", id);
jpaTermList = (TermList) tmList.get(0);
if (jpaTermList != null){
- ruleSrcList= ((TermList) jpaTermList).getSrcIPList();
+ ruleSrcList= jpaTermList.getSrcIPList();
if ((ruleSrcList!= null) && (!ruleSrcList.isEmpty()) && !ruleSrcList.equals("null")){
- displayString.append("Source IP List: " + ((TermList) jpaTermList).getSrcIPList());
+ displayString.append("Source IP List: " + jpaTermList.getSrcIPList());
displayString.append(" ; \t\n");
for(String srcList:ruleSrcList.split(",")){
- if(srcList.startsWith("Group_")){
- AddressGroup ag= new AddressGroup();
+ if(srcList.startsWith(GROUP)){
+ AddressGroup ag;
ag= mappingAddressGroup(srcList);
displayString.append("\n\t"+"Group has :"+ag.getPrefixList()+"\n");
for(String groupItems:ag.getPrefixList().split(",")){
@@ -351,7 +360,7 @@ public class CreateFirewallController extends RestrictedBaseController {
displayString.append("\n");
}
}else{
- if(!srcList.equals("ANY")){
+ if(!srcList.equals(ANY)){
valueDesc=mapping(srcList);
displayString.append("\n\t"+"Name: "+srcList);
displayString.append("\n\t"+"Description: "+valueDesc.get(1));
@@ -362,13 +371,13 @@ public class CreateFirewallController extends RestrictedBaseController {
}
displayString.append("\n");
}
- ruleDestList= ((TermList) jpaTermList).getDestIPList();
+ ruleDestList= jpaTermList.getDestIPList();
if ( ruleDestList!= null && (!ruleDestList.isEmpty())&& !ruleDestList.equals("null")){
- displayString.append("Destination IP List: " + ((TermList) jpaTermList).getDestIPList());
+ displayString.append("Destination IP List: " + jpaTermList.getDestIPList());
displayString.append(" ; \t\n");
for(String destList:ruleDestList.split(",")){
- if(destList.startsWith("Group_")){
- AddressGroup ag= new AddressGroup();
+ if(destList.startsWith(GROUP)){
+ AddressGroup ag;
ag= mappingAddressGroup(destList);
displayString.append("\n\t"+"Group has :"+ag.getPrefixList()+"\n");
for(String groupItems:ag.getPrefixList().split(",")){
@@ -379,7 +388,7 @@ public class CreateFirewallController extends RestrictedBaseController {
displayString.append("\n\t");
}
}else{
- if(!destList.equals("ANY")){
+ if(!destList.equals(ANY)){
valueDesc=mapping(destList);
displayString.append("\n\t"+"Name: "+destList);
displayString.append("\n\t"+"Description: "+valueDesc.get(1));
@@ -391,25 +400,25 @@ public class CreateFirewallController extends RestrictedBaseController {
displayString.append("\n");
}
- ruleSrcPort=((TermList) jpaTermList).getSrcPortList();
+ ruleSrcPort=jpaTermList.getSrcPortList();
if ( ruleSrcPort!= null && (!ruleSrcPort.isEmpty())&& !ruleSrcPort.equals("null")) {
displayString.append("\n"+"Source Port List:"
+ ruleSrcPort);
displayString.append(" ; \t\n");
}
- ruleDestPort= ((TermList) jpaTermList).getDestPortList();
+ ruleDestPort= jpaTermList.getDestPortList();
if (ruleDestPort != null && (!ruleDestPort.isEmpty())&& !ruleDestPort.equals("null")) {
displayString.append("\n"+"Destination Port List:"
+ ruleDestPort);
displayString.append(" ; \t\n");
for(String destServices:ruleDestPort.split(",")){
- if(destServices.startsWith("Group_")){
- GroupServiceList sg= new GroupServiceList();
+ if(destServices.startsWith(GROUP)){
+ GroupServiceList sg;
sg= mappingServiceGroup(destServices);
displayString.append("\n\t"+"Service Group has :"+sg.getServiceList()+"\n");
for(String groupItems:sg.getServiceList().split(",")){
- ServiceList sl= new ServiceList();
+ ServiceList sl;
sl= mappingServiceList(groupItems);
displayString.append("\n\t"+"Name: "+
sl.getServiceName());
@@ -423,8 +432,8 @@ public class CreateFirewallController extends RestrictedBaseController {
}
}
else{
- if(!destServices.equals("ANY")){
- ServiceList sl= new ServiceList();
+ if(!destServices.equals(ANY)){
+ ServiceList sl;
sl= mappingServiceList(destServices);
displayString.append("\n\t"+"Name: "+
sl.getServiceName());
@@ -438,7 +447,7 @@ public class CreateFirewallController extends RestrictedBaseController {
}
}
}
- displayString.append("\n");
+ displayString.append("\n");
}
ruleAction=(jpaTermList).getAction();
@@ -457,9 +466,11 @@ public class CreateFirewallController extends RestrictedBaseController {
String responseString = mapper.writeValueAsString(displayString);
JSONObject j = new JSONObject("{policyData: " + responseString + "}");
out.write(j.toString());
+ return null;
} catch (Exception e) {
policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
}
+ return null;
}
private String constructJson(PolicyRestAdapter policyData) {
@@ -497,6 +508,7 @@ public class CreateFirewallController extends RestrictedBaseController {
TagDefines tagDefine= new TagDefines();
List<TagDefines> tagList=null;
ServiceListJson targetSl=null;
+ AddressMembers addressMembersJson=null;
int i=0;
try{
String networkRole="";
@@ -509,7 +521,7 @@ public class CreateFirewallController extends RestrictedBaseController {
String tagValues=jpaTagPickerList.getTagValues();
tagList= new ArrayList<>();
for(String val:tagValues.split("#")) {
- int index=val.indexOf(":");
+ int index=val.indexOf(':');
String keyToStore=val.substring(0,index);
String valueToStore=val.substring(index+1,val.length());
@@ -626,12 +638,12 @@ public class CreateFirewallController extends RestrictedBaseController {
for(String destServices:destPort_map.get(tl).split(",") ){
ServicesJson destServicesJson= new ServicesJson();
destServicesJson.setType("REFERENCE");
- if(destServices.equals("ANY")){
+ if(destServices.equals(ANY)){
destServicesJson.setName("any");
destServicesJsonList.add(destServicesJson);
break;
}else{
- if(destServices.startsWith("Group_")){
+ if(destServices.startsWith(GROUP)){
destServicesJson.setName(destServices.substring(6,destServices.length()));
} else{
destServicesJson.setName(destServices);
@@ -656,13 +668,13 @@ public class CreateFirewallController extends RestrictedBaseController {
List<AddressJson> sourceListArrayJson= new ArrayList<>();
for(String srcList:srcIP_map.get(tl).split(",") ){
AddressJson srcListJson= new AddressJson();
- if(srcList.equals("ANY")){
+ if(srcList.equals(ANY)){
srcListJson.setType("any");
sourceListArrayJson.add(srcListJson);
break;
}else{
srcListJson.setType("REFERENCE");
- if(srcList.startsWith("Group_")){
+ if(srcList.startsWith(GROUP)){
srcListJson.setName(srcList.substring(6,srcList.length()));
}else{
srcListJson.setName(srcList);
@@ -677,13 +689,13 @@ public class CreateFirewallController extends RestrictedBaseController {
List<AddressJson> destListArrayJson= new ArrayList<>();
for(String destList:destIP_map.get(tl).split(",")){
AddressJson destListJson= new AddressJson();
- if(destList.equals("ANY")){
+ if(destList.equals(ANY)){
destListJson.setType("any");
destListArrayJson.add(destListJson);
break;
}else{
destListJson.setType("REFERENCE");
- if(destList.startsWith("Group_")){
+ if(destList.startsWith(GROUP)){
destListJson.setName(destList.substring(6,destList.length()));
}else{
destListJson.setName(destList);
@@ -707,7 +719,7 @@ public class CreateFirewallController extends RestrictedBaseController {
expandablePrefixIPList.add(destIP_map.get(tl));
}
termList.add(targetTerm);
- targetTerm.setPosition("" + (ruleCount++));
+ targetTerm.setPosition(Integer.toString (ruleCount++));
}
List<Object> securityZoneData = commonClassDao.getData(SecurityZone.class);
@@ -719,7 +731,7 @@ public class CreateFirewallController extends RestrictedBaseController {
idMapInstance.setAstraId(jpaSecurityZone.getZoneValue());
idMapInstance.setVendorId("deviceGroup:dev");
- List<IdMap> idMap = new ArrayList<IdMap>();
+ List<IdMap> idMap = new ArrayList <>();
idMap.add(idMapInstance);
VendorSpecificData vendorStructure= new VendorSpecificData();
@@ -741,6 +753,7 @@ public class CreateFirewallController extends RestrictedBaseController {
Set<ServiceListJson> servListArray = new HashSet<>();
Set<ServiceGroupJson> servGroupArray= new HashSet<>();
Set<AddressGroupJson> addrGroupArray= new HashSet<>();
+ Set<AddressMembers> addrArray= new HashSet<> ();
ServiceGroupJson targetSg= null;
AddressGroupJson addressSg=null;
@@ -750,9 +763,9 @@ public class CreateFirewallController extends RestrictedBaseController {
for(String serviceList:expandableServicesList){
for(String t: serviceList.split(",")){
- if((!t.startsWith("Group_"))){
- if(!t.equals("ANY")){
- ServiceList sl = new ServiceList();
+ if((!t.startsWith(GROUP))){
+ if(!t.equals(ANY)){
+ ServiceList sl;
targetSl= new ServiceListJson();
sl= mappingServiceList(t);
targetSl.setName(sl.getServiceName());
@@ -789,7 +802,7 @@ public class CreateFirewallController extends RestrictedBaseController {
servListArray.add(targetAnyUdp);
}
}else{//This is a group
- GroupServiceList sg= new GroupServiceList();
+ GroupServiceList sg;
targetSg= new ServiceGroupJson();
sg= mappingServiceGroup(t);
@@ -804,7 +817,7 @@ public class CreateFirewallController extends RestrictedBaseController {
serviceMembers.setName(groupString);
servMembersList.add(serviceMembers);
//Expand the group Name
- ServiceList expandGroupSl = new ServiceList();
+ ServiceList expandGroupSl ;
targetSl= new ServiceListJson();
expandGroupSl= mappingServiceList(groupString);
@@ -826,10 +839,10 @@ public class CreateFirewallController extends RestrictedBaseController {
Set<PrefixIPList> prefixIPList = new HashSet<>();
for(String prefixList:expandablePrefixIPList){
for(String prefixIP: prefixList.split(",")){
- if((!prefixIP.startsWith("Group_"))){
- if(!prefixIP.equals("ANY")){
+ if((!prefixIP.startsWith(GROUP))){
+ if(!prefixIP.equals(ANY)){
List<AddressMembers> addMembersList= new ArrayList<>();
- List<String> valueDesc= new ArrayList<>();
+ List<String> valueDesc;
PrefixIPList targetAddressList = new PrefixIPList();
AddressMembers addressMembers= new AddressMembers();
targetAddressList.setName(prefixIP);
@@ -853,31 +866,37 @@ public class CreateFirewallController extends RestrictedBaseController {
}
}
else{//This is a group
- AddressGroup ag= new AddressGroup();
+ AddressGroup ag;
addressSg= new AddressGroupJson();
ag= mappingAddressGroup(prefixIP);
String name=ag.getGroupName();
//Removing the "Group_" prepending string before packing the JSON
addressSg.setName(name.substring(6,name.length()));
-
- List<AddressMembers> addrMembersList= new ArrayList<>();
+
+ List<AddressMembersJson> addrMembersList= new ArrayList<>();
for(String groupString: ag.getPrefixList().split(",")){
- List<String> valueDesc= new ArrayList<>();
- AddressMembers addressMembers= new AddressMembers();
- valueDesc= mapping (groupString);
- if(valueDesc.size() > 0){
- addressMembers.setValue(valueDesc.get(0));
- }
- addressMembers.setType("SUBNET");
+ List<String> valueDesc;
+ AddressMembersJson addressMembers= new AddressMembersJson();
+ addressMembers.setType("REFERENCES");
+ addressMembers.setName(groupString);
addrMembersList.add(addressMembers);
//Expand the group Name
+ PrefixIPList expandGroupPrefix;
+ addressMembersJson= new AddressMembers();
+ valueDesc= mapping (groupString);
+
+ addressMembersJson.setName(groupString);
+ addressMembersJson.setType("SUBNET");
+ addressMembersJson.setValue(valueDesc.get(0));
+
+ addrArray.add(addressMembersJson);
+
}
addressSg.setMembers(addrMembersList);
addrGroupArray.add(addressSg);
}
-
}
}
@@ -900,6 +919,11 @@ public class CreateFirewallController extends RestrictedBaseController {
for(Object addObj1:addrGroupArray){
addressGroup.add(addObj1);
}
+
+ for(Object addObj2:addrArray){
+ addressGroup.add(addObj2);
+ }
+
tc.setServiceGroups(serviceGroup);
tc.setAddressGroups(addressGroup);
@@ -908,8 +932,10 @@ public class CreateFirewallController extends RestrictedBaseController {
ObjectWriter om = new ObjectMapper().writer();
try {
json = om.writeValueAsString(tc);
- } catch (Exception e) {
- policyLogger.error("Exception Occured"+e);
+ } catch (JsonGenerationException e) {
+ policyLogger.error("JsonGenerationException Ocured",e);
+ } catch (JsonMappingException e) {
+ policyLogger.error("IOException Occured",e);
}
}catch (Exception e) {
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java
index 71d0b3d03..af4f9ffaf 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreatePolicyController.java
@@ -31,7 +31,7 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.jpa.PolicyEntity;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java
index aedb94301..dba79e1bb 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DashboardController.java
@@ -45,29 +45,28 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.dao.SystemLogDbDao;
import org.onap.policy.model.PDPGroupContainer;
import org.onap.policy.rest.XACMLRestProperties;
import org.onap.policy.rest.dao.CommonClassDao;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.onap.policy.xacml.api.XACMLErrorConstants;
+import org.onap.policy.xacml.api.pap.OnapPDP;
+import org.onap.policy.xacml.api.pap.OnapPDPGroup;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
-import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
-import org.onap.policy.xacml.api.XACMLErrorConstants;
-import org.onap.policy.xacml.api.pap.OnapPDP;
-import org.onap.policy.xacml.api.pap.OnapPDPGroup;
-
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.api.pap.PDP;
import com.att.research.xacml.api.pap.PDPGroup;
import com.att.research.xacml.api.pap.PDPPolicy;
import com.att.research.xacml.util.XACMLProperties;
+import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java
index fc77c9316..8427797e8 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java
@@ -36,7 +36,7 @@ import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.adapter.RainyDayParams;
import org.onap.policy.rest.adapter.YAMLParams;
import org.onap.policy.rest.jpa.PolicyEntity;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -82,7 +82,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
Object policyData = policyAdapter.getPolicyData();
PolicyType policy = (PolicyType) policyData;
policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName());
- String policyNameValue = policyAdapter.getPolicyName().substring(policyAdapter.getPolicyName().indexOf("_") + 1);
+ String policyNameValue = policyAdapter.getPolicyName().substring(policyAdapter.getPolicyName().indexOf('_') + 1);
policyAdapter.setPolicyName(policyNameValue);
String description = "";
try{
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java
index bb06cb3fe..c0344d337 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java
@@ -38,15 +38,15 @@ import org.onap.policy.admin.RESTfulPAPEngine;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.model.PDPGroupContainer;
+import org.onap.policy.model.Roles;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.api.pap.OnapPDPGroup;
import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
import org.onap.policy.xacml.std.pap.StdPDP;
import org.onap.policy.xacml.std.pap.StdPDPGroup;
-import org.openecomp.policy.model.Roles;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -195,6 +195,12 @@ public class PDPController extends RestrictedBaseController {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
this.container = new PDPGroupContainer(controller.getPapEngine());
+
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ policyLogger.info("****************************************Logging UserID for Save PDP Group Function*****************************************");
+ policyLogger.info("UserId: " + userId + "PDP Group Data: "+ root.get("pdpGroupData").toString());
+ policyLogger.info("***************************************************************************************************************************");
+
StdPDPGroup pdpGroupData = mapper.readValue(root.get("pdpGroupData").toString().replace("groupName", "name"), StdPDPGroup.class);
try {
if(pdpGroupData.getId() == null){
@@ -241,6 +247,12 @@ public class PDPController extends RestrictedBaseController {
JsonNode root = mapper.readTree(request.getReader());
PolicyController controller = getPolicyControllerInstance();
this.container = new PDPGroupContainer(controller.getPapEngine());
+
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ policyLogger.info("****************************************Logging UserID for Remove PDP Group Function*****************************************");
+ policyLogger.info("UserId: " + userId + "PDP Group Data: "+ root.get("pdpGroupData").toString());
+ policyLogger.info("*****************************************************************************************************************************");
+
StdPDPGroup pdpGroupData = mapper.readValue(root.get("pdpGroupData").toString(), StdPDPGroup.class);
if(pdpGroupData.getName().equals("Default")) {
throw new UnsupportedOperationException("You can't remove the Default Group.");
@@ -284,6 +296,12 @@ public class PDPController extends RestrictedBaseController {
String update = root.get("update").toString();
PdpData pdpGroupData = (PdpData)mapper.readValue(root.get("pdpInGroup").toString(), PdpData.class);
StdPDPGroup activeGroupData = mapper.readValue(root.get("activePDP").toString(), StdPDPGroup.class);
+
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ policyLogger.info("****************************************Logging UserID while Saving pdp in PDP Group*****************************************");
+ policyLogger.info("UserId: " + userId + "PDP Group Data: "+ root.get("pdpInGroup").toString() + "Active Group Data: "+ root.get("activePDP").toString());
+ policyLogger.info("*******************************************************************************************************************************");
+
try {
if(update.contains("false")){
@@ -332,6 +350,11 @@ public class PDPController extends RestrictedBaseController {
StdPDP deletePdp = mapper.readValue(root.get("data").toString(), StdPDP.class);
StdPDPGroup activeGroupData = mapper.readValue(root.get("activePDP").toString(), StdPDPGroup.class);
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
+ policyLogger.info("****************************************Logging UserID while Removing pdp from PDP Group*****************************************");
+ policyLogger.info("UserId: " + userId + "Delete PDP Group Data: "+ root.get("data").toString() + "Active Group Data: "+ root.get("activePDP").toString());
+ policyLogger.info("***********************************************************************************************************************************");
+
this.container.removePDP(deletePdp, activeGroupData);
response.setCharacterEncoding("UTF-8");
response.setContentType("application / json");
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 321dc72d2..d244cf528 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
@@ -43,6 +43,7 @@ import org.onap.policy.admin.RESTfulPAPEngine;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.model.PDPGroupContainer;
+import org.onap.policy.model.Roles;
import org.onap.policy.rest.XACMLRestProperties;
import org.onap.policy.rest.XacmlAdminAuthorization;
import org.onap.policy.rest.dao.CommonClassDao;
@@ -53,10 +54,9 @@ import org.onap.policy.rest.jpa.PolicyVersion;
import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
-import org.openecomp.policy.model.Roles;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@@ -203,7 +203,12 @@ public class PolicyController extends RestrictedBaseController {
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");
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyExportAndImportController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyExportAndImportController.java
index 856d825bd..78a8c5ad1 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyExportAndImportController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyExportAndImportController.java
@@ -49,6 +49,7 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.json.JSONObject;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.model.Roles;
import org.onap.policy.rest.adapter.PolicyExportAdapter;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ActionBodyEntity;
@@ -58,9 +59,8 @@ import org.onap.policy.rest.jpa.PolicyEntity;
import org.onap.policy.rest.jpa.PolicyVersion;
import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.xacml.api.XACMLErrorConstants;
-import org.openecomp.policy.model.Roles;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java
index f987f906d..845b5f5a7 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java
@@ -38,8 +38,8 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.WatchPolicyNotificationTable;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java
index 6f8b3de8e..798a39d4d 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyRolesController.java
@@ -37,8 +37,9 @@ import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.PolicyEditorScopes;
import org.onap.policy.rest.jpa.PolicyRoles;
import org.onap.policy.rest.jpa.UserInfo;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@@ -83,6 +84,7 @@ public class PolicyRolesController extends RestrictedBaseController{
String scopeName = null;
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String userId = UserUtils.getUserSession(request).getOrgUserId();
JsonNode root = mapper.readTree(request.getReader());
ReadScopes adapter = mapper.readValue(root.get("editRoleData").toString(), ReadScopes.class);
for(int i = 0; i < adapter.getScope().size(); i++){
@@ -92,6 +94,9 @@ public class PolicyRolesController extends RestrictedBaseController{
scopeName = scopeName + "," + adapter.getScope().get(i);
}
}
+ LOGGER.info("****************************************Logging UserID for Roles Function********************************************************");
+ LOGGER.info("UserId: " + userId + "Updating the Scope for following user" + adapter.getLoginId() + "ScopeNames" + adapter.getScope());
+ LOGGER.info("*********************************************************************************************************************************");
PolicyRoles roles = new PolicyRoles();
roles.setId(adapter.getId());
roles.setLoginId(adapter.getLoginId());
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyValidationController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyValidationController.java
index a82fac27a..9a1aac1b5 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyValidationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyValidationController.java
@@ -33,8 +33,8 @@ import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.util.PolicyValidation;
import org.onap.policy.rest.util.PolicyValidationRequestWrapper;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.web.support.JsonMessage;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.web.support.JsonMessage;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@@ -63,7 +63,7 @@ public class PolicyValidationController extends RestrictedBaseController {
PolicyValidationRequestWrapper wrapper = new PolicyValidationRequestWrapper();
StringBuilder responseString;
ObjectMapper mapper = new ObjectMapper();
-
+
PolicyRestAdapter policyData = wrapper.populateRequestParameters(request);
responseString = validation.validatePolicy(policyData);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/Roles.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/model/Roles.java
index 31a41ca7b..51e78d0e5 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/model/Roles.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/model/Roles.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.policy.model;
+package org.onap.policy.model;
import java.io.Serializable;
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js
index 5e3238be7..2dfd545f1 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/ImportDictionaryController.js
@@ -45,10 +45,14 @@ app.controller('importDictionaryController' , function ($scope, $modalInstance,
withCredentials: false,
headers: {'Content-Type': undefined},
transformRequest: angular.identity
- }).success(function(){
- Notification.success("Dictionary Uploaded Successfully");
+ }).success(function(data){
+ if(data.includes("Success")){
+ Notification.success("Dictionary Uploaded Successfully");
+ }else{
+ Notification.error(data);
+ }
$scope.importButton = true;
- }).error(function(){
+ }).error(function(data){
Notification.error("Dictionary Upload Failed");
});
};
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js
index df78f6455..678902840 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryController/BRMSParamDictController.js
@@ -74,7 +74,9 @@ app.controller('editBRMSParamController' , function ($scope, $modalInstance, mes
$scope.brmsParamDictionaryDatas=data.brmsParamDictionaryDatas;});
if($scope.brmsParamDictionaryDatas == "Duplicate"){
Notification.error("BRMSParan Dictionary exists with Same Name.")
- }else{
+ }else if($scope.brmsParamDictionaryDatas == "Validation"){
+ Notification.error("BRMSParan Dictionary failed rule Validation.")
+ }else {
console.log($scope.brmsParamDictionaryDatas);
$modalInstance.close({brmsParamDictionaryDatas:$scope.brmsParamDictionaryDatas});
}
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js
index 27c95a78d..c80f53d69 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSControllerDictGridController.js
@@ -63,6 +63,7 @@ appDS2.controller('brmsControllerDictGridController', function ($scope, PolicyAp
},
{ field: 'controllerName', displayName : 'Controller Name', sort: { direction: 'asc', priority: 0 }},
{ field: 'description'},
+ { field: 'controller' , visible : false},
{field: 'userCreatedBy.userName', displayName : 'Created By'},
{field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' },
{field: 'userModifiedBy.userName', displayName : 'Modified By'},
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js
index a22b1121c..61a5012b7 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSDependencyDictGridController.js
@@ -62,6 +62,7 @@ app.controller('brmsDependencyDictGridController', function ($scope, PolicyAppSe
},
{ field: 'dependencyName', displayName : 'Dependency Name', sort: { direction: 'asc', priority: 0 }},
{ field: 'description'},
+ { field: 'dependency' , visible : false},
{field: 'userCreatedBy.userName', displayName : 'Created By'},
{field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' },
{field: 'userModifiedBy.userName', displayName : 'Modified By'},
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js
index 496a71a39..50e14ea26 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js
@@ -59,6 +59,7 @@ app.controller('brmsParamDictGridController', function ($scope, PolicyAppService
},
{ field: 'ruleName', displayName : 'Rule Name', sort: { direction: 'asc', priority: 0 }},
{ field: 'description'},
+ { field: 'rule', visible : false},
{field: 'userCreatedBy.userName', displayName : 'Created By'},
{field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }
],
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js
index e60b6744e..de692a4f4 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js
@@ -48,6 +48,9 @@ app.controller('serviceDictGridController', function ($scope, PolicyAppService,
$scope.serviceDictionaryGrid = {
data : 'closedLoopServiceDictionaryDatas',
enableFiltering: true,
+ exporterCsvFilename: 'ClosedLoopService.csv',
+ enableGridMenu: true,
+ enableSelectAll: true,
columnDefs: [{
field: 'id', enableFiltering: false, headerCellTemplate: '' +
'<button id=\'New\' ng-click="grid.appScope.createNewServiceDictWindow()" class="btn btn-success">' + 'Create</button>',
@@ -61,7 +64,35 @@ app.controller('serviceDictGridController', function ($scope, PolicyAppService,
{field: 'userModifiedBy.userName', displayName : 'Modified By'},
{field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' },
{field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }
- ]
+ ],
+ exporterMenuPdf: false,
+ exporterPdfDefaultStyle: {fontSize: 9},
+ exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
+ exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
+ exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
+ exporterPdfFooter: function ( currentPage, pageCount ) {
+ return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
+ },
+ exporterPdfCustomFormatter: function ( docDefinition ) {
+ docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
+ docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
+ return docDefinition;
+ },
+ exporterFieldCallback: function(grid, row, col, input) {
+ if( col.name == 'createdDate' || col.name == 'modifiedDate') {
+ var date = new Date(input);
+ return date.toString("yyyy-MM-dd HH:MM:ss a");
+ } else {
+ return input;
+ }
+ },
+ exporterPdfOrientation: 'portrait',
+ exporterPdfPageSize: 'LETTER',
+ exporterPdfMaxGridWidth: 500,
+ exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
+ onRegisterApi: function(gridApi){
+ $scope.gridApi = gridApi;
+ }
};
$scope.editCLService = null;
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js
index 62121d9e0..abf44f86a 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js
@@ -48,6 +48,9 @@ app.controller('siteDictGridController', function ($scope, PolicyAppService, mod
$scope.siteDictionaryGrid = {
data : 'closedLoopSiteDictionaryDatas',
enableFiltering: true,
+ exporterCsvFilename: 'ClosedLoopSite.csv',
+ enableGridMenu: true,
+ enableSelectAll: true,
columnDefs: [{
field: 'id', enableFiltering: false, headerCellTemplate: '' +
'<button id=\'New\' ng-click="grid.appScope.createNewSiteDictWindow()" class="btn btn-success">' + 'Create</button>',
@@ -61,7 +64,35 @@ app.controller('siteDictGridController', function ($scope, PolicyAppService, mod
{field: 'userModifiedBy.userName', displayName : 'Modified By'},
{field: 'createdDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' },
{field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }
- ]
+ ],
+ exporterMenuPdf: false,
+ exporterPdfDefaultStyle: {fontSize: 9},
+ exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
+ exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
+ exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
+ exporterPdfFooter: function ( currentPage, pageCount ) {
+ return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
+ },
+ exporterPdfCustomFormatter: function ( docDefinition ) {
+ docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
+ docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
+ return docDefinition;
+ },
+ exporterFieldCallback: function(grid, row, col, input) {
+ if( col.name == 'createdDate' || col.name == 'modifiedDate') {
+ var date = new Date(input);
+ return date.toString("yyyy-MM-dd HH:MM:ss a");
+ } else {
+ return input;
+ }
+ },
+ exporterPdfOrientation: 'portrait',
+ exporterPdfPageSize: 'LETTER',
+ exporterPdfMaxGridWidth: 500,
+ exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
+ onRegisterApi: function(gridApi){
+ $scope.gridApi = gridApi;
+ }
};
$scope.editCLSite = null;
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js
index 546775cb4..5a90ca8f7 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWParentListDictGridController.js
@@ -49,7 +49,6 @@ app.controller('parentDictGridController', function ($scope, PolicyAppService,mo
data : 'fwDictListDictionaryDatas',
enableFiltering: true,
exporterCsvFilename: 'ParentList.csv',
- enableGridMenu: true,
enableSelectAll: true,
columnDefs: [{
field: 'id', enableFiltering: false, headerCellTemplate: '' +
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js
index a5d3c3408..be0169689 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagListDictGridController.js
@@ -49,7 +49,6 @@ app.controller('tagListDictGridController', function ($scope, PolicyAppService,
data : 'fwTagDictionaryDatas',
enableFiltering: true,
exporterCsvFilename: 'FWTag.csv',
- enableGridMenu: true,
enableSelectAll: true,
columnDefs: [{
field: 'id', enableFiltering: false, headerCellTemplate: '' +
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js
index e4e2a1429..dbc6c09e5 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/FWTagPickerListDictGridController.js
@@ -49,7 +49,6 @@ app.controller('tagPickerListDictGridController', function ($scope, PolicyAppSer
data : 'fwTagPickerDictionaryDatas',
enableFiltering: true,
exporterCsvFilename: 'SearchCriteria.csv',
- enableGridMenu: true,
enableSelectAll: true,
columnDefs: [{
field: 'id', enableFiltering: false, headerCellTemplate: '' +
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js
index bbce9ddcb..007edd748 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/MSModelDictGridController.js
@@ -46,19 +46,57 @@ app.controller('msModelsDictGridController', function ($scope, PolicyAppService,
});
$scope.msModelsDictionaryGrid = {
- data : 'microServiceModelsDictionaryDatas',
- enableFiltering: true,
- columnDefs: [{
- field: 'id', enableFiltering: false, headerCellTemplate: '' +
- '<button id=\'New\' ng-click="grid.appScope.createNewMSModelsWindow()" class="btn btn-success">' + 'Create</button>',
- cellTemplate:
- '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSModels(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
- },{ field: 'modelName', displayName : 'Micro Service Model', sort: { direction: 'asc', priority: 0 }},
- { field: 'description' },
- { field: 'version', displayName : 'Model Version' },
- {field: 'userCreatedBy.userName', displayName : 'Imported By' }
- ]
+ data : 'microServiceModelsDictionaryDatas',
+ enableFiltering: true,
+ exporterCsvFilename: 'MSPolicyDictionary.csv',
+ enableGridMenu: true,
+ enableSelectAll: true,
+ columnDefs: [{
+ field: 'id',
+ enableFiltering: false, headerCellTemplate: '' +
+ '<button id=\'New\' ng-click="grid.appScope.createNewMSModelsWindow()" class="btn btn-success">' + 'Create</button>',
+ cellTemplate:
+ '<button type="button" class="btn btn-danger" ng-click="grid.appScope.deleteMSModels(row.entity)" ><i class="fa fa-trash-o"></i></button> ', width: '8%'
+ },{ field: 'modelName', displayName : 'Micro Service Model', sort: { direction: 'asc', priority: 0 }},
+ { field: 'description' },
+ { field: 'version', displayName : 'Model Version' },
+ {field: 'userCreatedBy.userName', displayName : 'Imported By' },
+ {field: 'dependency', visible: false},
+ {field: 'attributes', visible: false},
+ {field: 'enumValues', visible: false},
+ {field: 'ref_attributes',visible: false},
+ {field: 'sub_attributes', visible: false}
+ ] ,
+ exporterMenuPdf: false,
+ exporterPdfDefaultStyle: {fontSize: 9},
+ exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
+ exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
+ exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
+ exporterPdfFooter: function ( currentPage, pageCount ) {
+ return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
+ },
+ exporterPdfCustomFormatter: function ( docDefinition ) {
+ docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
+ docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
+ return docDefinition;
+ },
+ exporterFieldCallback: function(grid, row, col, input) {
+ if( col.name == 'createdDate' || col.name == 'modifiedDate') {
+ var date = new Date(input);
+ return date.toString("yyyy-MM-dd HH:MM:ss a");
+ } else {
+ return input;
+ }
+ },
+ exporterPdfOrientation: 'portrait',
+ exporterPdfPageSize: 'LETTER',
+ exporterPdfMaxGridWidth: 500,
+ exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
+ onRegisterApi: function(gridApi){
+ $scope.gridApi = gridApi;
+ }
};
+
$scope.editMSmodelName = null;
$scope.createNewMSModelsWindow = function(){
$scope.editMSmodelName = null;
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js
index 4d1d07539..34c472eb2 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/RiskTypeDictGridController.js
@@ -48,8 +48,6 @@ app.controller('riskTypeDictGridController', function ($scope, PolicyAppService,
$scope.riskTypeDictionaryGrid = {
data : 'riskTypeDictionaryDatas',
enableFiltering: true,
- exporterCsvFilename: 'RiskType.csv',
- enableGridMenu: true,
enableSelectAll: true,
columnDefs: [{
field: 'id', enableFiltering: false, headerCellTemplate: '' +
@@ -66,36 +64,12 @@ app.controller('riskTypeDictGridController', function ($scope, PolicyAppService,
{field: 'modifiedDate',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\''}
],
enableColumnResize : true,
- exporterPdfDefaultStyle: {fontSize: 9},
- exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
- exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
- exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
- exporterPdfFooter: function ( currentPage, pageCount ) {
- return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
- },
- exporterPdfCustomFormatter: function ( docDefinition ) {
- docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
- docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
- return docDefinition;
- },
- exporterFieldCallback: function(grid, row, col, input) {
- if( col.name == 'createdDate' || col.name == 'modifiedDate') {
- var date = new Date(input);
- return date.toString("yyyy-MM-dd HH:MM:ss a");
- } else {
- return input;
- }
- },
- exporterPdfOrientation: 'portrait',
- exporterPdfPageSize: 'LETTER',
- exporterPdfMaxGridWidth: 500,
- exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
onRegisterApi: function(gridApi){
$scope.gridApi = gridApi;
+ $scope.gridApi.core.refresh();
}
};
-
$scope.editRiskType = null;
$scope.createNewRiskType = function(){
$scope.editRiskType = null;
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js
index d8a7bf55a..654575596 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/actionPolicyDictGridController.js
@@ -68,6 +68,7 @@ app.controller('actionPolicyDictGridController', function ($scope,modalService,
{field: 'url'},
{field: 'method'},
{field: 'header', displayName: 'Headers'},
+ {field: 'body', visible : false},
{field: 'description'},
{field: 'userCreatedBy.userName', displayName: 'Created By'},
{field: 'userModifiedBy.userName', displayName: 'Modified By'},
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ExportPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ExportPolicyController.js
index f3974f863..de30fe011 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ExportPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ExportPolicyController.js
@@ -20,21 +20,22 @@
var app = appDS2;
app.controller('exportPolicyController', function ($scope, $window, PolicyAppService, modalService, $modal, Notification){
$( "#dialog" ).hide();
+ $scope.policydatas = [];
$scope.linkEnable = true;
- $scope.gridOptions = {
- data : 'policydatas',
- onRegisterApi: function(gridApi) {
- $scope.gridPolicyApi = gridApi;
- },
- enableSorting: true,
- enableFiltering: true,
- showTreeExpandNoChildren: true,
- paginationPageSizes: [10, 20, 50, 100],
- paginationPageSize: 20,
- columnDefs: [{name: 'policyName', displayName : 'Policy Name', sort: { direction: 'asc', priority: 0 }},
- {name: 'activeVersion', displayName : 'Version'},
- {name: 'modifiedDate', displayName : 'Last Modified',type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }]
- };
+ $scope.gridExportOptions = {
+ data : 'policydatas',
+ onRegisterApi: function(gridApi) {
+ $scope.gridPolicyApi = gridApi;
+ },
+ enableSorting: true,
+ enableFiltering: true,
+ showTreeExpandNoChildren: true,
+ paginationPageSizes: [10, 20, 50, 100],
+ paginationPageSize: 20,
+ columnDefs: [{name: 'policyName', displayName : 'Policy Name', sort: { direction: 'asc', priority: 0 }},
+ {name: 'activeVersion', displayName : 'Version'},
+ {name: 'modifiedDate', displayName : 'Last Modified',type: 'date', cellFilter: 'date:\'yyyy-MM-dd HH:MM:ss a\'' }]
+ };
$scope.files;
PolicyAppService.getData('get_AutoPushPoliciesContainerData').then(function (data) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html
index 5c0aa9fbd..11472b96a 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html
@@ -93,26 +93,26 @@
class="form-control" class="form-control"
ng-disabled="temp.policy.readOnly"
ng-model="temp.policy.configName"
- ng-options="option for option in microServiceCongigNameDictionaryDatas track by option"></select>
+ ng-options="option for option in microServiceCongigNameDictionaryDatas track by option" required="true"></select>
</div>
<div class="form-group col-sm-3" ng-show="isCheck">
<label>Location:<sup><b>*!</b></sup></label><br> <select
class="form-control" class="form-control"
ng-disabled="temp.policy.readOnly" ng-model="temp.policy.location"
- ng-options="option for option in microServiceLocationDictionaryDatas track by option"></select>
+ ng-options="option for option in microServiceLocationDictionaryDatas track by option" required="true"></select>
</div>
<div class="form-group col-sm-3" ng-show="isCheck">
<label>UUID:<sup><b>*!</b></sup></label><br> <select
class="form-control" class="form-control"
ng-disabled="temp.policy.readOnly" ng-model="temp.policy.uuid"
- ng-options="option for option in dcaeUUIDDictionaryDatas track by option"></select>
+ ng-options="option for option in dcaeUUIDDictionaryDatas track by option" required="true"></select>
</div>
<div class="form-group col-sm-3" ng-show="isCheck">
<label>Policy Scope:<sup><b>*</b></sup></label><br> <select
class="form-control" class="form-control"
ng-disabled="temp.policy.readOnly"
ng-model="temp.policy.policyScope"
- ng-options="option for option in groupPolicyScopeListDatas track by option"></select>
+ ng-options="option for option in groupPolicyScopeListDatas track by option" required="true"></select>
</div>
</div>
</div>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ExportPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ExportPolicyTemplate.html
index 5e9fdbd6c..6ae8d6b54 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ExportPolicyTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ExportPolicyTemplate.html
@@ -1,16 +1,14 @@
-<div class="modal fadeIn" id="exportPolicy"
+<div class="modal" id="exportPolicy" style="margin-bottom: 20px; width: 100%; height: 100%"
ng-controller="exportPolicyController" data-toggle="modal"
data-backdrop="static" data-keyboard="false">
- <div class="modal-dialog modal-lg">
+ <div class="modal-dialog-lg">
<div class="modal-content">
<div class="modal-header">
- <h2 style="text-align: left; color: #157bb2">Export Policies</h2>
- </div>
- <div class="divider-container">
- <hr>
+ <h2 class="modal-title" style="color: #157bb2">Export Policies</h2>
</div>
+ <div class="well">
<div>
- <div id="grid1" style="width: 100%; height: 500px;" ui-grid="gridOptions"
+ <div id="grid1" ui-grid="gridExportOptions"
ui-grid-pagination ui-grid-selection ui-grid-resize-columns class="grid"></div>
</div>
<div class="modal-footer">
@@ -19,6 +17,7 @@
<button type="button" class="btn btn-default" data-dismiss="modal"
ng-disabled="temp.inprocess">Close</button>
</div>
+ </div>
</div>
</div>
</div> \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css
index ec19f0d7f..317efd9fa 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css
@@ -99,6 +99,10 @@ body {
border-radius: 4px;
}
+.first_child {
+ margin-top: 10px;
+}
+
.btn {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .26);
font-weight: 500;
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
index 77006002c..1c33839f2 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html
@@ -43,7 +43,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
- <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus">Delete</button>
+ <button type="submit" class="btn btn-primary" ng-disabled="!temp.model.versions" autofocus="autofocus">Delete</button>
</div>
</form>
</div>
@@ -140,7 +140,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
- <button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Save</button>
+ <button type="submit" class="btn btn-primary" ng-disabled="temp.tempModel.content.highestVersion === temp.tempModel.content.activeVersion">Save</button>
</div>
</form>
</div>
@@ -160,6 +160,7 @@
<div class="modal-body">
<label class="radio">Enter new Policy Name to Clone <b>{{temp.model.name}}</b></label>
<input class="form-control" ng-model="temp.tempModel.name" autofocus="autofocus">
+ <div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
@@ -277,7 +278,7 @@
</div>
<div class="detail-sources">
<code class="mr5"><b>Destination:</b>{{temp.tempModel.fullPath()}}</code>
- <a href="" ng-click="openNavigator(temp)"><span class="label label-primary">move</span></a>
+ <a href="" ng-click="openNavigator(temp)"><span class="label label-primary">change</span></a>
</div>
</div>
</div>
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
index 22cc82a23..dc2159bc1 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyManagerServletTest.java
@@ -40,6 +40,7 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.controller.CreateDcaeMicroServiceController;
import org.onap.policy.controller.PolicyController;
+import org.onap.policy.model.Roles;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.ActionBodyEntity;
import org.onap.policy.rest.jpa.ConfigurationDataEntity;
@@ -48,7 +49,6 @@ import org.onap.policy.rest.jpa.PolicyEditorScopes;
import org.onap.policy.rest.jpa.PolicyEntity;
import org.onap.policy.rest.jpa.PolicyVersion;
import org.onap.policy.rest.jpa.UserInfo;
-import org.openecomp.policy.model.Roles;
public class PolicyManagerServletTest extends Mockito{
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
index 1bda7cd41..16cefd854 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
@@ -45,8 +45,8 @@ import org.onap.policy.rest.jpa.PrefixList;
import org.onap.policy.rest.jpa.SecurityZone;
import org.onap.policy.rest.jpa.ServiceList;
import org.onap.policy.rest.jpa.TermList;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.util.SystemProperties;
import org.springframework.mock.web.MockHttpServletResponse;
public class PolicyRestControllerTest {
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java
index f4acaeb9a..7a3401568 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyUserInfoControllerTest.java
@@ -29,8 +29,8 @@ import javax.servlet.http.HttpSession;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.util.SystemProperties;
import org.springframework.mock.web.MockHttpServletResponse;
public class PolicyUserInfoControllerTest {
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java
index 0109cb503..17ad56457 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/AdminTabControllerTest.java
@@ -19,7 +19,8 @@
*/
package org.onap.policy.controller;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -30,13 +31,17 @@ import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.dao.CommonClassDao;
import org.onap.policy.rest.jpa.GlobalRoleSettings;
+import org.onap.portalsdk.core.domain.User;
+import org.onap.portalsdk.core.util.SystemProperties;
import org.springframework.mock.web.MockHttpServletResponse;
public class AdminTabControllerTest {
@@ -55,6 +60,12 @@ public class AdminTabControllerTest {
request = mock(HttpServletRequest.class);
response = new MockHttpServletResponse();
+ HttpSession mockSession = mock(HttpSession.class);
+ User user = new User();
+ user.setOrgUserId("Test");
+ Mockito.when(mockSession.getAttribute(SystemProperties.getProperty("user_attribute_name"))).thenReturn(user);
+ Mockito.when(request.getSession(false)).thenReturn(mockSession);
+
AdminTabController.setCommonClassDao(commonClassDao);
GlobalRoleSettings globalRole = new GlobalRoleSettings();
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java
index 8433c4740..55a2288c7 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/controller/PDPControllerTest.java
@@ -34,10 +34,10 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.model.Roles;
import org.onap.policy.xacml.api.pap.OnapPDPGroup;
import org.onap.policy.xacml.std.pap.StdPDPGroup;
import org.onap.policy.xacml.std.pap.StdPDPGroupStatus;
-import org.openecomp.policy.model.Roles;
import org.springframework.mock.web.MockHttpServletResponse;