aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-REST
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-REST')
-rw-r--r--ONAP-REST/.gitignore6
-rw-r--r--ONAP-REST/policyLogger.properties44
-rw-r--r--ONAP-REST/pom.xml114
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRest.java216
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java456
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java220
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressGroupJson.java83
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressJson.java52
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembers.java46
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AutoPushTabAdapter.java42
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultBody.java280
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java44
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPMBody.java133
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPerformanceMetrics.java36
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicy.java61
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyConditions.java39
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyStatus.java41
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopSignatures.java52
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeletePolicyCondition.java38
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeployNowJson.java36
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/GridData.java54
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/IdMap.java42
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyExportAdapter.java36
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java896
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PrefixIPList.java72
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/RainyDayParams.java100
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceGroupJson.java83
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceListJson.java111
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceMembers.java48
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServicesJson.java44
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TagDefines.java41
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Tags.java59
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Term.java201
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TermCollector.java145
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/VendorSpecificData.java38
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java97
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/adapter/package-info.java20
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/dao/CommonClassDao.java57
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/dao/package-info.java21
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java195
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java103
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java211
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java114
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java363
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java93
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSController.java154
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSDependency.java153
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java142
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java218
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java175
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java177
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java99
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java224
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java121
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java116
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java102
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java102
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java47
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java244
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java235
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java181
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/EnforcingType.java96
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java180
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java189
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java164
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java122
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java219
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java93
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java270
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java111
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java104
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java109
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java102
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java102
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java189
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java227
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java123
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java167
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java183
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java147
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java537
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java365
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java147
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java131
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java241
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java116
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java150
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java159
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java308
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java60
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java162
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java102
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java100
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java100
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java100
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java100
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java104
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java183
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java104
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java114
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java105
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java118
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java102
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java172
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java125
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java109
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java101
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java154
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java163
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java261
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java76
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java102
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java173
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java173
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java184
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java80
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java101
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/jpa/package-info.java21
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/util/LockdownListener.java36
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeObject.java109
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeValue.java60
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java701
-rw-r--r--ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java115
-rw-r--r--ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java107
124 files changed, 17501 insertions, 0 deletions
diff --git a/ONAP-REST/.gitignore b/ONAP-REST/.gitignore
new file mode 100644
index 000000000..227059fcf
--- /dev/null
+++ b/ONAP-REST/.gitignore
@@ -0,0 +1,6 @@
+/bin/
+/target/
+/target/
+/target/
+/target/
+/target/
diff --git a/ONAP-REST/policyLogger.properties b/ONAP-REST/policyLogger.properties
new file mode 100644
index 000000000..e5c1619b6
--- /dev/null
+++ b/ONAP-REST/policyLogger.properties
@@ -0,0 +1,44 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP-REST
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# 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.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+################################### Set concurrentHashMap and timer info #######################
+#Timer initial delay and the delay between in milliseconds before task is to be execute.
+timer.delay.time=1000
+#Timer scheduleAtFixedRate period - time in milliseconds between successive task executions.
+check.interval= 30000
+#Longest time an event info can be stored in the concurrentHashMap for logging - in seconds.
+event.expired.time=86400
+#Size of the concurrentHashMap which stores the event starting time, etc - when its size reaches this limit, the Timer gets executed
+#to remove all expired records from this concurrentHashMap.
+concurrentHashMap.limit=5000
+#Size of the concurrentHashMap - when its size drops to this point, stop the Timer
+stop.check.point=2500
+################################### Set logging format #############################################
+# set EELF for EELF logging format, set LOG4J for using log4j, set SYSTEMOUT for using system.out.println
+logger.type=EELF
+#################################### Set level for EELF or SYSTEMOUT logging ##################################
+# Set level for debug file. Set DEBUG to enable .info, .warn and .debug; set INFO for enable .info and .warn; set OFF to disable all
+debugLogger.level=INFO
+# Set level for metrics file. Set OFF to disable; set ON to enable
+metricsLogger.level=ON
+# Set level for error file. Set OFF to disable; set ON to enable
+error.level=ON
+# Set level for audit file. Set OFF to disable; set ON to enable
+audit.level=ON
diff --git a/ONAP-REST/pom.xml b/ONAP-REST/pom.xml
new file mode 100644
index 000000000..220d2aa4e
--- /dev/null
+++ b/ONAP-REST/pom.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP Policy Engine
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+<!-- Apache Maven 2 POM generated by Apache Ivy http://ant.apache.org/ivy/
+ Apache Ivy version: 2.0.0-beta1 20071206070608 -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onap.policy.engine</groupId>
+ <artifactId>PolicyEngineSuite</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>ONAP-REST</artifactId>
+
+ <description>ONAP REST</description>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.policy.engine</groupId>
+ <version>${project.version}</version>
+ <artifactId>ONAP-XACML</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>14.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.9.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-mock</artifactId>
+ <version>2.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>com.mockrunner</groupId>
+ <artifactId>mockrunner</artifactId>
+ <version>0.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>org.eclipse.emf.ecore.xmi</artifactId>
+ <version>2.11.0-v20150123-0347</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>org.eclipse.emf.ecore</artifactId>
+ <version>2.11.0-v20150123-0347</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>org.eclipse.emf.common</artifactId>
+ <version>2.11.0-v20150123-0347</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>[20090211,)</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRest.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRest.java
new file mode 100644
index 000000000..6bef28dfb
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRest.java
@@ -0,0 +1,216 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+import com.att.research.xacml.util.XACMLProperties;
+
+
+/**
+ * This static class is used by both the PDP and PAP servlet's. It contains some common
+ * static functions and objects used by both the servlet's.
+ *
+ *
+ */
+public class XACMLRest {
+ private static final Log logger = LogFactory.getLog(XACMLRest.class);
+ private static Properties restProperties = new Properties();
+
+ /**
+ * This must be called during servlet initialization. It sets up the xacml.?.properties
+ * file as a system property. If the System property is already set, then it does not
+ * do anything. This allows the developer to specify their own xacml.properties file to be
+ * used. They can 1) modify the default properties that comes with the project, or 2) change
+ * the WebInitParam annotation, or 3) specify an alternative path in the web.xml, or 4) set
+ * the Java System property to point to their xacml.properties file.
+ *
+ * The recommended way of overriding the default xacml.properties file is using a Java System
+ * property:
+ *
+ * -Dxacml.properties=/opt/app/xacml/etc/xacml.admin.properties
+ *
+ * This way one does not change any actual code or files in the project and can leave the
+ * defaults alone.
+ *
+ * @param config - The servlet config file passed from the javax servlet init() function
+ */
+ public static void xacmlInit(ServletConfig config) {
+ //
+ // Get the XACML Properties File parameter first
+ //
+ String propFile = config.getInitParameter("XACML_PROPERTIES_NAME");
+ if (propFile != null) {
+ //
+ // Look for system override
+ //
+ String xacmlPropertiesName = System.getProperty(XACMLProperties.XACML_PROPERTIES_NAME);
+ logger.info("\n\n" + xacmlPropertiesName + "\n" + XACMLProperties.XACML_PROPERTIES_NAME);
+ if (xacmlPropertiesName == null) {
+ //
+ // Set it to our servlet default
+ //
+ if (logger.isDebugEnabled()) {
+ logger.debug("Using Servlet Config Property for XACML_PROPERTIES_NAME:" + propFile);
+ }
+ System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, propFile);
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Using System Property for XACML_PROPERTIES_NAME:" + xacmlPropertiesName);
+ }
+ }
+ }
+ //
+ // Setup the remaining properties
+ //
+ Enumeration<String> params = config.getInitParameterNames();
+ while (params.hasMoreElements()) {
+ String param = params.nextElement();
+ if (! param.equals("XACML_PROPERTIES_NAME")) {
+ String value = config.getInitParameter(param);
+ //logger.info(param + "=" + config.getInitParameter(param));
+ PolicyLogger.info(param + "=" + config.getInitParameter(param));
+ restProperties.setProperty(param, value);
+ }
+ }
+ }
+
+ /**
+ * Reset's the XACMLProperties internal properties object so we start
+ * in a fresh environment. Then adds back in our Servlet init properties that were
+ * passed in the javax Servlet init() call.
+ *
+ * This function is primarily used when a new configuration is passed in and the
+ * PDP servlet needs to load a new PDP engine instance.
+ *
+ * @param pipProperties - PIP configuration properties
+ * @param policyProperties - Policy configuration properties
+ */
+ public static void loadXacmlProperties(Properties policyProperties, Properties pipProperties) {
+ try {
+ //
+ // Start fresh
+ //
+ XACMLProperties.reloadProperties();
+ //
+ // Now load our init properties
+ //
+ XACMLProperties.getProperties().putAll(XACMLRest.restProperties);
+ //
+ // Load our policy properties
+ //
+ if (policyProperties != null) {
+ XACMLProperties.getProperties().putAll(policyProperties);
+ }
+ //
+ // Load our pip config properties
+ //
+ if (pipProperties != null) {
+ XACMLProperties.getProperties().putAll(pipProperties);
+ }
+ } catch (IOException e) {
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Failed to put init properties into Xacml properties");
+ }
+ //
+ // Dump them
+ //
+ if (logger.isDebugEnabled()) {
+ try {
+ logger.debug(XACMLProperties.getProperties().toString());
+ } catch (IOException e) {
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "Cannot dump properties");
+ }
+ }
+ }
+
+ /**
+ * Helper routine to dump the HTTP servlet request being serviced. Primarily for debugging.
+ *
+ * @param request - Servlet request (from a POST/GET/PUT/etc.)
+ */
+ public static void dumpRequest(HttpServletRequest request) {
+ if (logger.isDebugEnabled()) {
+ // special-case for receiving heartbeat - don't need to repeatedly output all of the information in multiple lines
+ if (request.getMethod().equals("GET") && "hb".equals(request.getParameter("type")) ) {
+ //logger.debug("GET type=hb : heartbeat received");
+ PolicyLogger.debug("GET type=hb : heartbeat received");
+ return;
+ }
+ logger.debug(request.getMethod() + ":" + request.getRemoteAddr() + " " + request.getRemoteHost() + " " + request.getRemotePort());
+ logger.debug(request.getLocalAddr() + " " + request.getLocalName() + " " + request.getLocalPort());
+ Enumeration<String> en = request.getHeaderNames();
+ logger.debug("Headers:");
+ while (en.hasMoreElements()) {
+ String element = en.nextElement();
+ Enumeration<String> values = request.getHeaders(element);
+ while (values.hasMoreElements()) {
+ String value = values.nextElement();
+ logger.debug(element + ":" + value);
+ }
+ }
+ logger.debug("Attributes:");
+ en = request.getAttributeNames();
+ while (en.hasMoreElements()) {
+ String element = en.nextElement();
+ logger.debug(element + ":" + request.getAttribute(element));
+ }
+ logger.debug("ContextPath: " + request.getContextPath());
+ if (request.getMethod().equals("PUT") || request.getMethod().equals("POST")) {
+ // POST and PUT are allowed to have parameters in the content, but in our usage the parameters are always in the Query string.
+ // More importantly, there are cases where the POST and PUT content is NOT parameters (e.g. it might contain a Policy file).
+ // Unfortunately the request.getParameterMap method reads the content to see if there are any parameters,
+ // and once the content is read it cannot be read again.
+ // Thus for PUT and POST we must avoid reading the content here so that the main code can read it.
+ logger.debug("Query String:" + request.getQueryString());
+ try {
+ if (request.getInputStream() == null) {
+ logger.debug("Content: No content inputStream");
+ } else {
+ logger.debug("Content available: " + request.getInputStream().available());
+ }
+ } catch (Exception e) {
+ logger.debug("Content: inputStream exception: " + e.getMessage() + "; (May not be relevant)" +e);
+ }
+ } else {
+ logger.debug("Parameters:");
+ Map<String, String[]> params = request.getParameterMap();
+ Set<String> keys = params.keySet();
+ for (String key : keys) {
+ String[] values = params.get(key);
+ logger.debug(key + "(" + values.length + "): " + (values.length > 0 ? values[0] : ""));
+ }
+ }
+ logger.debug("Request URL:" + request.getRequestURL());
+ }
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java
new file mode 100644
index 000000000..5c8449603
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XACMLRestProperties.java
@@ -0,0 +1,456 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest;
+
+import com.att.research.xacml.util.XACMLProperties;
+
+/**
+ * These are XACML Properties that are relevant to the RESTful API interface for
+ * the PDP, PAP and AC interfaces.
+ *
+ *
+ */
+public class XACMLRestProperties extends XACMLProperties {
+ /**
+ * A unique identifier for the PDP servlet instance. Usually set to the URL
+ * it is running as in the J2EE container.
+ *
+ * Eg. http://localhost:8080/pdp/
+ */
+ public static final String PROP_PDP_ID = "xacml.rest.pdp.id";
+ /**
+ * A PDP servlet's configuration directory. Holds the pip and policy
+ * configuration data as well as the local policy cache.
+ *
+ * Eg: /opt/app/xacml/config
+ */
+ public static final String PROP_PDP_CONFIG = "xacml.rest.pdp.config";
+ // Resilience feature-
+ public static final String PROP_PDP_WEBAPPS = "xacml.rest.pdp.webapps";
+ //Closed Loop JSON table
+ public static final String PROP_ADMIN_CLOSEDLOOP = "xacml.rest.admin.closedLoopJSON";
+ /**
+ * Set this property to true or false if the PDP servlet should register
+ * itself upon startup with the PAP servlet.
+ */
+ public static final String PROP_PDP_REGISTER = "xacml.rest.pdp.register";
+ /**
+ * Number of seconds the PDP will sleep while retrying registration with the
+ * PAP. This value must be greater or equal to 5.
+ */
+ public static final String PROP_PDP_REGISTER_SLEEP = "xacml.rest.pdp.register.sleep";
+ /**
+ * Number of retry attempts at registration with the PAP. A value of -1
+ * indicates infinite retries.
+ */
+ public static final String PROP_PDP_REGISTER_RETRIES = "xacml.rest.pdp.register.retries";
+ /**
+ * Max content length accepted for an incoming POST XML/JSON request.
+ * Default is 32767 bytes.
+ */
+ public static final String PROP_PDP_MAX_CONTENT = "xacml.rest.pdp.maxcontent";
+ /**
+ * Custom HTTP header used by PDP to send the value of the PROP_PDP_ID
+ */
+ public static final String PROP_PDP_HTTP_HEADER_ID = "X-XACML-PDP-ID";
+ /**
+ * Custom HHTP header used by PDP to send its heartbeat value.
+ */
+ public static final String PROP_PDP_HTTP_HEADER_HB = "X-XACML-PDP-HB";
+ /*
+ * Custom HTTP header used by PDP to send the value of the
+ * X-XACML-PDP-JMX-PORT
+ */
+ public static final String PROP_PDP_HTTP_HEADER_JMX_PORT = "X-XACML-PDP-JMX-PORT";
+ /**
+ * The URL of the PAP servlet. Used by PDP servlet's to communicate. Because
+ * administrators can set whatever context they want to run the PAP servlet,
+ * it isn't easy to determine a return URL for the PAP servlet. This is
+ * especially true upon initialization.
+ */
+ public static final String PROP_PAP_URL = "xacml.rest.pap.url";
+ /**
+ * A comma divided list of urls pointing to avaiable PAP urls.
+ * If one or more fail, the other servers in the list can
+ * handle the requests.
+ */
+ public static final String PROP_PAP_URLS = "xacml.rest.pap.urls";
+ public static final String PROP_PAP_FAILED_URLS = "xacml.rest.pap.failedUrls";
+ public static final String PROP_PAP_SUCCEEDED_URLS = "xacml.rest.pap.succeededUrls";
+ //public static final String PROP_PAP_FAILED_URL_TIME = "xacml.rest.pap.failedUrlTime";
+
+ /**
+ * Upon startup, have the PAP servlet send latest configuration information
+ * to all the PDP nodes it knows about.
+ */
+ public static final String PROP_PAP_INITIATE_PDP_CONFIG = "xacml.rest.pap.initiate.pdp";
+ /**
+ * The interval the PAP servlet uses to send heartbeat requests to the PDP
+ * nodes.
+ */
+ public static final String PROP_PAP_HEARTBEAT_INTERVAL = "xacml.rest.pap.heartbeat.interval";
+ /**
+ * Timeout value used by the PAP servlet when trying to check the heartbeat
+ * of a PDP node.
+ */
+ public static final String PROP_PAP_HEARTBEAT_TIMEOUT = "xacml.rest.pap.heartbeat.timeout";
+ /*
+ * This is the domain you can setup for your organization, it should be a URI.
+ * Eg. com:sample:foo
+ */
+ public static final String PROP_PAP_DOMAIN = "xacml.rest.pap.domain";
+
+ /*
+ * Local path to where user workspaces exist. The user workspace contains temporary files, the
+ * user's clone of the GIT repository, anything specific to the user, etc.
+ */
+ public static final String PROP_PAP_WORKSPACE = "xacml.rest.pap.workspace";
+
+ /*
+ * Local path to where the GIT repository exists.
+ *
+ * Eg. /opt/app/xacml/repository
+ */
+ public static final String PROP_PAP_REPOSITORY = "xacml.rest.pap.repository";
+
+ /*
+ * Database driver property
+ */
+ public static final String PROP_PAP_DB_DRIVER = "javax.persistence.jdbc.driver";
+
+ /*
+ * Database url
+ */
+ public static final String PROP_PAP_DB_URL = "javax.persistence.jdbc.url";
+
+ /*
+ * Database user
+ */
+ public static final String PROP_PAP_DB_USER = "javax.persistence.jdbc.user";
+
+ /*
+ * Database password
+ */
+ public static final String PROP_PAP_DB_PASSWORD = "javax.persistence.jdbc.password";
+
+ /*
+ * Time in ms which a Policy DB transaction will wait to get the transaction lock object
+ */
+ public static final String PROP_PAP_TRANS_WAIT = "xacml.rest.pap.transaction.waitms";
+
+ /*
+ * Policy DB transaction timeout in ms after it has obtained the transaction lock object
+ */
+ public static final String PROP_PAP_TRANS_TIMEOUT = "xacml.rest.pap.transaction.timeoutms";
+
+ /*
+ * Policy Audit transaction timeout in ms after it has obtained the transaction lock object
+ */
+ public static final String PROP_PAP_AUDIT_TIMEOUT = "xacml.rest.pap.audit.timeoutms";
+
+ /*
+ * Value determines direction of audit. Value=true will synch the file system to contents of the DB.
+ * Value=false will synch the DB to the contents of the file system.
+ */
+ public static final String PROP_PAP_AUDIT_FLAG = "xacml.rest.pap.filesystem.audit";
+
+ /*
+ * Value for enable/disable of audit functionality
+ */
+ public static final String PROP_PAP_RUN_AUDIT_FLAG = "xacml.rest.pap.run.audit.flag";
+
+ /*
+ * Controls how long the timeout will be when a pap sends a notification to another pap
+ */
+ public static final String PROP_PAP_NOTIFY_TIMEOUT = "xacml.rest.pap.notify.timeoutms";
+ /*
+ * Value for Enable/Disable of AutoPush Flag.
+ */
+ public static final String PROP_PAP_PUSH_FLAG = "xacml.rest.pap.autopush.flag";
+
+ /*
+ * Properties file for the AutoPush Functionality.
+ */
+ public static final String PROP_PAP_PUSH_FILE = "xacml.rest.pap.autopush.file";
+
+ /*
+ * Local path to where the GIT repository exists.
+ *
+ * Eg. /opt/app/xacml/repository
+ */
+ public static final String PROP_ADMIN_REPOSITORY = "xacml.rest.admin.repository";
+ /*
+ * Local path to where user workspaces exist. The user workspace contains
+ * temporary files, the user's clone of the GIT repository, anything
+ * specific to the user, etc.
+ */
+ public static final String PROP_ADMIN_WORKSPACE = "xacml.rest.admin.workspace";
+ /*
+ * This is the domain you can setup for your organization, it should be a
+ * URI.
+ *
+ * Eg. com:sample:foo
+ */
+ public static final String PROP_ADMIN_DOMAIN = "xacml.rest.admin.domain";
+ /**
+ * PROP_ADMIN_USER_NAME is simply a name for the logged in user.
+ *
+ * AC authentication is out the scope of the web application itself. It is
+ * up to the developer to setup authentication as they please in the J2EE
+ * container used to run the web application. Whatever authentication
+ * mechanism they use, they should then set the attribute into the
+ * HttpSession object. The Admin Console will be able to read that value
+ * (default to "guest") in.
+ *
+ * ((HttpServletRequest)
+ * request).getSession().setAttribute("xacml.rest.admin.user.name",
+ * "Homer");
+ *
+ */
+ public static final String PROP_ADMIN_USER_NAME = "xacml.rest.admin.user.name";
+ /**
+ *
+ * PROP_ADMIN_USER_ID is an id for the logged in user.
+ *
+ * Eg. hs1234
+ *
+ * @see #PROP_ADMIN_USER_NAME for more information.
+ */
+ public static final String PROP_ADMIN_USER_ID = "xacml.rest.admin.user.id";
+ /**
+ *
+ * PROP_ADMIN_USER_EMAIL is a user's email address.
+ *
+ * @see #PROP_ADMIN_USER_NAME for more information.
+ */
+ public static final String PROP_ADMIN_USER_EMAIL = "xacml.rest.admin.user.email";
+ /**
+ * Directory path containing sub-directories where the Subscriber servlet
+ * puts files sent through data feeds.
+ */
+ public static final String PROP_SUBSCRIBER_INCOMING = "xacml.subscriber.incoming";
+ /**
+ * The specific data feed name for the Subscriber servlet to register for.
+ */
+ public static final String PROP_SUBSCRIBER_FEED = "xacml.subscriber.feed";
+ /**
+ * Value for the log time frame that is to be stored in the database any
+ * logs after this time frame will be removed.
+ */
+ public static final String PROP_LOG_TIMEFRAME = "xacml.log.timeframe";
+ /**
+ * Value for the DB connections used to store the log files.
+ */
+ public static final String PROP_LOG_DB_DRIVER = "xacml.log.db.driver";
+ public static final String PROP_LOG_DB_URL = "xacml.log.db.url";
+ public static final String PROP_LOG_DB_USER = "xacml.log.db.user";
+ public static final String PROP_LOG_DB_PASSWORD = "xacml.log.db.password";
+ /*
+ * Value for JMX port for the PDP
+ */
+ public static final String PROP_PDP_JMX_PORT = "xacml.jmx.port";
+
+ /*
+ * Value for refresh rate
+ */
+ public static final String PROP_REFRESH_RATE = "xacml.refresh.rate";
+
+ // added for Security between Policy Components.
+ // 6/26
+ /*
+ * PROP_PAP_USERID is the PAP Unique User ID
+ */
+ public static final String PROP_PAP_USERID = "xacml.rest.pap.userid";
+ /*
+ * PROP_PAP_PASS is the PAP password
+ */
+ public static final String PROP_PAP_PASS = "xacml.rest.pap.password";
+ /*
+ * PROP_PAP_PASS is the PAP password
+ */
+ public static final String PROP_CONFIG_URL = "xacml.rest.config.url";
+ /*
+ * PROP_PDP_USERID is the PDP Unique User ID
+ */
+ public static final String PROP_PDP_USERID = "xacml.rest.pdp.userid";
+ /*
+ * PROP_PDP_PASS is the PDP password
+ */
+ public static final String PROP_PDP_PASS = "xacml.rest.pdp.password";
+ /*
+ * PROP_PDP_IDFILE is the PDP Authentication File
+ */
+ public static final String PROP_PDP_IDFILE = "xacml.rest.pdp.idfile";
+ /*
+ * PROP_PEP_IDFILE is the Client Authentication File
+ */
+ public static final String PROP_PEP_IDFILE = "xacml.rest.pep.idfile";
+ /*
+ * webapps Location of the PAP-REST server
+ */
+ public static final String PROP_PAP_WEBAPPS= "xacml.rest.config.webapps";
+ /*
+ * Value for Notification Option
+ */
+ public static final String PROP_NOTIFICATION_TYPE = "NOTIFICATION_TYPE";
+ /*
+ * Value for Notification DMaaP servers
+ */
+ public static final String PROP_NOTIFICATION_SERVERS = "NOTIFICATION_SERVERS";
+ /*
+ * Value for Notification Delay
+ */
+ public static final String PROP_NOTIFICATION_DELAY= "NOTIFICATION_DELAY";
+ /*
+ * Value for Notification Topic
+ */
+ public static final String PROP_NOTIFICATION_TOPIC= "NOTIFICATION_TOPIC";
+ /*
+ * Value for Notification Topic
+ */
+ public static final String PROP_UEB_API_KEY= "UEB_API_KEY";
+ /*
+ * Value for Notification Topic
+ */
+ public static final String PROP_UEB_API_SECRET= "UEB_API_SECRET";
+ /*
+ * Closedloop Fault Policy Template Version
+ */
+ public static final String TemplateVersion_Fault= "xacml.rest.closedLoopFault";
+ /*
+ * Closedloop PM Policy Template Version
+ */
+ public static final String TemplateVersion_PM= "xacml.rest.closedLoopPM";
+ /*
+ * Value for model properties file
+ */
+ public static final String PROP_ADMIN_MICROSERVICE = "xacml.rest.admin.microServiceModel";
+ /*
+ * MicroService Policy Template Version
+ */
+ public static final String TemplateVersion_MS= "xacml.rest.microServices";
+ /*
+ * Firewall Policy Template Version
+ */
+ public static final String TemplateVersion_FW= "xacml.rest.firewallPolicy";
+ /*
+ * Size of SelectList for Users in MS
+ *
+ */
+ public static final String PROP_USER_SELECTLIST_WINDOW_SIZE= "xacml.user.column.count";
+ /*
+ * Audit function in pap admin to Update userinfo table to syncronize with Roles table
+ */
+ public static final String PROP_ROLES_USERINFO_AUDIT= "xacml.audit.userInfo";
+ /*
+ * test Environment LoginId
+ */
+ public static final String PROP_TEST_ENVIRONMENT_LOGINID= "xacml.testEnvironment.loginId";
+ /*
+ * Size of of the page length for sqlcontainer
+ *
+ */
+ public static final String PROP_SQLCONTAINER_PAGE_LENGTH= "xacml.sqlcontainer.page.length";
+ /*
+ * add values used to connect to restful api
+ *
+ */
+ public static final String PROP_RESTFUL_INTERFACE= "xacm.restful.interface.file";
+ /*
+ * add pattern to identify what values are designed as required
+ *
+ */
+ public static final String PROP_XCORE_REQUIRED_PATTERN= "xacm.xcor.required.pattern";
+ /*
+ * Time before a cache value is evicted
+ *
+ */
+ public static final String PROP_CACHE_LIVE_TIME= "xacm.cache.live.time";
+ /*
+ * Highest value allowed in priority
+ *
+ */
+ public static final String PROP_PRIORITY_COUNT= "xacml.max.priority.count";
+ /*
+ * The name of the PAP. Must be unique across the system
+ */
+ public static final String PAP_RESOURCE_NAME="xacml.rest.pap.resource.name";
+ /*
+ * The name of the site in which the PAP resides
+ */
+ public static final String PAP_SITE_NAME="site_name";
+ /*
+ * The node type of the PAP - really a no-op since it's value is pap
+ */
+ public static final String PAP_NODE_TYPE="node_type";
+ /*
+ * A list of the groups of resources/nodes on which the PAP is dependent. The members of a
+ * group are comma-separated and the groups are separated with semicolons.
+ */
+ public static final String PAP_DEPENDENCY_GROUPS="dependency_groups";
+ /*
+ * The (optional) period of time in seconds between executions of the integrity audit.
+ * Value < 0 : Audit does not run (default value if property is not present = -1)
+ * Value = 0 : Audit runs continuously
+ * Value > 0 : The period of time in seconds between execution of the audit on a particular node
+ */
+ public static final String PAP_INTEGRITY_AUDIT_PERIOD_SECONDS = "integrity_audit_period_seconds";
+ /*
+ * The name of the Admin. Must be unique across the system
+ */
+ public static final String ADMIN_RESOURCE_NAME="xacml.rest.admin.resource.name";
+ /*
+ * The name of the PDP. Must be unique across the system
+ */
+ public static final String PDP_RESOURCE_NAME="xacml.rest.pdp.resource.name";
+ /*
+ * Audit function in pap admin to Update userinfo table to syncronize with Roles table
+ */
+ public static final String PROP_AUTOMATIC_POLICYPUSH= "xacml.automatic.push";
+ /*
+ * Add Limit for Onap Portal Dashboard tab data
+ */
+ public static final String PROP_ONAP_LOGLIMIT = "xacml.onap.dashboard.logTableLimit";
+ public static final String PROP_ONAP_SYSTEMALERTLIMIT = "xacml.onap.dashboard.systemAlertTableLimit";
+ /*
+ * Diff of the policies for the Firewall Feature.
+ */
+ public static final String PROP_FW_GETURL = "FW_GETURL";
+ public static final String PROP_FW_AUTHOURL = "FW_AUTHOURL";
+ public static final String PROP_FW_PROXY = "FW_PROXY";
+ public static final String PROP_FW_PORT = "FW_PORT";
+
+ /*
+ * The number of Risk Levels allowed
+ */
+ public static final String ADMIN_RISK_LEVEL_COUNT="xacml.risk.level.count";
+ /*
+ * The maxium Level displayed on the UI for Micro Services
+ */
+ public static final String PROP_MODEL_LEVEL = "xacml.model.level";
+
+ /*
+ * Value for Incoming Notification tries
+ *
+ * */
+ public static final String PROP_PAP_INCOMINGNOTIFICATION_TRIES = "xacml.rest.pap.incomingnotification.tries";
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java b/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java
new file mode 100644
index 000000000..c8dc71918
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/XacmlAdminAuthorization.java
@@ -0,0 +1,220 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.rest.jpa.UserInfo;
+import org.onap.policy.xacml.api.XACMLErrorConstants;
+
+import com.att.research.xacml.api.DataTypeException;
+import com.att.research.xacml.api.Decision;
+import com.att.research.xacml.api.Request;
+import com.att.research.xacml.api.Response;
+import com.att.research.xacml.api.Result;
+import com.att.research.xacml.api.pdp.PDPEngine;
+import com.att.research.xacml.api.pdp.PDPEngineFactory;
+import com.att.research.xacml.api.pdp.PDPException;
+import com.att.research.xacml.std.annotations.RequestParser;
+import com.att.research.xacml.std.annotations.XACMLAction;
+import com.att.research.xacml.std.annotations.XACMLRequest;
+import com.att.research.xacml.std.annotations.XACMLResource;
+import com.att.research.xacml.std.annotations.XACMLSubject;
+import com.att.research.xacml.util.FactoryException;
+
+
+
+public class XacmlAdminAuthorization {
+ private static Log logger = LogFactory.getLog(XacmlAdminAuthorization.class);
+
+ private static UserInfo userId;
+ public static UserInfo getUserId() {
+ return userId;
+ }
+
+ public void setUserId(UserInfo userId) {
+ XacmlAdminAuthorization.userId = userId;
+ }
+
+ public enum AdminAction {
+ ACTION_ACCESS("access"),
+ ACTION_READ("read"),
+ ACTION_WRITE("write"),
+ ACTION_ADMIN("admin");
+
+ String action;
+ AdminAction(String a) {
+ this.action = a;
+ }
+ public String toString() {
+ return this.action;
+ }
+ }
+
+ public enum AdminResource {
+ RESOURCE_APPLICATION("application"),
+ RESOURCE_POLICY_WORKSPACE("workspace"),
+ RESOURCE_POLICY_EDITOR("editor"),
+ RESOURCE_DICTIONARIES("dictionaries"),
+ RESOURCE_PDP_ADMIN("pdp_admin"),
+ RESOURCE_PIP_ADMIN("pip_admin"),
+ RESOURCE_SCOPES_SUPERADMIN("manage_scopes");
+
+ String resource;
+ AdminResource(String r) {
+ this.resource = r;
+ }
+ public String toString() {
+ return this.resource;
+ }
+ }
+
+ public enum Role {
+ ROLE_GUEST("guest"),
+ ROLE_ADMIN("admin"),
+ ROLE_EDITOR("editor"),
+ ROLE_SUPERGUEST("super-guest"),
+ ROLE_SUPEREDITOR("super-editor"),
+ ROLE_SUPERADMIN("super-admin");
+
+ String userRole;
+
+ Role(String a) {
+ this.userRole = a;
+ }
+ public String toString() {
+ return this.userRole;
+ }
+ }
+
+ @XACMLRequest(ReturnPolicyIdList=true)
+ public class AuthorizationRequest {
+
+ @XACMLSubject(includeInResults=true)
+ String userID;
+
+ @XACMLAction()
+ String action;
+
+ @XACMLResource()
+ String resource;
+
+ public AuthorizationRequest(String userId, String action, String resource) {
+ this.userID = userId;
+ this.action = action;
+ this.resource = resource;
+ }
+
+ public String getUserID() {
+ return userID;
+ }
+
+ public void setUserID(String userID) {
+ this.userID = userID;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getResource() {
+ return resource;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+ }
+
+ //
+ // The PDP Engine
+ //
+ protected PDPEngine pdpEngine;
+
+ public XacmlAdminAuthorization() {
+ PDPEngineFactory pdpEngineFactory = null;
+ try {
+ pdpEngineFactory = PDPEngineFactory.newInstance();
+ if (pdpEngineFactory == null) {
+ logger.error("Failed to create PDP Engine Factory");
+ PolicyLogger.error("Failed to create PDP Engine Factory");
+ }
+ this.pdpEngine = pdpEngineFactory.newEngine();
+ } catch (FactoryException e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Exception create PDP Engine: " + e.getLocalizedMessage());
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "Exception create PDP Engine");
+ }
+ }
+
+ public boolean isAuthorized(String userid, AdminAction action, AdminResource resource) {
+ logger.info("authorize: " + userid + " to " + action + " with " + resource);
+ if (this.pdpEngine == null) {
+ logger.warn("no pdp engine available to authorize");
+ return false;
+ }
+ Request request;
+ try {
+ request = RequestParser.parseRequest(new AuthorizationRequest(userid, action.toString(), resource.toString()));
+ } catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create request: " + e.getLocalizedMessage());
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "Failed to create request");
+ return false;
+ }
+ if (request == null) {
+ logger.error("Failed to parse request.");
+ PolicyLogger.error("Failed to parse request");
+ return false;
+ }
+ logger.info("Request: " + request);
+ //
+ // Ask the engine
+ //
+ try {
+ Response response = this.pdpEngine.decide(request);
+ if (response == null) {
+ logger.error("Null response from PDP decide");
+ PolicyLogger.error("Null response from PDP decide");
+ }
+ //
+ // Should only be one result
+ //
+ if(response != null){
+ for (Result result : response.getResults()) {
+ Decision decision = result.getDecision();
+ logger.info("Decision: " + decision);
+ if (decision.equals(Decision.PERMIT)) {
+ return true;
+ }
+ }
+ }
+ } catch (PDPException e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "PDP Decide failed: " + e.getLocalizedMessage());
+ PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XacmlAdminAuthorization", "PDP Decide failed");
+ }
+ return false;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressGroupJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressGroupJson.java
new file mode 100644
index 000000000..c634a74d1
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressGroupJson.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AddressGroupJson {
+
+ protected String name;
+ protected String description;
+ protected List<AddressMembers> members;
+
+ // name
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ public boolean equals(Object obj){
+ if(obj == null){
+ return false;
+ }
+ if(this.getClass() != obj.getClass()){
+ return false;
+ }
+ AddressGroupJson servGroupobj=(AddressGroupJson) obj;
+ if(this.getName().equals(servGroupobj.getName())){
+ return true;
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return Integer.valueOf(name.charAt(0)+(name.charAt(1)));
+ }
+
+ // description
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+ public List<AddressMembers> getMembers()
+ {
+ if(members==null)
+ {
+ members= new ArrayList<AddressMembers>();
+ }
+ return this.members;
+ }
+
+ public void setMembers(List<AddressMembers> members)
+ {
+ this.members = members;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressJson.java
new file mode 100644
index 000000000..555994347
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressJson.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public class AddressJson {
+
+ protected String type;
+ protected String name;
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ // type
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /*public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }*/
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembers.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembers.java
new file mode 100644
index 000000000..14e46f15f
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AddressMembers.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+
+public class AddressMembers {
+
+ protected String type;
+ protected String value;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AutoPushTabAdapter.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AutoPushTabAdapter.java
new file mode 100644
index 000000000..4e5336a05
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/AutoPushTabAdapter.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+import java.util.ArrayList;
+
+public class AutoPushTabAdapter {
+
+ private ArrayList<Object> pdpDatas;
+ private ArrayList<Object> policyDatas;
+ public ArrayList<Object> getPdpDatas() {
+ return pdpDatas;
+ }
+ public void setPdpDatas(ArrayList<Object> pdpDatas) {
+ this.pdpDatas = pdpDatas;
+ }
+ public ArrayList<Object> getPolicyDatas() {
+ return policyDatas;
+ }
+ public void setPolicyDatas(ArrayList<Object> policyDatas) {
+ this.policyDatas = policyDatas;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultBody.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultBody.java
new file mode 100644
index 000000000..80853af5d
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultBody.java
@@ -0,0 +1,280 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+
+public class ClosedLoopFaultBody {
+
+ private boolean trinity;
+ private boolean vUSP;
+ private boolean mcr;
+ private boolean gama;
+ private boolean vDNS;
+
+ private String vnfType;
+ private String vServices;
+ private String ONAPname;
+
+ private String closedLoopPolicyStatus;
+ private ClosedLoopSignatures triggerSignatures;
+ private String actions;
+ private int timeInterval;
+ private int timeOutvPRO;
+ private int timeOutRuby;
+ private int retrys;
+ private int agingWindow;
+ private String geoLink;
+ private String emailAddress;
+ private ClosedLoopSignatures verificationSignatures;
+ private ClosedLoopPolicyConditions conditions;
+ private ClosedLoopFaultTriggerUISignatures triggerSignaturesUsedForUI;
+ private ClosedLoopFaultTriggerUISignatures verificationSignaturesUsedForUI;
+ private int triggerTimeWindowUsedForUI;
+ private int verfificationTimeWindowUsedForUI;
+ private String pepName;
+ private String pepAction;
+ private String templateVersion;
+ private int trapMaxAgeUsedForUI;
+
+
+ public Integer getTrapMaxAgeUsedForUI() {
+ return trapMaxAgeUsedForUI;
+ }
+
+ public void setTrapMaxAgeUsedForUI(int trapMaxAgeUsedForUI) {
+ this.trapMaxAgeUsedForUI = trapMaxAgeUsedForUI;
+ }
+
+ public String getTemplateVersion() {
+ return templateVersion;
+ }
+
+ public void setTemplateVersion(String templateVersion) {
+ this.templateVersion = templateVersion;
+ }
+
+ public Integer getTimeOutvPRO() {
+ return timeOutvPRO;
+ }
+
+ public void setTimeOutvPRO(int timeOutvPRO) {
+ this.timeOutvPRO = timeOutvPRO;
+ }
+
+
+ public Integer getTriggerTimeWindowUsedForUI() {
+ return triggerTimeWindowUsedForUI;
+ }
+
+ public String getPepName() {
+ return pepName;
+ }
+
+ public void setPepName(String pepName) {
+ this.pepName = pepName;
+ }
+
+ public String getPepAction() {
+ return pepAction;
+ }
+
+ public void setPepAction(String pepAction) {
+ this.pepAction = pepAction;
+ }
+
+ public void setTriggerTimeWindowUsedForUI(int triggerTimeWindowUsedForUI) {
+ this.triggerTimeWindowUsedForUI = triggerTimeWindowUsedForUI;
+ }
+
+ public Integer getVerfificationTimeWindowUsedForUI() {
+ return verfificationTimeWindowUsedForUI;
+ }
+
+ public void setVerfificationTimeWindowUsedForUI(
+ int verfificationTimeWindowUsedForUI) {
+ this.verfificationTimeWindowUsedForUI = verfificationTimeWindowUsedForUI;
+ }
+
+ public String getONAPname(){
+ return ONAPname;
+ }
+
+ public void setONAPname(String ONAPname){
+ this.ONAPname = ONAPname;
+ }
+
+ public String getvServices() {
+ return vServices;
+ }
+ public void setvServices(String vServices) {
+ this.vServices = vServices;
+ }
+
+ public ClosedLoopFaultTriggerUISignatures getVerificationSignaturesUsedForUI() {
+ return verificationSignaturesUsedForUI;
+ }
+ public void setVerificationSignaturesUsedForUI(
+ ClosedLoopFaultTriggerUISignatures verificationSignaturesUsedForUI) {
+ this.verificationSignaturesUsedForUI = verificationSignaturesUsedForUI;
+ }
+ public ClosedLoopFaultTriggerUISignatures getTriggerSignaturesUsedForUI() {
+ return triggerSignaturesUsedForUI;
+ }
+ public void setTriggerSignaturesUsedForUI(
+ ClosedLoopFaultTriggerUISignatures triggerSignaturesUsedForUI) {
+ this.triggerSignaturesUsedForUI = triggerSignaturesUsedForUI;
+ }
+ public ClosedLoopPolicyConditions getConditions() {
+ return conditions;
+ }
+ public void setConditions(ClosedLoopPolicyConditions conditions) {
+ this.conditions = conditions;
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+
+ public Integer getAgingWindow() {
+ return agingWindow;
+ }
+ public void setAgingWindow(int agingWindow) {
+ this.agingWindow = agingWindow;
+ }
+
+ public String getClosedLoopPolicyStatus() {
+ return closedLoopPolicyStatus;
+ }
+ public void setClosedLoopPolicyStatus(
+ String closedLoopPolicyStatus) {
+ this.closedLoopPolicyStatus = closedLoopPolicyStatus;
+ }
+ public ClosedLoopSignatures getTriggerSignatures() {
+ return triggerSignatures;
+ }
+ public void setTriggerSignatures(ClosedLoopSignatures triggerSignatures) {
+ this.triggerSignatures = triggerSignatures;
+ }
+ public String getActions() {
+ return actions;
+ }
+ public void setActions(String actions) {
+ this.actions = actions;
+ }
+ public Integer getTimeInterval() {
+ return timeInterval;
+ }
+ public void setTimeInterval(int timeInterval) {
+ this.timeInterval = timeInterval;
+ }
+ public Integer getTimeOutRuby() {
+ return timeOutRuby;
+ }
+ public void setTimeOutRuby(int timeOutRuby) {
+ this.timeOutRuby = timeOutRuby;
+ }
+ public Integer getRetrys() {
+ return retrys;
+ }
+ public void setRetrys(int retrys) {
+ this.retrys = retrys;
+ }
+ public String getGeoLink() {
+ return geoLink;
+ }
+ public void setGeoLink(String geoLink) {
+ this.geoLink = geoLink;
+ }
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+ public ClosedLoopSignatures getVerificationSignatures() {
+ return verificationSignatures;
+ }
+ public void setVerificationSignatures(
+ ClosedLoopSignatures verificationSignatures) {
+ this.verificationSignatures = verificationSignatures;
+ }
+
+ /*public ArrayList<String> getD2Services() {
+ return d2Services;
+ }
+
+ public void setD2Services(ArrayList<String> d2Services) {
+ this.d2Services = d2Services;
+ }
+
+ public ArrayList<String> getSiteNames() {
+ return siteNames;
+ }
+
+ public void setSiteNames(ArrayList<String> siteNames) {
+ this.siteNames = siteNames;
+ }*/
+
+ public boolean isvDNS() {
+ return vDNS;
+ }
+
+ public void setvDNS(boolean vDNS) {
+ this.vDNS = vDNS;
+ }
+
+ public boolean isTrinity() {
+ return trinity;
+ }
+
+ public void setTrinity(boolean trinity) {
+ this.trinity = trinity;
+ }
+
+ public boolean isvUSP() {
+ return vUSP;
+ }
+
+ public void setvUSP(boolean vUSP) {
+ this.vUSP = vUSP;
+ }
+
+ public boolean isMcr() {
+ return mcr;
+ }
+
+ public void setMcr(boolean mcr) {
+ this.mcr = mcr;
+ }
+
+ public boolean isGama() {
+ return gama;
+ }
+
+ public void setGama(boolean gama) {
+ this.gama = gama;
+ }
+}
+
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java
new file mode 100644
index 000000000..6363aa95f
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTriggerUISignatures.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+
+public class ClosedLoopFaultTriggerUISignatures {
+
+ private String signatures;
+
+ private String connectSignatures;
+
+ public String getConnectSignatures() {
+ return connectSignatures;
+ }
+ public void setConnectSignatures(String connectSignatures) {
+ this.connectSignatures = connectSignatures;
+ }
+ public String getSignatures() {
+ return signatures;
+ }
+ public void setSignatures(String signatures) {
+ this.signatures = signatures;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPMBody.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPMBody.java
new file mode 100644
index 000000000..1898bc46d
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPMBody.java
@@ -0,0 +1,133 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+import java.util.Map;
+
+public class ClosedLoopPMBody {
+
+ private boolean trinity;
+ private boolean vUSP;
+ private boolean mcr;
+ private boolean gama;
+ private boolean vDNS;
+ private String geoLink;
+ private String vServices;
+ private String ONAPname;
+
+ private String emailAddress;
+
+ private String serviceTypePolicyName;
+
+ private Map<String, String> attributes;
+ private String templateVersion;
+
+ public String getTemplateVersion() {
+ return templateVersion;
+ }
+
+ public void setTemplateVersion(String templateVersion) {
+ this.templateVersion = templateVersion;
+ }
+
+ public String getONAPname(){
+ return ONAPname;
+ }
+
+ public void setONAPname(String ONAPname){
+ this.ONAPname = ONAPname;
+ }
+
+ public String getvServices() {
+ return vServices;
+ }
+
+ public void setvServices(String vServices) {
+ this.vServices = vServices;
+ }
+
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, String> map) {
+ this.attributes = map;
+ }
+
+ public String getGeoLink() {
+ return geoLink;
+ }
+
+ public void setGeoLink(String geoLink) {
+ this.geoLink = geoLink;
+ }
+
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ public String getServiceTypePolicyName() {
+ return serviceTypePolicyName;
+ }
+
+ public void setServiceTypePolicyName(String serviceTypePolicyName) {
+ this.serviceTypePolicyName = serviceTypePolicyName;
+ }
+
+ public boolean isGama() {
+ return gama;
+ }
+ public void setGama(boolean gama) {
+ this.gama = gama;
+ }
+ public boolean isvDNS() {
+ return vDNS;
+ }
+ public void setvDNS(boolean vDNS) {
+ this.vDNS = vDNS;
+ }
+
+ public boolean isTrinity() {
+ return trinity;
+ }
+ public void setTrinity(boolean trinity) {
+ this.trinity = trinity;
+ }
+ public boolean isvUSP() {
+ return vUSP;
+ }
+ public void setvUSP(boolean vUSP) {
+ this.vUSP = vUSP;
+ }
+ public boolean isMcr() {
+ return mcr;
+ }
+ public void setMcr(boolean mcr) {
+ this.mcr = mcr;
+ }
+
+}
+
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPerformanceMetrics.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPerformanceMetrics.java
new file mode 100644
index 000000000..32839e97a
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPerformanceMetrics.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public class ClosedLoopPerformanceMetrics {
+ public static final String CLPM_UIFIELD_ONSET_MESSAGE = "Onset Message";
+ public static final String CLPM_UIJSON_ONSET_MESSAGE = "attributes.OnsetMessage";
+
+ public static final String CLPM_UIFIELD_POLICY_NAME = "PolicyName";
+ public static final String CLPM_UIJSON_POLICY_NAME = "attributes.PolicyName";
+
+ public static final String CLPM_UIFIELD_ABATEMENT_MESSAGE = "Abatement Message";
+ public static final String CLPM_UIJSON_ABATEMENT_MESSAGE = "attributes.AbatementMessage";
+
+ public static final String CLPM_UIFIELD_GEOLINK = "Geo Link";
+ public static final String CLPM_UIJSON_GEOLINK = "geoLink";
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicy.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicy.java
new file mode 100644
index 000000000..a230db84e
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicy.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public class ClosedLoopPolicy {
+ public static final String CLFAULT_UIFIELD_D2_SERVICES_TRINITY = "Hosted Voice (Trinity)";
+ public static final String CLFAULT_UIJSON_D2_SERVICES_TRINITY = "trinity";
+
+ public static final String CLFAULT_UIFIELD_D2_SERVICES_VUSP = "vUSP";
+ public static final String CLFAULT_UIJSON_D2_SERVICES_VUSP = "vUSP";
+
+ public static final String CLFAULT_UIFIELD_D2_SERVICES_MCR = "MCR";
+ public static final String CLFAULT_UIJSON_D2_SERVICES_MCR = "mcr";
+
+ public static final String CLFAULT_UIFIELD_D2_SERVICES_GAMMA = "Gamma";
+ public static final String CLFAULT_UIJSON_D2_SERVICES_GAMMA = "gama";
+
+ public static final String CLFAULT_UIFIELD_D2_SERVICES_VDNS = "vDNS";
+ public static final String CLFAULT_UIJSON_D2_SERVICES_VDNS = "vDNS";
+
+ public static final String CLFAULT_UIFIELD_EMAIL_ADDRESS = "Email Address";
+ public static final String CLFAULT_UIJSON_EMAIL_ADDRESS = "emailAddress";
+
+ public static final String CLFAULT_UIFIELD_TRIGGER_SIGNATURE = "Trigger Signature";
+ public static final String CLFAULT_UIJSON_TRIGGER_SIGNATURE = "triggerSignaturesUsedForUI.signatures";
+
+ public static final String CLFAULT_UIFIELD_VERIFICATION_SIGNATURE = "Verification Signature";
+ public static final String CLFAULT_UIJSON_VERIFICATION_SIGNATURE = "verificationSignaturesUsedForUI.signatures";
+
+ public static final String CLFAULT_UIFIELD_CONNECT_ALL_TRAPS = "Connect All Traps";
+ public static final String CLFAULT_UIJSON_CONNECT_ALL_TRAPS = "triggerSignaturesUsedForUI.connectSignatures";
+
+ public static final String CLFAULT_UIFIELD_CONNECT_ALL_FAULTS = "Connect All Faults";
+ public static final String CLFAULT_UIJSON_CONNECT_ALL_FAULTS = "verificationSignaturesUsedForUI.connectSignatures";
+
+ public static final String CLFAULT_UIFIELD_POLICY_STATUS_ACTIVE = "Active";
+ public static final String CLFAULT_UIJSON_POLICY_STATUS_ACTIVE = "ACTIVE";
+
+ public static final String CLFAULT_UIFIELD_POLICY_STATUS_INACTIVE = "InActive";
+ public static final String CLFAULT_UIJSON_POLICY_STATUS_INACTIVE = "INACTIVE";
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyConditions.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyConditions.java
new file mode 100644
index 000000000..5b3838985
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyConditions.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public enum ClosedLoopPolicyConditions {
+ SEND("DCAE should send event notification"),
+
+ NOTSEND("DCAE should not send event notification");
+ private String name;
+
+ private ClosedLoopPolicyConditions(String name){
+ this.name = name;
+ }
+
+ @Override
+ public String toString(){
+ return this.name;
+ }
+}
+
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyStatus.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyStatus.java
new file mode 100644
index 000000000..fd8f2b6cf
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopPolicyStatus.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public enum ClosedLoopPolicyStatus {
+ ACTIVE("active"),
+
+ INACTIVE("inactive")
+ ;
+
+ private String name;
+
+ private ClosedLoopPolicyStatus(String name){
+ this.name = name;
+ }
+
+ @Override
+ public String toString(){
+ return this.name;
+ }
+}
+
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopSignatures.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopSignatures.java
new file mode 100644
index 000000000..b2226f95f
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopSignatures.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public class ClosedLoopSignatures {
+
+ private String signatures;
+
+ private int timeWindow;
+
+ private Integer trapMaxAge;
+
+ public String getSignatures() {
+ return signatures;
+ }
+ public void setSignatures(String signatures) {
+ this.signatures = signatures;
+ }
+
+ public Integer getTimeWindow() {
+ return timeWindow;
+ }
+ public void setTimeWindow(Integer timeWindow) {
+ this.timeWindow = timeWindow;
+ }
+
+ public Integer getTrapMaxAge() {
+ return trapMaxAge;
+ }
+ public void setTrapMaxAge(Integer trapMaxAge) {
+ this.trapMaxAge = trapMaxAge;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeletePolicyCondition.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeletePolicyCondition.java
new file mode 100644
index 000000000..b4fb5d973
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeletePolicyCondition.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public enum DeletePolicyCondition {
+ ONE("Are you sure you want to delete Current Version of policy"),
+
+ ALL("Are you sure you want to delete All Versions of policy");
+ private String name;
+
+ private DeletePolicyCondition(String name){
+ this.name = name;
+ }
+
+ @Override
+ public String toString(){
+ return this.name;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeployNowJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeployNowJson.java
new file mode 100644
index 000000000..6c41253a1
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/DeployNowJson.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public class DeployNowJson {
+
+ protected boolean deployNow;
+
+ // deployNow
+ public boolean getDeployNow() {
+ return deployNow;
+ }
+
+ public void setDeployNow(boolean value) {
+ this.deployNow = value;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/GridData.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/GridData.java
new file mode 100644
index 000000000..77bbf0378
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/GridData.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+import java.util.ArrayList;
+
+public class GridData {
+ private ArrayList<Object> attributes;
+ private ArrayList<Object> transportProtocols;
+ private ArrayList<Object> appProtocols;
+
+ public ArrayList<Object> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(ArrayList<Object> attributes) {
+ this.attributes = attributes;
+ }
+
+ public ArrayList<Object> getAppProtocols() {
+ return appProtocols;
+ }
+
+ public void setAppProtocols(ArrayList<Object> appProtocols) {
+ this.appProtocols = appProtocols;
+ }
+
+ public ArrayList<Object> getTransportProtocols() {
+ return transportProtocols;
+ }
+
+ public void setTransportProtocols(ArrayList<Object> transportProtocols) {
+ this.transportProtocols = transportProtocols;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/IdMap.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/IdMap.java
new file mode 100644
index 000000000..3557aae11
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/IdMap.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public class IdMap {
+
+ protected String astraId;
+ protected String vendorId;
+
+ public String getAstraId() {
+ return astraId;
+ }
+ public void setAstraId(String astraId) {
+ this.astraId = astraId;
+ }
+ public String getVendorId() {
+ return vendorId;
+ }
+ public void setVendorId(String vendorId) {
+ this.vendorId = vendorId;
+ }
+
+} \ No newline at end of file
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyExportAdapter.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyExportAdapter.java
new file mode 100644
index 000000000..21efb9b48
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyExportAdapter.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+import java.util.ArrayList;
+
+public class PolicyExportAdapter {
+
+ private ArrayList<Object> policyDatas;
+
+ public ArrayList<Object> getPolicyDatas() {
+ return policyDatas;
+ }
+ public void setPolicyDatas(ArrayList<Object> policyDatas) {
+ this.policyDatas = policyDatas;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java
new file mode 100644
index 000000000..9d05e3984
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java
@@ -0,0 +1,896 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-PAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManagerFactory;
+
+import org.onap.policy.rest.jpa.OnapName;
+
+public class PolicyRestAdapter {
+
+ /*
+ *
+ * Note : Make Sure if any variables are added in PolicyRestAdapter.java, add them to PolicyElasticData.java file
+ *
+ *
+ * */
+
+
+ //Common
+ private Object data;
+ private String policyName = null;
+ private String configBodyData = null;
+ private String configType = null;
+ private String policyID = null;
+ private String policyType = null;
+ private String comboPolicyType;
+ private String configPolicyType = null;
+ private String policyDescription = null;
+ private String onapName = null;
+ private String configName = null;
+ private String ruleID = null;
+ private String parentPath;
+ private boolean isValidData = false;
+ private String adminNotification = null;
+ private boolean isEditPolicy = false;
+ private boolean isViewPolicy = false;
+ private boolean isDraft = false;
+ private Object policyData = null;
+ private String gitPath;
+ private boolean readOnly;
+ private String configHome;
+ private String configUrl;
+ private String finalPolicyPath;
+ private String version;
+ private String jsonBody;
+ private String apiflag;
+ private String prevJsonBody;
+ private Integer highestVersion;
+ private EntityManagerFactory entityManagerFactory = null;
+ private Boolean policyExists = false;
+ private String oldPolicyFileName = null;
+ private String domain = null;
+ private String userId;
+ private String newFileName;
+ private String clWarning = null;
+ private String newCLName = null;
+ private String existingCLName = null;
+ //Used by GUI
+ private OnapName onapNameField;
+ private Object jsonBodyData;
+ private String dirPath;
+ private String configBodyPath;
+ private ArrayList<Object> attributes;
+ private ArrayList<Object> settings;
+ private ArrayList<Object> ruleAlgorithmschoices;
+
+ private LinkedHashMap<?, ?> serviceTypePolicyName;
+
+ private LinkedHashMap<?, ?> verticaMetrics;
+ private LinkedHashMap<?, ?> description;
+ private LinkedHashMap<?, ?> attributeFields;
+
+ //ClosedLoop
+ private String clearTimeOut;
+ private String trapMaxAge;
+ private String verificationclearTimeOut;
+ private Map<String , String> dynamicLayoutMap;
+
+ //FireWall
+ private String fwPolicyType;
+ private ArrayList<Object> fwattributes;
+ private String parentForChild;
+ private String securityZone;
+
+ //Action & Decision
+ private String ruleCombiningAlgId = null;
+ private Map<String,String> dynamicFieldConfigAttributes;
+ private Map<String,String> dynamicSettingsMap;
+ private Map<String,String> dropDownMap;
+ private String actionPerformer = null;
+ private String actionAttribute = null;
+ private List<String> dynamicRuleAlgorithmLabels;
+ private List<String> dynamicRuleAlgorithmCombo;
+ private List<String> dynamicRuleAlgorithmField1;
+ private List<String> dynamicRuleAlgorithmField2;
+ private List<Object> dynamicVariableList;
+ private List<String> dataTypeList;
+ private String actionAttributeValue;
+ private String ruleProvider;
+ private String actionBody = null;
+ private String actionDictHeader = null;
+ private String actionDictType = null;
+ private String actionDictUrl = null;
+ private String actionDictMethod = null;
+ private YAMLParams yamlparams;
+
+ //Rainy Day Decision
+ private RainyDayParams rainyday;
+ private Map<String,String> rainydayMap;
+ private List<String> errorCodeList;
+ private List<String> treatmentList;
+
+ //MicroSerice
+ private String serviceType = null;
+ private String uuid = null;
+ private String location = null;
+ private String priority = null;
+ private String msLocation = null;
+
+ //BRMS Policies
+ private String ruleName;
+ private Map<String,String> brmsParamBody=null;
+ private String brmsController = null;
+ private ArrayList<String> brmsDependency = null;
+ private LinkedHashMap<?, ?> ruleData;
+ private LinkedHashMap<?,?> ruleListData;
+ private Map<String,String> drlRuleAndUIParams=null;
+
+ //Safe Policy
+ private String policyScope;
+ private String providerComboBox = null;
+ private String riskType;
+ private String riskLevel;
+ private String guard = null;
+ private String ttlDate;
+ private Map<String,String> matching;
+
+ private ArrayList<Object> triggerSignatures;
+ private ArrayList<Object> symptomSignatures;
+ private String logicalConnector;
+ private String policyStatus;
+ private String gocServerScope;
+ private String supressionType;
+
+
+ public ArrayList<Object> getTriggerSignatures() {
+ return triggerSignatures;
+ }
+ public void setTriggerSignatures(ArrayList<Object> triggerSignatures) {
+ this.triggerSignatures = triggerSignatures;
+ }
+ public ArrayList<Object> getSymptomSignatures() {
+ return symptomSignatures;
+ }
+ public void setSymptomSignatures(ArrayList<Object> symptomSignatures) {
+ this.symptomSignatures = symptomSignatures;
+ }
+ public String getLogicalConnector() {
+ return logicalConnector;
+ }
+ public void setLogicalConnector(String logicalConnector) {
+ this.logicalConnector = logicalConnector;
+ }
+ public String getPolicyStatus() {
+ return policyStatus;
+ }
+ public void setPolicyStatus(String policyStatus) {
+ this.policyStatus = policyStatus;
+ }
+ public String getGocServerScope() {
+ return gocServerScope;
+ }
+ public void setGocServerScope(String gocServerScope) {
+ this.gocServerScope = gocServerScope;
+ }
+
+ public String getSupressionType() {
+ return supressionType;
+ }
+ public void setSupressionType(String supressionType) {
+ this.supressionType = supressionType;
+ }
+
+ /********************************************************************************/
+
+
+
+ public String getComboPolicyType() {
+ return comboPolicyType;
+ }
+ public void setComboPolicyType(String comboPolicyType) {
+ this.comboPolicyType = comboPolicyType;
+ }
+ public String getGitPath() {
+ return gitPath;
+ }
+ public void setGitPath(String gitPath) {
+ this.gitPath = gitPath;
+ }
+ public String getOldPolicyFileName() {
+ return oldPolicyFileName;
+ }
+ public void setOldPolicyFileName(String oldPolicyFileName) {
+ this.oldPolicyFileName = oldPolicyFileName;
+ }
+ public String getDomainDir() {
+ return domain;
+ }
+ public void setDomainDir(String domain) {
+ this.domain = domain;
+ }
+ public Integer getHighestVersion() {
+ return highestVersion;
+ }
+ public void setHighestVersion(Integer highestVersion) {
+ this.highestVersion = highestVersion;
+ }
+ public Object getData() {
+ return data;
+ }
+ public void setData(Object data) {
+ this.data = data;
+ }
+ public String getPolicyName() {
+ return policyName;
+ }
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+ public String getConfigBodyData() {
+ return configBodyData;
+ }
+ public void setConfigBodyData(String configBodyData) {
+ this.configBodyData = configBodyData;
+ }
+ public String getConfigType() {
+ return configType;
+ }
+ public void setConfigType(String configType) {
+ this.configType = configType;
+ }
+ public String getPolicyID() {
+ return policyID;
+ }
+ public void setPolicyID(String policyID) {
+ this.policyID = policyID;
+ }
+ public String getPolicyType() {
+ return policyType;
+ }
+ public void setPolicyType(String policyType) {
+ this.policyType = policyType;
+ }
+ public String getPolicyDescription() {
+ return policyDescription;
+ }
+ public void setPolicyDescription(String policyDescription) {
+ this.policyDescription = policyDescription;
+ }
+ public String getOnapName() {
+ return onapName;
+ }
+ public void setOnapName(String onapName) {
+ this.onapName = onapName;
+ }
+ public String getConfigName() {
+ return configName;
+ }
+ public void setConfigName(String configName) {
+ this.configName = configName;
+ }
+ public String getRuleID() {
+ return ruleID;
+ }
+ public void setRuleID(String ruleID) {
+ this.ruleID = ruleID;
+ }
+ public String getRuleCombiningAlgId() {
+ return ruleCombiningAlgId;
+ }
+ public void setRuleCombiningAlgId(String ruleCombiningAlgId) {
+ this.ruleCombiningAlgId = ruleCombiningAlgId;
+ }
+ public Map<String,String> getDynamicFieldConfigAttributes() {
+ return dynamicFieldConfigAttributes;
+ }
+ public void setDynamicFieldConfigAttributes(
+ Map<String,String> dynamicFieldConfigAttributes) {
+ this.dynamicFieldConfigAttributes = dynamicFieldConfigAttributes;
+ }
+ public String getParentPath() {
+ return parentPath;
+ }
+ public void setParentPath(String parentPath) {
+ this.parentPath = parentPath;
+ }
+ public boolean isEditPolicy() {
+ return isEditPolicy;
+ }
+ public void setEditPolicy(boolean isEditPolicy) {
+ this.isEditPolicy = isEditPolicy;
+ }
+ public boolean isViewPolicy() {
+ return isViewPolicy;
+ }
+ public void setViewPolicy(boolean isViewPolicy) {
+ this.isViewPolicy = isViewPolicy;
+ }
+ public Object getPolicyData() {
+ return policyData;
+ }
+ public void setPolicyData(Object policyData) {
+ this.policyData = policyData;
+ }
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+ public void setReadOnly(boolean readOnly) {
+ this.readOnly = readOnly;
+ }
+ public String getUserGitPath() {
+ return gitPath;
+ }
+ public void setUserGitPath(String gitPath) {
+ this.gitPath = gitPath;
+ }
+ public boolean isValidData() {
+ return isValidData;
+ }
+ public void setValidData(boolean isValidData) {
+ this.isValidData = isValidData;
+ }
+ public String getAdminNotification() {
+ return adminNotification;
+ }
+ public void setAdminNotification(String adminNotification) {
+ this.adminNotification = adminNotification;
+ }
+ public String getConfigHome() {
+ return configHome;
+ }
+ public void setConfigHome(String configHome) {
+ this.configHome = configHome;
+ }
+ public String getConfigUrl() {
+ return configUrl;
+ }
+ public void setConfigUrl(String configUrl) {
+ this.configUrl = configUrl;
+ }
+ public String getFinalPolicyPath() {
+ return finalPolicyPath;
+ }
+ public void setFinalPolicyPath(String finalPolicyPath) {
+ this.finalPolicyPath = finalPolicyPath;
+ }
+ public String getVersion() {
+ return version;
+ }
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ public String getJsonBody() {
+ return jsonBody;
+ }
+ public void setJsonBody(String jsonBody) {
+ this.jsonBody = jsonBody;
+ }
+ public String getPrevJsonBody() {
+ return prevJsonBody;
+ }
+ public void setPrevJsonBody(String prevJsonBody) {
+ this.prevJsonBody = prevJsonBody;
+ }
+ public String getApiflag() {
+ return apiflag;
+ }
+ public void setApiflag(String apiflag) {
+ this.apiflag = apiflag;
+ }
+ /**
+ * @return the actionPerformer
+ */
+ public String getActionPerformer() {
+ return actionPerformer;
+ }
+ /**
+ * @param actionPerformer the actionPerformer to set
+ */
+ public void setActionPerformer(String actionPerformer) {
+ this.actionPerformer = actionPerformer;
+ }
+ /**
+ * @return the actionAttribute
+ */
+ public String getActionAttribute() {
+ return actionAttribute;
+ }
+ /**
+ * @param actionAttribute the actionAttribute to set
+ */
+ public void setActionAttribute(String actionAttribute) {
+ this.actionAttribute = actionAttribute;
+ }
+ /**
+ * @return the dynamicRuleAlgorithmLabels
+ */
+ public List<String> getDynamicRuleAlgorithmLabels() {
+ return dynamicRuleAlgorithmLabels;
+ }
+ /**
+ * @param dynamicRuleAlgorithmLabels the dynamicRuleAlgorithmLabels to set
+ */
+ public void setDynamicRuleAlgorithmLabels(
+ List<String> dynamicRuleAlgorithmLabels) {
+ this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
+ }
+ /**
+ * @return the dynamicRuleAlgorithmCombo
+ */
+ public List<String> getDynamicRuleAlgorithmCombo() {
+ return dynamicRuleAlgorithmCombo;
+ }
+ /**
+ * @param dynamicRuleAlgorithmCombo the dynamicRuleAlgorithmCombo to set
+ */
+ public void setDynamicRuleAlgorithmCombo(List<String> dynamicRuleAlgorithmCombo) {
+ this.dynamicRuleAlgorithmCombo = dynamicRuleAlgorithmCombo;
+ }
+ /**
+ * @return the dynamicRuleAlgorithmField1
+ */
+ public List<String> getDynamicRuleAlgorithmField1() {
+ return dynamicRuleAlgorithmField1;
+ }
+ /**
+ * @param dynamicRuleAlgorithmField1 the dynamicRuleAlgorithmField1 to set
+ */
+ public void setDynamicRuleAlgorithmField1(
+ List<String> dynamicRuleAlgorithmField1) {
+ this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
+ }
+ /**
+ * @return the dynamicRuleAlgorithmField2
+ */
+ public List<String> getDynamicRuleAlgorithmField2() {
+ return dynamicRuleAlgorithmField2;
+ }
+ /**
+ * @param dynamicRuleAlgorithmField2 the dynamicRuleAlgorithmField2 to set
+ */
+ public void setDynamicRuleAlgorithmField2(
+ List<String> dynamicRuleAlgorithmField2) {
+ this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
+ }
+ public Map<String,String> getDropDownMap() {
+ return dropDownMap;
+ }
+ public void setDropDownMap(Map<String,String> dropDownMap) {
+ this.dropDownMap = dropDownMap;
+ }
+
+ public Map<String,String> getDynamicSettingsMap() {
+ return dynamicSettingsMap;
+ }
+ public void setDynamicSettingsMap(Map<String,String> dynamicSettingsMap) {
+ this.dynamicSettingsMap = dynamicSettingsMap;
+ }
+ public List<Object> getDynamicVariableList() {
+ return dynamicVariableList;
+ }
+ public void setDynamicVariableList(List<Object> dynamicVariableList) {
+ this.dynamicVariableList = dynamicVariableList;
+ }
+ public List<String> getDataTypeList() {
+ return dataTypeList;
+ }
+ public void setDataTypeList(List<String> dataTypeList) {
+ this.dataTypeList = dataTypeList;
+ }
+ public boolean isDraft() {
+ return isDraft;
+ }
+ public void setDraft(boolean isDraft) {
+ this.isDraft = isDraft;
+ }
+ public String getConfigPolicyType() {
+ return configPolicyType;
+ }
+ public void setConfigPolicyType(String configPolicyType) {
+ this.configPolicyType = configPolicyType;
+ }
+ public String getServiceType() {
+ return serviceType;
+ }
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+ public String getUuid() {
+ return uuid;
+ }
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+ public String getLocation() {
+ return location;
+ }
+ public void setLocation(String location) {
+ this.location = location;
+ }
+ public String getPriority() {
+ return priority;
+ }
+ public void setPriority(String priority) {
+ this.priority = priority;
+ }
+ public Map<String, String> getBrmsParamBody() {
+ return brmsParamBody;
+ }
+ public void setBrmsParamBody(Map<String, String> brmsParamBody) {
+ this.brmsParamBody = brmsParamBody;
+ }
+ public EntityManagerFactory getEntityManagerFactory() {
+ return entityManagerFactory;
+ }
+ public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
+ this.entityManagerFactory = entityManagerFactory;
+ }
+ /**
+ * @return the policyExists
+ */
+ public Boolean getPolicyExists() {
+ return policyExists;
+ }
+ /**
+ * @param policyExists the policyExists to set
+ */
+ public void setPolicyExists(Boolean policyExists) {
+ this.policyExists = policyExists;
+ }
+ public String getPolicyScope() {
+ return policyScope;
+ }
+
+ public void setPolicyScope(String domainDir) {
+ this. policyScope=domainDir;
+ }
+ public String getProviderComboBox() {
+ return providerComboBox;
+ }
+ public void setProviderComboBox(String providerComboBox) {
+ this.providerComboBox = providerComboBox;
+ }
+ public String getRiskType() {
+ return riskType;
+ }
+ public void setRiskType(String riskType) {
+ this.riskType = riskType;
+ }
+ public String getGuard() {
+ return guard;
+ }
+ public void setGuard(String guard) {
+ this.guard = guard;
+ }
+ public String getRiskLevel() {
+ return riskLevel;
+ }
+ public void setRiskLevel(String riskLevel) {
+ this.riskLevel = riskLevel;
+ }
+ public String getTtlDate() {
+ return ttlDate;
+ }
+ public void setTtlDate(String ttlDate) {
+ this.ttlDate = ttlDate;
+ }
+ public String getBrmsController() {
+ return brmsController;
+ }
+ public void setBrmsController(String brmsController) {
+ this.brmsController = brmsController;
+ }
+ public ArrayList<String> getBrmsDependency() {
+ return brmsDependency;
+ }
+ public void setBrmsDependency(ArrayList<String> brmsDependency) {
+ this.brmsDependency = brmsDependency;
+ }
+ public Map<String, String> getMatching() {
+ return matching;
+ }
+ public void setMatching(Map<String, String> matching) {
+ this.matching = matching;
+ }
+ public String getUserId() {
+ return userId;
+ }
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+ public String getNewFileName() {
+ return newFileName;
+ }
+ public void setNewFileName(String newFileName) {
+ this.newFileName = newFileName;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+ public OnapName getOnapNameField() {
+ return onapNameField;
+ }
+ public void setOnapNameField(OnapName onapNameField) {
+ this.onapNameField = onapNameField;
+ }
+ public Object getJsonBodyData() {
+ return jsonBodyData;
+ }
+ public void setJsonBodyData(Object jsonBodyData) {
+ this.jsonBodyData = jsonBodyData;
+ }
+ public String getDirPath() {
+ return dirPath;
+ }
+ public void setDirPath(String dirPath) {
+ this.dirPath = dirPath;
+ }
+ public String getConfigBodyPath() {
+ return configBodyPath;
+ }
+ public void setConfigBodyPath(String configBodyPath) {
+ this.configBodyPath = configBodyPath;
+ }
+ public ArrayList<Object> getAttributes() {
+ return attributes;
+ }
+ public void setAttributes(ArrayList<Object> attributes) {
+ this.attributes = attributes;
+ }
+ public ArrayList<Object> getSettings() {
+ return settings;
+ }
+ public void setSettings(ArrayList<Object> settings) {
+ this.settings = settings;
+ }
+ public ArrayList<Object> getRuleAlgorithmschoices() {
+ return ruleAlgorithmschoices;
+ }
+ public void setRuleAlgorithmschoices(ArrayList<Object> ruleAlgorithmschoices) {
+ this.ruleAlgorithmschoices = ruleAlgorithmschoices;
+ }
+ public LinkedHashMap<?, ?> getServiceTypePolicyName() {
+ return serviceTypePolicyName;
+ }
+ public void setServiceTypePolicyName(LinkedHashMap<?, ?> serviceTypePolicyName) {
+ this.serviceTypePolicyName = serviceTypePolicyName;
+ }
+ public LinkedHashMap<?, ?> getVerticaMetrics() {
+ return verticaMetrics;
+ }
+ public void setVerticaMetrics(LinkedHashMap<?, ?> verticaMetrics) {
+ this.verticaMetrics = verticaMetrics;
+ }
+ public LinkedHashMap<?, ?> getDescription() {
+ return description;
+ }
+ public void setDescription(LinkedHashMap<?, ?> description) {
+ this.description = description;
+ }
+ public LinkedHashMap<?, ?> getAttributeFields() {
+ return attributeFields;
+ }
+ public void setAttributeFields(LinkedHashMap<?, ?> attributeFields) {
+ this.attributeFields = attributeFields;
+ }
+ public String getClearTimeOut() {
+ return clearTimeOut;
+ }
+ public void setClearTimeOut(String clearTimeOut) {
+ this.clearTimeOut = clearTimeOut;
+ }
+ public String getTrapMaxAge() {
+ return trapMaxAge;
+ }
+ public void setTrapMaxAge(String trapMaxAge) {
+ this.trapMaxAge = trapMaxAge;
+ }
+ public String getVerificationclearTimeOut() {
+ return verificationclearTimeOut;
+ }
+ public void setVerificationclearTimeOut(String verificationclearTimeOut) {
+ this.verificationclearTimeOut = verificationclearTimeOut;
+ }
+ public Map<String, String> getDynamicLayoutMap() {
+ return dynamicLayoutMap;
+ }
+ public void setDynamicLayoutMap(Map<String, String> dynamicLayoutMap) {
+ this.dynamicLayoutMap = dynamicLayoutMap;
+ }
+ public String getFwPolicyType() {
+ return fwPolicyType;
+ }
+ public void setFwPolicyType(String fwPolicyType) {
+ this.fwPolicyType = fwPolicyType;
+ }
+ public ArrayList<Object> getFwattributes() {
+ return fwattributes;
+ }
+ public void setFwattributes(ArrayList<Object> fwattributes) {
+ this.fwattributes = fwattributes;
+ }
+ public String getParentForChild() {
+ return parentForChild;
+ }
+ public void setParentForChild(String parentForChild) {
+ this.parentForChild = parentForChild;
+ }
+ public String getRuleName() {
+ return ruleName;
+ }
+ public void setRuleName(String ruleName) {
+ this.ruleName = ruleName;
+ }
+ public LinkedHashMap<?, ?> getRuleData() {
+ return ruleData;
+ }
+ public void setRuleData(LinkedHashMap<?, ?> ruleData) {
+ this.ruleData = ruleData;
+ }
+ public LinkedHashMap<?, ?> getRuleListData() {
+ return ruleListData;
+ }
+ public void setRuleListData(LinkedHashMap<?, ?> ruleListData) {
+ this.ruleListData = ruleListData;
+ }
+ public String getSecurityZone() {
+ return securityZone;
+ }
+ public void setSecurityZone(String securityZone) {
+ this.securityZone = securityZone;
+ }
+ public String getActionAttributeValue() {
+ return actionAttributeValue;
+ }
+ public void setActionAttributeValue(String actionAttributeValue) {
+ this.actionAttributeValue = actionAttributeValue;
+ }
+ public String getRuleProvider() {
+ return ruleProvider;
+ }
+ public void setRuleProvider(String ruleProvider) {
+ this.ruleProvider = ruleProvider;
+ }
+ public String getMsLocation() {
+ return msLocation;
+ }
+ public void setMsLocation(String msLocation) {
+ this.msLocation = msLocation;
+ }
+ public Map<String,String> getDrlRuleAndUIParams() {
+ return drlRuleAndUIParams;
+ }
+ public void setDrlRuleAndUIParams(Map<String,String> drlRuleAndUIParams) {
+ this.drlRuleAndUIParams = drlRuleAndUIParams;
+ }
+ public String getActionBody() {
+ return actionBody;
+ }
+ public void setActionBody(String actionBody) {
+ this.actionBody = actionBody;
+ }
+ public String getActionDictHeader() {
+ return actionDictHeader;
+ }
+ public void setActionDictHeader(String actionDictHeader) {
+ this.actionDictHeader = actionDictHeader;
+ }
+ public String getActionDictType() {
+ return actionDictType;
+ }
+ public void setActionDictType(String actionDictType) {
+ this.actionDictType = actionDictType;
+ }
+ public String getActionDictUrl() {
+ return actionDictUrl;
+ }
+ public void setActionDictUrl(String actionDictUrl) {
+ this.actionDictUrl = actionDictUrl;
+ }
+ public String getActionDictMethod() {
+ return actionDictMethod;
+ }
+ public void setActionDictMethod(String actionDictMethod) {
+ this.actionDictMethod = actionDictMethod;
+ }
+ public String getClWarning() {
+ return clWarning;
+ }
+ public void setClWarning(String clWarning) {
+ this.clWarning = clWarning;
+ }
+ public String getNewCLName() {
+ return newCLName;
+ }
+ public void setNewCLName(String newCLName) {
+ this.newCLName = newCLName;
+ }
+ public String getExistingCLName() {
+ return existingCLName;
+ }
+ public void setExistingCLName(String existingCLName) {
+ this.existingCLName = existingCLName;
+ }
+ public YAMLParams getYamlparams() {
+ return yamlparams;
+ }
+ public void setYamlparams(YAMLParams yamlparams) {
+ this.yamlparams = yamlparams;
+ }
+ /**
+ * @return the rainyday
+ */
+ public RainyDayParams getRainyday() {
+ return rainyday;
+ }
+ /**
+ * @param rainyday the rainyday to set
+ */
+ public void setRainyday(RainyDayParams rainyday) {
+ this.rainyday = rainyday;
+ }
+ /**
+ * @return the errorCodeList
+ */
+ public List<String> getErrorCodeList() {
+ return errorCodeList;
+ }
+ /**
+ * @param errorCodeList the errorCodeList to set
+ */
+ public void setErrorCodeList(List<String> errorCodeList) {
+ this.errorCodeList = errorCodeList;
+ }
+ /**
+ * @return the treatmentList
+ */
+ public List<String> getTreatmentList() {
+ return treatmentList;
+ }
+ /**
+ * @param treatmentList the treatmentList to set
+ */
+ public void setTreatmentList(List<String> treatmentList) {
+ this.treatmentList = treatmentList;
+ }
+ /**
+ * @return the rainydayMap
+ */
+ public Map<String,String> getRainydayMap() {
+ return rainydayMap;
+ }
+ /**
+ * @param rainydayMap the rainydayMap to set
+ */
+ public void setRainydayMap(Map<String,String> rainydayMap) {
+ this.rainydayMap = rainydayMap;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PrefixIPList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PrefixIPList.java
new file mode 100644
index 000000000..c9b5b0cf1
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PrefixIPList.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class PrefixIPList {
+ protected String name;
+ protected String description;
+ protected List<AddressMembers> members;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<AddressMembers> getMembers()
+ {
+ if(members==null)
+ {
+ members= new ArrayList<AddressMembers>();
+ }
+ return this.members;
+ }
+
+ public void setMembers(List<AddressMembers> members)
+ {
+ this.members = members;
+ }
+ /*public String getValue() {
+ return value;
+ }
+
+
+ public void setValue(String value) {
+ this.value = value;
+ }*/
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/RainyDayParams.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/RainyDayParams.java
new file mode 100644
index 000000000..f465e8605
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/RainyDayParams.java
@@ -0,0 +1,100 @@
+package org.onap.policy.rest.adapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RainyDayParams {
+ private String serviceType;
+ private String vnfType;
+ private String bbid;
+ private String workstep;
+ private ArrayList<Object> treatmentTableChoices;
+ private List<String> errorcode;
+ private List<String> treatment;
+
+ /**
+ * @return the serviceType
+ */
+ public String getServiceType() {
+ return serviceType;
+ }
+ /**
+ * @param serviceType the serviceType to set
+ */
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+ /**
+ * @return the vnfType
+ */
+ public String getVnfType() {
+ return vnfType;
+ }
+ /**
+ * @param vnfType the vnfType to set
+ */
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+ /**
+ * @return the workstep
+ */
+ public String getWorkstep() {
+ return workstep;
+ }
+ /**
+ * @param workstep the workstep to set
+ */
+ public void setWorkstep(String workstep) {
+ this.workstep = workstep;
+ }
+ /**
+ * @return the bbid
+ */
+ public String getBbid() {
+ return bbid;
+ }
+ /**
+ * @param bbid the bbid to set
+ */
+ public void setBbid(String bbid) {
+ this.bbid = bbid;
+ }
+ /**
+ * @return the treatmentTableChoices
+ */
+ public ArrayList<Object> getTreatmentTableChoices() {
+ return treatmentTableChoices;
+ }
+ /**
+ * @param treatmentTableChoices the treatmentTableChoices to set
+ */
+ public void setTreatmentTableChoices(ArrayList<Object> treatmentTableChoices) {
+ this.treatmentTableChoices = treatmentTableChoices;
+ }
+ /**
+ * @return the errorcode
+ */
+ public List<String> getErrorcode() {
+ return errorcode;
+ }
+ /**
+ * @param errorcode the errorcode to set
+ */
+ public void setErrorcode(List<String> errorcode) {
+ this.errorcode = errorcode;
+ }
+ /**
+ * @return the treatment
+ */
+ public List<String> getTreatment() {
+ return treatment;
+ }
+ /**
+ * @param treatment the treatment to set
+ */
+ public void setTreatment(List<String> treatment) {
+ this.treatment = treatment;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceGroupJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceGroupJson.java
new file mode 100644
index 000000000..0d06552b1
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceGroupJson.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ServiceGroupJson {
+
+ protected String name;
+ protected String description;
+ protected List<ServiceMembers> members;
+
+ // name
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ public boolean equals(Object obj){
+ if(obj == null){
+ return false;
+ }
+ if(this.getClass() != obj.getClass()){
+ return false;
+ }
+ ServiceGroupJson servGroupobj=(ServiceGroupJson) obj;
+ if(this.getName().equals(servGroupobj.getName())){
+ return true;
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return Integer.valueOf(name.charAt(0)+(name.charAt(1)));
+ }
+
+ // description
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String value) {
+ this.description = value;
+ }
+
+ public List<ServiceMembers> getMembers()
+ {
+ if(members==null)
+ {
+ members= new ArrayList<ServiceMembers>();
+ }
+ return this.members;
+ }
+
+ public void setMembers(List<ServiceMembers> members)
+ {
+ this.members = members;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceListJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceListJson.java
new file mode 100644
index 000000000..f64abb83f
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceListJson.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+
+public class ServiceListJson {
+
+ protected String name;
+ protected String description;
+ protected String type;
+ protected String transportProtocol;
+ protected String appProtocol;
+ protected String ports;
+ // name
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ public boolean equals(Object obj){
+ if(obj == null){
+ return false;
+ }
+ if(this.getClass() != obj.getClass()){
+ return false;
+ }
+ ServiceListJson servobj=(ServiceListJson) obj;
+ if(this.getName().equals(servobj.getName())){
+ return true;
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ if(name!=null){
+ return Integer.valueOf(name.charAt(0)+(name.charAt(1)));
+ }else{
+ return 0;
+ }
+ }
+
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ // type
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String value) {
+ this.type = value;
+ }
+
+ // transportProtocol
+ public String getTransportProtocol() {
+ return transportProtocol;
+ }
+
+ public void setTransportProtocol(String value) {
+ this.transportProtocol = value;
+ }
+
+ // appProtocol
+ public String getAppProtocol() {
+ return appProtocol;
+ }
+
+ public void setAppProtocol(String value) {
+ this.appProtocol = value;
+ }
+
+ // ports
+ public String getPorts() {
+ return ports;
+ }
+
+ public void setPorts(String value) {
+ this.ports = value;
+ }
+
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceMembers.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceMembers.java
new file mode 100644
index 000000000..632d5a4e8
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServiceMembers.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+
+public class ServiceMembers {
+
+ protected String type;
+ protected String name;
+
+ // type
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String value) {
+ this.type = value;
+ }
+
+ // transportProtocol
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ this.name = value;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServicesJson.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServicesJson.java
new file mode 100644
index 000000000..5cb9e9801
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ServicesJson.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+public class ServicesJson {
+
+ protected String type;
+ protected String name;
+ // type
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String value) {
+ this.name = value;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TagDefines.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TagDefines.java
new file mode 100644
index 000000000..339b0e1f5
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TagDefines.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+public class TagDefines {
+ String key;
+ String value;
+
+ public String getKey() {
+ return key;
+ }
+ public void setKey(String key) {
+ this.key = key;
+ }
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Tags.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Tags.java
new file mode 100644
index 000000000..d046a2f97
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Tags.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+import java.util.List;
+
+
+public class Tags {
+ String ruleName;
+ List<TagDefines> tags;
+ String tagPickerName;
+ String networkRole;
+
+ public String getRuleName() {
+ return ruleName;
+ }
+ public void setRuleName(String ruleName) {
+ this.ruleName = ruleName;
+ }
+ public List<TagDefines> getTags() {
+ return tags;
+ }
+ public void setTags(List<TagDefines> tags) {
+ this.tags = tags;
+ }
+ public String getTagPickerName() {
+ return tagPickerName;
+ }
+
+ public void setTagPickerName(String tagPickerName) {
+ this.tagPickerName = tagPickerName;
+ }
+ public String getNetworkRole() {
+ return networkRole;
+ }
+ public void setNetworkRole(String networkRole) {
+ this.networkRole = networkRole;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Term.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Term.java
new file mode 100644
index 000000000..7188e3558
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/Term.java
@@ -0,0 +1,201 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+public class Term {
+
+ String position;
+ protected String ruleName;
+ protected List<String> fromZones;
+ protected List<String> toZones;
+ protected boolean negateSource; //hardcoded
+ protected boolean negateDestination; //hardcoded
+ protected List<AddressJson> sourceList;
+ protected List<AddressJson> destinationList;
+ protected List<ServicesJson> sourceServices;
+ protected Set<ServicesJson> destServices;
+ protected String action;
+ protected String description;
+ boolean enabled; //hardcoded
+ boolean log; //hardcoded
+
+ //position
+ public String getPosition() {
+ return position;
+ }
+
+ public void setPosition(String value) {
+ this.position = value;
+ }
+
+ //RuleName
+ public String getRuleName() {
+ return ruleName;
+ }
+
+ public void setRuleName(String value) {
+ this.ruleName = value;
+ }
+
+ //From Zone
+ public List<String> getFromZones() {
+ if (fromZones==null)
+ {
+ fromZones= new ArrayList<String>();
+ }
+ return fromZones;
+ }
+
+ public void setFromZones(List<String> fromZones) {
+ this.fromZones = fromZones;
+ }
+
+ //To Zone
+ public List<String> getToZones() {
+ if (toZones==null)
+ {
+ toZones= new ArrayList<String>();
+ }
+ return toZones;
+ }
+
+ public void setToZones(List<String> toZones) {
+ this.toZones = toZones;
+ }
+
+
+ //Negate Source
+ public boolean getNegateSource() {
+ return negateSource;
+ }
+
+ public void setNegateSource(boolean negateSource) {
+ this.negateSource = negateSource;
+ }
+
+ //Negate Destination
+ public boolean getNegateDestination() {
+ return negateDestination;
+ }
+
+ public void setNegateDestination(boolean negateDestination) {
+ this.negateDestination = negateDestination;
+ }
+
+ //SourceList
+ public List<AddressJson> getSourceList()
+ {
+ if(sourceList==null)
+ {
+ sourceList= new ArrayList<AddressJson>();
+ }
+ return this.sourceList;
+ }
+
+ public void setSourceList(List<AddressJson> srcList) {
+ this.sourceList = srcList;
+ }
+
+ //Destination List
+ public List<AddressJson> getDestinationList()
+ {
+ if(destinationList==null)
+ {
+ destinationList= new ArrayList<AddressJson>();
+ }
+ return this.destinationList;
+ }
+
+ public void setDestinationList(List<AddressJson> destList) {
+ this.destinationList = destList;
+ }
+
+ //Source Services
+ public List<ServicesJson> getSourceServices() {
+ if(sourceServices==null)
+ {
+ sourceServices= new ArrayList<ServicesJson>();
+ }
+ return this.sourceServices;
+ }
+
+ public void setSourceServices(List<ServicesJson> sourceServices) {
+ this.sourceServices = sourceServices;
+ }
+
+ //Destination services.
+ public Set<ServicesJson> getDestServices() {
+ if(destServices==null)
+ {
+ destServices= new HashSet<ServicesJson>();
+ }
+ return this.destServices;
+ }
+
+ public void setDestServices(Set<ServicesJson> destServices) {
+ this.destServices = destServices;
+ }
+
+ //Action
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String value) {
+ this.action = value;
+ }
+
+ //description
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ //enabled
+ public boolean getEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean value) {
+ this.enabled = value;
+ }
+
+ //Log
+ public boolean getLog() {
+ return log;
+ }
+
+ public void setLog(boolean value) {
+ this.log = value;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TermCollector.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TermCollector.java
new file mode 100644
index 000000000..cfc91f089
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/TermCollector.java
@@ -0,0 +1,145 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+public class TermCollector {
+ private String serviceTypeId;
+ private String configName;
+ private DeployNowJson deploymentOption;
+ private String securityZoneId;
+ private String vendorServiceId;
+ private VendorSpecificData vendorSpecificData= new VendorSpecificData();
+
+ protected Set<Object> serviceGroups;
+ protected Set<Object> addressGroups;
+ protected List<Term> firewallRuleList;
+
+ protected List<Tags> ruleToTag;
+
+ public List<Tags> getRuleToTag() {
+ return ruleToTag;
+ }
+
+ public void setRuleToTag(List<Tags> ruleToTag) {
+ this.ruleToTag = ruleToTag;
+ }
+
+ //SecurityTypeId
+ public String getServiceTypeId() {
+ return serviceTypeId;
+ }
+
+ public void setServiceTypeId(String serviceTypeId) {
+ this.serviceTypeId = serviceTypeId;
+ }
+
+ //ConfigName
+ public String getConfigName() {
+ return configName;
+ }
+
+ public void setConfigName(String configName) {
+ this.configName = configName;
+ }
+
+ //DeploymentControl
+ public DeployNowJson getDeploymentOption() {
+ return deploymentOption;
+ }
+
+ public void setDeploymentOption(DeployNowJson deploymentOption) {
+ this.deploymentOption = deploymentOption;
+ }
+
+ //SecurityZoneId
+ public String getSecurityZoneId() {
+ return securityZoneId;
+ }
+ public void setSecurityZoneId(String securityZoneId) {
+ this.securityZoneId = securityZoneId;
+ }
+
+
+ //ServiceGroup
+ public Set<Object> getServiceGroups() {
+ if(serviceGroups==null)
+ {
+ serviceGroups= new HashSet<Object>();
+ }
+ return this.serviceGroups;
+ }
+
+ public void setServiceGroups(Set<Object> servListArray) {
+ this.serviceGroups = servListArray;
+ }
+
+ //AddressGroup
+ public Set<Object> getAddressGroups() {
+ if(addressGroups==null)
+ {
+ addressGroups= new HashSet<Object>();
+ }
+ return this.addressGroups;
+ }
+
+ public void setAddressGroups(Set<Object> addressGroups) {
+ this.addressGroups = addressGroups;
+ }
+
+ //FirewallRuleList
+ public List<Term> getFirewallRuleList() {
+
+ if(firewallRuleList==null)
+ {
+ firewallRuleList= new ArrayList<Term>();
+ }
+ return this.firewallRuleList;
+ }
+
+ public void setFirewallRuleList(List<Term> firewallRuleList) {
+ this.firewallRuleList = firewallRuleList;
+ }
+
+ //vendorServiceId
+ public String getVendorServiceId() {
+ return vendorServiceId;
+ }
+
+ public void setVendorServiceId(String vendorServiceId) {
+ this.vendorServiceId = vendorServiceId;
+ }
+
+ public VendorSpecificData getVendorSpecificData() {
+ return vendorSpecificData;
+ }
+
+ public void setVendorSpecificData(VendorSpecificData vendorSpecificData) {
+ this.vendorSpecificData = vendorSpecificData;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/VendorSpecificData.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/VendorSpecificData.java
new file mode 100644
index 000000000..740aa838c
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/VendorSpecificData.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class VendorSpecificData {
+
+ private List<IdMap> idMap= new ArrayList<IdMap>();
+
+ public List<IdMap> getIdMap() {
+ return idMap;
+ }
+
+ public void setIdMap(List<IdMap> idMap) {
+ this.idMap = idMap;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java
new file mode 100644
index 000000000..e67a23ad8
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/YAMLParams.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.adapter;
+
+import java.util.List;
+
+public class YAMLParams {
+ private String actor;
+ private String recipe;
+ private String clname;
+ private String limit;
+ private String timeWindow;
+ private String timeUnits;
+ private String guardActiveStart;
+ private String guardActiveEnd;
+ private List<String> blackList;
+ private List<String> targets;
+
+ public String getActor() {
+ return actor;
+ }
+ public void setActor(String actor) {
+ this.actor = actor;
+ }
+ public String getRecipe() {
+ return recipe;
+ }
+ public void setRecipe(String recipe) {
+ this.recipe = recipe;
+ }
+ public String getLimit() {
+ return limit;
+ }
+ public void setLimit(String limit) {
+ this.limit = limit;
+ }
+ public String getTimeWindow() {
+ return timeWindow;
+ }
+ public void setTimeWindow(String timeWindow) {
+ this.timeWindow = timeWindow;
+ }
+ public String getGuardActiveStart() {
+ return guardActiveStart;
+ }
+ public void setGuardActiveStart(String guardActiveStart) {
+ this.guardActiveStart = guardActiveStart;
+ }
+ public String getGuardActiveEnd() {
+ return guardActiveEnd;
+ }
+ public void setGuardActiveEnd(String guardActiveEnd) {
+ this.guardActiveEnd = guardActiveEnd;
+ }
+ public List<String> getBlackList() {
+ return blackList;
+ }
+ public void setBlackList(List<String> blackList) {
+ this.blackList = blackList;
+ }
+ public String getClname() {
+ return clname;
+ }
+ public void setClname(String clname) {
+ this.clname = clname;
+ }
+ public String getTimeUnits() {
+ return timeUnits;
+ }
+ public void setTimeUnits(String timeUnits) {
+ this.timeUnits = timeUnits;
+ }
+ public List<String> getTargets() {
+ return targets;
+ }
+ public void setTargets(List<String> targets) {
+ this.targets = targets;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/package-info.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/package-info.java
new file mode 100644
index 000000000..29ad2551c
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/package-info.java
@@ -0,0 +1,20 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.rest.adapter; \ No newline at end of file
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/dao/CommonClassDao.java b/ONAP-REST/src/main/java/org/onap/policy/rest/dao/CommonClassDao.java
new file mode 100644
index 000000000..c486f53cb
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/dao/CommonClassDao.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.dao;
+
+import java.util.List;
+
+import org.onap.policy.rest.jpa.PolicyRoles;
+
+public interface CommonClassDao {
+
+ //Common methods
+ List<Object> getData(@SuppressWarnings("rawtypes") Class className);
+ List<Object> getDataById(@SuppressWarnings("rawtypes") Class className, String columnName, String key);
+ List<String> getDataByColumn(@SuppressWarnings("rawtypes") Class className, String columnName);
+ List<Object> checkDuplicateEntry(String value, String columnName, @SuppressWarnings("rawtypes") Class className);
+ Object getEntityItem(@SuppressWarnings("rawtypes") Class className, String columnName, String key);
+ List<Object> getDataByQuery(String query);
+ List<Object> getMultipleDataOnAddingConjunction(@SuppressWarnings("rawtypes") Class className, String columnName, List<String> data);
+ void save(Object entity);
+ void delete(Object entity);
+ void update(Object entity);
+ void updateQuery(String query);
+
+ //Group Policy Scope
+ List<Object> checkExistingGroupListforUpdate(String groupListValue, String groupNameValue);
+
+
+ //Roles
+ List<PolicyRoles> getUserRoles();
+
+
+ //ClosedLoops
+ void updateClAlarms(String clName, String alarms);
+ void updateClYaml(String clName, String yaml);
+ void deleteAll();
+
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/dao/package-info.java b/ONAP-REST/src/main/java/org/onap/policy/rest/dao/package-info.java
new file mode 100644
index 000000000..2d8be25c4
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/dao/package-info.java
@@ -0,0 +1,21 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.dao;
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java
new file mode 100644
index 000000000..e65b317d0
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java
@@ -0,0 +1,195 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+/*
+ * The Entity class to persist a policy object Action Body
+ */
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
+@Entity
+@Table(name="ActionBodyEntity")
+@NamedQueries({
+ @NamedQuery(name=" ActionBodyEntity.findAll", query="SELECT e FROM ActionBodyEntity e "),
+ @NamedQuery(name="ActionBodyEntity.deleteAll", query="DELETE FROM ActionBodyEntity WHERE 1=1")
+})
+
+public class ActionBodyEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="actionBodyId")
+ @JsonBackReference
+ private long actionBodyId;
+
+ @Column(name="actionBodyName", nullable=false, length=255)
+ private String actionBodyName = "";
+
+ @Version
+ @Column(name="version")
+ private int version;
+
+ @Lob
+ @Column(name="actionBody", nullable=false, columnDefinition="TEXT")
+ private String actionBody = "NoBody";
+
+ @Column(name="created_by", nullable=false, length=255)
+ private String createdBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="modified_by", nullable=false, length=255)
+ private String modifiedBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @Column(name="deleted", nullable=false)
+ private boolean deleted = false;
+
+ public ActionBodyEntity() {
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+ /**
+ * @return the configurationDataId
+ */
+ public long getActionBodyId() {
+ return actionBodyId;
+ }
+ /**
+ * @param configurationDataId the configurationDataId to set
+ */
+ public void setActionBodyName(String name) {
+ this.actionBodyName = name;
+ }
+ public String getActionBodyName(){
+ return this.actionBodyName;
+ }
+
+ /**
+ * @return the actionBody
+ */
+ public String getActionBody() {
+ return actionBody;
+ }
+ /**
+ * @param configBody the configBody to set
+ */
+ public void setActionBody(String body) {
+ this.actionBody = body;
+ }
+ /**
+ * @return the createdBy
+ */
+ public String getCreatedBy() {
+ return createdBy;
+ }
+ /**
+ * @param createdBy the createdBy to set
+ */
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ /**
+ * @return the modifiedBy
+ */
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+ /**
+ * @param modifiedBy the modifiedBy to set
+ */
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+ /**
+ * @return the modifiedDate
+ */
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+ /**
+ * @param modifiedDate the modifiedDate to set
+ */
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+ /**
+ * @return the version
+ */
+ public int getVersion() {
+ return version;
+ }
+ /**
+ * @return the createdDate
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ /**
+ * @return the deleted
+ */
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+ /**
+ * @param deleted the deleted to set
+ */
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java
new file mode 100644
index 000000000..6be8cd7a8
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="actionlist")
+@NamedQuery(name="ActionList.findAll", query="SELECT e FROM ActionList e ")
+public class ActionList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="actionname", nullable=false)
+ @OrderBy("asc")
+ private String actionName;
+
+ @Column(name="description")
+ private String description;
+/*
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;*/
+
+ public ActionList() {
+
+ }
+ public ActionList(String string, String userid) {
+ this(domain);
+
+ }
+ public ActionList(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+ public String getActionName() {
+ return this.actionName;
+ }
+
+ public void setActionName(String actionName) {
+ this.actionName = actionName;
+
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java
new file mode 100644
index 000000000..bf8a73161
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java
@@ -0,0 +1,211 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ */
+package org.onap.policy.rest.jpa;
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+
+@Entity
+@Table(name="ActionPolicyDict")
+@NamedQueries({
+ @NamedQuery(name="ActionPolicyDict.findAll", query="SELECT e FROM ActionPolicyDict e")
+})
+public class ActionPolicyDict implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="ATTRIBUTE_NAME", nullable=false)
+ @OrderBy("asc")
+ private String attributeName;
+
+ @Column(name="Type", nullable=false)
+ @OrderBy("asc")
+ private String type;
+
+ @Column(name="URL", nullable=false)
+ @OrderBy("asc")
+ private String url;
+
+ @Column(name="Method", nullable=false)
+ @OrderBy("asc")
+ private String method;
+
+ @Column(name="Headers", nullable=true)
+ @OrderBy("asc")
+ private String header;
+
+ @Column(name="Body", nullable=true)
+ @OrderBy("asc")
+ private String body;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log logger = LogFactory.getLog(ActionPolicyDict.class);
+ public ActionPolicyDict() {
+
+ }
+
+ public ActionPolicyDict(String string, String userid) {
+ this(string);
+ }
+
+ public ActionPolicyDict(String domain) {
+ this.type = domain;
+ }
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ logger.error("Exception caused While adding Modified by Role"+e);
+ //PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ActionPolicyDict", "Exception caused While adding Modified by Role");
+ }
+ }
+ public int getId() {
+ return this.id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+ public String getDescription() {
+ return this.description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+ public String getMethod() {
+ return method;
+ }
+ public void setMethod(String method) {
+ this.method = method;
+ }
+ public String getHeader() {
+ return header;
+ }
+ public void setHeader(String header) {
+ this.header = header;
+ }
+
+ public String getBody() {
+ return body;
+ }
+ public void setBody(String body) {
+ this.body = body;
+ }
+ public String getAttributeName() {
+ return attributeName;
+ }
+ public void setAttributeName(String attributeName) {
+ this.attributeName = attributeName;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java
new file mode 100644
index 000000000..2a14e709a
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="AddressGroup")
+@NamedQuery(name="AddressGroup.findAll", query="SELECT e FROM AddressGroup e ")
+public class AddressGroup implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="prefixlist")
+ private String prefixList;
+
+
+ @Column(name="description")
+ private String description;
+
+ public AddressGroup() {
+
+ }
+ public AddressGroup(String string, String userid) {
+ this(domain);
+
+ }
+ public AddressGroup(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getGroupName() {
+ return this.name;
+ }
+
+ public void setGroupName(String serviceName) {
+ this.name = serviceName;
+
+ }
+
+ public String getPrefixList() {
+ return this.prefixList;
+ }
+
+ public void setServiceList(String prefixList) {
+ this.prefixList = prefixList;
+
+ }
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java
new file mode 100644
index 000000000..7285e2e36
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java
@@ -0,0 +1,363 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+/**
+ * The persistent class for the Attribute database table.
+ *
+ */
+@Entity
+@Table(name="Attribute")
+@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);
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ //bi-directional many-to-one association to Category
+ @ManyToOne
+ @JoinColumn(name="constraint_type", nullable=true)
+ @JsonIgnore
+ private ConstraintType constraintType;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @Column(name="PRIORITY", nullable=true)
+ @OrderBy("asc")
+ private String priority;
+
+ @Column(name="ATTRIBUTE_VALUE", nullable=true)
+ @OrderBy("asc")
+ private String attributeValue;
+
+ @Column(name="xacml_id", unique = true, nullable=false)
+ @OrderBy("asc")
+ private String xacmlId = "urn";
+
+ //bi-directional many-to-one association to ConstraintValue
+ @OneToMany(mappedBy="attribute", orphanRemoval=true, cascade=CascadeType.REMOVE)
+ @JsonIgnore
+ private Set<ConstraintValue> constraintValues = new HashSet<>();
+
+ //bi-directional many-to-one association to Category
+ @ManyToOne
+ @JoinColumn(name="category")
+ @JsonIgnore
+ private Category categoryBean;
+
+ //bi-directional many-to-one association to Datatype
+ @ManyToOne
+ @JoinColumn(name="datatype")
+ private Datatype datatypeBean;
+
+ @Column(name="is_designator", nullable=false)
+ @JsonIgnore
+ private char isDesignator = '1';
+
+ @Column(name="selector_path", nullable=true, length=2048)
+ private String selectorPath;
+
+
+
+ @Transient
+ private String issuer = null;
+
+ @Transient
+ private boolean mustBePresent = false;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+
+ public Attribute() {
+ }
+
+ public Attribute(String domain) {
+ this.xacmlId = domain;
+ }
+
+ public Attribute(Attribute copy) {
+ this(copy.getXacmlId() + ":(0)");
+ this.constraintType = copy.getConstraintType();
+ this.categoryBean = copy.getCategoryBean();
+ this.datatypeBean = copy.getDatatypeBean();
+ this.description = copy.getDescription();
+ for (ConstraintValue value : copy.getConstraintValues()) {
+ ConstraintValue newValue = new ConstraintValue(value);
+ newValue.setAttribute(this);
+ this.addConstraintValue(newValue);
+ }
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy = XacmlAdminAuthorization.getUserId();
+ } catch (Exception e) {
+ logger.error("Exception caused While adding Modified by Role"+e);
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public ConstraintType getConstraintType() {
+ return this.constraintType;
+ }
+
+ public void setConstraintType(ConstraintType constraintType) {
+ this.constraintType = constraintType;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public String getXacmlId() {
+ return this.xacmlId;
+ }
+
+/* @Transient
+ public Identifier getXacmlIdentifier() {
+ return new IdentifierImpl(this.xacmlId);
+ }*/
+
+ public void setXacmlId(String xacmlId) {
+ this.xacmlId = xacmlId;
+ }
+
+ public Set<ConstraintValue> getConstraintValues() {
+ return this.constraintValues;
+ }
+
+ public void setConstraintValues(Set<ConstraintValue> constraintValues) {
+ for (ConstraintValue value : this.constraintValues) {
+ value.setAttribute(this);
+ }
+ this.constraintValues = constraintValues;
+ }
+
+ public ConstraintValue addConstraintValue(ConstraintValue constraintValue) {
+ if (this.constraintValues == null) {
+ this.constraintValues = new HashSet<>();
+ }
+ this.constraintValues.add(constraintValue);
+ constraintValue.setAttribute(this);
+
+ return constraintValue;
+ }
+
+ public ConstraintValue removeConstraintValue(ConstraintValue constraintValue) {
+ this.constraintValues.remove(constraintValue);
+ constraintValue.setAttribute(null);
+
+ return constraintValue;
+ }
+
+ public void removeAllConstraintValues() {
+ if (this.constraintValues == null) {
+ return;
+ }
+ for (ConstraintValue value : this.constraintValues) {
+ value.setAttribute(null);
+ }
+ this.constraintValues.clear();
+ }
+
+ public Category getCategoryBean() {
+ return this.categoryBean;
+ }
+
+ public void setCategoryBean(Category categoryBean) {
+ this.categoryBean = categoryBean;
+ }
+
+ public Datatype getDatatypeBean() {
+ return this.datatypeBean;
+ }
+
+ public void setDatatypeBean(Datatype datatypeBean) {
+ this.datatypeBean = datatypeBean;
+ }
+
+ public char getIsDesignator() {
+ return this.isDesignator;
+ }
+
+ public void setIsDesignator(char is) {
+ this.isDesignator = is;
+ }
+
+ public String getSelectorPath() {
+ return this.selectorPath;
+ }
+
+ public void setSelectorPath(String path) {
+ this.selectorPath = path;
+ }
+
+ @Transient
+ public String getIssuer() {
+ return issuer;
+ }
+
+ @Transient
+ public void setIssuer(String issuer) {
+ this.issuer = issuer;
+ }
+
+ @Transient
+ public boolean isMustBePresent() {
+ return mustBePresent;
+ }
+
+ @Transient
+ public void setMustBePresent(boolean mustBePresent) {
+ this.mustBePresent = mustBePresent;
+ }
+
+ @Transient
+ public boolean isDesignator() {
+ return (this.isDesignator == '1');
+ }
+
+ @Transient
+ public void setIsDesignator(boolean is) {
+ if (is) {
+ this.isDesignator = '1';
+ } else {
+ this.isDesignator = '0';
+ }
+ }
+
+ public String getPriority() {
+ return priority;
+ }
+
+ public void setPriority(String priority) {
+ this.priority = priority;
+ }
+
+ public String getAttributeValue() {
+ return attributeValue;
+ }
+
+ public void setAttributeValue(String attributeValue) {
+ this.attributeValue = attributeValue;
+ }
+}
+
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java
new file mode 100644
index 000000000..7a1be9e7d
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+
+/**
+ * The persistent class for the ObadviceExpressions database table.
+ *
+ */
+@Entity
+@Table(name="AttributeAssignment")
+@NamedQuery(name="AttributeAssignment.findAll", query="SELECT a FROM AttributeAssignment a")
+public class AttributeAssignment implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final String EXPRESSION_APPLY = "Apply";
+ public static final String EXPRESSION_SELECTOR = "AttributeSelector";
+ public static final String EXPRESSION_VALUE = "AttributeValue";
+ public static final String EXPRESSION_FUNCTION = "Function";
+ public static final String EXPRESSION_REFERENCE = "VarableReference";
+ public static final String EXPRESSION_DESIGNATOR = "AttributeDesignator";
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="attribute_id")
+ private int attributeId;
+
+ //bi-directional many-to-one association to Obadvice
+ @Column(name="expression", nullable=false)
+ private String expression;
+
+ //bi-directional many-to-one association to Obadvice
+ @ManyToOne
+ private Obadvice obadvice;
+
+ public AttributeAssignment() {
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getAttributeId() {
+ return this.attributeId;
+ }
+
+ public void setAttributeId(int attributeId) {
+ this.attributeId = attributeId;
+ }
+
+ public String getExpression() {
+ return expression;
+ }
+
+ public void setExpression(String expression) {
+ this.expression = expression;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSController.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSController.java
new file mode 100644
index 000000000..af2b11a20
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSController.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="BRMSController")
+@NamedQuery(name="BRMSController.findAll", query="SELECT b from BRMSController b ")
+public class BRMSController implements Serializable{
+ private static final long serialVersionUID = -8666947569754164177L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="controller_name", nullable=false, length=1024, unique=true)
+ @OrderBy("asc")
+ private String controllerName;
+
+ @Column(name="description", nullable=true, length=1024)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ @Column(name="controller", nullable=false)
+ private String controller;
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ public String getController() {
+ return controller;
+ }
+
+ public void setController(String controller) {
+ this.controller = controller;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getControllerName() {
+ return controllerName;
+ }
+
+ public void setControllerName(String controllerName) {
+ this.controllerName = controllerName;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSDependency.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSDependency.java
new file mode 100644
index 000000000..d06ec5d92
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSDependency.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="BRMSDependency")
+@NamedQuery(name="BRMSDependency.findAll", query="SELECT b from BRMSDependency b ")
+public class BRMSDependency implements Serializable{
+ private static final long serialVersionUID = -7005622785653160761L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="dependency_name", nullable=false, length=1024, unique=true)
+ @OrderBy("asc")
+ private String dependencyName;
+
+ @Column(name="description", nullable=true, length=1024)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ @Column(name="dependency", nullable=false)
+ private String dependency;
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ public String getDependency() {
+ return dependency;
+ }
+
+ public void setDependency(String dependency) {
+ this.dependency = dependency;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getDependencyName() {
+ return dependencyName;
+ }
+
+ public void setDependencyName(String dependencyName) {
+ this.dependencyName = dependencyName;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java
new file mode 100644
index 000000000..5a78df227
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BRMSParamTemplate.java
@@ -0,0 +1,142 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.onap.policy.rest.jpa.UserInfo;
+
+/*
+ * JPA for the BRMS Param Template.
+ *
+ * @version: 0.1
+ */
+
+
+@Entity
+@Table(name="BRMSParamTemplate")
+@NamedQuery(name="BRMSParamTemplate.findAll", query="SELECT b FROM BRMSParamTemplate b ")
+public class BRMSParamTemplate implements Serializable{
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="param_template_name", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String ruleName;
+
+ @Lob
+ @Column(name="rule",nullable=false)
+ private String rule;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public BRMSParamTemplate(){
+ }
+
+ public BRMSParamTemplate(String userid){
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getRule(){
+ return this.rule;
+ }
+
+ public void setRule(String rule){
+ this.rule = rule;
+ }
+
+ public String getRuleName(){
+ return this.ruleName;
+ }
+
+ public void setRuleName(String ruleName){
+ this.ruleName = ruleName;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java
new file mode 100644
index 000000000..1d0f0e456
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java
@@ -0,0 +1,218 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.att.research.xacml.api.Identifier;
+import com.att.research.xacml.api.XACML3;
+import com.att.research.xacml.std.IdentifierImpl;
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
+
+/**
+ * The persistent class for the Categories database table.
+ *
+ */
+@Entity
+@Table(name="Category")
+@NamedQuery(name="Category.findAll", query="SELECT c FROM Category c")
+public class Category implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final char STANDARD = 'S';
+ public static final char CUSTOM = 'C';
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="grouping", nullable=false, length=64)
+ private String grouping;
+
+ @Column(name="is_standard", nullable=false)
+ private char isStandard;
+
+ @Column(name="xacml_id", nullable=false, unique=true, length=255)
+ private String xacmlId;
+
+ @Column(name="short_name", nullable=false, length=64)
+ private String shortName;
+
+ //bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy="categoryBean")
+ @JsonBackReference
+ private Set<Attribute> attributes = new HashSet<>();
+
+ public Category() {
+ this.xacmlId = XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT.stringValue();
+ this.grouping = "subject";
+ this.isStandard = Category.STANDARD;
+ this.shortName = "subject";
+ }
+
+ public Category(Identifier cat, String grouping, char isStandard) {
+ if (cat != null) {
+ this.xacmlId = cat.stringValue();
+ }
+ this.isStandard = isStandard;
+ if (grouping != null) {
+ this.grouping = grouping;
+ } else {
+ this.grouping = Category.extractGrouping(this.xacmlId);
+ }
+ }
+
+ public Category(Identifier cat, String grouping) {
+ this(cat, grouping, Category.STANDARD);
+ }
+
+ public Category(Identifier cat, char standard) {
+ this(cat, null, standard);
+ }
+
+ public Category(Identifier cat) {
+ this(cat, Category.STANDARD);
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getGrouping() {
+ return this.grouping;
+ }
+
+ public void setGrouping(String grouping) {
+ this.grouping = grouping;
+ }
+
+ public char getIsStandard() {
+ return this.isStandard;
+ }
+
+ public void setIsStandard(char isStandard) {
+ this.isStandard = isStandard;
+ }
+
+ public String getXacmlId() {
+ return this.xacmlId;
+ }
+
+ public void setXacmlId(String xacmlId) {
+ this.xacmlId = xacmlId;
+ }
+
+ public String getShortName() {
+ return this.shortName;
+ }
+
+ public void setShortName(String shortName) {
+ this.shortName = shortName;
+ }
+
+ public Set<Attribute> getAttributes() {
+ return this.attributes;
+ }
+
+ public void setAttributes(Set<Attribute> attributes) {
+ this.attributes = attributes;
+ }
+
+ public Attribute addAttribute(Attribute attribute) {
+ getAttributes().add(attribute);
+ attribute.setCategoryBean(this);
+
+ return attribute;
+ }
+
+ public Attribute removeAttribute(Attribute attribute) {
+ getAttributes().remove(attribute);
+ attribute.setCategoryBean(null);
+
+ return attribute;
+ }
+
+ @Transient
+ public boolean isStandard() {
+ return (this.isStandard == Category.STANDARD);
+ }
+
+ @Transient
+ public boolean isCustom() {
+ return (this.isStandard == Category.CUSTOM);
+ }
+
+ @Transient
+ public static String extractGrouping(String xacmlId) {
+ if (xacmlId == null) {
+ return null;
+ }
+ if (xacmlId.matches(".*:attribute\\-category:.*")) {
+ String[] parts = xacmlId.split("[:]");
+ if (parts != null && parts.length > 0) {
+ return parts[parts.length - 1];
+ }
+ } else if (xacmlId.matches(".*:[a-zA-Z]+[\\-]category:.*")) {
+ String[] parts = xacmlId.split("[:]");
+ if (parts != null && parts.length > 0) {
+ for (String part : parts) {
+ int index = part.indexOf("-category");
+ if (index > 0) {
+ return part.substring(0, index);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Transient
+ public Identifier getIdentifer() {
+ return new IdentifierImpl(this.xacmlId);
+ }
+
+ @Transient
+ @Override
+ public String toString() {
+ return "Category [id=" + id + ", grouping=" + grouping
+ + ", isStandard=" + isStandard + ", xacmlId=" + xacmlId
+ + ", attributes=" + attributes + "]";
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java
new file mode 100644
index 000000000..f4ade220e
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java
@@ -0,0 +1,175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ *
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+
+@Entity
+@Table(name = "ClosedLoopD2Services")
+@NamedQuery(name="ClosedLoopD2Services.findAll", query="SELECT c FROM ClosedLoopD2Services c ")
+public class ClosedLoopD2Services implements Serializable{
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+
+ @Id
+ @Column(name ="id")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private int id;
+
+ @Column(name="service_Name", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String serviceName;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(ClosedLoopD2Services.class);
+
+ public ClosedLoopD2Services(){
+
+ }
+
+ public ClosedLoopD2Services(String string, String userid) {
+ this(domain);
+ }
+
+ public ClosedLoopD2Services(String domain) {
+ this.serviceName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy = XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ClosedLoopD2Services", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java
new file mode 100644
index 000000000..6fbf9fb11
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+/*
+ *
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+
+@Entity
+@Table(name = "ClosedLoopSite")
+@NamedQuery(name="ClosedLoopSite.findAll", query="SELECT c FROM ClosedLoopSite c ")
+public class ClosedLoopSite implements Serializable{
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+
+ @Id
+ @Column(name ="id")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private int id;
+
+ @Column(name="site_Name", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String siteName;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(ClosedLoopSite.class);
+
+ public ClosedLoopSite(){
+
+ }
+
+ public ClosedLoopSite(String string, String userid) {
+ this(domain);
+ }
+
+ public ClosedLoopSite(String domain) {
+ this.siteName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy = XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "ClosedLoopSite", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getSiteName() {
+ return siteName;
+ }
+
+ public void setSiteName(String siteName) {
+ this.siteName = siteName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java
new file mode 100644
index 000000000..bb5b4bda7
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="ClosedLoops")
+@NamedQueries({
+ @NamedQuery(name="ClosedLoops.findAll", query="SELECT e FROM ClosedLoops e"),
+ @NamedQuery(name="ClosedLoops.deleteAll", query="DELETE FROM ClosedLoops WHERE 1=1")
+})
+public class ClosedLoops implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7796845092457926842L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="closedLoopControlName", nullable=false, length=255)
+ @OrderBy("asc")
+ private String closedLoopControlName;
+
+ @Column(name="alarmConditions", nullable=true, length=255)
+ private String alarmConditions;
+
+ @Column(name="yaml", nullable=true, length=1028)
+ private String yaml;
+
+ public ClosedLoops() {
+
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getClosedLoopControlName() {
+ return closedLoopControlName;
+ }
+
+ public void setClosedLoopControlName(String closedLoopControlName) {
+ this.closedLoopControlName = closedLoopControlName;
+ }
+
+ public String getAlarmConditions() {
+ return alarmConditions;
+ }
+
+ public void setAlarmConditions(String alarmConditions) {
+ this.alarmConditions = alarmConditions;
+ }
+
+ public String getYaml() {
+ return yaml;
+ }
+
+ public void setYaml(String yaml) {
+ this.yaml = yaml;
+ }
+
+} \ No newline at end of file
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java
new file mode 100644
index 000000000..e755d6fc5
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java
@@ -0,0 +1,224 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+/*
+ * The Entity class to persist a policy object configuration data
+ */
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
+@Entity
+@Table(name="ConfigurationDataEntity")
+@NamedQueries({
+ @NamedQuery(name="ConfigurationDataEntity.findAll", query="SELECT e FROM ConfigurationDataEntity e "),
+ @NamedQuery(name="ConfigurationDataEntity.deleteAll", query="DELETE FROM ConfigurationDataEntity WHERE 1=1")
+})
+
+public class ConfigurationDataEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="configurationDataId")
+ @JsonBackReference
+ private long configurationDataId;
+
+ @Column(name="configurationName", nullable=false, length=255)
+ private String configurationName = "";
+
+ @Version
+ @Column(name="version")
+ private int version;
+
+ @Column(name="configType", nullable=false, length=255)
+ private String configType = "NoType";
+
+ @Lob
+ @Column(name="configBody", nullable=false, columnDefinition="TEXT")
+ private String configBody = "NoBody";
+
+ @Column(name="created_by", nullable=false, length=255)
+ private String createdBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=false, length=2048)
+ private String description = "NoDescription";
+
+ @Column(name="modified_by", nullable=false, length=255)
+ private String modifiedBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @Column(name="deleted", nullable=false)
+ private boolean deleted = false;
+
+ public ConfigurationDataEntity() {
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+ /**
+ * @return the configurationDataId
+ */
+ public long getConfigurationDataId() {
+ return configurationDataId;
+ }
+ /**
+ * @param configurationDataId the configurationDataId to set
+ */
+ public void setConfigurationName(String configurationName) {
+ this.configurationName = configurationName;
+ }
+ public String getConfigurationName(){
+ return this.configurationName;
+ }
+ /**
+ * @return the configType
+ */
+ public String getConfigType() {
+ return configType;
+ }
+ /**
+ * @param configType the configType to set
+ */
+ public void setConfigType(String configType) {
+ this.configType = configType;
+ }
+ /**
+ * @return the configBody
+ */
+ public String getConfigBody() {
+ return configBody;
+ }
+ /**
+ * @param configBody the configBody to set
+ */
+ public void setConfigBody(String configBody) {
+ this.configBody = configBody;
+ }
+ /**
+ * @return the createdBy
+ */
+ public String getCreatedBy() {
+ return createdBy;
+ }
+ /**
+ * @param createdBy the createdBy to set
+ */
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ /**
+ * @return the modifiedBy
+ */
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+ /**
+ * @param modifiedBy the modifiedBy to set
+ */
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+ /**
+ * @return the modifiedDate
+ */
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+ /**
+ * @param modifiedDate the modifiedDate to set
+ */
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+ /**
+ * @return the version
+ */
+ public int getVersion() {
+ return version;
+ }
+ /**
+ * @return the createdDate
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ /**
+ * @return the deleted
+ */
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+ /**
+ * @param deleted the deleted to set
+ */
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java
new file mode 100644
index 000000000..eeadeb0fc
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="ConstraintType")
+@NamedQuery(name="ConstraintType.findAll", query="SELECT a FROM ConstraintType a")
+public class ConstraintType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final String ENUMERATION_TYPE = "Enumeration";
+ public static final String RANGE_TYPE = "Range";
+ public static final String REGEXP_TYPE = "Regular Expression";
+
+ 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.");
+ }
+ private static final String[] RANGE_TYPES = {"minExclusive", "minInclusive", "maxExclusive", "maxInclusive"};
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="constraint_type", nullable=false, length=64)
+ private String constraintType;
+
+ @Column(name="description", nullable=false, length=255)
+ private String description;
+
+ //bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy="constraintType")
+ private Set<Attribute> attributes = new HashSet<>();
+
+ public ConstraintType() {
+
+ }
+
+ public ConstraintType(String constraintType) {
+ this();
+ this.constraintType = constraintType;
+ }
+
+ public ConstraintType(String constraintType, String description) {
+ this(constraintType);
+ this.description = description;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getConstraintType() {
+ return constraintType;
+ }
+
+ public void setConstraintType(String constraintType) {
+ this.constraintType = constraintType;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Set<Attribute> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Set<Attribute> attributes) {
+ this.attributes = attributes;
+ }
+
+ public static String[] getRangeTypes() {
+ return RANGE_TYPES;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java
new file mode 100644
index 000000000..57e9af8b8
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+
+/**
+ * The persistent class for the ConstraintValues database table.
+ *
+ */
+@Entity
+@Table(name="ConstraintValues")
+@NamedQuery(name="ConstraintValue.findAll", query="SELECT c FROM ConstraintValue c")
+public class ConstraintValue implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="property")
+ private String property;
+
+ @Column(name="value")
+ private String value;
+
+ //bi-directional many-to-one association to Attribute
+ @ManyToOne
+ @JoinColumn(name="attribute_id")
+ private Attribute attribute;
+
+ public ConstraintValue() {
+ }
+
+ public ConstraintValue(String property, String value) {
+ this.property = property;
+ this.value = value;
+ }
+
+ public ConstraintValue(ConstraintValue value) {
+ this.property = value.getProperty();
+ this.value = value.getValue();
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getProperty() {
+ return this.property;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public Attribute getAttribute() {
+ return this.attribute;
+ }
+
+ public void setAttribute(Attribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public ConstraintValue clone() {
+ ConstraintValue constraint = new ConstraintValue();
+
+ constraint.property = this.property;
+ constraint.value = this.value;
+ constraint.attribute = this.attribute;
+
+ return constraint;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java
new file mode 100644
index 000000000..27d5d2790
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEUsers.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="DCAEUsers")
+@NamedQuery(name="DCAEUsers.findAll", query="SELECT e FROM DCAEUsers e ")
+public class DCAEUsers implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description ")
+ private String description ;
+
+
+ public DCAEUsers() {
+
+ }
+ public DCAEUsers(String string, String userid) {
+ this(domain);
+
+ }
+ public DCAEUsers(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+ public String getDescriptionValue() {
+ return this.description ;
+ }
+
+ public void setDescriptionValue(String description ) {
+ this.description = description ;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java
new file mode 100644
index 000000000..b7f9243bc
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DCAEuuid.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="DCAEuuid")
+@NamedQuery(name="DCAEuuid.findAll", query="SELECT e FROM DCAEuuid e ")
+public class DCAEuuid implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description")
+ private String description;
+
+
+ public DCAEuuid() {
+
+ }
+ public DCAEuuid(String string, String userid) {
+ this(domain);
+
+ }
+ public DCAEuuid(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java
new file mode 100644
index 000000000..7b5a8954e
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="DatabaseLockEntity")
+public class DatabaseLockEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Column(name="lock_key")
+ private int lock_key = 1;
+ public DatabaseLockEntity(){
+
+ }
+ public int getKey(){
+ return lock_key;
+ }
+ public void setKey(int key){
+ this.lock_key = key;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java
new file mode 100644
index 000000000..6be1a84ce
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java
@@ -0,0 +1,244 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.att.research.xacml.api.Identifier;
+import com.att.research.xacml.api.XACML3;
+import com.att.research.xacml.std.IdentifierImpl;
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+
+/**
+ * The persistent class for the Datatype database table.
+ *
+ */
+@Entity
+@Table(name="Datatype")
+@NamedQuery(name="Datatype.findAll", query="SELECT d FROM Datatype d")
+public class Datatype implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final char STANDARD = 'S';
+ public static final char CUSTOM = 'C';
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="is_standard", nullable=false)
+ private char isStandard;
+
+ @Column(name="xacml_id", nullable=false, unique=true, length=255)
+ private String xacmlId;
+
+ @Column(name="short_name", nullable=false, length=64)
+ private String shortName;
+
+ //bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy="datatypeBean")
+ @JsonBackReference
+ private Set<Attribute> attributes = new HashSet<>();
+
+ //bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy="datatypeBean")
+ @JsonIgnore
+ private Set<FunctionDefinition> functions = new HashSet<>();
+
+ //bi-directional many-to-one association to Attribute
+ @OneToMany(mappedBy="datatypeBean")
+ @JsonIgnore
+ private Set<FunctionArgument> arguments = new HashSet<>();
+
+ public Datatype() {
+ this.xacmlId = XACML3.ID_DATATYPE_STRING.stringValue();
+ this.isStandard = Datatype.STANDARD;
+ }
+
+
+ public Datatype(int id, Datatype dt) {
+ this.id = id;
+ this.isStandard = dt.isStandard;
+ this.xacmlId = dt.xacmlId;
+ this.shortName = dt.shortName;
+ //
+ // Make a copy?
+ //
+ this.attributes = new HashSet<>();
+ }
+
+ public Datatype(Identifier identifier, char standard) {
+ if (identifier != null) {
+ this.xacmlId = identifier.stringValue();
+
+ }
+ this.isStandard = standard;
+ }
+
+ public Datatype(Identifier identifier) {
+ this(identifier, Datatype.STANDARD);
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public char getIsStandard() {
+ return this.isStandard;
+ }
+
+ public void setIsStandard(char isStandard) {
+ this.isStandard = isStandard;
+ }
+
+ public String getXacmlId() {
+ return this.xacmlId;
+ }
+
+ public void setXacmlId(String xacmlId) {
+ this.xacmlId = xacmlId;
+ }
+
+ public String getShortName() {
+ return shortName;
+ }
+
+ public void setShortName(String shortName) {
+ this.shortName = shortName;
+ }
+
+ public Set<Attribute> getAttributes() {
+ return this.attributes;
+ }
+
+ public void setAttributes(Set<Attribute> attributes) {
+ this.attributes = attributes;
+ }
+
+ public Attribute addAttribute(Attribute attribute) {
+ getAttributes().add(attribute);
+ attribute.setDatatypeBean(this);
+
+ return attribute;
+ }
+
+ public Attribute removeAttribute(Attribute attribute) {
+ getAttributes().remove(attribute);
+ attribute.setDatatypeBean(null);
+
+ return attribute;
+ }
+
+ public Set<FunctionDefinition> getFunctions() {
+ return this.functions;
+ }
+
+ public void setFunctions(Set<FunctionDefinition> functions) {
+ this.functions = functions;
+ }
+
+ public FunctionDefinition addFunction(FunctionDefinition function) {
+ getFunctions().add(function);
+ function.setDatatypeBean(this);
+
+ return function;
+ }
+
+ public FunctionDefinition removeAttribute(FunctionDefinition function) {
+ getFunctions().remove(function);
+ function.setDatatypeBean(null);
+
+ return function;
+ }
+
+ public Set<FunctionArgument> getArguments() {
+ return this.arguments;
+ }
+
+ public void setArguments(Set<FunctionArgument> argument) {
+ this.arguments = argument;
+ }
+
+ public FunctionArgument addArgument(FunctionArgument argument) {
+ getArguments().add(argument);
+ argument.setDatatypeBean(this);
+
+ return argument;
+ }
+
+ public FunctionArgument removeArgument(FunctionArgument argument) {
+ getArguments().remove(argument);
+ argument.setDatatypeBean(null);
+
+ return argument;
+ }
+
+ @Transient
+ public Identifier getIdentifer() {
+ return new IdentifierImpl(this.xacmlId);
+ }
+
+ @Transient
+ public Identifier getIdentiferByShortName() {
+ return new IdentifierImpl(this.shortName);
+ }
+
+ @Transient
+ public boolean isStandard() {
+ return (this.isStandard == Datatype.STANDARD);
+ }
+
+ @Transient
+ public boolean isCustom() {
+ return (this.isStandard == Datatype.CUSTOM);
+ }
+
+ @Transient
+ @Override
+ public String toString() {
+ return "Datatype [id=" + id + ", isStandard=" + isStandard
+ + ", xacmlId=" + xacmlId + ", shortName=" + shortName
+ + ", attributes=" + attributes + ", functions=" + functions
+ + ", arguments=" + arguments + "]";
+
+ //return "Datatype [shortName=" + shortName + "]";
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java
new file mode 100644
index 000000000..164cc3cef
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java
@@ -0,0 +1,235 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+
+@Entity
+@Table(name="DecisionSettings")
+@NamedQuery(name="DecisionSettings.findAll", query="SELECT a FROM DecisionSettings a order by a.priority asc, a.xacmlId asc")
+public class DecisionSettings implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @Column(name="PRIORITY", nullable=true)
+ @OrderBy("asc")
+ private String priority;
+
+ @Column(name="xacml_id", unique = true, nullable=false)
+ @OrderBy("asc")
+ private String xacmlId = "urn";
+
+ //bi-directional many-to-one association to Datatype
+ @ManyToOne
+ @JoinColumn(name="datatype")
+ private Datatype datatypeBean;
+
+ @Transient
+ private String issuer = null;
+
+ @Transient
+ private boolean mustBePresent = false;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ public DecisionSettings() {
+ }
+
+ public DecisionSettings(String domain) {
+ this.xacmlId = domain;
+ }
+
+ public DecisionSettings(String domain, String user) {
+ this(domain);
+ }
+ public DecisionSettings(DecisionSettings copy, String user) {
+ this(copy.getXacmlId() + ":(0)", user);
+ this.datatypeBean = copy.getDatatypeBean();
+ this.description = copy.getDescription();
+
+ }
+
+ public String getDecisionSettings(){
+ return this.xacmlId;
+ }
+
+ public String setDecisionSettings(){
+ return this.xacmlId;
+ }
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy = XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DecisionSettings", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public String getXacmlId() {
+ return this.xacmlId;
+ }
+
+/* @Transient
+ public Identifier getXacmlIdentifier() {
+ return new IdentifierImpl(this.xacmlId);
+ }*/
+
+ public void setXacmlId(String xacmlId) {
+ this.xacmlId = xacmlId;
+ }
+
+ public Datatype getDatatypeBean() {
+ return this.datatypeBean;
+ }
+
+ public void setDatatypeBean(Datatype datatypeBean) {
+ this.datatypeBean = datatypeBean;
+ }
+
+ @Transient
+ public String getIssuer() {
+ return issuer;
+ }
+
+ @Transient
+ public void setIssuer(String issuer) {
+ this.issuer = issuer;
+ }
+
+ @Transient
+ public boolean isMustBePresent() {
+ return mustBePresent;
+ }
+
+ @Transient
+ public void setMustBePresent(boolean mustBePresent) {
+ this.mustBePresent = mustBePresent;
+ }
+
+ public String getPriority() {
+ return priority;
+ }
+
+ public void setPriority(String priority) {
+ this.priority = priority;
+ }
+}
+
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java
new file mode 100644
index 000000000..30882fc13
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+
+@Entity
+@Table(name = "DescriptiveScope")
+@NamedQuery(name = "DescriptiveScope.findAll", query= "Select p from DescriptiveScope p")
+public class DescriptiveScope implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "Id")
+ private int id;
+
+ @Column(name="scopename", nullable=false)
+ @OrderBy("asc")
+ private String descriptiveScopeName;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Column(name="search", nullable=true)
+ @OrderBy("asc")
+ private String search;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(DescriptiveScope.class);
+
+ public DescriptiveScope(){
+
+ }
+
+ public DescriptiveScope(String string, String userid) {
+ this(string);
+ }
+
+ public DescriptiveScope(String domain) {
+ this.descriptiveScopeName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DescriptiveScope", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getScopeName() {
+ return descriptiveScopeName;
+ }
+
+ public void setScopeName(String descriptiveScopeName) {
+ this.descriptiveScopeName = descriptiveScopeName;
+ }
+
+ public String getSearch() {
+ return search;
+ }
+
+ public void setSearch(String search) {
+ this.search = search;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/EnforcingType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/EnforcingType.java
new file mode 100644
index 000000000..9c1cda451
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/EnforcingType.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+/**
+ * Entity implementation class for Entity: EnforcingType
+ *
+ */
+@Entity
+@Table(name="EnforcingType")
+@NamedQuery(name="EnforcingType.findAll", query="SELECT e FROM EnforcingType e ")
+public class EnforcingType implements Serializable {
+
+
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+ @Column(name="enforcingType", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String enforcingType;
+ @Column(name="script", nullable=false, length=255)
+ private String script;
+ @Column(name="connectionQuery", nullable=false, length=255)
+ private String connectionQuery;
+ @Column(name="valueQuery", nullable=false, length=255)
+ private String valueQuery;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getEnforcingType() {
+ return enforcingType;
+ }
+
+ public void setEnforcingType(String enforcingType) {
+ this.enforcingType = enforcingType;
+ }
+
+ public String getScript() {
+ return script;
+ }
+
+ public void setScript(String script) {
+ this.script = script;
+ }
+
+ public String getConnectionQuery() {
+ return connectionQuery;
+ }
+
+ public void setConnectionQuery(String connectionQuery) {
+ this.connectionQuery = connectionQuery;
+ }
+
+ public String getValueQuery() {
+ return valueQuery;
+ }
+
+ public void setValueQuery(String valueQuery) {
+ this.valueQuery = valueQuery;
+ }
+
+ public EnforcingType() {
+ super();
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java
new file mode 100644
index 000000000..71f4d6a6a
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java
@@ -0,0 +1,180 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+@Entity
+@Table(name = "FWTag")
+@NamedQuery(name = "FWTag.findAll", query= "Select p from FWTag p")
+public class FWTag implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "Id")
+ private int id;
+
+ @Column(name="tagName", nullable=false)
+ @OrderBy("asc")
+ private String fwTagName;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Column(name="tagValues", nullable=true)
+ @OrderBy("asc")
+ private String tagValues;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(FWTag.class);
+
+ public FWTag(){
+
+ }
+
+ public FWTag(String string, String userid) {
+ this(string);
+ }
+
+ public FWTag(String domain) {
+ this.fwTagName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "FWTag", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getFwTagName() {
+ return fwTagName;
+ }
+
+ public void setFwTagName(String fwTagName) {
+ this.fwTagName = fwTagName;
+ }
+
+ public String getTagValues() {
+ return tagValues;
+ }
+
+ public void setTagValues(String tagValues) {
+ this.tagValues = tagValues;
+ }
+
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java
new file mode 100644
index 000000000..6f03b4915
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java
@@ -0,0 +1,189 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+@Entity
+@Table(name = "FWTagPicker")
+@NamedQuery(name = "FWTagPicker.findAll", query= "Select p from FWTagPicker p")
+public class FWTagPicker implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "Id")
+ private int id;
+
+ @Column(name="tagPickerName", nullable=false)
+ @OrderBy("asc")
+ private String tagPickerName;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Column(name="networkRole", nullable=true)
+ private String networkRole;
+
+ @Column(name="tags", nullable=true)
+ @OrderBy("asc")
+ private String tagValues;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ private static Log logger = LogFactory.getLog(FWTagPicker.class);
+
+ public FWTagPicker(){
+
+ }
+
+ public FWTagPicker(String string, String userid) {
+ this(string);
+ }
+
+ public FWTagPicker(String domain) {
+ this.tagPickerName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();
+ } catch (Exception e) {
+ logger.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "DescriptiveScope", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getTagPickerName() {
+ return tagPickerName;
+ }
+
+ public void setTagPickerName(String tagPickerName) {
+ this.tagPickerName = tagPickerName;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getNetworkRole() {
+ return networkRole;
+ }
+
+ public void setNetworkRole(String networkRole) {
+ this.networkRole = networkRole;
+ }
+
+ public String getTagValues() {
+ return tagValues;
+ }
+
+ public void setTagValues(String tagValues) {
+ this.tagValues = tagValues;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java
new file mode 100644
index 000000000..27f5e75bd
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java
@@ -0,0 +1,164 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="parentdictionaryitems")
+@NamedQuery(name="FirewallDictionaryList.findAll", query="SELECT e FROM FirewallDictionaryList e")
+public class FirewallDictionaryList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="parentItemName", nullable=false)
+ @OrderBy("asc")
+ private String parentItemName;
+
+ @Column(name="description")
+ private String description;
+
+ @Column(name="addressList")
+ private String addressList;
+
+ @Column(name="serviceList")
+ private String serviceList;
+
+/* @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;*/
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getParentItemName() {
+ return parentItemName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getAddressList() {
+ return addressList;
+ }
+
+ public String getServiceList() {
+ return serviceList;
+ }
+
+ public void setParentItemName(String parentItemName) {
+ this.parentItemName = parentItemName;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setAddressList(String addressList) {
+ this.addressList = addressList;
+ }
+
+ public void setServiceList(String serviceList) {
+ this.serviceList = serviceList;
+ }
+
+
+ /*public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }*/
+
+ public FirewallDictionaryList() {
+
+ }
+
+ public FirewallDictionaryList(String string, String userid) {
+ this(domain);
+ }
+ public FirewallDictionaryList(String domain) {
+ this.parentItemName = domain;
+ }
+
+ /*@PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ auditLogger.debug("Added New Term Name: "+this.parentItemName+" by "+this.userCreatedBy);
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "TermList", "Exception caused While adding Modified by Role");
+ }
+ auditLogger.debug("Updated Term Name: "+this.parentItemName+" by "+this.userModifiedBy);
+ }
+*/
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java
new file mode 100644
index 000000000..4d712994c
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+
+/**
+ * The persistent class for the FunctionArguments database table.
+ *
+ */
+@Entity
+@Table(name="FunctionArguments")
+@NamedQuery(name="FunctionArgument.findAll", query="SELECT f FROM FunctionArgument f")
+public class FunctionArgument implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="is_bag", nullable=false)
+ private int isBag;
+
+ //bi-directional many-to-one association to FunctionDefinition
+ @ManyToOne
+ @JoinColumn(name="function_id")
+ private FunctionDefinition functionDefinition;
+
+ @Column(name="arg_index", nullable=false)
+ private int argIndex;
+
+ //bi-directional many-to-one association to Datatype
+ @ManyToOne
+ @JoinColumn(name="datatype_id")
+ private Datatype datatypeBean;
+
+ public FunctionArgument() {
+ }
+
+ public FunctionArgument(final FunctionArgument argument) {
+ this.argIndex = argument.argIndex;
+ this.datatypeBean = argument.datatypeBean;
+ this.isBag = argument.isBag;
+ this.functionDefinition = argument.functionDefinition;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public int getArgIndex() {
+ return this.argIndex;
+ }
+
+ public void setArgIndex(int argIndex) {
+ this.argIndex = argIndex;
+ }
+
+ public Datatype getDatatypeBean() {
+ return this.datatypeBean;
+ }
+
+ public void setDatatypeBean(Datatype datatypeBean) {
+ this.datatypeBean = datatypeBean;
+ }
+
+ public FunctionDefinition getFunctionDefinition() {
+ return this.functionDefinition;
+ }
+
+ public int getIsBag() {
+ return isBag;
+ }
+
+ public void setIsBag(int isBag) {
+ this.isBag = isBag;
+ }
+
+ public void setFunctionDefinition(FunctionDefinition functionDefinition) {
+ this.functionDefinition = functionDefinition;
+ }
+
+ @Transient
+ @Override
+ public String toString() {
+ return "FunctionArgument [id=" + id + ", argIndex=" + argIndex
+ + ", datatypeBean=" + datatypeBean + ", isBag=" + isBag
+ + ", functionDefinition=" + functionDefinition + "]";
+ }
+
+ @Transient
+ public boolean isBag() {
+ return this.isBag == 1;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java
new file mode 100644
index 000000000..c3dfcaa63
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java
@@ -0,0 +1,219 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+import java.util.List;
+
+
+/**
+ * The persistent class for the FunctionDefinition database table.
+ *
+ */
+@Entity
+@Table(name="FunctionDefinition")
+@NamedQueries({
+ @NamedQuery(name="FunctionDefinition.findAll", query="SELECT f FROM FunctionDefinition f")
+})
+public class FunctionDefinition implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="short_name", nullable=false, length=64)
+ private String shortname;
+
+ @Column(name="xacml_id", nullable=false, length=255)
+ private String xacmlid;
+
+ //bi-directional many-to-one association to Datatype
+ @ManyToOne
+ @JoinColumn(name="return_datatype", nullable=true)
+ private Datatype datatypeBean;
+
+ @Column(name="is_bag_return", nullable=false)
+ private Integer isBagReturn;
+
+ @Column(name="is_higher_order", nullable=false)
+ private Integer isHigherOrder;
+
+ @Column(name="arg_lb", nullable=false)
+ private Integer argLb;
+
+ @Column(name="arg_ub", nullable=false)
+ private Integer argUb;
+
+ @Column(name="ho_arg_lb", nullable=true)
+ private Integer higherOrderArg_LB;
+
+ @Column(name="ho_arg_ub", nullable=true)
+ private Integer higherOrderArg_UB;
+
+ @Column(name="ho_primitive", nullable=true)
+ private Character higherOrderIsPrimitive;
+
+ //bi-directional many-to-one association to FunctionArgument
+ @OneToMany(mappedBy="functionDefinition")
+ private List<FunctionArgument> functionArguments;
+
+ public FunctionDefinition() {
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public int getArgLb() {
+ return this.argLb;
+ }
+
+ public void setArgLb(Integer argLb) {
+ this.argLb = argLb;
+ }
+
+ public int getArgUb() {
+ return this.argUb;
+ }
+
+ public void setArgUb(Integer argUb) {
+ this.argUb = argUb;
+ }
+
+ public int getIsBagReturn() {
+ return isBagReturn;
+ }
+
+ public void setIsBagReturn(Integer isBagReturn) {
+ this.isBagReturn = isBagReturn;
+ }
+
+ public int getIsHigherOrder() {
+ return isHigherOrder;
+ }
+
+ public void setIsHigherOrder(Integer isHigherOrder) {
+ this.isHigherOrder = isHigherOrder;
+ }
+
+ public Datatype getDatatypeBean() {
+ return this.datatypeBean;
+ }
+
+ public void setDatatypeBean(Datatype datatypeBean) {
+ this.datatypeBean = datatypeBean;
+ }
+
+ public String getShortname() {
+ return this.shortname;
+ }
+
+ public void setShortname(String shortname) {
+ this.shortname = shortname;
+ }
+
+ public String getXacmlid() {
+ return this.xacmlid;
+ }
+
+ public void setXacmlid(String xacmlid) {
+ this.xacmlid = xacmlid;
+ }
+
+ public int getHigherOrderArg_LB() {
+ return higherOrderArg_LB;
+ }
+
+ public void setHigherOrderArg_LB(Integer higherOrderArg_LB) {
+ this.higherOrderArg_LB = higherOrderArg_LB;
+ }
+
+ public int getHigherOrderArg_UB() {
+ return higherOrderArg_UB;
+ }
+
+ public void setHigherOrderArg_UB(Integer higherOrderArg_UB) {
+ this.higherOrderArg_UB = higherOrderArg_UB;
+ }
+
+ public Character getHigherOrderIsPrimitive() {
+ return higherOrderIsPrimitive;
+ }
+
+ public void setHigherOrderIsPrimitive(Character higherOrderIsPrimitive) {
+ this.higherOrderIsPrimitive = higherOrderIsPrimitive;
+ }
+
+ public List<FunctionArgument> getFunctionArguments() {
+ return this.functionArguments;
+ }
+
+ public void setFunctionArguments(List<FunctionArgument> functionArguments) {
+ this.functionArguments = functionArguments;
+ }
+
+ public FunctionArgument addFunctionArgument(FunctionArgument functionArgument) {
+ getFunctionArguments().add(functionArgument);
+ functionArgument.setFunctionDefinition(this);
+
+ return functionArgument;
+ }
+
+ public FunctionArgument removeFunctionArgument(FunctionArgument functionArgument) {
+ getFunctionArguments().remove(functionArgument);
+ functionArgument.setFunctionDefinition(null);
+
+ return functionArgument;
+ }
+
+ @Transient
+ @Override
+ public String toString() {
+ return "FunctionDefinition [id=" + id + ", argLb=" + argLb + ", argUb="
+ + argUb + ", isBagReturn=" + isBagReturn + ", isHigherOrder="
+ + isHigherOrder + ", datatypeBean=" + datatypeBean
+ + ", shortname=" + shortname + ", xacmlid=" + xacmlid
+ + ", higherOrderArg_LB=" + higherOrderArg_LB
+ + ", higherOrderArg_UB=" + higherOrderArg_UB
+ + ", higherOrderIsPrimitive=" + higherOrderIsPrimitive
+ + ", functionArguments=" + functionArguments + "]";
+ }
+
+ @Transient
+ public boolean isBagReturn() {
+ return this.isBagReturn == 1;
+ }
+
+ @Transient
+ public boolean isHigherOrder() {
+ return this.isHigherOrder == 1;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java
new file mode 100644
index 000000000..357906d4f
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+
+/**
+ * Entity implementation class for Entity: Administration
+ *
+ */
+@Entity
+@Table(name="GlobalRoleSettings")
+@NamedQuery(name="GlobalRoleSettings.findAll", query="SELECT g FROM GlobalRoleSettings g")
+public class GlobalRoleSettings implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name="role", length=45)
+ private String role;
+
+ @Column(name="lockdown")
+ private boolean lockdown;
+
+ public GlobalRoleSettings() {
+ super();
+ }
+
+ public GlobalRoleSettings(boolean lockdown) {
+ this.role = org.onap.policy.rest.XacmlAdminAuthorization.Role.ROLE_SUPERADMIN.toString();
+ this.lockdown = lockdown;
+ }
+
+ /**
+ * return the role
+ *
+ * @return the role
+ */
+ public String getRole() {
+ return role;
+ }
+
+ /**
+ * set role
+ *
+ * @param role the role to set
+ */
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ /**
+ * is the system locked down
+ *
+ * @return
+ */
+ public boolean isLockdown() {
+ return lockdown;
+ }
+
+ /**
+ * sets lockdown configuration
+ *
+ * @param lockdown
+ */
+ public void setLockdown(boolean lockdown) {
+ this.lockdown = lockdown;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java
new file mode 100644
index 000000000..a53ac2d58
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java
@@ -0,0 +1,270 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * AT&T - PROPRIETARY
+ * THIS FILE CONTAINS PROPRIETARY INFORMATION OF
+ * AT&T AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN
+ * ACCORDANCE WITH APPLICABLE AGREEMENTS.
+ *
+ * Copyright (c) 2013 AT&T Knowledge Ventures
+ * Unpublished and Not for Publication
+ * All Rights Reserved
+ */
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+
+import com.fasterxml.jackson.annotation.JsonManagedReference;
+
+/*
+ * The Entity class to persist a policy object and its configuration data
+ */
+
+/**
+ *
+ */
+@Entity
+//Add a non-unique index and a constraint that says the combo of policyName and scopeId must be unique
+@Table(name="GroupEntity")
+
+@NamedQueries({
+ @NamedQuery(name="GroupEntity.findAll", query="SELECT e FROM GroupEntity e "),
+ @NamedQuery(name="GroupEntity.deleteAll", query="DELETE FROM GroupEntity WHERE 1=1")
+})
+
+public class GroupEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column (name="groupKey", nullable=false)
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private long groupKey;
+
+ @Column (name="groupId", nullable=false)
+ private String groupId;
+
+ @Column(name="groupName", nullable=false, unique=false, length=255)
+ private String groupName;
+
+ @Version
+ @Column(name="version")
+ private int version;
+
+ @ManyToMany(cascade = CascadeType.ALL)
+ @JoinTable(name="PolicyGroupEntity",joinColumns={@JoinColumn(name="groupKey")}, inverseJoinColumns={@JoinColumn(name="policyId")})
+ @JsonManagedReference
+ private List<PolicyEntity> policies;
+
+ @Column(name="created_by", nullable=false, length=255)
+ private String createdBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=false, length=2048)
+ private String description = "NoDescription";
+
+ @Column(name="modified_by", nullable=false, length=255)
+ private String modifiedBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @Column(name="defaultGroup", nullable=false)
+ private boolean defaultGroup = false;
+ @Column(name="deleted", nullable=false)
+ private boolean deleted = false;
+
+ public GroupEntity() {
+ super();
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ /**
+ * @return the policyId
+ */
+ public String getGroupId() {
+ return groupId;
+ }
+ public long getGroupKey(){
+ return groupKey;
+ }
+
+ public void setGroupId(String groupId){
+ this.groupId = groupId;
+ }
+
+ /**
+ * @param policyId cannot be set
+ */
+
+ public String getgroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ public boolean isDefaultGroup(){
+ return defaultGroup;
+ }
+
+ public void setDefaultGroup(boolean isDefaultGroup){
+ this.defaultGroup = isDefaultGroup;
+ }
+
+
+
+ /**
+ * @return the configurationDataEntity
+ */
+ public List<PolicyEntity> getPolicies() {
+ return policies;
+ }
+
+ /**
+ * @param configurationDataEntity the configurationDataEntity to set
+ */
+ public void addPolicyToGroup(PolicyEntity policy) {
+ if(!this.policies.contains(policy)){
+ this.policies.add(policy);
+ }
+ }
+ public void removePolicyFromGroup(PolicyEntity policy){
+ this.policies.remove(policy);
+ }
+
+
+
+ /**
+ * @return the createdBy
+ */
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ /**
+ * @param createdBy the createdBy to set
+ */
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the modifiedBy
+ */
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+ /**
+ * @param modifiedBy the modifiedBy to set
+ */
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ /**
+ * @return the version
+ */
+ public int getVersion() {
+ return version;
+ }
+
+ /**
+ * @return the createdDate
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ /**
+ * @return the modifiedDate
+ */
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ /**
+ * @return the deleted
+ */
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+ /**
+ * @param deleted the deleted to set
+ */
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java
new file mode 100644
index 000000000..44f27ba35
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="GroupPolicyScopeList")
+@NamedQuery(name="GroupPolicyScopeList.findAll", query="SELECT e FROM GroupPolicyScopeList e ")
+public class GroupPolicyScopeList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="groupList")
+ private String groupList;
+
+ @Column(name="description")
+ private String description;
+
+ public GroupPolicyScopeList() {
+
+ }
+ public GroupPolicyScopeList(String string, String userid) {
+ this(domain);
+
+ }
+ public GroupPolicyScopeList(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getGroupName() {
+ return this.name;
+ }
+
+ public void setGroupName(String serviceName) {
+ this.name = serviceName;
+
+ }
+
+ public String getGroupList() {
+ return this.groupList;
+ }
+
+ public void setGroupList(String groupList) {
+ this.groupList = groupList;
+
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java
new file mode 100644
index 000000000..53fb89d4f
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="GroupServiceList")
+@NamedQuery(name="GroupServiceList.findAll", query="SELECT e FROM GroupServiceList e ")
+public class GroupServiceList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="serviceList ")
+ private String serviceList;
+
+
+ public GroupServiceList() {
+
+ }
+ public GroupServiceList(String string, String userid) {
+ this(domain);
+
+ }
+ public GroupServiceList(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getGroupName() {
+ return this.name;
+ }
+
+ public void setGroupName(String serviceName) {
+ this.name = serviceName;
+
+ }
+
+ public String getServiceList() {
+ return this.serviceList;
+ }
+
+ public void setServiceList(String serviceList) {
+ this.serviceList = serviceList;
+
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java
new file mode 100644
index 000000000..bb0507123
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="MicroServiceAttribute")
+@NamedQuery(name="MicroServiceAttribute.findAll", query="SELECT e FROM MicroServiceAttribute e ")
+public class MicroServiceAttribute implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="value")
+ private String value ;
+
+ @Column(name="modelName")
+ private String modelName;
+
+
+ public MicroServiceAttribute() {
+
+ }
+ public MicroServiceAttribute(String string, String userid) {
+ this(domain);
+
+ }
+ public MicroServiceAttribute(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+ public String getValue() {
+ return this.value ;
+ }
+
+ public void setValue(String value ) {
+ this.value = value ;
+ }
+ public String getModelName() {
+ return modelName;
+ }
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+} \ No newline at end of file
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java
new file mode 100644
index 000000000..f47b96ed8
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="MicroServiceConfigName")
+@NamedQuery(name="MicroServiceConfigName.findAll", query="SELECT e FROM MicroServiceConfigName e ")
+public class MicroServiceConfigName implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description ")
+ private String description ;
+
+
+ public MicroServiceConfigName() {
+
+ }
+ public MicroServiceConfigName(String string, String userid) {
+ this(domain);
+
+ }
+ public MicroServiceConfigName(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+ public String getDescriptionValue() {
+ return this.description ;
+ }
+
+ public void setDescriptionValue(String description ) {
+ this.description = description ;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java
new file mode 100644
index 000000000..4d82a3b20
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="MicroServiceLocation")
+@NamedQuery(name="MicroServiceLocation.findAll", query="SELECT e FROM MicroServiceLocation e ")
+public class MicroServiceLocation implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description ")
+ private String description ;
+
+
+ public MicroServiceLocation() {
+
+ }
+ public MicroServiceLocation(String string, String userid) {
+ this(domain);
+
+ }
+ public MicroServiceLocation(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+ public String getDescriptionValue() {
+ return this.description ;
+ }
+
+ public void setDescriptionValue(String description ) {
+ this.description = description ;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java
new file mode 100644
index 000000000..513799762
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java
@@ -0,0 +1,189 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * AT&T - PROPRIETARY
+ * THIS FILE CONTAINS PROPRIETARY INFORMATION OF
+ * AT&T AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN
+ * ACCORDANCE WITH APPLICABLE AGREEMENTS.
+ *
+ * Copyright (c) 2015 AT&T Knowledge Ventures
+ * Unpublished and Not for Publication
+ * All Rights Reserved
+ */
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+/*
+ * JPA for the Micro Service Models.
+ *
+ * @version: 0.1
+ */
+
+
+@Entity
+@Table(name="MicroServiceModels")
+@NamedQuery(name="MicroServiceModels.findAll", query="SELECT b FROM MicroServiceModels b ")
+public class MicroServiceModels implements Serializable{
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="modelName", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String modelName;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Column(name="dependency", nullable=true, length=2048)
+ private String dependency;
+
+ @Column(name="attributes", nullable=false, length=255)
+ private String attributes;
+
+ @Column(name="ref_attributes", nullable=false, length=255)
+ private String ref_attributes;
+
+ @Column (name="sub_attributes", nullable=false, length=2000)
+ private String sub_attributes;
+
+ @Column (name="version", nullable=false, length=2000)
+ private String version;
+
+ @Column (name="enumValues", nullable=false, length=2000)
+ private String enumValues;
+
+ @Column (name="annotation", nullable=false, length=2000)
+ private String annotation;
+
+ public String getSub_attributes() {
+ return sub_attributes;
+ }
+
+ public void setSub_attributes(String sub_attributes) {
+ this.sub_attributes = sub_attributes;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ @ManyToOne
+ @JoinColumn(name="imported_by")
+ private UserInfo userCreatedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public MicroServiceModels(){
+ }
+
+ public MicroServiceModels(String userid){
+
+ }
+
+ public String getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(String attributes) {
+ this.attributes = attributes;
+ }
+
+ public String getRef_attributes() {
+ return ref_attributes;
+ }
+
+ public void setRef_attributes(String ref_attributes) {
+ this.ref_attributes = ref_attributes;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getDependency() {
+ return dependency;
+ }
+
+ public void setDependency(String dependency) {
+ this.dependency = dependency;
+ }
+
+ public String getModelName(){
+ return this.modelName;
+ }
+
+ public void setModelName(String modelName){
+ this.modelName = modelName;
+ }
+
+ public String getEnumValues() {
+ return enumValues;
+ }
+
+ public void setEnumValues(String enumValues) {
+ this.enumValues = enumValues;
+ }
+
+ public String getAnnotation() {
+ return annotation;
+ }
+
+ public void setAnnotation(String annotation) {
+ this.annotation = annotation;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java
new file mode 100644
index 000000000..b3b52cdd4
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java
@@ -0,0 +1,227 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import com.att.research.xacml.api.Identifier;
+
+/**
+ * The persistent class for the Obadvice database table.
+ *
+ */
+@Entity
+@Table(name="Obadvice")
+@NamedQuery(name="Obadvice.findAll", query="SELECT o FROM Obadvice o")
+public class Obadvice implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final String OBLIGATION = "Obligation";
+ public static final String ADVICE = "Advice";
+ public static final String EFFECT_PERMIT = "Permit";
+ public static final String EFFECT_DENY = "Deny";
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="type", nullable=false)
+ private String type;
+
+ @Column(name="xacml_id", nullable=false, length=255)
+ private String xacmlId;
+
+ @Column(name="fulfill_on", nullable=true, length=32)
+ private String fulfillOn;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ //bi-directional one-to-many association to Attribute Assignment
+ @OneToMany(mappedBy="obadvice", orphanRemoval=true, cascade=CascadeType.REMOVE)
+ private Set<ObadviceExpression> obadviceExpressions = new HashSet<>(2);
+
+ @Column(name="created_by", nullable=false, length=255)
+ private String createdBy;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", nullable=false, updatable=false)
+ private Date createdDate;
+
+ @Column(name="modified_by", nullable=false, length=255)
+ private String modifiedBy;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ public Obadvice() {
+ this.type = Obadvice.OBLIGATION;
+ this.fulfillOn = Obadvice.EFFECT_PERMIT;
+ }
+
+ public Obadvice(String domain, String userid) {
+ this.xacmlId = domain;
+ this.type = Obadvice.OBLIGATION;
+ this.fulfillOn = Obadvice.EFFECT_PERMIT;
+ this.createdBy = userid;
+ this.modifiedBy = userid;
+ }
+
+ public Obadvice(Identifier id, String userid) {
+ this(id.stringValue(), userid);
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getCreatedBy() {
+ return this.createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFulfillOn() {
+ return this.fulfillOn;
+ }
+
+ public void setFulfillOn(String fulfillOn) {
+ this.fulfillOn = fulfillOn;
+ }
+
+ public String getModifiedBy() {
+ return this.modifiedBy;
+ }
+
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getXacmlId() {
+ return this.xacmlId;
+ }
+
+ public void setXacmlId(String xacmlId) {
+ this.xacmlId = xacmlId;
+ }
+
+ public Set<ObadviceExpression> getObadviceExpressions() {
+ return this.obadviceExpressions;
+ }
+
+ public void setObadviceExpressions(Set<ObadviceExpression> obadviceExpressions) {
+ this.obadviceExpressions = obadviceExpressions;
+ }
+
+ public ObadviceExpression addObadviceExpression(ObadviceExpression obadviceExpression) {
+ this.obadviceExpressions.add(obadviceExpression);
+ obadviceExpression.setObadvice(this);
+
+ return obadviceExpression;
+ }
+
+ public ObadviceExpression removeObadviceExpression(ObadviceExpression obadviceExpression) {
+ this.obadviceExpressions.remove(obadviceExpression);
+ obadviceExpression.setObadvice(null);
+
+ return obadviceExpression;
+ }
+
+ public void removeAllExpressions() {
+ if (this.obadviceExpressions == null) {
+ return;
+ }
+ for (ObadviceExpression expression : this.obadviceExpressions) {
+ expression.setObadvice(null);
+ }
+ this.obadviceExpressions.clear();
+ }
+
+ @Transient
+ public Obadvice clone() {
+ Obadvice obadvice = new Obadvice();
+
+ obadvice.type = this.type;
+ obadvice.xacmlId = this.xacmlId;
+ obadvice.fulfillOn = this.fulfillOn;
+ obadvice.description = this.description;
+ obadvice.createdBy = this.createdBy;
+ obadvice.modifiedBy = this.modifiedBy;
+ for (ObadviceExpression exp: this.obadviceExpressions) {
+ obadvice.addObadviceExpression(exp.clone());
+ }
+
+ return obadvice;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java
new file mode 100644
index 000000000..8d5be9742
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+
+
+/**
+ * The persistent class for the ObadviceExpressions database table.
+ *
+ */
+@Entity
+@Table(name="ObadviceExpressions")
+@NamedQuery(name="ObadviceExpression.findAll", query="SELECT o FROM ObadviceExpression o")
+public class ObadviceExpression implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final String EXPRESSION_APPLY = "Apply";
+ public static final String EXPRESSION_SELECTOR = "Attribute Selector";
+ public static final String EXPRESSION_VALUE = "Attribute Value";
+ public static final String EXPRESSION_FUNCTION = "Function";
+ public static final String EXPRESSION_REFERENCE = "Varable Reference";
+ public static final String EXPRESSION_DESIGNATOR = "Attribute Designator";
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ //unidirectional one-to-one association to Attribute
+ @OneToOne
+ @JoinColumn(name="attribute_id")
+ private Attribute attribute;
+
+ @Column(name="type", nullable=false)
+ private String type;
+
+ /*
+ @Lob
+ @Column(name="expression", nullable=false)
+ private byte[] expression;
+ */
+
+ //bi-directional many-to-one association to Obadvice
+ @ManyToOne
+ @JoinColumn(name="obadvice_id")
+ private Obadvice obadvice;
+
+ public ObadviceExpression() {
+ type = EXPRESSION_VALUE;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Attribute getAttribute() {
+ return this.attribute;
+ }
+
+ public void setAttribute(Attribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Obadvice getObadvice() {
+ return this.obadvice;
+ }
+
+ public void setObadvice(Obadvice obadvice) {
+ this.obadvice = obadvice;
+ }
+
+ public ObadviceExpression clone() {
+ ObadviceExpression expression = new ObadviceExpression();
+
+ expression.attribute = this.attribute;
+ expression.type = this.type;
+ expression.obadvice = this.obadvice;
+
+ return expression;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java
new file mode 100644
index 000000000..a4c0c85da
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+
+@Entity
+@Table(name="OnapName")
+@NamedQuery(name="OnapName.findAll", query="SELECT e FROM OnapName e ")
+public class OnapName implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="onap_Name", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String onapName;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ public OnapName() {
+
+ }
+
+ public OnapName(String string, String userid) {
+ this(domain);
+ }
+
+ public OnapName(String domain) {
+ this.onapName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();
+ } catch (Exception e) {
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "OnapName", "Exception caused While adding Modified by Role");
+ }
+ }
+ public String getOnapName() {
+ return this.onapName;
+ }
+
+ public void setOnapName(String onapName) {
+ this.onapName = onapName;
+
+ }
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java
new file mode 100644
index 000000000..c1fff1420
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java
@@ -0,0 +1,183 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ *
+ * */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+
+@Entity
+@Table(name = "PEPOptions")
+@NamedQuery(name = "PEPOptions.findAll", query= "Select p from PEPOptions p")
+public class PEPOptions implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "Id")
+ private int id;
+
+ @Column(name="PEP_NAME", nullable=false)
+ @OrderBy("asc")
+ private String pepName;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Column(name="Actions", nullable=true)
+ @OrderBy("asc")
+ private String actions;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(PEPOptions.class);
+
+ public PEPOptions(){
+
+ }
+
+ public PEPOptions(String string, String userid) {
+ this(string);
+ }
+
+ public PEPOptions(String domain) {
+ this.pepName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PEPOptions", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getPepName() {
+ return pepName;
+ }
+
+ public void setPepName(String pepName) {
+ this.pepName = pepName;
+ }
+
+ public String getActions() {
+ return actions;
+ }
+
+ public void setActions(String actions) {
+ this.actions = actions;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java
new file mode 100644
index 000000000..1540c8ad8
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java
@@ -0,0 +1,147 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+
+/**
+ * The persistent class for the PIPConfigParams database table.
+ *
+ */
+@Entity
+@Table(name="PIPConfigParams")
+@NamedQuery(name="PIPConfigParam.findAll", query="SELECT p FROM PIPConfigParam p")
+public class PIPConfigParam implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="PARAM_NAME", nullable=false, length=1024)
+ private String paramName;
+
+ @Column(name="PARAM_VALUE", nullable=false, length=2048)
+ private String paramValue;
+
+ @Column(name="PARAM_DEFAULT", nullable=true, length=2048)
+ private String paramDefault = null;
+
+ @Column(name="REQUIRED", nullable=false)
+ private char required = '0';
+
+ //bi-directional many-to-one association to PIPConfiguration
+ @ManyToOne
+ @JoinColumn(name="PIP_ID")
+ private PIPConfiguration pipconfiguration;
+
+ public PIPConfigParam() {
+ }
+
+ public PIPConfigParam(String param) {
+ this.paramName = param;
+ }
+
+ public PIPConfigParam(String param, String value) {
+ this(param);
+ this.paramValue = value;
+ }
+
+ public PIPConfigParam(PIPConfigParam param) {
+ this(param.getParamName(), param.getParamValue());
+ this.paramDefault = param.getParamDefault();
+ this.required = param.required;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getParamName() {
+ return this.paramName;
+ }
+
+ public void setParamName(String paramName) {
+ this.paramName = paramName;
+ }
+
+ public String getParamValue() {
+ return this.paramValue;
+ }
+
+ public void setParamValue(String paramValue) {
+ this.paramValue = paramValue;
+ }
+
+ public String getParamDefault() {
+ return paramDefault;
+ }
+
+ public void setParamDefault(String paramDefault) {
+ this.paramDefault = paramDefault;
+ }
+
+ public char getRequired() {
+ return required;
+ }
+
+ public void setRequired(char required) {
+ this.required = required;
+ }
+
+ public PIPConfiguration getPipconfiguration() {
+ return this.pipconfiguration;
+ }
+
+ public void setPipconfiguration(PIPConfiguration pipconfiguration) {
+ this.pipconfiguration = pipconfiguration;
+ }
+
+ @Transient
+ public boolean isRequired() {
+ return (this.required == '1');
+ }
+
+ @Transient
+ public void setRequired(boolean required) {
+ if (required) {
+ this.setRequired('1');
+ } else {
+ this.setRequired('0');
+ }
+ }
+
+ @Transient
+ @Override
+ public String toString() {
+ return "PIPConfigParam [id=" + id + ", paramName=" + paramName
+ + ", paramValue=" + paramValue + ", required=" + required + "]";
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java
new file mode 100644
index 000000000..5d731552b
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java
@@ -0,0 +1,537 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.xacml.api.XACMLErrorConstants;
+
+import com.att.research.xacml.api.pip.PIPException;
+import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
+import com.att.research.xacml.util.XACMLProperties;
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+
+
+/**
+ * The persistent class for the PIPConfiguration database table.
+ *
+ */
+@Entity
+@Table(name="PIPConfiguration")
+@NamedQuery(name="PIPConfiguration.findAll", query="SELECT p FROM PIPConfiguration p")
+public class PIPConfiguration implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final Log logger = LogFactory.getLog(PIPConfiguration.class);
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="DESCRIPTION", nullable=true, length=2048)
+ private String description;
+
+ @Column(name="NAME", nullable=false, length=255)
+ private String name;
+
+ @Column(name="CLASSNAME", nullable=false, length=2048)
+ private String classname;
+
+ @Column(name="ISSUER", nullable=true, length=1024)
+ private String issuer;
+
+ @Column(name="READ_ONLY", nullable=false)
+ private char readOnly = '0';
+
+ @Column(name="REQUIRES_RESOLVER", nullable=false)
+ private char requiresResolvers;
+
+ @Column(name="CREATED_BY", nullable=false, length=255)
+ private String createdBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="CREATED_DATE", nullable=false, updatable=false)
+ private Date createdDate;
+
+ @Column(name="MODIFIED_BY", nullable=false, length=255)
+ private String modifiedBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="MODIFIED_DATE", nullable=false)
+ private Date modifiedDate;
+
+ //bi-directional many-to-one association to PIPConfigParam
+ @OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE)
+ private Set<PIPConfigParam> pipconfigParams = new HashSet<>();
+
+ //bi-directional many-to-one association to PIPType
+ @ManyToOne
+ @JoinColumn(name="TYPE")
+ private PIPType piptype;
+
+ //bi-directional many-to-one association to PIPResolver
+ @OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE)
+ private Set<PIPResolver> pipresolvers = new HashSet<>();
+
+ public PIPConfiguration() {
+ }
+
+ public PIPConfiguration(PIPConfiguration config, String user) {
+ this.description = config.description;
+ this.name = config.name;
+ this.classname = config.classname;
+ this.issuer = config.issuer;
+ this.requiresResolvers = config.requiresResolvers;
+ this.readOnly = config.readOnly;
+ this.piptype = config.piptype;
+ for (PIPConfigParam param : config.pipconfigParams) {
+ this.addPipconfigParam(new PIPConfigParam(param));
+ }
+ for (PIPResolver resolver : config.pipresolvers) {
+ this.addPipresolver(new PIPResolver(resolver));
+ }
+ }
+
+ public PIPConfiguration(String id, Properties properties) throws PIPException {
+ this.readProperties(id, properties);
+ }
+
+ public PIPConfiguration(String id, Properties properties, String user) throws PIPException {
+ this.createdBy = user;
+ this.modifiedBy = user;
+ this.readProperties(id, properties);
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getClassname() {
+ return classname;
+ }
+
+ public void setClassname(String classname) {
+ this.classname = classname;
+ }
+
+ public String getIssuer() {
+ return issuer;
+ }
+
+ public void setIssuer(String issuer) {
+ this.issuer = issuer;
+ }
+
+ public char getReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(char readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ public char getRequiresResolvers() {
+ return requiresResolvers;
+ }
+
+ public void setRequiresResolvers(char requireResolvers) {
+ this.requiresResolvers = requireResolvers;
+ }
+
+ public Set<PIPConfigParam> getPipconfigParams() {
+ return this.pipconfigParams;
+ }
+
+ public void setPipconfigParams(Set<PIPConfigParam> pipconfigParams) {
+ this.pipconfigParams = pipconfigParams;
+ }
+
+ public PIPConfigParam addPipconfigParam(PIPConfigParam pipconfigParam) {
+ getPipconfigParams().add(pipconfigParam);
+ pipconfigParam.setPipconfiguration(this);
+
+ return pipconfigParam;
+ }
+
+ public PIPConfigParam removePipconfigParam(PIPConfigParam pipconfigParam) {
+ if (pipconfigParam == null) {
+ return pipconfigParam;
+ }
+ getPipconfigParams().remove(pipconfigParam);
+ pipconfigParam.setPipconfiguration(null);
+
+ return pipconfigParam;
+ }
+
+ @Transient
+ public void clearConfigParams() {
+ while (this.pipconfigParams.isEmpty() == false) {
+ this.removePipconfigParam(this.pipconfigParams.iterator().next());
+ }
+ }
+
+ public PIPType getPiptype() {
+ return this.piptype;
+ }
+
+ public void setPiptype(PIPType piptype) {
+ this.piptype = piptype;
+ }
+
+ public Set<PIPResolver> getPipresolvers() {
+ return this.pipresolvers;
+ }
+
+ public void setPipresolvers(Set<PIPResolver> pipresolvers) {
+ this.pipresolvers = pipresolvers;
+ }
+
+ public PIPResolver addPipresolver(PIPResolver pipresolver) {
+ getPipresolvers().add(pipresolver);
+ pipresolver.setPipconfiguration(this);
+
+ return pipresolver;
+ }
+
+ public PIPResolver removePipresolver(PIPResolver pipresolver) {
+ getPipresolvers().remove(pipresolver);
+ pipresolver.setPipconfiguration(null);
+
+ return pipresolver;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ @Transient
+ public boolean isReadOnly() {
+ return (this.readOnly == '1');
+ }
+
+ @Transient
+ public void setReadOnly(boolean readOnly) {
+ if (readOnly) {
+ this.readOnly = '1';
+ } else {
+ this.readOnly = '0';
+ }
+ }
+
+ @Transient
+ public boolean requiresResolvers() {
+ return (this.requiresResolvers == '1');
+ }
+
+ @Transient
+ public void setRequiresResolvers(boolean requires) {
+ if (requires) {
+ this.requiresResolvers = '1';
+ } else {
+ this.requiresResolvers = '0';
+ }
+ }
+
+ @Transient
+ public static Collection<PIPConfiguration> importPIPConfigurations(Properties properties) {
+ Collection<PIPConfiguration> configurations = new ArrayList<>();
+ String engines = properties.getProperty(XACMLProperties.PROP_PIP_ENGINES);
+ if (engines == null || engines.isEmpty()) {
+ return configurations;
+ }
+ for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(engines)) {
+ PIPConfiguration configuration;
+ try {
+ String user = "super-admin";
+ configuration = new PIPConfiguration(id, properties, user);
+ configuration.setCreatedBy(user);
+ configuration.setModifiedBy(user);
+ configurations.add(configuration);
+ } catch (PIPException e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Import failed: " + e.getLocalizedMessage());
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Import failed");
+ }
+ }
+
+ return configurations;
+ }
+
+ @Transient
+ protected void readProperties(String id, Properties properties) throws PIPException {
+ //
+ // Save the id if we don't have one already
+ //
+
+ if (this.id == 0) {
+ try {
+ this.id = Integer.parseInt(id);
+ } catch (NumberFormatException e) {
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Convert id to integer failed: " + id);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Convert id to integer failed");
+ }
+ }
+ //
+ // Get its classname, this MUST exist.
+ //
+ this.classname = properties.getProperty(id + ".classname");
+ if (this.classname == null) {
+ throw new PIPException("PIP Engine defined without a classname");
+ }
+ //
+ // Go through each property
+ //
+ for (Object name : properties.keySet()) {
+ if (name.toString().startsWith(id) == false) {
+ continue;
+ }
+ if (name.equals(id + ".classname")) {
+ //
+ // We already saved this
+ //
+ } else if (name.equals(id + "." + StdConfigurableEngine.PROP_NAME)) {
+ this.name = properties.getProperty(name.toString());
+ } else if (name.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) {
+ this.description = properties.getProperty(name.toString());
+ } else if (name.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) {
+ this.issuer = properties.getProperty(name.toString());
+ } else if (name.equals(id + ".resolvers")) {
+ //
+ // It has resolvers, make sure this is set to true if
+ // it has been already.
+ //
+ this.setRequiresResolvers(true);
+ //
+ // Parse the resolvers
+ //
+ Collection<PIPResolver> resolvers = PIPResolver.importResolvers(id + ".resolver",
+ properties.getProperty(name.toString()),
+ properties,"super-admin"
+ );
+ for (PIPResolver resolver : resolvers) {
+ this.addPipresolver(resolver);
+ }
+ } else if (name.toString().startsWith(id + ".resolver")) {
+ //
+ // Ignore, the PIPResolver will parse these values
+ //
+ } else {
+ //
+ // Config Parameter
+ //
+ this.addPipconfigParam(new PIPConfigParam(name.toString().substring(id.length() + 1),
+ properties.getProperty(name.toString())));
+ }
+ }
+ //
+ // Make sure we have a name at least
+ //
+ if (this.name == null) {
+ this.name = id;
+ }
+ }
+
+
+ @Transient
+ public Map<String, String> getConfiguration(String name) {
+ String prefix;
+ if (name == null) {
+ prefix = Integer.toString(this.id);
+ } else {
+ prefix = name;
+ }
+ if (prefix.endsWith(".") == false) {
+ prefix = prefix + ".";
+ }
+ Map<String, String> map = new HashMap<>();
+ map.put(prefix + "classname", this.classname);
+ map.put(prefix + "name", this.name);
+ if (this.description != null) {
+ map.put(prefix + "description", this.description);
+ }
+ if (this.issuer != null) {
+ map.put(prefix + "issuer", this.issuer);
+ }
+
+ for (PIPConfigParam param : this.pipconfigParams) {
+ map.put(prefix + param.getParamName(), param.getParamValue());
+ }
+
+ List<String> ids = new ArrayList<>();
+ Iterator<PIPResolver> iter = this.pipresolvers.iterator();
+ while (iter.hasNext()) {
+ PIPResolver resolver = iter.next();
+ String id = Integer.toString(resolver.getId());
+ Map<String, String> resolverMap = resolver.getConfiguration(prefix + "resolver." + id);
+ map.putAll(resolverMap);
+ ids.add(id);
+ }
+ if (ids.size() > 0) {
+ map.put(prefix + "resolvers", Joiner.on(',').join(ids));
+ }
+ return map;
+ }
+
+ @Transient
+ public Properties generateProperties(String name) {
+ String prefix;
+ if (name == null) {
+ prefix = Integer.toString(this.id);
+ } else {
+ if (name.endsWith(".")) {
+ prefix = name;
+ } else {
+ prefix = name + ".";
+ }
+ }
+ Properties props = new Properties();
+ props.setProperty("xacml.pip.engines", name);
+ props.setProperty(prefix + "classname", this.classname);
+ props.setProperty(prefix + "name", this.name);
+ if (this.description != null) {
+ props.setProperty(prefix + "description", this.description);
+ }
+ if (this.issuer != null && this.issuer.isEmpty() == false) {
+ props.setProperty(prefix + "issuer", this.issuer);
+ }
+
+ for (PIPConfigParam param : this.pipconfigParams) {
+ props.setProperty(prefix + param.getParamName(), param.getParamValue());
+ }
+
+ List<String> ids = new ArrayList<>();
+ Iterator<PIPResolver> iter = this.pipresolvers.iterator();
+ while (iter.hasNext()) {
+ PIPResolver resolver = iter.next();
+ String id = Integer.toString(resolver.getId());
+ resolver.generateProperties(props, prefix + "resolver." + id);
+ ids.add(id);
+ }
+ if (ids.size() > 0) {
+ props.setProperty(prefix + "resolvers", Joiner.on(',').join(ids));
+ }
+ return props;
+ }
+
+ @Transient
+ @Override
+ public String toString() {
+ return "PIPConfiguration [id=" + id + ", piptype=" + piptype
+ + ", classname=" + classname + ", name=" + name
+ + ", description=" + description + ", issuer=" + issuer
+ + ", readOnly=" + readOnly + ", requiresResolvers="
+ + requiresResolvers + ", createdBy=" + createdBy
+ + ", createdDate=" + createdDate + ", modifiedBy=" + modifiedBy
+ + ", modifiedDate=" + modifiedDate + ", pipconfigParams="
+ + pipconfigParams + ", pipresolvers=" + pipresolvers + "]";
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java
new file mode 100644
index 000000000..daab6d658
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java
@@ -0,0 +1,365 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import com.att.research.xacml.api.pip.PIPException;
+import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
+import com.google.common.base.Splitter;
+
+
+/**
+ * The persistent class for the PIPResolver database table.
+ *
+ */
+@Entity
+@Table(name="PIPResolver")
+@NamedQuery(name="PIPResolver.findAll", query="SELECT p FROM PIPResolver p")
+public class PIPResolver implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="DESCRIPTION", nullable=true, length=2048)
+ private String description;
+
+ @Column(name="NAME", nullable=false, length=255)
+ private String name;
+
+ @Column(name="ISSUER", nullable=true, length=1024)
+ private String issuer;
+
+ @Column(name="CLASSNAME", nullable=false, length=2048)
+ private String classname;
+
+ @Column(name="READ_ONLY", nullable=false)
+ private char readOnly = '0';
+
+ @Column(name="CREATED_BY", nullable=false, length=255)
+ private String createdBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="CREATED_DATE", nullable=false, updatable=false)
+ private Date createdDate;
+
+ @Column(name="MODIFIED_BY", nullable=false, length=255)
+ private String modifiedBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="MODIFIED_DATE", nullable=false)
+ private Date modifiedDate;
+
+ //bi-directional many-to-one association to PIPConfiguration
+ @ManyToOne
+ @JoinColumn(name="PIP_ID")
+ private PIPConfiguration pipconfiguration;
+
+ //bi-directional many-to-one association to PIPResolverParam
+ @OneToMany(mappedBy="pipresolver", orphanRemoval=true, cascade=CascadeType.REMOVE)
+ private Set<PIPResolverParam> pipresolverParams = new HashSet<>();
+
+ public PIPResolver() {
+ }
+
+ public PIPResolver(String prefix, Properties properties, String user) throws PIPException {
+ this.createdBy = user;
+ this.modifiedBy = user;
+ this.readOnly = '0';
+ this.readProperties(prefix, properties);
+ }
+
+ public PIPResolver(PIPResolver resolver) {
+ this.name = resolver.name;
+ this.description = resolver.description;
+ this.issuer = resolver.issuer;
+ this.classname = resolver.classname;
+ this.readOnly = resolver.readOnly;
+ for (PIPResolverParam param : this.pipresolverParams) {
+ this.addPipresolverParam(new PIPResolverParam(param));
+ }
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getIssuer() {
+ return issuer;
+ }
+
+ public void setIssuer(String issuer) {
+ this.issuer = issuer;
+ }
+
+ public String getClassname() {
+ return classname;
+ }
+
+ public void setClassname(String classname) {
+ this.classname = classname;
+ }
+
+ public char getReadOnly() {
+ return readOnly;
+ }
+
+ public void setReadOnly(char readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public PIPConfiguration getPipconfiguration() {
+ return this.pipconfiguration;
+ }
+
+ public void setPipconfiguration(PIPConfiguration pipconfiguration) {
+ this.pipconfiguration = pipconfiguration;
+ }
+
+ public Set<PIPResolverParam> getPipresolverParams() {
+ return this.pipresolverParams;
+ }
+
+ public void setPipresolverParams(Set<PIPResolverParam> pipresolverParams) {
+ this.pipresolverParams = pipresolverParams;
+ }
+
+ public PIPResolverParam addPipresolverParam(PIPResolverParam pipresolverParam) {
+ getPipresolverParams().add(pipresolverParam);
+ pipresolverParam.setPipresolver(this);
+
+ return pipresolverParam;
+ }
+
+ public PIPResolverParam removePipresolverParam(PIPResolverParam pipresolverParam) {
+ if (pipresolverParam == null) {
+ return pipresolverParam;
+ }
+ getPipresolverParams().remove(pipresolverParam);
+ pipresolverParam.setPipresolver(null);
+
+ return pipresolverParam;
+ }
+
+ @Transient
+ public void clearParams() {
+ while (this.pipresolverParams.isEmpty() == false) {
+ this.removePipresolverParam(this.pipresolverParams.iterator().next());
+ }
+ }
+
+ @Transient
+ public boolean isReadOnly() {
+ return (this.readOnly == '1');
+ }
+
+ @Transient
+ public void setReadOnly(boolean readOnly) {
+ if (readOnly) {
+ this.readOnly = '1';
+ } else {
+ this.readOnly = '0';
+ }
+ }
+
+ @Transient
+ public static Collection<PIPResolver> importResolvers(String prefix, String list, Properties properties, String user) throws PIPException {
+ Collection<PIPResolver> resolvers = new ArrayList<>();
+ for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(list)) {
+ resolvers.add(new PIPResolver(prefix + "." + id, properties, user));
+ }
+ return resolvers;
+ }
+
+ @Transient
+ protected void readProperties(String prefix, Properties properties) throws PIPException {
+ //
+ // Get its classname, this MUST exist.
+ //
+ this.classname = properties.getProperty(prefix + ".classname");
+ if (this.classname == null) {
+ throw new PIPException("PIP Engine defined without a classname");
+ }
+ //
+ // Go through each property
+ //
+ for (Object name : properties.keySet()) {
+ if (name.toString().startsWith(prefix) == false) {
+ continue;
+ }
+ if (name.equals(prefix + ".classname")) {
+ //
+ // We already saved this
+ //
+ } else if (name.equals(prefix + "." + StdConfigurableEngine.PROP_NAME)) {
+ this.name = properties.getProperty(name.toString());
+ } else if (name.equals(prefix + "." + StdConfigurableEngine.PROP_DESCRIPTION)) {
+ this.description = properties.getProperty(name.toString());
+ } else if (name.equals(prefix + "." + StdConfigurableEngine.PROP_ISSUER)) {
+ this.issuer = properties.getProperty(name.toString());
+ } else {
+ this.addPipresolverParam(new PIPResolverParam(name.toString().substring(prefix.length() + 1),
+ properties.getProperty(name.toString())));
+ }
+ }
+ }
+
+ @Transient
+ public Map<String, String> getConfiguration(String prefix) {
+ Map<String, String> map = new HashMap<>();
+ if (prefix.endsWith(".") == false) {
+ prefix = prefix + ".";
+ }
+ map.put(prefix + "classname", this.classname);
+ map.put(prefix + "name", this.name);
+ if (this.description != null) {
+ map.put(prefix + "description", this.description);
+ }
+ if (this.issuer != null && this.issuer.isEmpty() != false) {
+ map.put(prefix + "issuer", this.issuer);
+ }
+ for (PIPResolverParam param : this.pipresolverParams) {
+ map.put(prefix + param.getParamName(), param.getParamValue());
+ }
+ return map;
+ }
+
+ @Transient
+ public void generateProperties(Properties props, String prefix) {
+ if (prefix.endsWith(".") == false) {
+ prefix = prefix + ".";
+ }
+ props.setProperty(prefix + "classname", this.classname);
+ props.setProperty(prefix + "name", this.name);
+ if (this.description != null) {
+ props.setProperty(prefix + "description", this.description);
+ }
+ if (this.issuer != null && this.issuer.isEmpty() != false) {
+ props.setProperty(prefix + "issuer", this.issuer);
+ }
+ for (PIPResolverParam param : this.pipresolverParams) {
+ props.setProperty(prefix + param.getParamName(), param.getParamValue());
+ }
+ }
+
+ @Transient
+ @Override
+ public String toString() {
+ return "PIPResolver [id=" + id + ", classname=" + classname + ", name="
+ + name + ", description=" + description + ", issuer=" + issuer
+ + ", readOnly=" + readOnly + ", createdBy=" + createdBy
+ + ", createdDate=" + createdDate + ", modifiedBy=" + modifiedBy
+ + ", modifiedDate=" + modifiedDate + ", pipresolverParams="
+ + pipresolverParams + "]";
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java
new file mode 100644
index 000000000..8dec7915a
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java
@@ -0,0 +1,147 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.*;
+
+
+/**
+ * The persistent class for the PIPResolverParams database table.
+ *
+ */
+@Entity
+@Table(name="PIPResolverParams")
+@NamedQuery(name="PIPResolverParam.findAll", query="SELECT p FROM PIPResolverParam p")
+public class PIPResolverParam implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="PARAM_NAME", nullable=false, length=1024)
+ private String paramName;
+
+ @Column(name="PARAM_VALUE", nullable=false, length=2048)
+ private String paramValue;
+
+ @Column(name="PARAM_DEFAULT", nullable=true, length=2048)
+ private String paramDefault;
+
+ @Column(name="REQUIRED", nullable=false)
+ private char required = '0';
+
+ //bi-directional many-to-one association to PIPResolver
+ @ManyToOne
+ @JoinColumn(name="ID_RESOLVER")
+ private PIPResolver pipresolver;
+
+ public PIPResolverParam() {
+ }
+
+ public PIPResolverParam(String name) {
+ this.paramName = name;
+ }
+
+ public PIPResolverParam(String name, String value) {
+ this(name);
+ this.paramValue = value;
+ }
+
+ public PIPResolverParam(PIPResolverParam param) {
+ this(param.getParamName(), param.getParamValue());
+ this.paramDefault = param.getParamDefault();
+ this.required = param.required;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getParamName() {
+ return this.paramName;
+ }
+
+ public void setParamName(String paramName) {
+ this.paramName = paramName;
+ }
+
+ public String getParamValue() {
+ return this.paramValue;
+ }
+
+ public void setParamValue(String paramValue) {
+ this.paramValue = paramValue;
+ }
+
+ public String getParamDefault() {
+ return paramDefault;
+ }
+
+ public void setParamDefault(String paramDefault) {
+ this.paramDefault = paramDefault;
+ }
+
+ public char getRequired() {
+ return required;
+ }
+
+ public void setRequired(char required) {
+ this.required = required;
+ }
+
+ public PIPResolver getPipresolver() {
+ return this.pipresolver;
+ }
+
+ public void setPipresolver(PIPResolver pipresolver) {
+ this.pipresolver = pipresolver;
+ }
+
+ @Transient
+ public boolean isRequired() {
+ return this.required == '1';
+ }
+
+ @Transient
+ public void setRequired(boolean required) {
+ if (required) {
+ this.required = '1';
+ } else {
+ this.required = '0';
+ }
+ }
+
+ @Transient
+ @Override
+ public String toString() {
+ return "PIPResolverParam [id=" + id + ", paramName=" + paramName
+ + ", paramValue=" + paramValue + ", required=" + required + "]";
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java
new file mode 100644
index 000000000..0ef4388c4
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+
+/**
+ * The persistent class for the PIPType database table.
+ *
+ */
+@Entity
+@Table(name="PIPType")
+@NamedQuery(name="PIPType.findAll", query="SELECT p FROM PIPType p")
+public class PIPType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final String TYPE_SQL = "SQL";
+ public static final String TYPE_LDAP = "LDAP";
+ public static final String TYPE_CSV = "CSV";
+ public static final String TYPE_HYPERCSV = "Hyper-CSV";
+ public static final String TYPE_CUSTOM = "Custom";
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="type", nullable=false, length=45)
+ private String type;
+
+ //bi-directional many-to-one association to PIPConfiguration
+ @OneToMany(mappedBy="piptype")
+ private Set<PIPConfiguration> pipconfigurations;
+
+ public PIPType() {
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Set<PIPConfiguration> getPipconfigurations() {
+ return this.pipconfigurations;
+ }
+
+ public void setPipconfigurations(Set<PIPConfiguration> pipconfigurations) {
+ this.pipconfigurations = pipconfigurations;
+ }
+
+ public PIPConfiguration addPipconfiguration(PIPConfiguration pipconfiguration) {
+ getPipconfigurations().add(pipconfiguration);
+ pipconfiguration.setPiptype(this);
+
+ return pipconfiguration;
+ }
+
+ public PIPConfiguration removePipconfiguration(PIPConfiguration pipconfiguration) {
+ getPipconfigurations().remove(pipconfiguration);
+ pipconfiguration.setPiptype(null);
+
+ return pipconfiguration;
+ }
+
+ @Transient
+ public boolean isSQL() {
+ return this.type.equals(TYPE_SQL);
+ }
+
+ @Transient
+ public boolean isLDAP() {
+ return this.type.equals(TYPE_LDAP);
+ }
+
+ @Transient
+ public boolean isCSV() {
+ return this.type.equals(TYPE_CSV);
+ }
+
+ @Transient
+ public boolean isHyperCSV() {
+ return this.type.equals(TYPE_HYPERCSV);
+ }
+
+ @Transient
+ public boolean isCustom() {
+ return this.type.equals(TYPE_CUSTOM);
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java
new file mode 100644
index 000000000..a76bd624a
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java
@@ -0,0 +1,241 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/*
+ * The Entity class to persist a policy object and its configuration data
+ */
+
+/**
+ *
+ */
+@Entity
+//Add a non-unique index and a constraint that says the combo of policyName and scopeId must be unique
+@Table(name="PdpEntity")
+@NamedQueries({
+ @NamedQuery(name="PdpEntity.findAll", query="SELECT e FROM PdpEntity e "),
+ @NamedQuery(name="PdpEntity.deleteAll", query="DELETE FROM PdpEntity WHERE 1=1")
+})
+
+public class PdpEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqPdp")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column (name="pdpKey")
+ private long pdpKey;
+
+ @Column (name="pdpId", nullable=false, unique=false, length=255)
+ private String pdpId;
+
+ @Column(name="pdpName", nullable=false, unique=false, length=255)
+ private String pdpName;
+
+ @Column(name="jmxPort", nullable=false, unique=false)
+ private int jmxPort;
+
+
+ @ManyToOne(optional=false)
+ @JoinColumn(name="groupKey", referencedColumnName="groupKey")
+ private GroupEntity groupEntity;
+
+ @Column(name="created_by", nullable=false, length=255)
+ private String createdBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=false, length=2048)
+ private String description = "NoDescription";
+
+ @Column(name="modified_by", nullable=false, length=255)
+ private String modifiedBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @Column(name="deleted", nullable=false)
+ private boolean deleted = false;
+
+ public PdpEntity() {
+ super();
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ public long getPdpKey(){
+ return pdpKey;
+ }
+ /**
+ * @return the policyId
+ */
+ public String getPdpId() {
+ return pdpId;
+ }
+
+ public void setPdpId(String id){
+ pdpId = id;
+ }
+ /**
+ * @param policyId cannot be set
+ */
+
+ public String getPdpName() {
+ return pdpName;
+ }
+
+ public void setPdpName(String groupName) {
+ this.pdpName = groupName;
+ }
+
+
+
+ /**
+ * @return the configurationDataEntity
+ */
+ public GroupEntity getGroup() {
+ return groupEntity;
+ }
+
+ /**
+ * @param configurationDataEntity the configurationDataEntity to set
+ */
+ public void setGroup(GroupEntity group) {
+ this.groupEntity = group;
+ }
+
+
+
+ /**
+ * @return the createdBy
+ */
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ /**
+ * @param createdBy the createdBy to set
+ */
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the modifiedBy
+ */
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+ /**
+ * @param modifiedBy the modifiedBy to set
+ */
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ /**
+ * @return the version
+ */
+ public int getJmxPort() {
+ return jmxPort;
+ }
+
+ public void setJmxPort(int jmxPort){
+ this.jmxPort = jmxPort;
+ }
+
+ /**
+ * @return the createdDate
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ /**
+ * @return the modifiedDate
+ */
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ /**
+ * @return the deleted
+ */
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+ /**
+ * @param deleted the deleted to set
+ */
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java
new file mode 100644
index 000000000..4488fcd30
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.att.research.xacml.api.Identifier;
+
+@Entity
+@Table(name="PolicyAlgorithms")
+@NamedQuery(name="PolicyAlgorithms.findAll", query="SELECT d FROM PolicyAlgorithms d")
+public class PolicyAlgorithms implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final char STANDARD = 'S';
+ public static final char CUSTOM = 'C';
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="is_standard", nullable=false)
+ private char isStandard;
+
+ @Column(name="xacml_id", nullable=false, unique=true, length=255)
+ private String xacmlId;
+
+ @Column(name="short_name", nullable=false, length=64)
+ private String shortName;
+
+ public PolicyAlgorithms(Identifier identifier, char standard) {
+ this.isStandard = standard;
+ if (identifier != null) {
+ this.xacmlId = identifier.stringValue();
+ }
+ }
+
+ public PolicyAlgorithms(Identifier identifier) {
+ this(identifier, PolicyAlgorithms.STANDARD);
+ }
+
+ public PolicyAlgorithms() {
+ this(null, PolicyAlgorithms.STANDARD);
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public char getIsStandard() {
+ return this.isStandard;
+ }
+
+ public void setIsStandard(char isStandard) {
+ this.isStandard = isStandard;
+ }
+
+ @Transient
+ public boolean isStandard() {
+ return (this.isStandard == PolicyAlgorithms.STANDARD);
+ }
+
+ @Transient
+ public boolean isCustom() {
+ return (this.isStandard == PolicyAlgorithms.CUSTOM);
+ }
+
+ public String getXacmlId() {
+ return this.xacmlId;
+ }
+
+ public void setXacmlId(String xacmlId) {
+ this.xacmlId = xacmlId;
+ }
+
+ public String getShortName() {
+ return shortName;
+ }
+
+ public void setShortName(String shortName) {
+ this.shortName = shortName;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java
new file mode 100644
index 000000000..8b0843ed0
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java
@@ -0,0 +1,150 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/*
+ * The Entity class to persist a PolicyDBDaoEntity object for registration of PolicyDBDao
+ */
+
+/**
+ *
+ */
+@Entity
+@Table(name="PolicyDBDaoEntity")
+
+@NamedQueries({
+ @NamedQuery(name="PolicyDBDaoEntity.findAll", query="SELECT e FROM PolicyDBDaoEntity e "),
+ @NamedQuery(name="PolicyDBDaoEntity.deleteAll", query="DELETE FROM PolicyDBDaoEntity WHERE 1=1")
+})
+
+public class PolicyDBDaoEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name="policyDBDaoUrl", nullable=false, unique=true)
+ private String policyDBDaoUrl;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ //username for the pap server that registered this PolicyDBDaoEntity
+ @Column(name="username")
+ private String username;
+
+ //AES encrypted password for the pap server that registered this PolicyDBDaoEntity
+ @Column(name="password")
+ private String password;
+
+ //A column to allow some descriptive text. For example: Atlanta data center
+ @Column(name="description", nullable=false, length=2048)
+ private String description = "NoDescription";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ public PolicyDBDaoEntity() {
+ super();
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ /**
+ * @return the policyDBDaoUrl
+ */
+ public String getPolicyDBDaoUrl() {
+ return policyDBDaoUrl;
+ }
+
+ /**
+ * @param url the policyDBDaoUrl to set
+ */
+ public void setPolicyDBDaoUrl(String url) {
+ this.policyDBDaoUrl = url;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the createdDate
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ /**
+ * @return the modifiedDate
+ */
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public String getUsername(){
+ return this.username;
+ }
+ public void setUsername(String username){
+ this.username = username;
+ }
+ public String getPassword(){
+ return this.password;
+ }
+ public void setPassword(String password){
+ this.password = password;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java
new file mode 100644
index 000000000..bfb4218ab
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java
@@ -0,0 +1,159 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+@Entity
+@Table(name="PolicyEditorScopes")
+@NamedQuery(name="PolicyEditorScopes.findAll", query="SELECT p FROM PolicyEditorScopes p ")
+public class PolicyEditorScopes implements Serializable{
+ private static final long serialVersionUID = 1L;
+ private static Log logger = LogFactory.getLog(PolicyEditorScopes.class);
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="scopeName", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String scopeName;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public PolicyEditorScopes() {
+ }
+
+ public PolicyEditorScopes(String string, String userid) {
+ this(domain);
+ }
+
+ public PolicyEditorScopes(String domain) {
+ this.scopeName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();
+ } catch (Exception e) {
+ logger.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyEditorScopes", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getScopeName() {
+ return scopeName;
+ }
+
+ public void setScopeName(String scopeName) {
+ this.scopeName = scopeName;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java
new file mode 100644
index 000000000..4cb4440c1
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java
@@ -0,0 +1,308 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToOne;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Version;
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonManagedReference;
+
+/*
+ * The Entity class to persist a policy object and its configuration data
+ */
+
+/**
+ *
+ */
+@Entity
+//Add a non-unique index and a constraint that says the combo of policyName and scopeId must be unique
+@Table(name="PolicyEntity")
+
+@NamedQueries({
+ @NamedQuery(name="PolicyEntity.findAll", query="SELECT e FROM PolicyEntity e "),
+ @NamedQuery(name="PolicyEntity.findAllByDeletedFlag", query="SELECT e FROM PolicyEntity e WHERE e.deleted = :deleted"),
+ @NamedQuery(name="PolicyEntity.FindById", query="SELECT e FROM PolicyEntity e WHERE e.policyId = :id"),
+ @NamedQuery(name="PolicyEntity.deleteAll", query="DELETE FROM PolicyEntity WHERE 1=1"),
+ @NamedQuery(name="PolicyEntity.findByNameAndScope", query="SELECT e FROM PolicyEntity e WHERE e.policyName = :name AND e.scope = :scope")
+})
+
+public class PolicyEntity implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column (name="policyId")
+ @JsonBackReference
+ private long policyId;
+
+ @Column(name="policyName", nullable=false, unique=false, length=255)
+ private String policyName;
+
+ //The scope is the directory structure in dot notation. For example: org.onap.myproject
+ @Column(name="scope", nullable=false, unique=false, length=255)
+ private String scope;
+
+ @Version
+ @Column(name="version")
+ private int version;
+
+ //not going to be used
+ @Column(name="policyVersion")
+ private int policyVersion = 0;
+
+ @Lob
+ @Column(name="policyData", nullable=false, columnDefinition="TEXT")
+ private String policyData = "NoData";
+
+ @OneToOne(optional=true, orphanRemoval=true)
+ @JoinColumn(name="configurationDataId")
+ @JsonManagedReference
+ private ConfigurationDataEntity configurationDataEntity;
+
+ @OneToOne(optional=true, orphanRemoval=true)
+ @JoinColumn(name="actionBodyId")
+ @JsonManagedReference
+ private ActionBodyEntity actionBodyEntity;
+
+ @Column(name="created_by", nullable=false, length=255)
+ private String createdBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=false, length=2048)
+ private String description = "NoDescription";
+
+ @Column(name="modified_by", nullable=false, length=255)
+ private String modifiedBy = "guest";
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @Column(name="deleted", nullable=false)
+ private boolean deleted = false;
+
+ public PolicyEntity() {
+ super();
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ }
+
+ /*
+ public void resetPolicyVersion(){
+ this.policyVersion = 1;
+ }
+ public void advancePolicyVersion(){
+ this.policyVersion++;
+ }
+ public int getPolicyVersion(){
+ return this.policyVersion;
+ }
+ public void setPolicyVersion(int polVer){
+ this.policyVersion = polVer;
+ }
+ */
+
+ /**
+ * @return the policyId
+ */
+ public long getPolicyId() {
+ return policyId;
+ }
+
+ /**
+ * @param policyId cannot be set
+ */
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ /**
+ * @return the policyData
+ */
+ public String getPolicyData() {
+ return policyData;
+ }
+
+ /**
+ * @param policyData the policyData to set
+ */
+ public void setPolicyData(String policyData) {
+ this.policyData = policyData;
+ }
+
+ /**
+ * @return the configurationDataEntity
+ */
+ public ConfigurationDataEntity getConfigurationData() {
+ return configurationDataEntity;
+ }
+
+ /**
+ * @param configurationDataEntity the configurationDataEntity to set
+ */
+ public void setConfigurationData(ConfigurationDataEntity configurationDataEntity) {
+ this.configurationDataEntity = configurationDataEntity;
+ }
+
+ /**
+ * @return the actionBodyEntity
+ */
+ public ActionBodyEntity getActionBodyEntity() {
+ return actionBodyEntity;
+ }
+
+ /**
+ * @param actionBodyEntity the actionBodyEntity to set
+ */
+ public void setActionBodyEntity(ActionBodyEntity actionBodyEntity) {
+ this.actionBodyEntity = actionBodyEntity;
+ }
+
+ /**
+ * @return the scope
+ */
+ public String getScope() {
+ return scope;
+ }
+
+ /**
+ * @param scope the scope to set
+ */
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ /**
+ * @return the createdBy
+ */
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ /**
+ * @param createdBy the createdBy to set
+ */
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * @param description the description to set
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @return the modifiedBy
+ */
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+ /**
+ * @param modifiedBy the modifiedBy to set
+ */
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+ /**
+ * @return the version
+ */
+ public int getVersion() {
+ return version;
+ }
+
+ /**
+ * @return the createdDate
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ /**
+ * @return the modifiedDate
+ */
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ /**
+ * @return the deleted
+ */
+ public boolean isDeleted() {
+ return deleted;
+ }
+
+ /**
+ * @param deleted the deleted to set
+ */
+ public void setDeleted(boolean deleted) {
+ this.deleted = deleted;
+ }
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java
new file mode 100644
index 000000000..ef2ff6e56
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="PolicyGroupEntity")
+@NamedQuery(name="PolicyGroupEntity.findAll", query="SELECT p FROM PolicyGroupEntity p ")
+public class PolicyGroupEntity implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name="groupKey")
+ private int groupKey;
+
+ @Id
+ @Column(name="policyid")
+ private int policyid;
+
+ public int getGroupKey() {
+ return groupKey;
+ }
+
+ public void setGroupKey(int groupKey) {
+ this.groupKey = groupKey;
+ }
+
+ public int getPolicyid() {
+ return policyid;
+ }
+
+ public void setPolicyid(int policyid) {
+ this.policyid = policyid;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java
new file mode 100644
index 000000000..2a6571e52
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyManagement.java
@@ -0,0 +1,162 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.sql.Clob;
+import java.sql.Timestamp;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+
+
+/**
+ * The persistent class for the roles database table.
+ *
+ */
+@Entity
+@Table(name="policy_manangement")
+@NamedQuery(name="PolicyManagement.findAll", query="SELECT r FROM PolicyManagement r")
+public class PolicyManagement implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+
+ @Column(name="id")
+ private int id;
+
+ @Column(name="POLICY_NAME", nullable=false, length=45)
+ private String policyName;
+
+ @Column(name="scope", nullable=false, length=45)
+ private String scope;
+
+ @Column(name="ONAP_NAME", nullable=false, length=45)
+ private String onapName;
+
+ @Column(name="CONFIG_NAME", nullable=false, length=45)
+ private String configName;
+
+ @Column(name="XML", nullable=false)
+ private Clob xml;
+
+ @Column(name="CREATE_DATE_TIME", nullable=false)
+ private Timestamp createDateTime;
+
+
+ @Column(name="CREATED_BY", nullable=false, length=45)
+ private String createdBy;
+
+ @Column(name="UPDATE_DATE_TIME", nullable=false)
+ private Timestamp updateDateTime;
+
+ @Column(name="UPDATED_BY", nullable=false, length=45)
+ private String updatedBy;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ public String getOnapName() {
+ return onapName;
+ }
+
+ public void setOnapName(String onapName) {
+ this.onapName = onapName;
+ }
+
+ public String getConfigName() {
+ return configName;
+ }
+
+ public void setConfigName(String configName) {
+ this.configName = configName;
+ }
+
+ public Clob getXml() {
+ return xml;
+ }
+
+ public void setXml(Clob xml) {
+ this.xml = xml;
+ }
+
+ public Timestamp getCreateDateTime() {
+ return createDateTime;
+ }
+
+ public void setCreateDateTime(Timestamp createDateTime) {
+ this.createDateTime = createDateTime;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public Timestamp getUpdateDateTime() {
+ return updateDateTime;
+ }
+
+ public void setUpdateDateTime(Timestamp updateDateTime) {
+ this.updateDateTime = updateDateTime;
+ }
+
+ public String getUpdatedBy() {
+ return updatedBy;
+ }
+
+ public void setUpdatedBy(String updatedBy) {
+ this.updatedBy = updatedBy;
+ }
+
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java
new file mode 100644
index 000000000..99d6075a3
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
+import org.onap.policy.rest.jpa.UserInfo;
+
+
+/**
+ * The persistent class for the roles database table.
+ *
+ */
+@Entity
+@Table(name="roles")
+@NamedQuery(name="PolicyRoles.findAll", query="SELECT r FROM PolicyRoles r ")
+public class PolicyRoles implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+
+ @Column(name="id")
+ private int id;
+
+ @ManyToOne
+ @JoinColumn(name="loginid")
+ @OrderBy("asc")
+ private UserInfo loginId;
+
+ public UserInfo getLoginId() {
+ return loginId;
+ }
+
+ public void setLoginId(UserInfo loginId) {
+ this.loginId = loginId;
+ }
+
+ @Column(name="scope", nullable=true, length=45)
+ private String scope;
+
+ @Column(name="role", nullable=false, length=45)
+ private String role;
+
+ public PolicyRoles() {
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getScope() {
+ return this.scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+
+ }
+ public String getRole() {
+ return this.role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java
new file mode 100644
index 000000000..6fc45eb70
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="PolicyScopeClosedLoop")
+@NamedQuery(name="PolicyScopeClosedLoop.findAll", query="SELECT e FROM PolicyScopeClosedLoop e ")
+public class PolicyScopeClosedLoop implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description ")
+ private String description ;
+
+ public PolicyScopeClosedLoop() {
+
+ }
+ public PolicyScopeClosedLoop(String string, String userid) {
+ this(domain);
+
+ }
+ public PolicyScopeClosedLoop(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+ public String getDescriptionValue() {
+ return this.description ;
+ }
+
+ public void setDescriptionValue(String description ) {
+ this.description = description ;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java
new file mode 100644
index 000000000..f9ec94564
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="PolicyScopeResource")
+@NamedQuery(name="PolicyScopeResource.findAll", query="SELECT e FROM PolicyScopeResource e ")
+public class PolicyScopeResource implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description ")
+ private String description ;
+
+ public PolicyScopeResource() {
+
+ }
+ public PolicyScopeResource(String string, String userid) {
+ this(domain);
+
+ }
+ public PolicyScopeResource(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+ public String getDescriptionValue() {
+ return this.description ;
+ }
+
+ public void setDescriptionValue(String description ) {
+ this.description = description ;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java
new file mode 100644
index 000000000..84e85570b
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="PolicyScopeService")
+@NamedQuery(name="PolicyScopeService.findAll", query="SELECT e FROM PolicyScopeService e ")
+public class PolicyScopeService implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description ")
+ private String description ;
+
+ public PolicyScopeService() {
+
+ }
+ public PolicyScopeService(String string, String userid) {
+ this(domain);
+
+ }
+ public PolicyScopeService(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+ public String getDescriptionValue() {
+ return this.description ;
+ }
+
+ public void setDescriptionValue(String description ) {
+ this.description = description ;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java
new file mode 100644
index 000000000..48f17b0fc
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="PolicyScopeType")
+@NamedQuery(name="PolicyScopeType.findAll", query="SELECT e FROM PolicyScopeType e ")
+public class PolicyScopeType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description ")
+ private String description ;
+
+ public PolicyScopeType() {
+
+ }
+ public PolicyScopeType(String string, String userid) {
+ this(domain);
+
+ }
+ public PolicyScopeType(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+ public String getDescriptionValue() {
+ return this.description ;
+ }
+
+ public void setDescriptionValue(String description ) {
+ this.description = description ;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java
new file mode 100644
index 000000000..3ad4b9b85
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="POLICYSCORE")
+@NamedQueries({
+ @NamedQuery(name="POLICYSCORE.findAll", query="SELECT p FROM PolicyScore p"),
+ @NamedQuery(name="POLICYSCORE.deleteAll", query="DELETE FROM PolicyScore WHERE 1=1"),
+ @NamedQuery(name="POLICYSCORE.findByPolicyName", query="Select p from PolicyScore p where p.PolicyName=:pname")
+})
+public class PolicyScore implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="POLICY_NAME", nullable=false)
+ @OrderBy("asc")
+ private String PolicyName;
+
+ @Column(name="VERSIONEXTENSION", nullable=false)
+ @OrderBy("asc")
+ private String VersionExtension;
+
+ @Column(name="POLICY_SCORE", nullable=true)
+ private String PolicyScore;
+
+ public PolicyScore() {
+
+ }
+
+ public PolicyScore(String pName, String pScore) {
+ this(domain);
+
+ }
+ public PolicyScore(String domain) {
+
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getPolicyName() {
+ return PolicyName;
+ }
+ public void setPolicyName(String policyName) {
+ PolicyName = policyName;
+ }
+ public String getVersionExtension() {
+ return VersionExtension;
+ }
+
+ public void setVersionExtension(String versionExtension) {
+ VersionExtension = versionExtension;
+ }
+ public String getPolicyScore() {
+ return PolicyScore;
+ }
+ public void setPolicyScore(String policyScore) {
+ PolicyScore = policyScore;
+ }
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java
new file mode 100644
index 000000000..d098ee5a2
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java
@@ -0,0 +1,183 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+//import java.sql.Clob;
+import java.sql.Timestamp;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+
+@Entity
+@Table(name="PolicyVersion")
+@NamedQueries({
+ @NamedQuery(name="PolicyVersion.findAll", query="SELECT p FROM PolicyVersion p"),
+ @NamedQuery(name="PolicyVersion.deleteAll", query="DELETE FROM PolicyVersion WHERE 1=1"),
+ @NamedQuery(name="PolicyVersion.findByPolicyName", query="Select p from PolicyVersion p where p.policyName=:pname"),
+ @NamedQuery(name="PolicyVersion.findAllCount", query="SELECT COUNT(p) FROM PolicyVersion p")
+})
+public class PolicyVersion implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+
+ @Column(name="id")
+ private int id;
+
+ @Column(name="POLICY_NAME", nullable=false, length=255)
+ private String policyName;
+
+ @Column(name="ACTIVE_VERSION")
+ private int activeVersion;
+
+ @Column(name="HIGHEST_VERSION")
+ private int higherVersion;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", nullable=false)
+ private Date createdDate;
+
+
+ public int getActiveVersion() {
+ return activeVersion;
+ }
+
+ public void setActiveVersion(int activeVersion) {
+ this.activeVersion = activeVersion;
+ }
+
+ public int getHigherVersion() {
+ return higherVersion;
+ }
+
+ public void setHigherVersion(int higherVersion) {
+ this.higherVersion = higherVersion;
+ }
+
+ @Column(name="CREATED_BY", nullable=false, length=45)
+ private String createdBy;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+
+ @Column(name="modified_by", nullable=false, length=45)
+ private String modifiedBy;
+
+ public PolicyVersion(String domain, String loginUserId) {
+ this(domain);
+ this.createdBy = loginUserId;
+ this.modifiedBy = loginUserId;
+ }
+
+ public PolicyVersion(String domain) {
+ this.policyName = domain;
+ }
+
+ public PolicyVersion(){
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ /*
+ * The modifiedBy must be set via the setModifiedBy() method since PolicyVersion
+ * has been moved to XACML-REST module for access from the XACML-PAP-REST module
+
+ String userid = ((XacmlAdminUI) UI.getCurrent()).getLoginUserId();
+ this.modifiedBy =userid;
+ *
+ */
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Timestamp createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getCreatedBy() {
+ return createdBy;
+ }
+
+ public void setCreatedBy(String createdBy) {
+ this.createdBy = createdBy;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Timestamp modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public String getModifiedBy() {
+ return modifiedBy;
+ }
+
+ public void setModifiedBy(String modifiedBy) {
+ this.modifiedBy = modifiedBy;
+ }
+
+}
+
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java
new file mode 100644
index 000000000..5d2f35414
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="portlist")
+@NamedQuery(name="PortList.findAll", query="SELECT e FROM PortList e ")
+public class PortList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="portname", nullable=false)
+ @OrderBy("asc")
+ private String portName;
+
+ @Column(name="description")
+ private String description;
+/*
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;*/
+
+ public PortList() {
+
+ }
+ public PortList(String string, String userid) {
+ this(domain);
+
+ }
+ public PortList(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getPortName() {
+ return this.portName;
+ }
+
+ public void setPortName(String portName) {
+ this.portName = portName;
+
+ }
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java
new file mode 100644
index 000000000..98e940228
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="PrefixList")
+@NamedQuery(name="PrefixList.findAll", query="SELECT e FROM PrefixList e ")
+public class PrefixList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="pl_name", nullable=false)
+ @OrderBy("asc")
+ private String prefixListName;
+
+ @Column(name="description", nullable=false)
+ private String description;
+
+ @Column(name="pl_value", nullable=false)
+ private String prefixListValue;
+/*
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;*/
+
+ public PrefixList() {
+
+ }
+ public PrefixList(String string, String userid) {
+ this(domain);
+
+ }
+ public PrefixList(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+ public String getPrefixListName() {
+ return this.prefixListName;
+ }
+
+ public void setPrefixListName(String prefixListName) {
+ this.prefixListName = prefixListName;
+
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+
+ }
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getPrefixListValue() {
+ return this.prefixListValue;
+ }
+
+ public void setPrefixListValue(String prefixListValue) {
+ this.prefixListValue = prefixListValue;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java
new file mode 100644
index 000000000..befea36ed
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="protocollist")
+@NamedQuery(name="ProtocolList.findAll", query="SELECT e FROM ProtocolList e ")
+public class ProtocolList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="protocolname", nullable=false)
+ @OrderBy("asc")
+ private String protocolName;
+
+ @Column(name="description")
+ private String description;
+/*
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;*/
+
+ public ProtocolList() {
+
+ }
+ public ProtocolList(String string, String userid) {
+ this(domain);
+
+ }
+ public ProtocolList(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+ public String getProtocolName() {
+ return this.protocolName;
+ }
+
+ public void setProtocolName(String protocolName) {
+ this.protocolName = protocolName;
+
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java
new file mode 100644
index 000000000..383eb11c2
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RainyDayTreatments.java
@@ -0,0 +1,118 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
+import java.io.Serializable;
+
+/**
+ * The persistent class for the RainyDayTreatment database table.
+ *
+ */
+@Entity
+@Table(name="RainyDayTreatments")
+@NamedQuery(name="RainyDayTreatments.findAll", query="SELECT e FROM RainyDayTreatments e")
+public class RainyDayTreatments implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2491410352490381323L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="bbid", nullable=false, length=255)
+ @OrderBy("asc")
+ private String bbid;
+
+ @Column(name="workstep", nullable=true, length=255)
+ private String workstep;
+
+ @Column(name="treatments", nullable=true, length=1028)
+ private String treatments;
+
+ public RainyDayTreatments() {
+
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the bbid
+ */
+ public String getBbid() {
+ return bbid;
+ }
+
+ /**
+ * @param bbid the bbid to set
+ */
+ public void setBbid(String bbid) {
+ this.bbid = bbid;
+ }
+
+ /**
+ * @return the workstep
+ */
+ public String getWorkstep() {
+ return workstep;
+ }
+
+ /**
+ * @param workstep the workstep to set
+ */
+ public void setWorkstep(String workstep) {
+ this.workstep = workstep;
+ }
+
+ /**
+ * @return the treatments
+ */
+ public String getTreatments() {
+ return treatments;
+ }
+
+ /**
+ * @param treatments the treatments to set
+ */
+ public void setTreatments(String treatments) {
+ this.treatments = treatments;
+ }
+
+
+} \ No newline at end of file
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java
new file mode 100644
index 000000000..f0443c0db
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RemoteCatalogValues.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="RemoteCatalogValues")
+@NamedQuery(name="RemoteCatalogValues.findAll", query="SELECT e FROM RemoteCatalogValues e ")
+public class RemoteCatalogValues implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="value")
+ private String value;
+
+
+ public RemoteCatalogValues() {
+
+ }
+ public RemoteCatalogValues(String string, String userid) {
+ this(domain);
+
+ }
+ public RemoteCatalogValues(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java
new file mode 100644
index 000000000..155372617
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RiskType.java
@@ -0,0 +1,172 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+
+@Entity
+@Table(name="RiskType")
+@NamedQuery(name="RiskType.findAll", query="SELECT e FROM RiskType e ")
+public class RiskType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String name;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(RiskType.class);
+
+ public RiskType() {
+
+ }
+
+ public RiskType(String string, String userid) {
+ this(domain);
+ }
+
+ public RiskType(String domain) {
+ this.name = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "RiskType", "Exception caused While adding Modified by Role");
+ }
+ }
+ public String getRiskName() {
+ return this.name;
+ }
+
+ public void setRiskName(String riskName) {
+ this.name = riskName;
+
+ }
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java
new file mode 100644
index 000000000..83f6e2d3e
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/RuleAlgorithms.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * AT&T - PROPRIETARY
+ * THIS FILE CONTAINS PROPRIETARY INFORMATION OF
+ * AT&T AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN
+ * ACCORDANCE WITH APPLICABLE AGREEMENTS.
+ *
+ * Copyright (c) 2014 AT&T Knowledge Ventures
+ * Unpublished and Not for Publication
+ * All Rights Reserved
+ */
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.att.research.xacml.api.Identifier;
+
+@Entity
+@Table(name="RuleAlgorithms")
+@NamedQuery(name="RuleAlgorithms.findAll", query="SELECT d FROM RuleAlgorithms d")
+public class RuleAlgorithms implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final char STANDARD = 'S';
+ public static final char CUSTOM = 'C';
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="is_standard", nullable=false)
+ private char isStandard;
+
+ @Column(name="xacml_id", nullable=false, unique=true, length=255)
+ private String xacmlId;
+
+ @Column(name="short_name", nullable=false, length=64)
+ private String shortName;
+
+ public RuleAlgorithms(Identifier id, char standard) {
+ if (id != null) {
+ this.xacmlId = id.stringValue();
+ }
+ this.isStandard = standard;
+ }
+ public RuleAlgorithms(Identifier id) {
+ this(id, RuleAlgorithms.STANDARD);
+ }
+
+ public RuleAlgorithms() {
+ this(null, RuleAlgorithms.STANDARD);
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public char getIsStandard() {
+ return this.isStandard;
+ }
+
+ public void setIsStandard(char isStandard) {
+ this.isStandard = isStandard;
+ }
+
+ @Transient
+ public boolean isStandard() {
+ return (this.isStandard == RuleAlgorithms.STANDARD);
+ }
+
+ @Transient
+ public boolean isCustom() {
+ return (this.isStandard == RuleAlgorithms.CUSTOM);
+ }
+
+ public String getXacmlId() {
+ return this.xacmlId;
+ }
+
+ public void setXacmlId(String xacmlId) {
+ this.xacmlId = xacmlId;
+ }
+
+ public String getShortName() {
+ return shortName;
+ }
+
+ public void setShortName(String shortName) {
+ this.shortName = shortName;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java
new file mode 100644
index 000000000..1f92fe67a
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SafePolicyWarning.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="SafePolicyWarning")
+@NamedQuery(name="SafePolicyWarning.findAll", query="SELECT e FROM SafePolicyWarning e ")
+public class SafePolicyWarning implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="message")
+ private String message ;
+
+ @Column(name="riskType")
+ private String riskType ;
+
+ public String getRiskType() {
+ return riskType;
+ }
+ public void setRiskType(String riskType) {
+ this.riskType = riskType;
+ }
+ public SafePolicyWarning() {
+
+ }
+ public SafePolicyWarning(String string, String userid) {
+ this(domain);
+
+ }
+ public SafePolicyWarning(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+ public void setName(String name) {
+ this.name = name;
+
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java
new file mode 100644
index 000000000..d8bc33c13
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SecurityZone.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="securityzone")
+@NamedQuery(name="SecurityZone.findAll", query="SELECT e FROM SecurityZone e ")
+public class SecurityZone implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String zoneName;
+
+ @Column(name="value")
+ private String zoneValue;
+
+
+ public SecurityZone() {
+
+ }
+ public SecurityZone(String string, String userid) {
+ this(domain);
+
+ }
+ public SecurityZone(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getZoneName() {
+ return this.zoneName;
+ }
+
+ public void setZoneName(String zoneName) {
+ this.zoneName = zoneName;
+
+ }
+ public String getZoneValue() {
+ return this.zoneValue;
+ }
+
+ public void setZoneValue(String zoneValue) {
+ this.zoneValue = zoneValue;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java
new file mode 100644
index 000000000..40e31172e
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ServiceList.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="servicegroup")
+@NamedQuery(name="ServiceList.findAll", query="SELECT e FROM ServiceList e ")
+public class ServiceList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String serviceName;
+
+ @Column(name="description")
+ private String serviceDesc;
+
+ @Column(name="type")
+ private String serviceType;
+
+ @Column(name="transportprotocol")
+ private String serviceTrasProtocol;
+
+ @Column(name="appprotocol ")
+ private String serviceAppProtocol;
+
+ @Column(name="ports")
+ private String servicePorts;
+
+
+
+/*
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;*/
+
+ public ServiceList() {
+
+ }
+ public ServiceList(String string, String userid) {
+ this(domain);
+
+ }
+ public ServiceList(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getServiceName() {
+ return this.serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+
+ }
+
+ public String getServiceDescription() {
+ return this.serviceDesc;
+ }
+
+ public void setServiceDescription(String serviceDesc) {
+ this.serviceDesc = serviceDesc;
+
+ }
+
+ public String getServiceType() {
+ return this.serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceTransProtocol() {
+ return this.serviceTrasProtocol;
+ }
+
+ public void setServiceTransProtocol(String serviceTrasProtocol) {
+ this.serviceTrasProtocol = serviceTrasProtocol;
+
+ }
+
+ public String getServiceAppProtocol() {
+ return this.serviceAppProtocol;
+ }
+
+ public void setServiceAppProtocol(String serviceAppProtocol) {
+ this.serviceAppProtocol = serviceAppProtocol;
+
+ }
+ public String getServicePorts() {
+ return this.servicePorts;
+ }
+
+ public void setServicePorts(String servicePorts) {
+ this.servicePorts = servicePorts;
+
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java
new file mode 100644
index 000000000..0747c837f
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/SystemLogDB.java
@@ -0,0 +1,163 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * AT&T - PROPRIETARY
+ * THIS FILE CONTAINS PROPRIETARY INFORMATION OF
+ * AT&T AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN
+ * ACCORDANCE WITH APPLICABLE AGREEMENTS.
+ *
+ * Copyright (c) 2013 AT&T Knowledge Ventures
+ * Unpublished and Not for Publication
+ * All Rights Reserved
+ */
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * The persistent class for the system log database table.
+ *
+*/
+@Entity
+@Table(name="SystemLogDB")
+@NamedQuery(name="SystemLogDB.findAll", query="SELECT o FROM SystemLogDB o")
+public class SystemLogDB implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="type", nullable=false)
+ private String type;
+
+ @Column(name="system", nullable=false, length=255)
+ private String system;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Column(name="remote", nullable=false, length=255)
+ private String remote;
+
+ @Column(name="logtype", nullable=false, length=255)
+ private String logtype;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="date", nullable=false, updatable=false)
+ private Date date;
+
+ public SystemLogDB() {
+ super();
+ }
+
+ public SystemLogDB(int id, String system, String description, String remote,
+ String type, String logtype) {
+ this.id = id;
+ this.system = system;
+ this.description = description;
+ this.remote = remote;
+ this.type = type;
+ this.logtype = logtype;
+ }
+
+ public void SystemLogB (int id, String system, String description, String remote, String type, Date date, String logtype){
+ this.id = id;
+ this.system = system;
+ this.description = description;
+ this.remote = remote;
+ this.type = type;
+ this.date = date;
+ this.logtype = logtype;
+
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Date getDate(){
+ return this.date;
+ }
+
+ public void setDate(Date date){
+ this.date = date;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+
+ }
+
+ public String getSystem() {
+ return this.system;
+ }
+
+ public void setSystem(String system) {
+ this.system = system;
+ }
+
+ public String getRemote() {
+ return this.remote;
+ }
+
+ public void setRemote(String remote) {
+ this.remote = remote;
+
+ }
+ public String getLogtype() {
+ return this.logtype;
+ }
+
+ public void setLogtype(String logtype) {
+ this.logtype = logtype;
+
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java
new file mode 100644
index 000000000..c9a27ef15
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java
@@ -0,0 +1,261 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+
+@Entity
+@Table(name="TERM")
+@NamedQuery(name="TermList.findAll", query="SELECT e FROM TermList e")
+public class TermList implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="termName", nullable=false)
+ @OrderBy("asc")
+ private String termName;
+
+ @Column(name="description")
+ private String termDescription;
+
+ @Column(name="fromzone")
+ private String fromZone;
+
+ @Column(name="tozone")
+ private String toZone;
+
+ @Column(name="srcIPList")
+ private String srcIPList;
+
+ @Column(name="destIPList")
+ private String destIPList;
+
+ @Column(name="protocolList")
+ private String protocolList;
+
+ @Column(name="portList")
+ private String portList;
+
+ @Column(name="srcPortList")
+ private String srcPortList;
+
+ @Column(name="destPortList")
+ private String destPortList;
+
+ @Column(name="action")
+ private String action;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(TermList.class);
+
+ public TermList() {
+
+ }
+
+ private static final Log auditLogger = LogFactory
+ .getLog("auditLogger");
+
+ public TermList(String string, String userid) {
+ this(domain);
+ }
+ public TermList(String domain) {
+ this.termName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ auditLogger.debug("Added New Term Name: "+this.termName+" by "+this.userCreatedBy);
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "TermList", "Exception caused While adding Modified by Role");
+ }
+ auditLogger.debug("Updated Term Name: "+this.termName+" by "+this.userModifiedBy);
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getTermName() {
+ return this.termName;
+ }
+
+ public void setTermName(String termName) {
+ this.termName = termName;
+ }
+
+ public String getTermDescription() {
+ return this.termDescription;
+ }
+
+ public void setDescription(String termDescription) {
+ this.termDescription = termDescription;
+ }
+
+ public String getFromZone() {
+ return this.fromZone;
+ }
+
+ public void setFromZones(String fromZone) {
+ this.fromZone = fromZone;
+ }
+
+ public String getToZone() {
+ return this.toZone;
+ }
+
+ public void setToZones(String toZone) {
+ this.toZone = toZone;
+ }
+
+ public String getSrcIPList() {
+ return this.srcIPList;
+ }
+
+ public void setSrcIPList(String srcIPList) {
+ this.srcIPList = srcIPList;
+ }
+
+ public String getDestIPList() {
+ return this.destIPList;
+ }
+
+ public void setDestIPList(String destIPList) {
+ this.destIPList = destIPList;
+ }
+
+ public String getProtocolList() {
+ return this.protocolList;
+ }
+
+ public void setProtocolList(String protocolList) {
+ this.protocolList = protocolList;
+ }
+
+ public String getPortList() {
+ return this.portList;
+ }
+
+ public void setPortList(String portList) {
+ this.portList = portList;
+ }
+
+ public String getSrcPortList() {
+ return this.srcPortList;
+ }
+
+ public void setSrcPortList(String srcPortList) {
+ this.srcPortList = srcPortList;
+ }
+
+ public String getDestPortList() {
+ return this.destPortList;
+ }
+
+ public void setDestPortList(String destPortList) {
+ this.destPortList = destPortList;
+ }
+
+
+ public String getAction() {
+ return this.action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java
new file mode 100644
index 000000000..d2185c27b
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/UserInfo.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.att.research.xacml.api.Identifier;
+import com.att.research.xacml.std.IdentifierImpl;
+import com.fasterxml.jackson.annotation.JsonBackReference;
+
+@Entity
+@Table(name = "UserInfo")
+@NamedQuery(name="UserInfo.findAll", query="SELECT u FROM UserInfo u ")
+public class UserInfo implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name="loginid", nullable=false, length=45)
+ private String userLoginId;
+
+ @Column(name = "name", nullable = false, unique = true)
+ private String userName;
+
+ public UserInfo(){
+ this.userLoginId = userName;
+
+ }
+
+ public String getUserLoginId() {
+ return userLoginId;
+ }
+
+ public void setUserLoginId(String loginid) {
+ this.userLoginId = loginid;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Transient
+ @JsonBackReference
+ public Identifier getIdentiferByUserId() {
+ return new IdentifierImpl(this.userName);
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java
new file mode 100644
index 000000000..01df59201
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VMType.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="VMType")
+@NamedQuery(name="VMType.findAll", query="SELECT e FROM VMType e ")
+public class VMType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="name", nullable=false)
+ @OrderBy("asc")
+ private String name;
+
+ @Column(name="description")
+ private String description;
+
+
+ public VMType() {
+
+ }
+ public VMType(String string, String userid) {
+ this(domain);
+
+ }
+ public VMType(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java
new file mode 100644
index 000000000..cf1e6b85f
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java
@@ -0,0 +1,173 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+
+
+@Entity
+@Table(name="VNFType")
+@NamedQuery(name="VNFType.findAll", query="SELECT v FROM VNFType v ")
+public class VNFType implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="vnf_type", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String vnftype;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(VNFType.class);
+
+ public VNFType() {
+
+ }
+
+ public String getVnftype() {
+ return vnftype;
+ }
+
+ public void setVnftype(String vnftype) {
+ this.vnftype = vnftype;
+ }
+
+ public VNFType(String string, String userid) {
+ this(domain);
+ }
+
+ public VNFType(String domain) {
+ this.vnftype = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VNFType", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java
new file mode 100644
index 000000000..5bfab1793
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java
@@ -0,0 +1,173 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+
+@Entity
+@Table(name="VSCLAction")
+@NamedQuery(name="VSCLAction.findAll", query="SELECT v FROM VSCLAction v ")
+public class VSCLAction implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="vscl_action", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String vsclaction;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Column(name="description", nullable=true, length=2048)
+ private String description;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(VSCLAction.class);
+
+ public VSCLAction() {
+
+ }
+
+ public VSCLAction(String string, String userid) {
+ this(domain);
+ }
+
+ public VSCLAction(String domain) {
+ this.vsclaction = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VSCLAction", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getVsclaction() {
+ return vsclaction;
+ }
+
+ public void setVsclaction(String vsclaction) {
+ this.vsclaction = vsclaction;
+ }
+
+
+ public Date getCreatedDate() {
+ return this.createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getModifiedDate() {
+ return this.modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java
new file mode 100644
index 000000000..0ede025bd
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java
@@ -0,0 +1,184 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XacmlAdminAuthorization;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.policy.common.logging.eelf.PolicyLogger;
+
+@Entity
+@Table(name="VarbindDictionary")
+@NamedQuery(name = "VarbindDictionary.findAll", query = "Select v FROM VarbindDictionary v")
+public class VarbindDictionary implements Serializable{
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "Id")
+ private int id;
+
+ @Column(name ="varbind_Name", nullable = false, unique = true)
+ @OrderBy("asc")
+ private String varbindName;
+
+ @Column(name = "varbind_Description", nullable = true, length = 2048)
+ private String varbindDescription;
+
+ @Column(name = "varbind_oid", nullable = false)
+ private String varbindOID;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="created_date", updatable=false)
+ private Date createdDate;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name="modified_date", nullable=false)
+ private Date modifiedDate;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="created_by")
+ private UserInfo userCreatedBy;
+
+ @ManyToOne(optional = false)
+ @JoinColumn(name="modified_by")
+ private UserInfo userModifiedBy;
+
+ public UserInfo getUserCreatedBy() {
+ return userCreatedBy;
+ }
+
+ public void setUserCreatedBy(UserInfo userCreatedBy) {
+ this.userCreatedBy = userCreatedBy;
+ }
+
+ public UserInfo getUserModifiedBy() {
+ return userModifiedBy;
+ }
+
+ public void setUserModifiedBy(UserInfo userModifiedBy) {
+ this.userModifiedBy = userModifiedBy;
+ }
+
+ private static Log LOGGER = LogFactory.getLog(VarbindDictionary.class);
+
+ public VarbindDictionary() {
+
+ }
+
+ public VarbindDictionary(String string, String userid) {
+ this(domain);
+ }
+
+ public VarbindDictionary(String domain) {
+ this.varbindName = domain;
+ }
+
+ @PrePersist
+ public void prePersist() {
+ Date date = new Date();
+ this.createdDate = date;
+ this.modifiedDate = date;
+ }
+
+ @PreUpdate
+ public void preUpdate() {
+ this.modifiedDate = new Date();
+ try {
+ this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
+ } catch (Exception e) {
+ LOGGER.error("Exception caused While adding Modified by Role"+e);
+ PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "VarbindDictionary", "Exception caused While adding Modified by Role");
+ }
+ }
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getVarbindName() {
+ return varbindName;
+ }
+
+ public void setVarbindName(String varbindName) {
+ this.varbindName = varbindName;
+ }
+
+ public String getVarbindDescription() {
+ return varbindDescription;
+ }
+
+ public void setVarbindDescription(String varbindDescription) {
+ this.varbindDescription = varbindDescription;
+ }
+
+ public String getVarbindOID() {
+ return varbindOID;
+ }
+
+ public void setVarbindOID(String varbindOID) {
+ this.varbindOID = varbindOID;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java
new file mode 100644
index 000000000..297c1f6df
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/WatchPolicyNotificationTable.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ *
+ *
+ * */
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "WatchPolicyNotificationTable")
+@NamedQuery(name="WatchPolicyNotificationTable.findAll", query="SELECT e FROM WatchPolicyNotificationTable e ")
+public class WatchPolicyNotificationTable implements Serializable{
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="policyName", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String policyName;
+
+ @Column(name="loginIds", nullable=false, unique=true)
+ @OrderBy("asc")
+ private String loginIds;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ public String getLoginIds() {
+ return loginIds;
+ }
+
+ public void setLoginIds(String loginIds) {
+ this.loginIds = loginIds;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java
new file mode 100644
index 000000000..eb53c42f1
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Zone.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+/*
+ */
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.NamedQuery;
+import javax.persistence.OrderBy;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="zone")
+@NamedQuery(name="Zone.findAll", query="SELECT e FROM Zone e ")
+public class Zone implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private static String domain;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name="id")
+ private int id;
+
+ @Column(name="zonename", nullable=false)
+ @OrderBy("asc")
+ private String zoneName;
+
+ @Column(name="zonevalue")
+ private String zoneValue;
+
+
+ public Zone() {
+
+ }
+ public Zone(String string, String userid) {
+ this(domain);
+
+ }
+ public Zone(String domain) {
+
+ }
+
+ @PrePersist
+ public void prePersist() {
+
+ }
+ @PreUpdate
+ public void preUpdate() {
+ }
+
+
+ public int getId() {
+ return this.id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getZoneName() {
+ return this.zoneName;
+ }
+
+ public void setZoneName(String zoneName) {
+ this.zoneName = zoneName;
+
+ }
+ public String getZoneValue() {
+ return this.zoneValue;
+ }
+
+ public void setZoneValue(String zoneValue) {
+ this.zoneValue = zoneValue;
+ }
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/package-info.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/package-info.java
new file mode 100644
index 000000000..72a36f4f4
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/package-info.java
@@ -0,0 +1,21 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/LockdownListener.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/LockdownListener.java
new file mode 100644
index 000000000..8e06656a3
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/LockdownListener.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/**
+ *
+ */
+package org.onap.policy.rest.util;
+
+public interface LockdownListener {
+ /**
+ * lockdown has been set in database
+ */
+ public void lockdownSet();
+
+ /**
+ * lockdown has been unset in the database
+ */
+ public void lockdownUnset();
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeObject.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeObject.java
new file mode 100644
index 000000000..b5d359fd6
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeObject.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class MSAttributeObject {
+
+ private String className;
+ private HashMap<String, String> attribute = new HashMap<>();
+ private HashMap<String, String> refAttribute = new HashMap<>();
+ private HashMap<String, Object> subClass = new HashMap<>();
+ private String dependency;
+ private HashMap<String, String> enumType = new HashMap<>();
+ private HashMap<String, String> matchingSet = new HashMap<>();
+ private boolean policyTempalate;
+
+ public Map<String, String> getRefAttribute() {
+ return refAttribute;
+ }
+ public void setRefAttribute(HashMap<String, String> refAttribute) {
+ this.refAttribute = refAttribute;
+ }
+ public String getClassName() {
+ return className;
+ }
+ public void setClassName(String className) {
+ this.className = className;
+ }
+ public Map<String, String> getAttribute() {
+ return attribute;
+ }
+ public void setAttribute(HashMap<String, String> attribute) {
+ this.attribute = attribute;
+ }
+ public HashMap<String, String> getEnumType() {
+ return enumType;
+ }
+ public void setEnumType(HashMap<String, String> enumType) {
+ this.enumType = enumType;
+ }
+ public void addAttribute(String key, String value){
+ this.attribute.put(key, value);
+ }
+ public void addRefAttribute(String key, String value){
+ this.refAttribute.put(key, value);
+ }
+ public void addAllAttribute(Map<String, String> map){
+ this.attribute.putAll(map);
+ }
+ public void addAllRefAttribute(Map<String, String> map){
+ this.refAttribute.putAll(map);
+ }
+ public HashMap<String, Object> getSubClass() {
+ return subClass;
+ }
+ public void setSubClass(HashMap<String, Object> subClass) {
+ this.subClass = subClass;
+ }
+ public void addAllSubClass(HashMap<String, Object> subClass){
+ this.subClass.putAll(subClass);
+ }
+ public String getDependency() {
+ return dependency;
+ }
+ public void setDependency(String dependency) {
+ this.dependency = dependency;
+ }
+ public void addSingleEnum(String key, String value){
+ this.enumType.put(key, value);
+ }
+ public HashMap<String, String> getMatchingSet() {
+ return matchingSet;
+ }
+ public void setMatchingSet(HashMap<String, String> matchingSet) {
+ this.matchingSet = matchingSet;
+ }
+ public void addMatchingSet(String key, String value){
+ this.matchingSet.put(key, value);
+ }
+ public void addMatchingSet(HashMap<String, String> matchingSet){
+ this.matchingSet.putAll(matchingSet);
+ }
+ public boolean isPolicyTempalate() {
+ return policyTempalate;
+ }
+ public void setPolicyTempalate(boolean policyTempalate) {
+ this.policyTempalate = policyTempalate;
+ }
+} \ No newline at end of file
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeValue.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeValue.java
new file mode 100644
index 000000000..23b5f8658
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSAttributeValue.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.util;
+
+public class MSAttributeValue{
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getType() {
+ return type;
+ }
+ public void setType(String type) {
+ this.type = type;
+ }
+ public Boolean getRequired() {
+ return required;
+ }
+ public void setRequired(Boolean required) {
+ this.required = required;
+ }
+ public Boolean getArrayValue() {
+ return arrayValue;
+ }
+ public void setArrayValue(Boolean arrayValue) {
+ this.arrayValue = arrayValue;
+ }
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+ private String name;
+ private String type;
+ private Boolean required;
+ private Boolean arrayValue;
+ private String defaultValue;
+
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java
new file mode 100644
index 000000000..fa2c51d18
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java
@@ -0,0 +1,701 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.util;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.EAttributeImpl;
+import org.eclipse.emf.ecore.impl.EEnumImpl;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.json.JSONObject;
+import org.onap.policy.rest.XACMLRestProperties;
+
+import com.att.research.xacml.util.XACMLProperties;
+import com.google.gson.Gson;
+
+
+public class MSModelUtils {
+
+ private static final Log logger = LogFactory.getLog(MSModelUtils.class);
+
+ private HashMap<String,MSAttributeObject > classMap = new HashMap<>();
+ private HashMap<String, String> enumMap = new HashMap<>();
+ private HashMap<String, String> matchingClass = new HashMap<>();
+ private String configuration = "configuration";
+ private String dictionary = "dictionary";
+ private String onap = "";
+ private String policy = "";
+ private String eProxyURI = "eProxyURI:";
+
+ public MSModelUtils(String onap, String policy){
+ this.onap = onap;
+ this.policy = policy;
+ }
+
+ private enum ANNOTATION_TYPE{
+ MATCHING, VALIDATION, DICTIONARY
+ };
+
+ public enum MODEL_TYPE {
+ XMI
+ };
+
+
+ public HashMap<String, MSAttributeObject> processEpackage(String file, MODEL_TYPE model){
+ if (model == MODEL_TYPE.XMI ){
+ processXMIEpackage(file);
+ }
+ return classMap;
+
+ }
+
+ private void processXMIEpackage(String xmiFile){
+ EPackage root = getEpackage(xmiFile);
+ TreeIterator<EObject> treeItr = root.eAllContents();
+ String className = null;
+ String returnValue = null;
+
+ // Pulling out dependency from file
+ while (treeItr.hasNext()) {
+ EObject obj = (EObject) treeItr.next();
+ if (obj instanceof EClassifier) {
+ EClassifier eClassifier = (EClassifier) obj;
+ className = eClassifier.getName();
+
+ if (obj instanceof EEnum) {
+ enumMap.putAll(getEEnum(obj));
+ }else if (obj instanceof EClass) {
+ String temp = getDependencyList(eClassifier, className).toString();
+ returnValue = StringUtils.replaceEach(temp, new String[]{"[", "]"}, new String[]{"", ""});
+ getAttributes(className, returnValue, root);
+ }
+ }
+ }
+
+ if (!enumMap.isEmpty()){
+ addEnumClassMap();
+ }
+ if (!matchingClass.isEmpty()){
+ CheckForMatchingClass();
+ }
+ }
+
+ private void CheckForMatchingClass() {
+ HashMap<String, String> tempAttribute = new HashMap<>();
+
+ for (Entry<String, String> set : matchingClass.entrySet()){
+ String key = set.getKey();
+ if (classMap.containsKey(key)){
+ Map<String, String> listAttributes = classMap.get(key).getAttribute();
+ Map<String, String> listRef = classMap.get(key).getRefAttribute();
+ for ( Entry<String, String> eSet : listAttributes.entrySet()){
+ String key2 = eSet.getKey();
+ tempAttribute.put(key2, "matching-true");
+ }
+ for ( Entry<String, String> eSet : listRef.entrySet()){
+ String key3 = eSet.getKey();
+ tempAttribute.put(key3, "matching-true");
+ }
+
+ }
+ UpdateMatching(tempAttribute, key);
+ }
+
+ }
+
+
+
+ private void UpdateMatching(HashMap<String, String> tempAttribute, String key) {
+ Map<String, MSAttributeObject> newClass = null;
+
+ newClass = classMap;
+
+ for (Entry<String, MSAttributeObject> updateClass : newClass.entrySet()){
+ HashMap<String, String> valueMap = updateClass.getValue().getMatchingSet();
+ String keymap = updateClass.getKey();
+ if (valueMap.containsKey(key)){
+ HashMap<String, String> modifyMap = classMap.get(keymap).getMatchingSet();
+ modifyMap.remove(key);
+ modifyMap.putAll(tempAttribute);
+ classMap.get(keymap).setMatchingSet(modifyMap);
+ }
+
+ }
+ }
+
+ private void addEnumClassMap() {
+ for (Entry<String, MSAttributeObject> value :classMap.entrySet()){
+ value.getValue().setEnumType(enumMap);
+ }
+ }
+
+ private EPackage getEpackage(String xmiFile) {
+ ResourceSet resSet = new ResourceSetImpl();
+ Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
+ Map<String, Object> m = reg.getExtensionToFactoryMap();
+ m.put("xmi", new XMIResourceFactoryImpl());
+ Resource resource = resSet.getResource(URI.createFileURI(xmiFile), true);
+ try {
+ resource.load(Collections.EMPTY_MAP);
+ } catch (IOException e) {
+ logger.error("Error loading Encore Resource for new Model" + e);
+ }
+
+ EPackage root = (EPackage) resource.getContents().get(0);
+
+ return root;
+ }
+
+ private HashMap<String, String> getEEnum(EObject obj) {
+ List<String> valueList = new ArrayList<>();
+ HashMap<String, String> returnMap = new HashMap<>();
+ EEnum eenum = (EEnum)obj;
+
+ String name = eenum.getName();
+ for (EEnumLiteral eEnumLiteral : eenum.getELiterals())
+ {
+ Enumerator instance = eEnumLiteral.getInstance();
+ String value = instance.getLiteral();
+ valueList.add(value);
+ }
+ returnMap.put(name, valueList.toString());
+ return returnMap;
+ }
+
+ public void getAttributes(String className, String dependency, EPackage root) {
+ List<String> dpendList = new ArrayList<>();
+ if (dependency!=null){
+ dpendList = new ArrayList<String>(Arrays.asList(dependency.split(",")));
+ }
+ MSAttributeObject msAttributeObject = new MSAttributeObject();
+ msAttributeObject.setClassName(className);
+ String extendClass = getSubTypes(root, className);
+ HashMap<String, String> returnRefList = getRefAttributeList(root, className, extendClass);
+ HashMap<String, String> returnAttributeList = getAttributeList(root, className, extendClass);
+ HashMap<String, Object> returnSubList = getSubAttributeList(root, className, extendClass);
+ HashMap<String, String> returnAnnotation = getAnnotation(root, className, extendClass);
+ msAttributeObject.setAttribute(returnAttributeList);
+ msAttributeObject.setRefAttribute(returnRefList);
+ msAttributeObject.setSubClass(returnSubList);
+ msAttributeObject.setDependency(dpendList.toString());
+ msAttributeObject.addMatchingSet(returnAnnotation);
+ msAttributeObject.setPolicyTempalate(isPolicyTemplate(root, className));
+
+ this.classMap.put(className, msAttributeObject);
+ }
+
+ private HashMap<String, String> getAnnotation(EPackage root, String className, String extendClass) {
+ TreeIterator<EObject> treeItr = root.eAllContents();
+ boolean requiredAttribute = false;
+ boolean requiredMatchAttribute = false;
+ HashMap<String, String> annotationSet = new HashMap<>();
+ String matching = null;
+ String range = null;
+ String dictionary = null;
+
+ // Pulling out dependency from file
+ while (treeItr.hasNext()) {
+ EObject obj = treeItr.next();
+ if (obj instanceof EClassifier) {
+ requiredAttribute = isRequiredAttribute(obj, className );
+ requiredMatchAttribute = isRequiredAttribute(obj, extendClass );
+ }
+
+ if (requiredAttribute){
+ if (obj instanceof EStructuralFeature) {
+ EStructuralFeature eStrucClassifier = (EStructuralFeature) obj;
+ if (eStrucClassifier.getEAnnotations().size() != 0) {
+ matching = annotationValue(eStrucClassifier, ANNOTATION_TYPE.MATCHING, policy);
+ if (matching!=null){
+ annotationSet.put(eStrucClassifier.getName(), matching);
+ }
+ range = annotationValue(eStrucClassifier, ANNOTATION_TYPE.VALIDATION, policy);
+ if (range!=null){
+ annotationSet.put(eStrucClassifier.getName(), range);
+ }
+ dictionary = annotationValue(eStrucClassifier, ANNOTATION_TYPE.DICTIONARY, policy);
+ if (dictionary!=null){
+ annotationSet.put(eStrucClassifier.getName(), dictionary);
+ }
+ }
+ }
+ } else if (requiredMatchAttribute){
+ if (obj instanceof EStructuralFeature) {
+ EStructuralFeature eStrucClassifier = (EStructuralFeature) obj;
+ if (eStrucClassifier.getEAnnotations().size() != 0) {
+ matching = annotationValue(eStrucClassifier, ANNOTATION_TYPE.MATCHING, policy);
+ if (matching!=null){
+ if (obj instanceof EReference){
+ EClass refType = ((EReference) obj).getEReferenceType();
+ annotationSet.put(refType.getName(), matching);
+ matchingClass.put(refType.getName(), matching);
+ }else{
+ annotationSet.put(eStrucClassifier.getName(), matching);
+ }
+ }
+ }
+ }
+ }
+ }
+ return annotationSet;
+ }
+
+ private HashMap<String, Object> getSubAttributeList(EPackage root, String className , String superClass) {
+ TreeIterator<EObject> treeItr = root.eAllContents();
+ boolean requiredAttribute = false;
+ HashMap<String, Object> subAttribute = new HashMap<String, Object>();
+ int rollingCount = 0;
+ int processClass = 0;
+ boolean annotation = false;
+
+ // Pulling out dependency from file
+ while (treeItr.hasNext() && rollingCount < 2) {
+
+ EObject obj = treeItr.next();
+ if (obj instanceof EClassifier) {
+ if (isRequiredAttribute(obj, className ) || isRequiredAttribute(obj, superClass )){
+ requiredAttribute = true;
+ }else {
+ requiredAttribute = false;
+ }
+ if (requiredAttribute){
+ processClass++;
+ }
+ rollingCount = rollingCount+processClass;
+ }
+
+ if (requiredAttribute) {
+ if (obj instanceof EStructuralFeature) {
+ EStructuralFeature eStrucClassifier = (EStructuralFeature) obj;
+ if (eStrucClassifier.getEAnnotations().size() != 0) {
+ annotation = annotationTest(eStrucClassifier, configuration, onap);
+ if (annotation && obj instanceof EReference) {
+ EClass refType = ((EReference) obj).getEReferenceType();
+ if(!refType.toString().contains(eProxyURI)){
+ subAttribute.put(eStrucClassifier.getName(), refType.getName());
+ }
+ }
+ }
+ }
+ }
+ }
+ return subAttribute;
+ }
+
+ public String checkDefultValue(String defultValue) {
+ if (defultValue!=null){
+ return ":defaultValue-"+ defultValue;
+ }
+ return ":defaultValue-NA";
+
+ }
+
+ public String checkRequiredPattern(int upper, int lower) {
+
+ String pattern = XACMLProperties.getProperty(XACMLRestProperties.PROP_XCORE_REQUIRED_PATTERN);
+
+ if (pattern!=null){
+ if (upper == Integer.parseInt(pattern.split(",")[1]) && lower==Integer.parseInt(pattern.split(",")[0])){
+ return ":required-true";
+ }
+ }
+
+ return ":required-false";
+ }
+
+ public JSONObject buildJavaObject(HashMap<String, String> map, String attributeType){
+
+ JSONObject returnValue = new JSONObject(map);
+
+ return returnValue;
+
+ }
+
+ public HashMap<String, String> getRefAttributeList(EPackage root, String className, String superClass){
+
+ TreeIterator<EObject> treeItr = root.eAllContents();
+ boolean requiredAttribute = false;
+ HashMap<String, String> refAttribute = new HashMap<>();
+ int rollingCount = 0;
+ int processClass = 0;
+ boolean annotation = false;
+ // Pulling out dependency from file
+ while (treeItr.hasNext()) {
+ EObject obj = treeItr.next();
+ if (obj instanceof EClassifier) {
+ if (isRequiredAttribute(obj, className ) || isRequiredAttribute(obj, superClass )){
+ requiredAttribute = true;
+ }else {
+ requiredAttribute = false;
+ }
+ if (requiredAttribute){
+ processClass++;
+ }
+ rollingCount = rollingCount+processClass;
+ }
+
+ if (requiredAttribute) {
+ if (obj instanceof EStructuralFeature) {
+ EStructuralFeature eStrucClassifier = (EStructuralFeature) obj;
+ if (eStrucClassifier.getEAnnotations().size() != 0) {
+ annotation = annotationTest(eStrucClassifier, configuration, onap);
+ if ( annotation && obj instanceof EReference) {
+ EClass refType = ((EReference) obj).getEReferenceType();
+ if(refType.toString().contains(eProxyURI)){
+ String one = refType.toString().split(eProxyURI)[1];
+ String refValue = StringUtils.replaceEach(one.split("#")[1], new String[]{"//", ")"}, new String[]{"", ""});
+ refAttribute.put(eStrucClassifier.getName(), refValue);
+ } else {
+ String array = arrayCheck(((EStructuralFeature) obj).getUpperBound());
+ refAttribute.put(eStrucClassifier.getName(), refType.getName() + array);
+ }
+ } else if (annotation && obj instanceof EAttributeImpl){
+ EClassifier refType = ((EAttributeImpl) obj).getEType();
+ if (refType instanceof EEnumImpl){
+ String array = arrayCheck(((EStructuralFeature) obj).getUpperBound());
+ refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); }
+ }
+ }
+ }
+ }
+ }
+ return refAttribute;
+ }
+
+ private boolean annotationTest(EStructuralFeature eStrucClassifier, String annotation, String type) {
+ String annotationType = null;
+ EAnnotation eAnnotation = null;
+ String onapType = null;
+ String onapValue = null;
+
+ EList<EAnnotation> value = eStrucClassifier.getEAnnotations();
+
+ for (int i = 0; i < value.size(); i++){
+ annotationType = value.get(i).getSource();
+ eAnnotation = eStrucClassifier.getEAnnotations().get(i);
+ onapType = eAnnotation.getDetails().get(0).getValue();
+ onapValue = eAnnotation.getDetails().get(0).getKey();
+ if (annotationType.contains(type) && onapType.contains(annotation)){
+ return true;
+ } else if (annotationType.contains(type) && onapValue.contains(annotation)){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ private String annotationValue(EStructuralFeature eStrucClassifier, ANNOTATION_TYPE annotation, String type) {
+ String annotationType = null;
+ EAnnotation eAnnotation = null;
+ String onapType = null;
+ String onapValue = null;
+
+ EList<EAnnotation> value = eStrucClassifier.getEAnnotations();
+
+ for (int i = 0; i < value.size(); i++){
+ annotationType = value.get(i).getSource();
+ eAnnotation = eStrucClassifier.getEAnnotations().get(i);
+ onapType = eAnnotation.getDetails().get(0).getKey();
+ if (annotationType.contains(type) && onapType.compareToIgnoreCase(annotation.toString())==0){
+ onapValue = eAnnotation.getDetails().get(0).getValue();
+ if (annotation == ANNOTATION_TYPE.VALIDATION){
+ return onapValue;
+ } else {
+ return onapType + "-" + onapValue;
+ }
+ }
+ }
+
+ return onapValue;
+ }
+ public boolean isRequiredAttribute(EObject obj, String className){
+ EClassifier eClassifier = (EClassifier) obj;
+ String workingClass = eClassifier.getName();
+ workingClass.trim();
+ if (workingClass.equalsIgnoreCase(className)){
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean isPolicyTemplate(EPackage root, String className){
+
+ for (EClassifier classifier : root.getEClassifiers()){
+ if (classifier instanceof EClass) {
+ EClass eClass = (EClass)classifier;
+ if (eClass.getName().contentEquals(className)){
+ EList<EAnnotation> value = eClass.getEAnnotations();
+ for (EAnnotation workingValue : value){
+ EMap<String, String> keyMap = workingValue.getDetails();
+ if (keyMap.containsKey("policyTemplate")){
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+ private String getSubTypes(EPackage root, String className) {
+ String returnSubTypes = null;
+ for (EClassifier classifier : root.getEClassifiers()){
+ if (classifier instanceof EClass) {
+ EClass eClass = (EClass)classifier;
+
+ for (EClass eSuperType : eClass.getEAllSuperTypes())
+ {
+ if (eClass.getName().contentEquals(className)){
+ returnSubTypes = eSuperType.getName();
+ }
+ }
+ }
+ }
+ return returnSubTypes;
+ }
+
+ public HashMap<String, String> getAttributeList(EPackage root, String className, String superClass){
+
+ TreeIterator<EObject> treeItr = root.eAllContents();
+ boolean requiredAttribute = false;
+ HashMap<String, String> refAttribute = new HashMap<>();
+ boolean annotation = false;
+ boolean dictionaryTest = false;
+ String defaultValue = null;
+ String eType = null;
+
+ // Pulling out dependency from file
+ while (treeItr.hasNext()) {
+ EObject obj = treeItr.next();
+ if (obj instanceof EClassifier) {
+ if (isRequiredAttribute(obj, className ) || isRequiredAttribute(obj, superClass )){
+ requiredAttribute = true;
+ }else {
+ requiredAttribute = false;
+ }
+
+ }
+
+ if (requiredAttribute){
+ if (obj instanceof EStructuralFeature) {
+ EStructuralFeature eStrucClassifier = (EStructuralFeature) obj;
+ if (eStrucClassifier.getEAnnotations().size() != 0) {
+ annotation = annotationTest(eStrucClassifier, configuration, onap);
+ dictionaryTest = annotationTest(eStrucClassifier, dictionary, policy);
+ EClassifier refType = ((EStructuralFeature) obj).getEType();
+ if (annotation && !(obj instanceof EReference) && !(refType instanceof EEnumImpl)) {
+ String name = eStrucClassifier.getName();
+ if (dictionaryTest){
+ eType = annotationValue(eStrucClassifier, ANNOTATION_TYPE.DICTIONARY, policy);
+ }else {
+ eType = eStrucClassifier.getEType().getInstanceClassName();
+ }
+ defaultValue = checkDefultValue(((EStructuralFeature) obj).getDefaultValueLiteral());
+
+ String array = arrayCheck(((EStructuralFeature) obj).getUpperBound());
+ String required = checkRequiredPattern(((EStructuralFeature) obj).getUpperBound(), ((EStructuralFeature) obj).getLowerBound());
+ String attributeValue = eType + defaultValue + required + array;
+ refAttribute.put(name, attributeValue);
+ }
+ }
+ }
+ }
+ }
+ return refAttribute;
+
+ }
+
+ public String arrayCheck(int upperBound) {
+
+ if (upperBound == -1){
+ return ":MANY-true";
+ }
+
+ return ":MANY-false";
+ }
+
+ public List<String> getDependencyList(EClassifier eClassifier, String className){
+ List<String> returnValue = new ArrayList<>();;
+ EList<EClass> somelist = ((EClass) eClassifier).getEAllSuperTypes();
+ if (somelist.isEmpty()){
+ return returnValue;
+ }
+ for(EClass depend: somelist){
+ if (depend.toString().contains(eProxyURI)){
+ String one = depend.toString().split(eProxyURI)[1];
+ String value = StringUtils.replaceEach(one.split("#")[1], new String[]{"//", ")"}, new String[]{"", ""});
+ returnValue.add(value);
+ }
+ }
+
+ return returnValue;
+ }
+
+ public Map<String, String> buildSubList(HashMap<String, String> subClassAttributes, HashMap<String, MSAttributeObject> classMap, String className){
+ Map<String, String> missingValues = new HashMap<>();
+ Map<String, String> workingMap = new HashMap<>();
+ boolean enumType;
+
+ for ( Entry<String, String> map : classMap.get(className).getRefAttribute().entrySet()){
+ String value = map.getValue().split(":")[0];
+ if (value!=null){
+ classMap.get(className).getEnumType();
+ enumType = classMap.get(className).getEnumType().containsKey(value);
+ if (!enumType){
+ workingMap = classMap.get(value).getRefAttribute();
+ for ( Entry<String, String> subMab : workingMap.entrySet()){
+ String value2 = subMab.getValue().split(":")[0];
+ if (!subClassAttributes.containsValue(value2)){
+ missingValues.put(subMab.getKey(), subMab.getValue());
+ }
+ }
+
+ }
+ }
+ }
+
+ return missingValues;
+ }
+
+ public Map<String, HashMap<String, String>> recursiveReference(HashMap<String, MSAttributeObject> classMap, String className){
+
+ Map<String, HashMap<String, String>> returnObject = new HashMap<>();
+ HashMap<String, String> returnClass = getRefclass(classMap, className);
+ returnObject.put(className, returnClass);
+ for (Entry<String, String> reAttribute :returnClass.entrySet()){
+ if (reAttribute.getValue().split(":")[1].contains("MANY")){
+ if (classMap.get(reAttribute.getValue().split(":")[0]) != null){
+ returnObject.putAll(recursiveReference(classMap, reAttribute.getValue().split(":")[0]));
+ }
+ }
+
+ }
+
+ return returnObject;
+
+ }
+
+ public String createJson(HashMap<String, Object> subClassAttributes, HashMap<String, MSAttributeObject> classMap, String className) {
+ boolean enumType;
+ Map<String, HashMap<String, String>> myObject = new HashMap<>();
+ for ( Entry<String, String> map : classMap.get(className).getRefAttribute().entrySet()){
+ String value = map.getValue().split(":")[0];
+ if (value!=null){
+ enumType = classMap.get(className).getEnumType().containsKey(value);
+ if (!enumType){
+ if (map.getValue().split(":")[1].contains("MANY")){
+ Map<String, HashMap<String, String>> testRecursive = recursiveReference(classMap, map.getValue().split(":")[0] );
+ myObject.putAll(testRecursive);
+ }
+ }
+ }
+ }
+
+ Gson gson = new Gson();
+ String json = gson.toJson(myObject);
+
+ return json;
+ }
+
+ public HashMap<String, String> getRefclass(HashMap<String, MSAttributeObject> classMap, String className){
+ HashMap<String, String> missingValues = new HashMap<>();
+
+ if (classMap.get(className).getAttribute()!=null || !classMap.get(className).getAttribute().isEmpty()){
+ missingValues.putAll(classMap.get(className).getAttribute());
+ }
+
+ if (classMap.get(className).getRefAttribute()!=null || !classMap.get(className).getRefAttribute().isEmpty()){
+ missingValues.putAll(classMap.get(className).getRefAttribute());
+ }
+
+ return missingValues;
+ }
+
+ public String createSubAttributes(ArrayList<String> dependency, HashMap<String, MSAttributeObject> classMap, String modelName) {
+
+ HashMap <String, Object> workingMap = new HashMap<>();
+ MSAttributeObject tempObject = new MSAttributeObject();
+ if (dependency!=null){
+ if (dependency.size()==0){
+ return "{}";
+ }
+ dependency.add(modelName);
+ for (String element: dependency){
+ tempObject = classMap.get(element);
+ if (tempObject!=null){
+ workingMap.putAll(classMap.get(element).getSubClass());
+ }
+ }
+ }
+
+ String returnValue = createJson(workingMap, classMap, modelName);
+ return returnValue;
+ }
+
+ public ArrayList<String> getFullDependencyList(ArrayList<String> dependency, HashMap<String,MSAttributeObject > classMap) {
+ ArrayList<String> returnList = new ArrayList<>();
+ ArrayList<String> workingList = new ArrayList<>();
+ returnList.addAll(dependency);
+ for (String element : dependency ){
+ if (classMap.containsKey(element)){
+ MSAttributeObject value = classMap.get(element);
+ String rawValue = StringUtils.replaceEach(value.getDependency(), new String[]{"[", "]"}, new String[]{"", ""});
+ workingList = new ArrayList<String>(Arrays.asList(rawValue.split(",")));
+ for(String depend : workingList){
+ if (!returnList.contains(depend) && !depend.isEmpty()){
+ returnList.add(depend.trim());
+ }
+ }
+ }
+ }
+
+ return returnList;
+ }
+}
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java
new file mode 100644
index 000000000..908078f73
--- /dev/null
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/Webapps.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.util;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.policy.rest.XACMLRestProperties;
+
+import org.onap.policy.xacml.api.XACMLErrorConstants;
+import com.att.research.xacml.util.XACMLProperties;
+
+import org.onap.policy.common.logging.eelf.MessageCodes;
+import org.onap.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 Webapps() {
+ }
+
+ public static String getConfigHome(){
+ try {
+ loadWebapps();
+ } catch (Exception e) {
+ logger.error("Exception Occured while loading webapps"+e);
+ return null;
+ }
+ return configHome;
+ }
+
+ public static String getActionHome(){
+ 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(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("\\")){
+ webappsPathConfig = Paths.get(webappsPath.toString()+"\\Config");
+ webappsPathAction = Paths.get(webappsPath.toString()+"\\Action");
+ }else{
+ webappsPathConfig = Paths.get(webappsPath.toString()+"/Config");
+ webappsPathAction = Paths.get(webappsPath.toString()+"/Action");
+ }
+
+ 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");
+ }
+ }
+ }
+
+}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java
new file mode 100644
index 000000000..3de436481
--- /dev/null
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/XACMLRestTest.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest;
+
+/*import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockServletConfig;
+
+import com.att.research.xacml.util.XACMLProperties;
+import com.mockrunner.mock.web.MockServletInputStream;
+
+public class XACMLRestTest extends TestCase{
+ private static Log logger = LogFactory.getLog(XACMLRestTest.class);
+
+ private List<String> headers = new ArrayList<String>();
+
+ private HttpServletRequest httpServletRequest;
+ private HttpServletResponse httpServletResponse;
+ private ServletOutputStream mockOutput;
+ private ServletInputStream mockInput;
+ private ServletConfig servletConfig;
+
+
+ @Before
+ public void setUp(){
+ httpServletRequest = Mockito.mock(HttpServletRequest.class);
+ Mockito.when(httpServletRequest.getMethod()).thenReturn("POST");
+ Mockito.when(httpServletRequest.getHeaderNames()).thenReturn(Collections.enumeration(headers));
+ Mockito.when(httpServletRequest.getAttributeNames()).thenReturn(Collections.enumeration(headers));
+
+ mockOutput = Mockito.mock(ServletOutputStream.class);
+
+ httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
+
+ try {
+ Mockito.when(httpServletResponse.getOutputStream()).thenReturn(mockOutput);
+ } catch (IOException e) {
+ fail();
+ }
+
+ servletConfig = Mockito.mock(MockServletConfig.class);
+ Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(headers));
+ //pdpServlet = new XACMLPdpServlet();
+
+ Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties");
+
+ System.setProperty("xacml.properties", "xacml.pdp.properties");
+ System.setProperty("xacml.rest.pdp.config", "config_testing");
+ System.setProperty("xacml.rest.pep.idfile", "testclient.properties");
+ System.setProperty("xacml.rest.pdp.webapps", "/webapps");
+ System.setProperty("xacml.rootPolicies", "test_PolicyEngine.xml");
+ System.setProperty("xacml.referencedPolicies", "test_PolicyEngine.xml");
+ System.setProperty("test_PolicyEngine.xml.file", "config_testing\\test_PolicyEngine.xml");
+ System.setProperty("xacml.rest.pdp.register", "false");
+ }
+
+ @Test
+ public void testDummy(){
+ logger.info("XACMLRestTest - testInit");
+ try {
+ assertTrue(true);
+ } catch (Exception e) {
+ fail();
+
+ }
+
+ }
+}
+*/ \ No newline at end of file