diff options
Diffstat (limited to 'POLICY-SDK-APP/src/main')
30 files changed, 232 insertions, 148 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java index 3febbed44..7ac9ca310 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/admin/CheckPDP.java @@ -34,6 +34,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Properties; import org.onap.policy.common.logging.flexlogger.FlexLogger; @@ -49,9 +50,14 @@ public class CheckPDP { private static HashMap<String, String> pdpMap = null; private static final Logger LOGGER = FlexLogger.getLogger(CheckPDP.class); - private CheckPDP(){ + public static Map<String, String> getPdpMap() { + return pdpMap; + } + + public CheckPDP(){ //default constructor } + public static boolean validateID(String id) { // ReadFile try { 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 4f42023c9..d65d1da8a 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -91,16 +91,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class PolicyManagerServlet extends HttpServlet { private static final Logger LOGGER = FlexLogger.getLogger(PolicyManagerServlet.class); private static final long serialVersionUID = -8453502699403909016L; - - private static boolean jUnit = false; - - public static boolean isjUnit() { - return jUnit; - } - - public static void setjUnit(boolean jUnit) { - PolicyManagerServlet.jUnit = jUnit; - } private enum Mode { LIST, RENAME, COPY, DELETE, EDITFILE, ADDFOLDER, DESCRIBEPOLICYFILE, VIEWPOLICY, ADDSUBSCOPE, SWITCHVERSION, EXPORT, SEARCHLIST @@ -123,11 +113,11 @@ public class PolicyManagerServlet extends HttpServlet { private static String EDITOR = "editor"; private static String GUEST = "guest"; private static String RESULT = "result"; - + private static Path closedLoopJsonLocation; private static JsonArray policyNames; private static String testUserId = null; - + public static JsonArray getPolicyNames() { return policyNames; } @@ -154,7 +144,7 @@ public class PolicyManagerServlet extends HttpServlet { // PolicyManagerServlet.initializeJSONLoad(); } - + protected static void initializeJSONLoad() { closedLoopJsonLocation = Paths.get(XACMLProperties .getProperty(XACMLRestProperties.PROP_ADMIN_CLOSEDLOOP)); @@ -163,7 +153,7 @@ public class PolicyManagerServlet extends HttpServlet { String location = closedLoopJsonLocation.toString(); try { inputStream = new FileInputStream(location); - if (location.endsWith("json")) { + if (location.endsWith("json")) { jsonReader = Json.createReader(inputStream); policyNames = jsonReader.readArray(); serviceTypeNamesList = new ArrayList<>(); @@ -341,7 +331,7 @@ public class PolicyManagerServlet extends HttpServlet { try { //Get the Login Id of the User from Request String userId = UserUtils.getUserSession(request).getOrgUserId(); - //Check if the Role and Scope Size are Null get the values from db. + //Check if the Role and Scope Size are Null get the values from db. List<Object> userRoles = controller.getRoles(userId); roles = new ArrayList<>(); scopes = new HashSet<>(); @@ -356,7 +346,7 @@ public class PolicyManagerServlet extends HttpServlet { } }else{ scopes.add(userRole.getScope()); - } + } } } if (roles.contains(ADMIN) || roles.contains(EDITOR) || roles.contains(GUEST) ) { @@ -373,7 +363,7 @@ public class PolicyManagerServlet extends HttpServlet { } } } - } + } if(policyList!= null){ for(int i = 0; i < policyList.length(); i++){ String policyName = policyList.get(i).toString().replace(".xml", ""); @@ -390,7 +380,7 @@ public class PolicyManagerServlet extends HttpServlet { if(!activeData.isEmpty()){ PolicyVersion policy = (PolicyVersion) activeData.get(0); JSONObject el = new JSONObject(); - el.put("name", policy.getPolicyName().replace(File.separator, "/")); + el.put("name", policy.getPolicyName().replace(File.separator, "/")); el.put("date", policy.getModifiedDate()); el.put("version", policy.getActiveVersion()); el.put("size", ""); @@ -409,7 +399,7 @@ public class PolicyManagerServlet extends HttpServlet { PolicyVersion filterdata = (PolicyVersion) filter; try{ String scopeName = filterdata.getPolicyName().substring(0, filterdata.getPolicyName().lastIndexOf(File.separator)); - if(scopes.contains(scopeName)){ + if(scopes.contains(scopeName)){ policyData.add(filterdata); } }catch(Exception e){ @@ -417,12 +407,12 @@ public class PolicyManagerServlet extends HttpServlet { } } } - + if(!policyData.isEmpty()){ for(int i =0; i < policyData.size(); i++){ PolicyVersion policy = (PolicyVersion) policyData.get(i); JSONObject el = new JSONObject(); - el.put("name", policy.getPolicyName().replace(File.separator, "/")); + el.put("name", policy.getPolicyName().replace(File.separator, "/")); el.put("date", policy.getModifiedDate()); el.put("version", policy.getActiveVersion()); el.put("size", ""); @@ -436,7 +426,7 @@ public class PolicyManagerServlet extends HttpServlet { }catch(Exception e){ LOGGER.error("Exception occured while reading policy Data from Policy Version table for Policy Search Data"+e); } - + return new JSONObject().put(RESULT, resultList); } @@ -542,7 +532,7 @@ public class PolicyManagerServlet extends HttpServlet { peParams.put("split_1", split[1]); peParams.put("split_0", split[0]); List<Object> queryData = null; - if(jUnit){ + if(PolicyController.isjUnit()){ queryData = controller.getDataByQuery(query, null); }else{ queryData = controller.getDataByQuery(query, peParams); @@ -574,12 +564,12 @@ public class PolicyManagerServlet extends HttpServlet { }else{ return error("Error Occured while Describing the Policy"); } - + return object; } //Get the List of Policies and Scopes for Showing in Editor tab - private JSONObject list(JSONObject params, HttpServletRequest request) throws ServletException { + private JSONObject list(JSONObject params, HttpServletRequest request) throws ServletException { Set<String> scopes = null; List<String> roles = null; try { @@ -587,7 +577,7 @@ public class PolicyManagerServlet extends HttpServlet { //Get the Login Id of the User from Request String testUserID = getTestUserId(); String userId = testUserID != null ? testUserID : UserUtils.getUserSession(request).getOrgUserId(); - //Check if the Role and Scope Size are Null get the values from db. + //Check if the Role and Scope Size are Null get the values from db. List<Object> userRoles = controller.getRoles(userId); roles = new ArrayList<>(); scopes = new HashSet<>(); @@ -602,7 +592,7 @@ public class PolicyManagerServlet extends HttpServlet { } }else{ scopes.add(userRole.getScope()); - } + } } } @@ -623,8 +613,8 @@ public class PolicyManagerServlet extends HttpServlet { scopes.add(tempScope); } } - } - + } + if("/".equals(path)){ if(roles.contains(SUPERADMIN) || roles.contains(SUPEREDITOR) || roles.contains(SUPERGUEST)){ List<Object> scopesList = queryPolicyEditorScopes(null); @@ -632,7 +622,7 @@ public class PolicyManagerServlet extends HttpServlet { PolicyEditorScopes scope = (PolicyEditorScopes) list; if(!(scope.getScopeName().contains(File.separator))){ JSONObject el = new JSONObject(); - el.put("name", scope.getScopeName()); + el.put("name", scope.getScopeName()); el.put("date", scope.getCreatedDate()); el.put("size", ""); el.put("type", "dir"); @@ -647,7 +637,7 @@ public class PolicyManagerServlet extends HttpServlet { List<Object> scopesList = queryPolicyEditorScopes(scope.toString()); if(!scopesList.isEmpty()){ PolicyEditorScopes scopeById = (PolicyEditorScopes) scopesList.get(0); - el.put("name", scopeById.getScopeName()); + el.put("name", scopeById.getScopeName()); el.put("date", scopeById.getCreatedDate()); el.put("size", ""); el.put("type", "dir"); @@ -663,7 +653,7 @@ public class PolicyManagerServlet extends HttpServlet { activePolicyList(scopeName, resultList, roles, scopes, onlyFolders); } catch (Exception ex) { LOGGER.error("Error Occured While reading Policy Files List"+ex ); - } + } } return new JSONObject().put(RESULT, resultList); @@ -684,7 +674,7 @@ public class PolicyManagerServlet extends HttpServlet { } PolicyController controller = getPolicyControllerInstance(); List<Object> scopesList = null; - if(jUnit){ + if(PolicyController.isjUnit()){ scopesList = controller.getDataByQuery(scopeNamequery, null); }else{ scopesList = controller.getDataByQuery(scopeNamequery, params); @@ -703,13 +693,13 @@ public class PolicyManagerServlet extends HttpServlet { } String query = "from PolicyVersion where POLICY_NAME like :scopeName"; String scopeNamequery = "from PolicyEditorScopes where SCOPENAME like :scopeName"; - + SimpleBindings params = new SimpleBindings(); params.put("scopeName", scopeName + "%"); - + List<Object> activePolicies = null; List<Object> scopesList = null; - if(jUnit){ + if(PolicyController.isjUnit()){ activePolicies = controller.getDataByQuery(query, null); scopesList = controller.getDataByQuery(scopeNamequery, null); }else{ @@ -732,7 +722,7 @@ public class PolicyManagerServlet extends HttpServlet { } if(scopeName.equalsIgnoreCase(checkScope)){ JSONObject el = new JSONObject(); - el.put("name", scope); + el.put("name", scope); el.put("date", scopeById.getModifiedDate()); el.put("size", ""); el.put("type", "dir"); @@ -740,7 +730,7 @@ public class PolicyManagerServlet extends HttpServlet { el.put("modifiedBy", scopeById.getUserModifiedBy().getUserName()); resultList.add(el); } - } + } } String scopeNameCheck = null; for (Object list : activePolicies) { @@ -754,7 +744,7 @@ public class PolicyManagerServlet extends HttpServlet { } if(scopeNameValue.equals(scopeNameCheck)){ JSONObject el = new JSONObject(); - el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1)); + el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1)); el.put("date", policy.getModifiedDate()); el.put("version", policy.getActiveVersion()); el.put("size", ""); @@ -765,7 +755,7 @@ public class PolicyManagerServlet extends HttpServlet { } }else if(!scopes.isEmpty() && scopes.contains(scopeNameValue)){ JSONObject el = new JSONObject(); - el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1)); + el.put("name", policy.getPolicyName().substring(policy.getPolicyName().lastIndexOf(File.separator)+1)); el.put("date", policy.getModifiedDate()); el.put("version", policy.getActiveVersion()); el.put("size", ""); @@ -774,7 +764,7 @@ public class PolicyManagerServlet extends HttpServlet { el.put("modifiedBy", getUserName(policy.getModifiedBy())); resultList.add(el); } - } + } } private String getUserName(String loginId){ @@ -836,11 +826,11 @@ public class PolicyManagerServlet extends HttpServlet { if(activePolicies.size() != policyActiveInPDP.size()){ rename = true; } - + UserInfo userInfo = new UserInfo(); userInfo.setUserLoginId(userId); if(policyActiveInPDP.size() == 0){ - renameScope(scopesList, scopeName, newScopeName, controller); + renameScope(scopesList, scopeName, newScopeName, controller); }else if(rename){ renameScope(scopesList, scopeName, newScopeName, controller); for(String scope : scopeOfPolicyActiveInPDP){ @@ -853,7 +843,7 @@ public class PolicyManagerServlet extends HttpServlet { } if(isActive){ return error("The Following policies rename failed. Since they are active in PDP Groups" +policyActiveInPDP); - } + } } return success(); } catch (Exception e) { @@ -861,7 +851,7 @@ public class PolicyManagerServlet extends HttpServlet { return error(e.getMessage()); } } - + private void renameScope(List<Object> scopesList, String scopeName, String newScopeName, PolicyController controller){ for(Object object : scopesList){ PolicyEditorScopes editorScopeEntity = (PolicyEditorScopes) object; @@ -874,7 +864,7 @@ public class PolicyManagerServlet extends HttpServlet { controller.updateData(editorScopeEntity); } } - + private JSONObject policyRename(String oldPath, String newPath, String userId) throws ServletException { try { PolicyEntity entity = null; @@ -909,7 +899,7 @@ public class PolicyManagerServlet extends HttpServlet { String[] oldPolicySplit = oldPolicyCheck.split(":"); //Check PolicyEntity table with newPolicy Name - String policyEntityquery = "FROM PolicyEntity where policyName = :newPolicySplit_1 and scope = :newPolicySplit_1"; + String policyEntityquery = "FROM PolicyEntity where policyName = :newPolicySplit_1 and scope = :newPolicySplit_0"; SimpleBindings policyParams = new SimpleBindings(); policyParams.put("newPolicySplit_1", newPolicySplit[1]); policyParams.put("newPolicySplit_0", newPolicySplit[0]); @@ -951,7 +941,7 @@ public class PolicyManagerServlet extends HttpServlet { }else{ return error("Policy rename failed due to policy not able to retrieve from database. Please, contact super-admin."); } - + return success(); } catch (Exception e) { LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Exception Occured While Renaming Policy"+e); @@ -959,7 +949,7 @@ public class PolicyManagerServlet extends HttpServlet { } } - private JSONObject checkOldPolicyEntryAndUpdate(PolicyEntity entity, String newScope, String removenewPolicyExtension, String oldScope, String removeoldPolicyExtension, + private JSONObject checkOldPolicyEntryAndUpdate(PolicyEntity entity, String newScope, String removenewPolicyExtension, String oldScope, String removeoldPolicyExtension, String policyName, String newpolicyName, String oldpolicyName, String userId) throws ServletException{ try { ConfigurationDataEntity configEntity = entity.getConfigurationData(); @@ -1151,7 +1141,7 @@ public class PolicyManagerServlet extends HttpServlet { cloneRecord(newPolicySplit[1], oldPolicySplit[0], oldPolicySplit[1], newPolicySplit[0], newPolicySplit[1], entity, userId); success = true; } - + if(success){ PolicyVersion entityItem = new PolicyVersion(); entityItem.setActiveVersion(Integer.parseInt(version)); @@ -1202,7 +1192,8 @@ public class PolicyManagerServlet extends HttpServlet { splitPolicyName = policyNamewithoutExtension.replace(".Decision_", ":Decision_"); } String[] split = splitPolicyName.split(":"); - query = "FROM PolicyEntity where policyName like split_1 and scope = split_0"; + + query = "FROM PolicyEntity where policyName like :split_1 and scope = :split_0"; policyParams.put("split_1", split[1] + "%"); policyParams.put("split_0", split[0]); }else{ @@ -1210,7 +1201,7 @@ public class PolicyManagerServlet extends HttpServlet { query = "FROM PolicyEntity where scope like :policyNamewithoutExtension"; policyParams.put("policyNamewithoutExtension", policyNamewithoutExtension + "%"); } - + List<Object> policyEntityobjects = controller.getDataByQuery(query, policyParams); String activePolicyName = null; boolean pdpCheck = false; @@ -1238,7 +1229,7 @@ public class PolicyManagerServlet extends HttpServlet { controller.deleteData(policyEntity.getConfigurationData()); }else if(policyNamewithoutExtension.contains("Action_")){ controller.deleteData(policyEntity.getActionBodyEntity()); - } + } } } } @@ -1267,11 +1258,11 @@ public class PolicyManagerServlet extends HttpServlet { String currentVersionPolicyName = policyNamewithExtension.substring(policyNamewithExtension.lastIndexOf(File.separator)+1); String currentVersionScope = policyNamewithExtension.substring(0, policyNamewithExtension.lastIndexOf(File.separator)).replace(File.separator, "."); query = "FROM PolicyEntity where policyName = :currentVersionPolicyName and scope = :currentVersionScope"; - + SimpleBindings peParams = new SimpleBindings(); peParams.put("currentVersionPolicyName", currentVersionPolicyName); peParams.put("currentVersionScope", currentVersionScope); - + List<Object> policyEntitys = controller.getDataByQuery(query, peParams); if(!policyEntitys.isEmpty()){ policyEntity = (PolicyEntity) policyEntitys.get(0); @@ -1292,9 +1283,9 @@ public class PolicyManagerServlet extends HttpServlet { }else if(policyNamewithoutExtension.contains("Action_")){ controller.deleteData(policyEntity.getActionBodyEntity()); } - + if(version > 1){ - int highestVersion = 0; + int highestVersion = 0; if(!policyEntityobjects.isEmpty()){ for(Object object : policyEntityobjects){ policyEntity = (PolicyEntity) object; @@ -1325,7 +1316,7 @@ public class PolicyManagerServlet extends HttpServlet { return error("Policy can't be deleted, it is active in PDP Groups. PolicyName: '"+policyEntity.getScope() + "." +policyEntity.getPolicyName()+"'"); } } - } + } }else{ List<String> activePoliciesInPDP = new ArrayList<String>(); if(!policyEntityobjects.isEmpty()){ @@ -1355,7 +1346,7 @@ public class PolicyManagerServlet extends HttpServlet { //Delete from policyVersion and policyEditor Scope table String policyVersionQuery = "delete PolicyVersion where POLICY_NAME like '"+path.replace("\\", "\\\\")+"%' and id >0"; controller.executeQuery(policyVersionQuery); - + //Policy Notification PolicyVersion entity = new PolicyVersion(); entity.setPolicyName(path); @@ -1375,7 +1366,7 @@ public class PolicyManagerServlet extends HttpServlet { insertactivePDPVersion.setModifiedBy(userId); controller.saveData(insertactivePDPVersion); } - + return error("All the Policies has been deleted in Scope. Except the following list of Policies:"+activePoliciesInPDP); }else{ String policyScopeQuery = "delete PolicyEditorScopes where SCOPENAME like '"+path.replace("\\", "\\\\")+"%' and id >0"; @@ -1401,10 +1392,10 @@ public class PolicyManagerServlet extends HttpServlet { String mode = params.getString("mode"); String path = params.getString("path"); LOGGER.debug("editFile path: {}"+ path); - + String domain = path.substring(1, path.lastIndexOf("/")); domain = domain.replace("/", "."); - + path = path.substring(1); path = path.replace("/", "."); String dbCheckName = path; @@ -1415,14 +1406,14 @@ public class PolicyManagerServlet extends HttpServlet { }else if(dbCheckName.contains("Decision_")){ dbCheckName = dbCheckName.replace(".Decision_", ":Decision_"); } - + String[] split = dbCheckName.split(":"); String query = "FROM PolicyEntity where policyName = :split_1 and scope = :split_0"; SimpleBindings peParams = new SimpleBindings(); peParams.put("split_1", split[1]); peParams.put("split_0", split[0]); List<Object> queryData = null; - if(jUnit){ + if(PolicyController.isjUnit()){ queryData = controller.getDataByQuery(query, null); }else{ queryData = controller.getDataByQuery(query, peParams); @@ -1432,7 +1423,7 @@ public class PolicyManagerServlet extends HttpServlet { Object policy = XACMLPolicyScanner.readPolicy(stream); - PolicyRestAdapter policyAdapter = new PolicyRestAdapter(); + PolicyRestAdapter policyAdapter = new PolicyRestAdapter(); policyAdapter.setData(policy); if("viewPolicy".equalsIgnoreCase(mode)){ @@ -1451,7 +1442,7 @@ public class PolicyManagerServlet extends HttpServlet { PolicyAdapter setpolicyAdapter = PolicyAdapter.getInstance(); setpolicyAdapter.configure(policyAdapter,entity); - + policyAdapter.setParentPath(null); ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsString(policyAdapter); @@ -1478,7 +1469,7 @@ public class PolicyManagerServlet extends HttpServlet { } }else{ name = params.getString("name"); - } + } }catch(Exception e){ name = params.getString("name"); LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Exception Occured While Adding Scope"+e); @@ -1493,7 +1484,7 @@ public class PolicyManagerServlet extends HttpServlet { String validate = PolicyUtils.policySpecialCharValidator(validateName); if(!validate.contains("success")){ return error(validate); - } + } } LOGGER.debug("addFolder path: {} name: {}" + path +name); if(!name.equals("")){ @@ -1508,7 +1499,7 @@ public class PolicyManagerServlet extends HttpServlet { newScope.setScopeName(name); newScope.setUserCreatedBy(userInfo); newScope.setUserModifiedBy(userInfo); - controller.saveData(newScope); + controller.saveData(newScope); }else{ return error("Scope Already Exists"); } @@ -1543,7 +1534,7 @@ public class PolicyManagerServlet extends HttpServlet { throw new ServletException(e); } } - + private PolicyController getPolicyControllerInstance(){ return policyController != null ? getPolicyController() : new PolicyController(); } @@ -1555,4 +1546,4 @@ public class PolicyManagerServlet extends HttpServlet { public static void setTestUserId(String testUserId) { PolicyManagerServlet.testUserId = testUserId; } -}
\ No newline at end of file +} 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 a4e476200..2326a9fb7 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 @@ -122,7 +122,12 @@ public class PolicyNotificationMail{ boolean sendFlag = false; SimpleBindings params = new SimpleBindings(); params.put("policyFileName", policyFileName); - List<Object> watchList = policyNotificationDao.getDataByQuery(query, params); + List<Object> watchList = null; + if(PolicyController.isjUnit()){ + watchList = policyNotificationDao.getDataByQuery(query, null); + }else{ + watchList = policyNotificationDao.getDataByQuery(query, params); + } if(watchList != null && !watchList.isEmpty()){ for(Object watch : watchList){ WatchPolicyNotificationTable list = (WatchPolicyNotificationTable) watch; 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 7234a3b6a..08f80304c 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 @@ -82,8 +82,24 @@ public class PolicyRestController extends RestrictedBaseController{ private static final String modal = "model"; private static final String importDictionary = "import_dictionary"; + private static CommonClassDao commonClassDao; + + public static CommonClassDao getCommonClassDao() { + return commonClassDao; + } + + public static void setCommonClassDao(CommonClassDao commonClassDao) { + PolicyRestController.commonClassDao = commonClassDao; + } + @Autowired - CommonClassDao commonClassDao; + private PolicyRestController(CommonClassDao commonClassDao){ + PolicyRestController.commonClassDao = commonClassDao; + } + + public PolicyRestController(){ + //default constructor + } @RequestMapping(value={"/policycreation/save_policy"}, method={RequestMethod.POST}) public void policyCreationController(HttpServletRequest request, HttpServletResponse response) { diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java index a0f1ba86d..7c60ecfdf 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/components/HumanPolicyComponent.java @@ -202,7 +202,7 @@ class HtmlProcessor extends SimpleCallback { combiningAlgo2human.put("only-one-applicable", "to honour the result of the first successfully evaluated $placeholder$ in order"); } - private Map<String, AttributeIdentifiers> attributeIdentifiersMap = new HashMap<String, AttributeIdentifiers>(); + private Map<String, AttributeIdentifiers> attributeIdentifiersMap = new HashMap<>(); private final StringWriter stringWriter = new StringWriter(); private final PrintWriter htmlOut = new PrintWriter(stringWriter); @@ -357,7 +357,7 @@ class HtmlProcessor extends SimpleCallback { else policySet(policySet, "li"); - if (policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0) + if (!policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty()) htmlOut.println("<ol>"); return super.onPreVisitPolicySet(parent, policySet); @@ -377,7 +377,7 @@ class HtmlProcessor extends SimpleCallback { LOGGER.trace("PolicySet: " + policySet.getPolicySetId() + " Description: " + policySet.getDescription()); - if (policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0) + if (!policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty()) htmlOut.println("</ol>"); htmlOut.println("<p></p>"); @@ -421,7 +421,7 @@ class HtmlProcessor extends SimpleCallback { } if (policySet.getPolicySetOrPolicyOrPolicySetIdReference() != null && - policySet.getPolicySetOrPolicyOrPolicySetIdReference().size() > 0) { + !policySet.getPolicySetOrPolicyOrPolicySetIdReference().isEmpty()) { String algoDesc = combiningAlgo2human.get(combiningAlgorithm); if (algoDesc != null) { algoDesc = algoDesc.replace("$placeholder$", "policy") + " (" + "<i>" + combiningAlgorithm + "</i>)"; @@ -449,7 +449,7 @@ class HtmlProcessor extends SimpleCallback { policy(policy); - if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0) + if (!policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty()) htmlOut.println("<ol type=\"i\">"); return super.onPreVisitPolicy(parent, policy); @@ -464,7 +464,7 @@ class HtmlProcessor extends SimpleCallback { LOGGER.trace("PolicySet: " + policy.getPolicyId() + "Parent PolicySet: " + parent.getPolicySetId() + " Version: " + parent.getVersion()); - if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0) + if (!policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty()) htmlOut.println("</ol>"); htmlOut.println("<p></p>"); @@ -506,7 +506,7 @@ class HtmlProcessor extends SimpleCallback { } if (policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition() != null && - policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().size() > 0) { + !policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().isEmpty()) { String algoDesc = combiningAlgo2human.get(combiningAlgorithm); if (algoDesc != null) { algoDesc = algoDesc.replace("$placeholder$", "rule") + " (<i>" + combiningAlgorithm + "</i>)"; @@ -710,7 +710,7 @@ class HtmlProcessor extends SimpleCallback { // StdAttribute attribute = null; AttributeValueType value = match.getAttributeValue(); - String attributeDataType = null; + String attributeDataType; if (match.getAttributeDesignator() != null && value != null) { AttributeDesignatorType designator = match.getAttributeDesignator(); attribute = new StdAttribute(new IdentifierImpl(designator.getCategory()), @@ -822,11 +822,12 @@ class HtmlProcessor extends SimpleCallback { } private String removePrimitives(String in) { - in = in.replace("string-", ""); - in = in.replace("integer-", ""); - in = in.replace("double-", ""); - in = in.replace("boolean-", ""); - return in; + String newIn = in; + newIn = newIn.replace("string-", ""); + newIn = newIn.replace("integer-", ""); + newIn = newIn.replace("double-", ""); + newIn = newIn.replace("boolean-", ""); + return newIn; } private String stringifyCondition(ConditionType condition) { diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java index 353e08a44..32f40b9e7 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java @@ -64,4 +64,6 @@ public class HibernateSession{ logSessionFactory = logSessionFactory1; } + private HibernateSession(){ + } } 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 fc7cb60e5..4dc45425a 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 @@ -173,7 +173,7 @@ public class CreateBRMSParamController extends RestrictedBaseController { if (flag) { params.append(line); } - if (line.contains("declare Params")) { + if (line.contains("declare PapParams")) { params.append(line); flag = true; } @@ -181,7 +181,7 @@ public class CreateBRMSParamController extends RestrictedBaseController { break; } } - params = new StringBuilder(params.toString().replace("declare Params", "").replace("end", "").replaceAll("\\s+", "")); + params = new StringBuilder(params.toString().replace("declare PapParams", "").replace("end", "").replaceAll("\\s+", "")); String[] components = params.toString().split(":"); String caption = ""; for (int i = 0; i < components.length; i++) { @@ -400,7 +400,7 @@ public class CreateBRMSParamController extends RestrictedBaseController { if (flag) { params.append(line); } - if (line.contains("rule") && line.contains(".Params\"")) { + if (line.contains("rule") && line.contains(".PapParams\"")) { params.append(line); flag = true; } @@ -408,8 +408,8 @@ public class CreateBRMSParamController extends RestrictedBaseController { break; } } - params = new StringBuilder(params.substring(params.indexOf(".Params\"")+ 8)); - params = new StringBuilder(params.toString().replaceAll("\\s+", "").replace("salience1000whenthenParamsparams=newParams();","") + params = new StringBuilder(params.substring(params.indexOf(".PapParams\"")+ 11)); + params = new StringBuilder(params.toString().replaceAll("\\s+", "").replace("salience1000whenthenPapParamsparams=newPapParams();","") .replace("insert(params);end", "") .replace("params.set", "")); String[] components = params.toString().split("\\);"); @@ -462,7 +462,7 @@ public class CreateBRMSParamController extends RestrictedBaseController { brmsTemplateVlaue + policyData.getRuleName() + "%$> \n */ \n"; body = body + findRule((String) policyData.getRuleName()) + "\n"; StringBuilder generatedRule = new StringBuilder(); - generatedRule.append("rule \""+ policyData.getDomainDir().replace("\\", ".") +".Config_BRMS_Param_" + policyData.getPolicyName()+".Params\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tParams params = new Params();"); + generatedRule.append("rule \""+ policyData.getDomainDir().replace("\\", ".") +".Config_BRMS_Param_" + policyData.getPolicyName()+".PapParams\" \n\tsalience 1000 \n\twhen\n\tthen\n\t\tPapParams params = new PapParams();"); if(policyData.getRuleData().size() > 0){ for(Object keyValue: policyData.getRuleData().keySet()){ diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java index f10041e38..392adf039 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopPMController.java @@ -98,24 +98,24 @@ public class CreateClosedLoopPMController{ String attributeId = designator.getAttributeId(); // First match in the target is OnapName, so set that value. - if (attributeId.equals("ONAPName")) { + if ("ONAPName".equals(attributeId)) { policyAdapter.setOnapName(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")){ + if ("TTLDate".equals(attributeId) && !value.contains("NA")){ PolicyController controller = new PolicyController(); String newDate = controller.convertDate(value); policyAdapter.setTtlDate(newDate); } - if (attributeId.equals("ServiceType")){ + if ("ServiceType".equals(attributeId)){ LinkedHashMap<String, String> serviceTypePolicyName1 = new LinkedHashMap<>(); String key = "serviceTypePolicyName"; serviceTypePolicyName1.put(key, value); 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 0f55ba6ec..b349adacb 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 @@ -1379,6 +1379,14 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { @RequestMapping(value={"/ms_dictionary/set_MSModelData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) public void SetMSModelData(HttpServletRequest request, HttpServletResponse response) throws IOException, FileUploadException{ + modelList = new ArrayList<>(); + dirDependencyList = new ArrayList<>(); + classMap = new HashMap<>(); + retmap = new HashMap<>(); + uniqueKeys= new HashSet<>(); + uniqueDataKeys= new HashSet<>(); + dataListBuffer=new StringBuilder(); + dataConstraints= new ArrayList <>(); List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); boolean zip = false; boolean yml= false; 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 ed0bf4caf..9832f5803 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 @@ -90,6 +90,14 @@ public class CreateFirewallController extends RestrictedBaseController { private static CommonClassDao commonClassDao; + public static CommonClassDao getCommonClassDao() { + return commonClassDao; + } + + public static void setCommonClassDao(CommonClassDao commonClassDao) { + CreateFirewallController.commonClassDao = commonClassDao; + } + private List<String> tagCollectorList; private String jsonBody; List<String> expandablePrefixIPList = new ArrayList<>(); 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 625b2bdd8..71d0b3d03 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 @@ -60,7 +60,7 @@ public class CreatePolicyController extends RestrictedBaseController{ policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName()); policyAdapter.setConfigType(entity.getConfigurationData().getConfigType()); policyAdapter.setConfigBodyData(entity.getConfigurationData().getConfigBody()); - 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/PolicyNotificationController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java index 21f3793f1..f987f906d 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 @@ -64,13 +64,13 @@ public class PolicyNotificationController extends RestrictedBaseController { String responseValue = ""; try { String userId = UserUtils.getUserSession(request).getOrgUserId(); - System.out.println(userId); + logger.info("userid info: " + userId); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); String name = root.get("watchData").get("name").toString(); JsonNode pathList = root.get("watchData").get("path"); - String finalName = ""; + String finalName; if(pathList.isArray()){ ArrayNode arrayNode = (ArrayNode) pathList; for (int i = 0; i < arrayNode.size(); i++) { diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java index 946f90ac7..c8ed3a096 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/CommonClassDaoImpl.java @@ -268,7 +268,12 @@ public class CommonClassDaoImpl implements CommonClassDao{ try { Query hbquery = session.createQuery(query); for (Map.Entry<String, Object> paramPair : params.entrySet()) { - hbquery.setParameter(paramPair.getKey(), paramPair.getValue()); + if(paramPair.getValue() instanceof java.lang.Long){ + hbquery.setLong(paramPair.getKey(), (long) paramPair.getValue()); + } + else{ + hbquery.setParameter(paramPair.getKey(), paramPair.getValue()); + } } data = hbquery.list(); tx.commit(); diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java index 49024ba0d..c96da506f 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java @@ -43,16 +43,6 @@ import org.onap.policy.common.logging.flexlogger.Logger; public class SystemLogDbDaoImpl implements SystemLogDbDao { private static final Logger logger = FlexLogger.getLogger(SystemLogDbDaoImpl.class); - private static boolean jUnit = false; - - public static boolean isjUnit() { - return jUnit; - } - - public static void setjUnit(boolean jUnit) { - SystemLogDbDaoImpl.jUnit = jUnit; - } - @SuppressWarnings("unchecked") @Override public List<SystemLogDB> getLoggingData() { @@ -61,7 +51,7 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao { List<SystemLogDB> system = null; try { String sqlWhere = null; - if(jUnit){ + if(PolicyController.isjUnit()){ sqlWhere = ""; }else{ sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) ORDER BY date DESC limit "+PolicyController.getLogTableLimit()+""; @@ -90,7 +80,7 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao { List<SystemLogDB> system = null; try { String sqlWhere = null; - if(jUnit){ + if(PolicyController.isjUnit()){ sqlWhere = ""; }else{ sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) and logtype = 'error' ORDER BY date DESC limit "+PolicyController.getSystemAlertTableLimit()+""; diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java index 04ec3e868..3b3f11957 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/model/PDPGroupContainer.java @@ -365,7 +365,7 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po @Override public Object firstItemId() { synchronized (this.groups) { - if (this.groups.size() > 0) { + if (!this.groups.isEmpty()) { return this.groups.get(0); } } @@ -375,7 +375,7 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po @Override public Object lastItemId() { synchronized (this.groups) { - if (this.groups.size() > 0) { + if (!this.groups.isEmpty()) { return this.groups.get(this.groups.size() - 1); } } @@ -385,8 +385,8 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po @Override public boolean isFirstId(Object itemId) { synchronized (this.groups) { - if (this.groups.size() > 0) { - return (this.groups.get(0).equals(itemId)); + if (!this.groups.isEmpty()) { + return this.groups.get(0).equals(itemId); } } return false; @@ -395,8 +395,8 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po @Override public boolean isLastId(Object itemId) { synchronized (this.groups) { - if (this.groups.size() > 0) { - return (this.groups.get(this.groups.size() - 1).equals(itemId)); + if (!this.groups.isEmpty()) { + return this.groups.get(this.groups.size() - 1).equals(itemId); } } return false; @@ -444,7 +444,7 @@ public class PDPGroupContainer extends PolicyItemSetChangeNotifier implements Po // // You cannot remove the default group // - if (((OnapPDPGroup) itemId).getId().equals("Default")) { + if ("Default".equals(((OnapPDPGroup) itemId).getId())) { throw new UnsupportedOperationException("You can't remove the Default Group."); } // diff --git a/POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties b/POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties index 43b2de708..84c5dc5dd 100644 --- a/POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties +++ b/POLICY-SDK-APP/src/main/webapp/WEB-INF/conf/system.properties @@ -23,8 +23,8 @@ decryption_key = AGLDdG4D04BKm2IxIWEr8o== # The following properties MAY require changes by partner applications. ########################################################################## #Mysql -db.driver = com.mysql.jdbc.Driver -db.connectionURL = jdbc:mysql://localhost:3306/onapsdk1707 +db.driver = org.mariadb.jdbc.Driver +db.connectionURL = jdbc:mariadb://localhost:3306/onapsdk1707 db.userName = root db.password = db.hib.dialect = org.hibernate.dialect.MySQLDialect diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html index 98570f3dd..2271992b0 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLVarbindDictionary.html @@ -45,7 +45,7 @@ </div> <div class="form-group row"> <div class="form-group col-sm-6" ng-class="{ 'has-error' : formdata.varbindOID.$invalid && !formdata.varbindOID.$pristine }"> - <label>Varbind OID:</label><br> + <label>Varbind OID:<sup><b>*</b></sup></label><br> <input type="text" ng-model="editCLVarbind.varbindOID" class="form-control" name= "varbindOID" required/> <p ng-show="formdata.varbindOID.$invalid && !formdata.varbindOID.$pristine" class="help-block">Varbind OID is required.</p> </div> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html index fe7ad5811..89e3aff1e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/MSDCAEUUIDDictionary.html @@ -34,7 +34,7 @@ <div class="form-group col-sm-6" ng-class="{ 'has-error' : formdata.name.$invalid && !formdata.name.$pristine }"> <label>UUID:<sup><b>*</b></sup></label><br> <input type="text" ng-model="editDCAEuuid.name" class="form-control" name= "name" required/> - <p ng-show="formdata.name.$invalid && !formdata.name.$pristine" class="help-block">Onap Name is required.</p> + <p ng-show="formdata.name.$invalid && !formdata.name.$pristine" class="help-block">UUID field is required.</p> </div> </div> <div class="form-group row"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js index 08d4662da..90b77e45d 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js @@ -140,7 +140,7 @@ app.controller('vnfTypeDictGridController', function ($scope, PolicyAppService, $scope.deleteVnfType = function(data) { var uuu = "searchDictionary"; - var postData={data: data, type: "attribute"}; + var postData={data: data, type: "clVnf"}; var searchString = "\n"; $.ajax({ type : 'POST', diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html index 9721e1c2e..f5a5e8678 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/main/policyEditor.html @@ -220,10 +220,6 @@ <link rel="stylesheet" href="app/fusion/external/ds2/css/digital-ng-library/ionicons.css"> <link rel="stylesheet" href="app/fusion/styles/ecomp.css"> <link rel="stylesheet" href="app/fusion/external/angular-gridster/dist/angular-gridster.min.css"> - <script src= "app/policyApp/CSS/UIGrid/ui-grid.eot"></script> - <link rel="stylesheet" href="app/policyApp/CSS/UIGrid/ui-grid.svg"> - <script src= "app/policyApp/CSS/UIGrid/ui-grid.woff"></script> - <script src= "app/policyApp/CSS/UIGrid/ui-grid.ttf"></script> </head> <body class="appBody" ng-app="abs" style="padding-top: 0px;"> diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js index 2892936f8..a9097d559 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js @@ -24,6 +24,12 @@ app.controller('actionPolicyController', ['$scope', 'PolicyAppService', 'policyN $scope.savebutton = true; $scope.refreshCheck = false; + if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){ + $scope.temp.policy = { + policyType : "Action" + } + }; + $scope.refresh = function(){ if($scope.refreshCheck){ $scope.policyNavigator.refresh(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js index 02c31486b..22511c5a7 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSParamPolicyController.js @@ -24,6 +24,13 @@ angular.module('abs').controller('brmsParamPolicyController', ['$scope', '$windo $scope.savebutton = true; $scope.refreshCheck = false; + if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){ + $scope.temp.policy = { + policyType : "Config", + configPolicyType : "BRMS_Param" + } + }; + $scope.refresh = function(){ if($scope.refreshCheck){ $scope.policyNavigator.refresh(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js index 8f27f2a09..6061b1ef8 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BRMSRawPolicyController.js @@ -24,6 +24,13 @@ angular.module('abs').controller('brmsRawPolicyController', ['$scope', '$window' $scope.savebutton = true; $scope.refreshCheck = false; + if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){ + $scope.temp.policy = { + policyType : "Config", + configPolicyType : "BRMS_Raw" + } + }; + $scope.refresh = function(){ if($scope.refreshCheck){ $scope.policyNavigator.refresh(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js index 891e4098b..7425c92d4 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js @@ -25,6 +25,13 @@ app.controller('baseConfigController', ['$scope', 'PolicyAppService', 'policyNav $scope.savebutton = true; $scope.refreshCheck = false; + if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){ + $scope.temp.policy = { + policyType : "Config", + configPolicyType : "Base" + } + }; + $scope.refresh = function(){ if($scope.refreshCheck){ $scope.policyNavigator.refresh(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js index b3f702f6a..1015e7aac 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js @@ -24,6 +24,13 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol $scope.savebutton = true; $scope.refreshCheck = false; + if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){ + $scope.temp.policy = { + policyType : "Config", + configPolicyType : "ClosedLoop_Fault" + } + }; + $scope.refresh = function(){ if($scope.refreshCheck){ $scope.policyNavigator.refresh(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js index caec13feb..a67266074 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopPMController.js @@ -23,7 +23,14 @@ angular.module("abs").controller('clPMController', ['$scope', '$window', '$timeo $scope.policyNavigator; $scope.savebutton = true; $scope.refreshCheck = false; - + + if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){ + $scope.temp.policy = { + policyType : "Config", + configPolicyType : "ClosedLoop_PM" + } + }; + $scope.refresh = function(){ if($scope.refreshCheck){ $scope.policyNavigator.refresh(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js index fb10a2cc9..5b2bdb2b2 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js @@ -24,6 +24,12 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA $scope.savebutton = true; $scope.refreshCheck = false; + if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){ + $scope.temp.policy = { + policyType : "Decision" + } + }; + $scope.refresh = function(){ if($scope.refreshCheck){ $scope.policyNavigator.refresh(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js index 5988ef302..1051ecd9a 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/FirewallPolicyController.js @@ -24,6 +24,13 @@ angular.module('abs').controller('fwPolicyController', ['$scope', '$window', 'Po $scope.savebutton = true; $scope.refreshCheck = false; + if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){ + $scope.temp.policy = { + policyType : "Config", + configPolicyType : "Firewall Config" + } + }; + $scope.refresh = function(){ if($scope.refreshCheck){ $scope.policyNavigator.refresh(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js index b96a4f732..0e095a841 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/entities/item.js @@ -26,7 +26,7 @@ angular.module('abs').factory('item', ['$http', '$q', 'policyManagerConfig', fun path: path || [], type: model && model.type || 'file', size: model && parseInt(model.size || 0), - date: parseMySQLDate(model && model.date), + date: model && model.date, version: model && model.version || '', createdBy: model && model.createdBy || '', modifiedBy: model && model.modifiedBy || '', @@ -139,6 +139,11 @@ angular.module('abs').factory('item', ['$http', '$q', 'policyManagerConfig', fun self.inprocess = true; self.error = ''; $http.post(policyManagerConfig.renameUrl, data).success(function(data) { + if(data.result.error != undefined){ + var value = data.result.error; + value = value.replace("rename" , "move"); + data.result.error = value; + } self.deferredHandler(data, deferred); }).error(function(data) { self.deferredHandler(data, deferred, 'Error Occured While Moving'); 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 f7a6d2442..77006002c 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 @@ -1,4 +1,4 @@ -<div class="modal animated fadeIn" id="delete" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="delete" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form ng-submit="remove(temp)"> @@ -21,7 +21,7 @@ </div> </div> -<div class="modal animated fadeIn" id="deletePolicy" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="deletePolicy" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form ng-submit="removePolicy(temp)"> @@ -50,7 +50,7 @@ </div> </div> -<div class="modal animated fadeIn" id="rename" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="rename" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form ng-submit="rename(temp)"> @@ -75,7 +75,7 @@ </div> </div> -<div class="modal animated fadeIn" id="searchWindow" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="searchWindow" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form> @@ -96,7 +96,7 @@ </div> </div> -<div class="modal animated fadeIn" id="move" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="move" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form ng-submit="move(temp)"> @@ -119,7 +119,7 @@ </div> </div> -<div class="modal animated fadeIn" id="switchVersion" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="switchVersion" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form ng-submit="switchVersion(temp)"> @@ -147,7 +147,7 @@ </div> </div> -<div class="modal animated fadeIn" id="copy" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="copy" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form ng-submit="copy(temp)"> @@ -160,9 +160,6 @@ <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="'path-selector'" class="clearfix"></div> - <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> @@ -197,7 +194,7 @@ </div> </div> -<div class="modal animated fadeIn" id="addSubScope" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="addSubScope" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form ng-submit="subScopeFolder(temp)"> @@ -221,7 +218,7 @@ </div> </div> -<div class="modal animated fadeIn" id="uploadfile" data-toggle="modal" data-backdrop="static" data-keyboard="false"> +<div class="modal" id="uploadfile" data-toggle="modal" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog"> <div class="modal-content"> <form ng-submit="uploadFiles()"> @@ -250,7 +247,7 @@ </div> </div> -<div class="modal animated fadeIn" id="selector" ng-controller="PolicyManagerModalCtrl"> +<div class="modal" id="selector" ng-controller="PolicyManagerModalCtrl"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> |