summaryrefslogtreecommitdiffstats
path: root/ECOMP-REST
diff options
context:
space:
mode:
authorRavindra Bakkamanthala <rb7147@att.com>2017-05-31 15:54:24 -0400
committerRavindra Bakkamanthala <rb7147@att.com>2017-05-31 15:57:02 -0400
commitd9007d680d19734d5dc106479784c420236cca4b (patch)
treeb3356847c3d6e1543098b447c1df7d49e7118652 /ECOMP-REST
parent6a5e800771311208c66ad79ce1bdf76affd144b2 (diff)
[Policy-17] Removed the sql scripts from sdk app
Change-Id: I5b017aad569014c7f12eab35e1dbd1c215f90ebe Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'ECOMP-REST')
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyRestAdapter.java8
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java16
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConstraintType.java10
-rw-r--r--ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java63
4 files changed, 48 insertions, 49 deletions
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyRestAdapter.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyRestAdapter.java
index 2cfacab85..8c54f2a2d 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyRestAdapter.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/adapter/PolicyRestAdapter.java
@@ -55,8 +55,8 @@ public class PolicyRestAdapter {
private String parentPath;
private boolean isValidData = false;
private String adminNotification = null;
- public boolean isEditPolicy = false;
- public boolean isViewPolicy = false;
+ private boolean isEditPolicy = false;
+ private boolean isViewPolicy = false;
private boolean isDraft = false;
private Object policyData = null;
private String gitPath;
@@ -97,7 +97,7 @@ public class PolicyRestAdapter {
private String clearTimeOut;
private String trapMaxAge;
private String verificationclearTimeOut;
- public Map<String , String> dynamicLayoutMap;
+ private Map<String , String> dynamicLayoutMap;
//FireWall
private String fwPolicyType;
@@ -156,7 +156,7 @@ public class PolicyRestAdapter {
private ArrayList<Object> symptomSignatures;
private String logicalConnector;
private String policyStatus;
- public String gocServerScope;
+ private String gocServerScope;
private String supressionType;
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java
index 6badfa9a9..f9d60ff4d 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/Attribute.java
@@ -58,10 +58,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
@NamedQuery(name="Attribute.findAll", query="SELECT a FROM Attribute a order by a.priority asc, a.xacmlId asc")
public class Attribute implements Serializable {
private static final long serialVersionUID = 1L;
+ private static final Log logger = LogFactory.getLog(Attribute.class);
- public static String ATTRIBUTE_DESIGNATOR = "Attribute Designator";
- public static String ATTRIBUTE_SELECTOR = "Attribute Selector";
-
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
@@ -151,7 +149,7 @@ public class Attribute implements Serializable {
this.userModifiedBy = userModifiedBy;
}
- private static Log LOGGER = LogFactory.getLog(Attribute.class);
+
public Attribute() {
}
@@ -159,12 +157,8 @@ public class Attribute implements Serializable {
this.xacmlId = domain;
}
- public Attribute(String domain, String user) {
- this(domain);
- }
-
- public Attribute(Attribute copy, String user) {
- this(copy.getXacmlId() + ":(0)", user);
+ public Attribute(Attribute copy) {
+ this(copy.getXacmlId() + ":(0)");
this.constraintType = copy.getConstraintType();
this.categoryBean = copy.getCategoryBean();
this.datatypeBean = copy.getDatatypeBean();
@@ -189,7 +183,7 @@ public class Attribute implements Serializable {
try {
this.userModifiedBy = XacmlAdminAuthorization.getUserId();
} catch (Exception e) {
- LOGGER.error("Exception caused While adding Modified by Role"+e);
+ logger.error("Exception caused While adding Modified by Role"+e);
}
}
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConstraintType.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConstraintType.java
index 73e053ce7..d7f5a720f 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConstraintType.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/jpa/ConstraintType.java
@@ -41,17 +41,17 @@ import javax.persistence.Table;
public class ConstraintType implements Serializable {
private static final long serialVersionUID = 1L;
- public static String ENUMERATION_TYPE = "Enumeration";
- public static String RANGE_TYPE = "Range";
- public static String REGEXP_TYPE = "Regular Expression";
+ public static final String ENUMERATION_TYPE = "Enumeration";
+ public static final String RANGE_TYPE = "Range";
+ public static final String REGEXP_TYPE = "Regular Expression";
- public static Map<String, String> defaults = new HashMap<String, String>();
+ protected static final Map<String, String> defaults = new HashMap<>();
static {
defaults.put(ENUMERATION_TYPE, "Enumerate a set of values that the attribute may be set to during policy creation.");
defaults.put(RANGE_TYPE, "Set a range of min and/or max integer/double values the attribute can be set to during policy creation.");
defaults.put(REGEXP_TYPE, "Define a regular expression the attribute must match against during policy creation.");
}
- public static final String[] RANGE_TYPES = {"minExclusive", "minInclusive", "maxExclusive", "maxInclusive"};
+ protected static final String[] RANGE_TYPES = {"minExclusive", "minInclusive", "maxExclusive", "maxInclusive"};
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
diff --git a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java
index ef1eecf27..5cffb998a 100644
--- a/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java
+++ b/ECOMP-REST/src/main/java/org/openecomp/policy/rest/util/Webapps.java
@@ -38,7 +38,7 @@ import org.openecomp.policy.common.logging.eelf.PolicyLogger;
public class Webapps {
private static String actionHome = null;
private static String configHome = null;
- private static Log LOGGER = LogFactory.getLog(Webapps.class);
+ private static Log logger = LogFactory.getLog(Webapps.class);
private Webapps() {
}
@@ -47,6 +47,7 @@ public class Webapps {
try {
loadWebapps();
} catch (Exception e) {
+ logger.error("Exception Occured while loading webapps"+e);
return null;
}
return configHome;
@@ -56,55 +57,59 @@ public class Webapps {
try {
loadWebapps();
} catch (Exception e) {
+ logger.error("Exception Occured while loading webapps"+e);
return null;
}
return actionHome;
}
private static void loadWebapps() throws Exception{
+ String errorMessageName = "Invalid Webapps Path Location property :";
if(actionHome == null || configHome == null){
Path webappsPath = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS));
//Sanity Check
if (webappsPath == null) {
- LOGGER.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
- PolicyLogger.error("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
- throw new Exception("Invalid Webapps Path Location property : " + XACMLRestProperties.PROP_PAP_WEBAPPS);
+ logger.error(errorMessageName + XACMLRestProperties.PROP_PAP_WEBAPPS);
+ PolicyLogger.error(errorMessageName + XACMLRestProperties.PROP_PAP_WEBAPPS);
+ throw new Exception(errorMessageName + XACMLRestProperties.PROP_PAP_WEBAPPS);
}
Path webappsPathConfig;
Path webappsPathAction;
- if(webappsPath.toString().contains("\\"))
- {
+ if(webappsPath.toString().contains("\\")){
webappsPathConfig = Paths.get(webappsPath.toString()+"\\Config");
webappsPathAction = Paths.get(webappsPath.toString()+"\\Action");
- }
- else
- {
+ }else{
webappsPathConfig = Paths.get(webappsPath.toString()+"/Config");
webappsPathAction = Paths.get(webappsPath.toString()+"/Action");
}
- if (Files.notExists(webappsPathConfig))
- {
- try {
- Files.createDirectories(webappsPathConfig);
- } catch (IOException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: "
- + webappsPathConfig.toAbsolutePath().toString(), e);
- PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Webapps", "Failed to create config directory");
- }
- }
- if (Files.notExists(webappsPathAction))
- {
- try {
- Files.createDirectories(webappsPathAction);
- } catch (IOException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: "
- + webappsPathAction.toAbsolutePath().toString(), e);
- PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Webapps", "Failed to create config directory");
- }
- }
+
+ checkConfigActionHomeExists(webappsPathConfig, webappsPathAction);
+
actionHome = webappsPathAction.toString();
configHome = webappsPathConfig.toString();
}
}
+
+ private static void checkConfigActionHomeExists(Path webappsPathConfig, Path webappsPathAction){
+ if (!webappsPathConfig.toFile().exists()){
+ try {
+ Files.createDirectories(webappsPathConfig);
+ } catch (IOException e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: "
+ + webappsPathConfig.toAbsolutePath().toString(), e);
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Webapps", "Failed to create config directory");
+ }
+ }
+
+ if (!webappsPathAction.toFile().exists()){
+ try {
+ Files.createDirectories(webappsPathAction);
+ } catch (IOException e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create config directory: "
+ + webappsPathAction.toAbsolutePath().toString(), e);
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Webapps", "Failed to create config directory");
+ }
+ }
+ }
}