Merge "Cleanup drl files in policy/engine test modules"
authorJorge Hernandez <jorge.hernandez-herrero@att.com>
Fri, 15 Nov 2019 15:37:59 +0000 (15:37 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 15 Nov 2019 15:37:59 +0000 (15:37 +0000)
136 files changed:
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/DictionaryNames.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/Heartbeat.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/UpdateOthersPAPS.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateBrmsParamPolicy.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/CreateNewMicroServiceModel.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPaps.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDao.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryController.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryController.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportController.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/MicroServiceDictionaryController.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/elk/client/PolicyElasticSearchController.java
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DictionaryHandlerImpl.java
ONAP-PAP-REST/src/main/resources/META-INF/drop.ddl
ONAP-PAP-REST/src/main/resources/META-INF/persistence.xml
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/UpdateOthersPAPSTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/test/XACMLPAPTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/HeartbeatTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/BRMSPolicyTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPapsTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/ClosedLoopDictionaryControllerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/DictionaryImportControllerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/OptimizationDictionaryControllerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/jpa/PolicyEntityTest.java
ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/service/ImportServiceTest.java
ONAP-PAP-REST/src/test/resources/dictionaryImport/PepOptions.csv [moved from ONAP-PAP-REST/src/test/resources/dictionaryImport/PEPOptions.csv with 100% similarity]
ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/GetDictionaryService.java
ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/api/test/GetDictionaryServiceTest.java
ONAP-PDP-REST/src/test/resources/META-INF/drop.ddl
ONAP-PDP-REST/src/test/resources/META-INF/persistence.xml
ONAP-REST/pom.xml
ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsController.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsDependency.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsParamTemplate.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUsers.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUuid.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DictionaryData.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FwTag.java [moved from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java with 56% similarity]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FwTagPicker.java [moved from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java with 53% similarity]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceAttribute.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceConfigName.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceLocation.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroServiceModels.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaults.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Obadvice.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ObadviceExpression.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OnapName.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/OptimizationModels.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java [deleted file]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java [deleted file]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PdpEntity.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PepOptions.java [moved from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java with 56% similarity]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PipConfigParam.java [new file with mode: 0644]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PipConfiguration.java [moved from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfiguration.java with 52% similarity]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PipResolver.java [moved from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolver.java with 59% similarity]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PipResolverParam.java [new file with mode: 0644]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PipType.java [moved from ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPType.java with 59% similarity]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAlgorithms.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyAuditlog.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDBDaoEntity.java [deleted file]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDbDaoEntity.java [new file with mode: 0644]
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEntity.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyGroupEntity.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyRoles.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeClosedLoop.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeResource.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeService.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScopeType.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyScore.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PortList.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PrefixList.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ProtocolList.java
ONAP-REST/src/main/java/org/onap/policy/rest/jpa/package-info.java [deleted file]
ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java
ONAP-REST/src/test/java/org/onap/policy/rest/adapter/PolicyRestAdapterTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/daoimpl/PolicyValidationDaoImplTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJpaTest.java [moved from ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ClosedLoopPolicyDictionaryJPATest.java with 70% similarity]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/CommonDictionaryJpaTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ConfigurationDataEntityTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJpaTest.java [moved from ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DecisionDictionaryJPATest.java with 80% similarity]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/DictionaryDataTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java [moved from ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java with 80% similarity]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroServiceDictionaryJpaTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaultsTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ModelsTest.java [new file with mode: 0644]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJpaTest.java [moved from ONAP-REST/src/test/java/org/onap/policy/rest/jpa/OptimizationModelsJPATest.java with 87% similarity]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java [deleted file]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PipConfigurationTest.java [new file with mode: 0644]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PipJpaTest.java [moved from ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPJPATest.java with 57% similarity]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyAuditlogTest.java
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java [deleted file]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java [new file with mode: 0644]
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJpaTest.java [moved from ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyUtilsJPATest.java with 50% similarity]
POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java
POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
POLICY-SDK-APP/src/test/java/org/onap/policy/controller/CreateDcaeMicroServiceControllerTest.java
POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java
packages/base/src/files/install/mysql/data/161000_upgrade_script.sql
packages/base/src/files/install/mysql/data/170701_downgrade_script.sql
packages/base/src/files/install/mysql/data/170701_upgrade_script.sql
packages/docker/pom.xml

index 2bb2e95..0e1cc52 100644 (file)
@@ -36,7 +36,7 @@ public enum DictionaryNames {
     VSCLAction,
     ClosedLoopService,
     ClosedLoopSite,
-    PEPOptions,
+    PepOptions,
     VarbindDictionary,
     BRMSParamDictionary,
     BRMSControllerDictionary,
index 81e7c67..920c3dd 100644 (file)
@@ -23,7 +23,7 @@ package org.onap.policy.pap.xacml.rest;
 import com.att.research.xacml.api.pap.PAPException;
 import com.att.research.xacml.api.pap.PDPStatus;
 import com.att.research.xacml.util.XACMLProperties;
-
+import com.google.common.annotations.VisibleForTesting;
 import java.net.ConnectException;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
@@ -33,7 +33,6 @@ import java.net.UnknownHostException;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
-
 import org.onap.policy.common.logging.eelf.MessageCodes;
 import org.onap.policy.common.logging.eelf.PolicyLogger;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -88,9 +87,9 @@ public class Heartbeat implements Runnable {
     public Heartbeat(PAPPolicyEngine papEngine2) {
         papEngine = papEngine2;
         this.heartbeatInterval =
-                Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_HEARTBEAT_INTERVAL, "10000"));
+            Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_HEARTBEAT_INTERVAL, "10000"));
         this.heartbeatTimeout =
-                Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_HEARTBEAT_TIMEOUT, "10000"));
+            Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_HEARTBEAT_TIMEOUT, "10000"));
     }
 
     @Override
@@ -127,7 +126,8 @@ public class Heartbeat implements Runnable {
         }
     }
 
-    private void getPdpsFromGroup() {
+    @VisibleForTesting
+    protected void getPdpsFromGroup() {
         try {
             for (OnapPDPGroup g : papEngine.getOnapPDPGroups()) {
                 for (OnapPDP p : g.getOnapPdps()) {
@@ -136,11 +136,12 @@ public class Heartbeat implements Runnable {
             }
         } catch (PAPException e) {
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, XACMLPAPSERVLET,
-                    "Heartbeat unable to read PDPs from PAPEngine");
+                "Heartbeat unable to read PDPs from PAPEngine");
         }
     }
 
-    private void notifyEachPdp() {
+    @VisibleForTesting
+    protected void notifyEachPdp() {
         HashMap<String, URL> idToUrlMap = new HashMap<>();
         for (OnapPDP pdp : pdps) {
             // Check for shutdown
@@ -163,14 +164,15 @@ public class Heartbeat implements Runnable {
                     }
                 } catch (MalformedURLException e) {
                     PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, XACMLPAPSERVLET,
-                            " PDP id '" + fullUrlString + "' is not a valid URL");
+                        " PDP id '" + fullUrlString + "' is not a valid URL");
                 }
             }
             updatePdpStatus(pdp, openPdpConnection(pdpUrl, pdp));
         }
     }
 
-    private String openPdpConnection(URL pdpUrl, OnapPDP pdp) {
+    @VisibleForTesting
+    protected String openPdpConnection(URL pdpUrl, OnapPDP pdp) {
         // Do a GET with type HeartBeat
         String newStatus = "";
         HttpURLConnection connection = null;
@@ -197,25 +199,25 @@ public class Heartbeat implements Runnable {
                     // anything else is an unexpected result
                     newStatus = PDPStatus.Status.UNKNOWN.toString();
                     PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " Heartbeat connect response code "
-                            + connection.getResponseCode() + ": " + pdp.getId());
+                        + connection.getResponseCode() + ": " + pdp.getId());
                 }
             }
         } catch (UnknownHostException e) {
             newStatus = PDPStatus.Status.NO_SUCH_HOST.toString();
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, XACMLPAPSERVLET,
-                    HEARTBEATSTRING + pdp.getId() + "' NO_SUCH_HOST");
+                HEARTBEATSTRING + pdp.getId() + "' NO_SUCH_HOST");
         } catch (SocketTimeoutException e) {
             newStatus = PDPStatus.Status.CANNOT_CONNECT.toString();
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, XACMLPAPSERVLET,
-                    HEARTBEATSTRING + pdp.getId() + "' connection timeout");
+                HEARTBEATSTRING + pdp.getId() + "' connection timeout");
         } catch (ConnectException e) {
             newStatus = PDPStatus.Status.CANNOT_CONNECT.toString();
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, XACMLPAPSERVLET,
-                    HEARTBEATSTRING + pdp.getId() + "' cannot connect");
+                HEARTBEATSTRING + pdp.getId() + "' cannot connect");
         } catch (Exception e) {
             newStatus = PDPStatus.Status.UNKNOWN.toString();
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, XACMLPAPSERVLET,
-                    HEARTBEATSTRING + pdp.getId() + "' connect exception");
+                HEARTBEATSTRING + pdp.getId() + "' connect exception");
         } finally {
             // cleanup the connection
             if (connection != null)
@@ -224,7 +226,8 @@ public class Heartbeat implements Runnable {
         return newStatus;
     }
 
-    private void updatePdpStatus(OnapPDP pdp, String newStatus) {
+    @VisibleForTesting
+    protected void updatePdpStatus(OnapPDP pdp, String newStatus) {
         if (!pdp.getStatus().getStatus().toString().equals(newStatus)) {
             if (LOGGER.isDebugEnabled()) {
                 LOGGER.debug("previous status='" + pdp.getStatus().getStatus() + "'  new Status='" + newStatus + "'");
@@ -233,7 +236,7 @@ public class Heartbeat implements Runnable {
                 getPAPInstance().setPDPSummaryStatus(pdp, newStatus);
             } catch (PAPException e) {
                 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, XACMLPAPSERVLET,
-                        "Unable to set state for PDP '" + pdp.getId());
+                    "Unable to set state for PDP '" + pdp.getId());
             }
         }
     }
index 2bb4229..1b25c3b 100644 (file)
@@ -48,7 +48,7 @@ import org.onap.policy.rest.XacmlRestProperties;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.ActionBodyEntity;
 import org.onap.policy.rest.jpa.ConfigurationDataEntity;
-import org.onap.policy.rest.jpa.PolicyDBDaoEntity;
+import org.onap.policy.rest.jpa.PolicyDbDaoEntity;
 import org.onap.policy.utils.PeCryptoUtils;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -103,11 +103,11 @@ public class UpdateOthersPAPS {
         body.setOldPolicyName(request.getParameter("oldPolicyName"));
 
         String currentPap = XacmlRestProperties.getProperty("xacml.rest.pap.url");
-        List<Object> getPAPUrls = commonClassDao.getData(PolicyDBDaoEntity.class);
+        List<Object> getPAPUrls = commonClassDao.getData(PolicyDbDaoEntity.class);
         if (getPAPUrls != null && !getPAPUrls.isEmpty()) {
             for (int i = 0; i < getPAPUrls.size(); i++) {
-                PolicyDBDaoEntity papId = (PolicyDBDaoEntity) getPAPUrls.get(i);
-                String papUrl = papId.getPolicyDBDaoUrl();
+                PolicyDbDaoEntity papId = (PolicyDbDaoEntity) getPAPUrls.get(i);
+                String papUrl = papId.getPolicyDbDaoUrl();
                 if (!papUrl.equals(currentPap)) {
                     String userName = papId.getUsername();
                     String password = papId.getPassword();
index 36ab893..ffb902b 100644 (file)
@@ -22,7 +22,7 @@ package org.onap.policy.pap.xacml.rest.components;
 
 import com.att.research.xacml.api.pap.PAPException;
 import com.att.research.xacml.std.IdentifierImpl;
-
+import com.google.common.annotations.VisibleForTesting;
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -41,9 +41,7 @@ import java.util.Map.Entry;
 import java.util.UUID;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-
 import javax.script.SimpleBindings;
-
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
@@ -57,7 +55,6 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-
 import org.apache.commons.io.FilenameUtils;
 import org.onap.policy.common.logging.eelf.MessageCodes;
 import org.onap.policy.common.logging.eelf.PolicyLogger;
@@ -131,7 +128,7 @@ public class CreateBrmsParamPolicy extends Policy {
             out.close();
         } catch (Exception e) {
             PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy",
-                    "Exception saving configuration file");
+                "Exception saving configuration file");
         }
     }
 
@@ -148,6 +145,7 @@ public class CreateBrmsParamPolicy extends Policy {
     }
 
     // Validations for Config form
+    @Override
     public boolean validateConfigForm() {
 
         // Validating mandatory Fields.
@@ -184,7 +182,7 @@ public class CreateBrmsParamPolicy extends Policy {
     private String getValueFromDictionary(String templateName) {
         String ruleTemplate = null;
         CommonClassDaoImpl dbConnection = new CommonClassDaoImpl();
-        String queryString = "from BRMSParamTemplate where param_template_name= :templateName";
+        String queryString = "from BrmsParamTemplate where param_template_name= :templateName";
         SimpleBindings params = new SimpleBindings();
         params.put("templateName", templateName);
         List<Object> result = dbConnection.getDataByQuery(queryString, params);
@@ -252,7 +250,7 @@ public class CreateBrmsParamPolicy extends Policy {
                     }
                 }
                 String param =
-                        params.toString().replace("declare Params", "").replace("end", "").replaceAll("\\s+", "");
+                    params.toString().replace("declare Params", "").replace("end", "").replaceAll("\\s+", "");
                 String[] components = param.split(":");
                 String caption = "";
                 for (int i = 0; i < components.length; i++) {
@@ -283,7 +281,7 @@ public class CreateBrmsParamPolicy extends Policy {
                 }
             } catch (Exception e) {
                 PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CreateBrmsParamPolicy",
-                        "Exception parsing file in findType");
+                    "Exception parsing file in findType");
             }
         }
         return mapFieldType;
@@ -327,7 +325,7 @@ public class CreateBrmsParamPolicy extends Policy {
 
             try {
                 body.append("/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI "
-                        + "purpose. \n\t " + "<$%BRMSParamTemplate=" + templateValue + "%$> \n");
+                    + "purpose. \n\t " + "<$%BRMSParamTemplate=" + templateValue + "%$> \n");
                 body.append("<%$Values=");
                 for (Map.Entry<String, String> entry : ruleAndUIValue.entrySet()) {
                     String uiKey = entry.getKey();
@@ -339,7 +337,7 @@ public class CreateBrmsParamPolicy extends Policy {
                 body.append(valueFromDictionary + "\n");
             } catch (Exception e) {
                 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy",
-                        "Exception saving policy");
+                    "Exception saving policy");
             }
 
             saveConfigurations(policyName, body.toString());
@@ -407,7 +405,7 @@ public class CreateBrmsParamPolicy extends Policy {
                 accessURI = new URI(ACTION_ID);
             } catch (URISyntaxException e) {
                 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy",
-                        "Exception creating ACCESS URI");
+                    "Exception creating ACCESS URI");
             }
             accessAttributeDesignator.setCategory(CATEGORY_ACTION);
             accessAttributeDesignator.setDataType(STRING_DATATYPE);
@@ -429,7 +427,7 @@ public class CreateBrmsParamPolicy extends Policy {
                 configURI = new URI(RESOURCE_ID);
             } catch (URISyntaxException e) {
                 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy",
-                        "Exception creating Config URI");
+                    "Exception creating Config URI");
             }
 
             configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
@@ -461,7 +459,8 @@ public class CreateBrmsParamPolicy extends Policy {
     }
 
     // Data required for Advice part is setting here.
-    private AdviceExpressionsType getAdviceExpressions(int version, String fileName) {
+    @VisibleForTesting
+    protected AdviceExpressionsType getAdviceExpressions(int version, String fileName) {
 
         // Policy Config ID Assignment
         AdviceExpressionsType advices = new AdviceExpressionsType();
@@ -546,8 +545,8 @@ public class CreateBrmsParamPolicy extends Policy {
         // Adding Controller Information.
         if (policyAdapter.getBrmsController() != null) {
             BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
-            advice.getAttributeAssignmentExpression().add(createResponseAttributes(
-                    "controller:" + policyAdapter.getBrmsController(),
+            advice.getAttributeAssignmentExpression()
+                .add(createResponseAttributes("controller:" + policyAdapter.getBrmsController(),
                     brmsDicitonaryController.getControllerDataByID(policyAdapter.getBrmsController()).getController()));
         }
 
@@ -561,14 +560,14 @@ public class CreateBrmsParamPolicy extends Policy {
                 key.append(dependencyName + ",");
             }
             advice.getAttributeAssignmentExpression()
-                    .add(createResponseAttributes("dependencies:" + key.toString(), dependencies.toString()));
+                .add(createResponseAttributes("dependencies:" + key.toString(), dependencies.toString()));
         }
 
         // Dynamic Field Config Attributes.
         Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
         for (Entry<String, String> map : dynamicFieldConfigAttributes.entrySet()) {
             advice.getAttributeAssignmentExpression()
-                    .add(createResponseAttributes("key:" + map.getKey(), map.getValue()));
+                .add(createResponseAttributes("key:" + map.getKey(), map.getValue()));
         }
 
         // Risk Attributes
index 573f274..ea5e8aa 100644 (file)
@@ -275,7 +275,7 @@ public class CreateNewMicroServiceModel {
             newModel.setDependency("[]");
             if (mainClass.getSubClass() != null) {
                 String value = new Gson().toJson(mainClass.getSubClass());
-                newModel.setSub_attributes(value);
+                newModel.setSubAttributes(value);
             }
 
             if (mainClass.getAttribute() != null) {
@@ -289,7 +289,7 @@ public class CreateNewMicroServiceModel {
                 String refAttributes = mainClass.getRefAttribute().toString().replace("{", "").replace("}", "");
                 int equalsIndex = refAttributes.indexOf("=");
                 String refAttributesAfterFirstEquals = refAttributes.substring(equalsIndex + 1);
-                this.newModel.setRef_attributes(refAttributesAfterFirstEquals);
+                this.newModel.setRefAttributes(refAttributesAfterFirstEquals);
             }
 
             if (mainClass.getEnumType() != null) {
@@ -328,14 +328,14 @@ public class CreateNewMicroServiceModel {
             }
             subAttribute = utils.createSubAttributes(dependency, classMap, this.newModel.getModelName());
 
-            this.newModel.setSub_attributes(subAttribute);
+            this.newModel.setSubAttributes(subAttribute);
             if (mainClass.getAttribute() != null && !mainClass.getAttribute().isEmpty()) {
                 this.newModel.setAttributes(mainClass.getAttribute().toString().replace("{", "").replace("}", ""));
             }
 
             if (mainClass.getRefAttribute() != null && !mainClass.getRefAttribute().isEmpty()) {
                 this.newModel
-                        .setRef_attributes(mainClass.getRefAttribute().toString().replace("{", "").replace("}", ""));
+                        .setRefAttributes(mainClass.getRefAttribute().toString().replace("{", "").replace("}", ""));
             }
 
             if (mainClass.getEnumType() != null && !mainClass.getEnumType().isEmpty()) {
@@ -368,8 +368,8 @@ public class CreateNewMicroServiceModel {
             model.setDependency(this.newModel.getDependency());
             model.setDescription(this.newModel.getDescription());
             model.setEnumValues(this.newModel.getEnumValues());
-            model.setRef_attributes(this.newModel.getRef_attributes());
-            model.setSub_attributes(this.newModel.getSub_attributes());
+            model.setRefAttributes(this.newModel.getRefAttributes());
+            model.setSubAttributes(this.newModel.getSubAttributes());
             model.setDataOrderInfo(this.newModel.getDataOrderInfo());
             model.setDecisionModel(this.newModel.isDecisionModel());
             model.setRuleFormation(this.newModel.getRuleFormation());
index 4e4c026..72e6f48 100644 (file)
@@ -250,12 +250,12 @@ public class HandleIncomingNotifications {
         } else if (localGroup == null) {
             // creating a new group
             try {
-                PolicyDbDao.getPolicyDbDaoInstance().getPapEngine().newGroup(groupRecord.getgroupName(),
+                PolicyDbDao.getPolicyDbDaoInstance().getPapEngine().newGroup(groupRecord.getGroupName(),
                         groupRecord.getDescription());
             } catch (NullPointerException | PAPException e) {
                 PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, PolicyDbDao.POLICYDBDAO_VAR,
                         "Caught PAPException trying to create pdp group with "
-                                + "papEngine.newGroup(groupRecord.getgroupName(), groupRecord.getDescription());");
+                                + "papEngine.newGroup(groupRecord.getGroupName(), groupRecord.getDescription());");
                 throw new PAPException("Could not create group " + groupRecord);
             }
             try {
@@ -311,11 +311,11 @@ public class HandleIncomingNotifications {
                 needToUpdate = true;
             }
             if (!PolicyDbDao.stringEquals(localGroupClone.getId(), groupRecord.getGroupId())
-                    || !PolicyDbDao.stringEquals(localGroupClone.getName(), groupRecord.getgroupName())) {
+                    || !PolicyDbDao.stringEquals(localGroupClone.getName(), groupRecord.getGroupName())) {
                 // changing ids
                 // we do not want to change the id, the papEngine will do this
                 // for us, it needs to know the old id
-                localGroupClone.setName(groupRecord.getgroupName());
+                localGroupClone.setName(groupRecord.getGroupName());
                 needToUpdate = true;
             }
             if (!PolicyDbDao.stringEquals(localGroupClone.getDescription(), groupRecord.getDescription())) {
index cd290c6..e9db043 100644 (file)
@@ -35,13 +35,13 @@ import java.util.UUID;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.rest.XacmlRestProperties;
-import org.onap.policy.rest.jpa.PolicyDBDaoEntity;
+import org.onap.policy.rest.jpa.PolicyDbDaoEntity;
 import org.onap.policy.utils.PeCryptoUtils;
 
 public class NotifyOtherPaps {
 
     private static final Logger LOGGER = FlexLogger.getLogger(NotifyOtherPaps.class);
-    private List<PolicyDBDaoEntity> failedPaps = null;
+    private List<PolicyDbDaoEntity> failedPaps = null;
 
     public void notifyOthers(long entityId, String entityType) {
         notifyOthers(entityId, entityType, null);
@@ -104,8 +104,8 @@ public class NotifyOtherPaps {
         @Override
         public void run() {
             PolicyDbDao dao = new PolicyDbDao();
-            PolicyDBDaoEntity dbdEntity = (PolicyDBDaoEntity) obj;
-            String otherPap = dbdEntity.getPolicyDBDaoUrl();
+            PolicyDbDaoEntity dbdEntity = (PolicyDbDaoEntity) obj;
+            String otherPap = dbdEntity.getPolicyDbDaoUrl();
             String txt;
             try {
                 txt = PeCryptoUtils.decrypt(dbdEntity.getPassword());
index e0db53e..9af380b 100644 (file)
@@ -59,7 +59,7 @@ import org.onap.policy.rest.jpa.ConfigurationDataEntity;
 import org.onap.policy.rest.jpa.DatabaseLockEntity;
 import org.onap.policy.rest.jpa.GroupEntity;
 import org.onap.policy.rest.jpa.PdpEntity;
-import org.onap.policy.rest.jpa.PolicyDBDaoEntity;
+import org.onap.policy.rest.jpa.PolicyDbDaoEntity;
 import org.onap.policy.rest.jpa.PolicyEntity;
 import org.onap.policy.utils.PeCryptoUtils;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
@@ -212,14 +212,14 @@ public class PolicyDbDao {
     /**
      * Gets the list of other registered PolicyDBDaos from the database.
      *
-     * @return List (type PolicyDBDaoEntity) of other PolicyDBDaos
+     * @return List (type PolicyDbDaoEntity) of other PolicyDBDaos
      */
     private List<?> getRemotePolicyDbDaoList() {
         logger.debug("getRemotePolicyDBDaoList() as getRemotePolicyDBDaoList() called");
         List<?> policyDbDaoEntityList = new LinkedList<>();
         Session session = sessionfactory.openSession();
         try {
-            Criteria cr = session.createCriteria(PolicyDBDaoEntity.class);
+            Criteria cr = session.createCriteria(PolicyDbDaoEntity.class);
             policyDbDaoEntityList = cr.list();
         } catch (Exception e) {
             PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, POLICYDBDAO_VAR,
@@ -328,7 +328,7 @@ public class PolicyDbDao {
     }
 
     /**
-     * Register the PolicyDBDao instance in the PolicyDBDaoEntity table.
+     * Register the PolicyDBDao instance in the PolicyDbDaoEntity table.
      *
      * @return Boolean, were we able to register?
      */
@@ -370,19 +370,19 @@ public class PolicyDbDao {
             }
         }
         logger.debug("\nPolicyDBDao.register. Database locking and concurrency control is initialized\n");
-        PolicyDBDaoEntity foundPolicyDbDaoEntity = null;
-        Criteria cr = session.createCriteria(PolicyDBDaoEntity.class);
-        cr.add(Restrictions.eq("policyDBDaoUrl", url[0]));
+        PolicyDbDaoEntity foundPolicyDbDaoEntity = null;
+        Criteria cr = session.createCriteria(PolicyDbDaoEntity.class);
+        cr.add(Restrictions.eq("policyDbDaoUrl", url[0]));
         List<?> data = cr.list();
         if (!data.isEmpty()) {
-            foundPolicyDbDaoEntity = (PolicyDBDaoEntity) data.get(0);
+            foundPolicyDbDaoEntity = (PolicyDbDaoEntity) data.get(0);
         }
 
         // encrypt the password
         String txt = PeCryptoUtils.encrypt(url[2]);
         if (foundPolicyDbDaoEntity == null) {
-            PolicyDBDaoEntity newPolicyDbDaoEntity = new PolicyDBDaoEntity();
-            newPolicyDbDaoEntity.setPolicyDBDaoUrl(url[0]);
+            PolicyDbDaoEntity newPolicyDbDaoEntity = new PolicyDbDaoEntity();
+            newPolicyDbDaoEntity.setPolicyDbDaoUrl(url[0]);
             newPolicyDbDaoEntity.setDescription("PAP server at " + url[0]);
             newPolicyDbDaoEntity.setUsername(url[1]);
             newPolicyDbDaoEntity.setPassword(txt);
index 882169a..67214ac 100644 (file)
@@ -1008,7 +1008,7 @@ public class PolicyDbDaoTransactionInstance implements PolicyDbDaoTransaction {
             }
 
             if (group.getName() != null
-                    && !PolicyDbDao.stringEquals(group.getName(), groupToUpdateInDb.getgroupName())) {
+                    && !PolicyDbDao.stringEquals(group.getName(), groupToUpdateInDb.getGroupName())) {
                 // we need to check if the new id exists in the database
                 String newGrpId = PolicyDbDao.createNewPdpGroupId(group.getName());
                 Query checkGroupQuery = session.createQuery(PolicyDbDao.GROUPENTITY_SELECT);
index 0b94b40..16e8e2e 100644 (file)
@@ -38,7 +38,7 @@ import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.ClosedLoopD2Services;
 import org.onap.policy.rest.jpa.ClosedLoopSite;
 import org.onap.policy.rest.jpa.OnapName;
-import org.onap.policy.rest.jpa.PEPOptions;
+import org.onap.policy.rest.jpa.PepOptions;
 import org.onap.policy.rest.jpa.UserInfo;
 import org.onap.policy.rest.jpa.VNFType;
 import org.onap.policy.rest.jpa.VSCLAction;
@@ -134,7 +134,7 @@ public class ClosedLoopDictionaryController {
             produces = MediaType.APPLICATION_JSON_VALUE)
     public void getPEPOptionsDictionaryByNameEntityData(HttpServletResponse response) {
         DictionaryUtils utils = getDictionaryUtilsInstance();
-        utils.getDataByEntity(response, pepOptionDatas, pepName, PEPOptions.class);
+        utils.getDataByEntity(response, pepOptionDatas, pepName, PepOptions.class);
     }
 
     @RequestMapping(
@@ -143,7 +143,7 @@ public class ClosedLoopDictionaryController {
             produces = MediaType.APPLICATION_JSON_VALUE)
     public void getPEPOptionsDictionaryEntityData(HttpServletResponse response) {
         DictionaryUtils utils = getDictionaryUtilsInstance();
-        utils.getData(response, pepOptionDatas, PEPOptions.class);
+        utils.getData(response, pepOptionDatas, PepOptions.class);
     }
 
     @RequestMapping(
@@ -336,15 +336,15 @@ public class ClosedLoopDictionaryController {
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             JsonNode root = mapper.readTree(request.getReader());
-            PEPOptions pEPOptions;
+            PepOptions pEPOptions;
             GridData gridData;
             String userId = null;
             if (fromAPI) {
-                pEPOptions = mapper.readValue(root.get(dictionaryFields).toString(), PEPOptions.class);
+                pEPOptions = mapper.readValue(root.get(dictionaryFields).toString(), PepOptions.class);
                 gridData = mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
                 userId = "API";
             } else {
-                pEPOptions = mapper.readValue(root.get("pepOptionsDictionaryData").toString(), PEPOptions.class);
+                pEPOptions = mapper.readValue(root.get("pepOptionsDictionaryData").toString(), PepOptions.class);
                 gridData = mapper.readValue(root.get("pepOptionsDictionaryData").toString(), GridData.class);
                 userId = root.get(userid).textValue();
             }
@@ -355,10 +355,10 @@ public class ClosedLoopDictionaryController {
             }
 
             List<Object> duplicateData =
-                    commonClassDao.checkDuplicateEntry(pEPOptions.getPepName(), pepName, PEPOptions.class);
+                    commonClassDao.checkDuplicateEntry(pEPOptions.getPepName(), pepName, PepOptions.class);
             boolean duplicateflag = false;
             if (!duplicateData.isEmpty()) {
-                PEPOptions data = (PEPOptions) duplicateData.get(0);
+                PepOptions data = (PepOptions) duplicateData.get(0);
                 if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
                     pEPOptions.setId(data.getId());
                 } else if ((request.getParameter(operation) != null
@@ -377,7 +377,7 @@ public class ClosedLoopDictionaryController {
                     pEPOptions.setModifiedDate(new Date());
                     commonClassDao.update(pEPOptions);
                 }
-                responseString = mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class));
+                responseString = mapper.writeValueAsString(commonClassDao.getData(PepOptions.class));
             } else {
                 responseString = duplicateResponseString;
             }
index 5de2dfb..e2e2e38 100644 (file)
@@ -211,7 +211,7 @@ public class DictionaryController {
             UserInfo userInfo = utils.getUserInfo(userId);
 
             List<Object> duplicateData =
-                    commonClassDao.checkDuplicateEntry(onapData.getOnapName(), onapName, OnapName.class);
+                    commonClassDao.checkDuplicateEntry(onapData.getName(), onapName, OnapName.class);
             boolean duplicateflag = false;
             if (!duplicateData.isEmpty()) {
                 OnapName data = (OnapName) duplicateData.get(0);
index 7400eb0..ef47503 100644 (file)
@@ -56,7 +56,7 @@ import org.onap.policy.rest.jpa.DescriptiveScope;
 import org.onap.policy.rest.jpa.GroupServiceList;
 import org.onap.policy.rest.jpa.MicroServiceModels;
 import org.onap.policy.rest.jpa.OnapName;
-import org.onap.policy.rest.jpa.PEPOptions;
+import org.onap.policy.rest.jpa.PepOptions;
 import org.onap.policy.rest.jpa.PrefixList;
 import org.onap.policy.rest.jpa.ProtocolList;
 import org.onap.policy.rest.jpa.SecurityZone;
@@ -213,7 +213,7 @@ public class DictionaryImportController {
                     for (int j = 0; j < rows.length; j++) {
                         if ("onap_name".equalsIgnoreCase(dictSheet.get(0)[j])
                                 || "Onap Name".equalsIgnoreCase(dictSheet.get(0)[j])) {
-                            attribute.setOnapName(rows[j]);
+                            attribute.setName(rows[j]);
                         }
                         if (DESCRIPTION.equalsIgnoreCase(dictSheet.get(0)[j])) {
                             attribute.setDescription(rows[j]);
@@ -252,10 +252,10 @@ public class DictionaryImportController {
                             attribute.setEnumValues(rows[j]);
                         }
                         if ("Ref Attributes".equalsIgnoreCase(dictSheet.get(0)[j])) {
-                            attribute.setRef_attributes(rows[j]);
+                            attribute.setRefAttributes(rows[j]);
                         }
                         if ("Sub Attributes".equalsIgnoreCase(dictSheet.get(0)[j])) {
-                            attribute.setSub_attributes(rows[j]);
+                            attribute.setSubAttributes(rows[j]);
                         }
                         if ("annotations".equalsIgnoreCase(dictSheet.get(0)[j])) {
                             attribute.setAnnotation(rows[j]);
@@ -295,10 +295,10 @@ public class DictionaryImportController {
                             attribute.setEnumValues(rows[j]);
                         }
                         if ("Ref Attributes".equalsIgnoreCase(dictSheet.get(0)[j])) {
-                            attribute.setRef_attributes(rows[j]);
+                            attribute.setRefAttributes(rows[j]);
                         }
                         if ("Sub Attributes".equalsIgnoreCase(dictSheet.get(0)[j])) {
-                            attribute.setSub_attributes(rows[j]);
+                            attribute.setSubAttributes(rows[j]);
                         }
                         if ("annotations".equalsIgnoreCase(dictSheet.get(0)[j])) {
                             attribute.setAnnotation(rows[j]);
@@ -389,9 +389,9 @@ public class DictionaryImportController {
                     commonClassDao.save(attribute);
                 }
             }
-            if (dictionaryName.startsWith("PEPOptions")) {
+            if (dictionaryName.startsWith("PepOptions")) {
                 for (int i = 1; i < dictSheet.size(); i++) {
-                    PEPOptions attribute = new PEPOptions();
+                    PepOptions attribute = new PepOptions();
                     UserInfo userinfo = new UserInfo();
                     userinfo.setUserLoginId(userId);
                     attribute.setUserCreatedBy(userinfo);
@@ -801,7 +801,7 @@ public class DictionaryImportController {
                 case VSCLAction:
                 case ClosedLoopService:
                 case ClosedLoopSite:
-                case PEPOptions:
+                case PepOptions:
                 case VarbindDictionary:
                 case BRMSParamDictionary:
                 case BRMSControllerDictionary:
index 8dda4dd..39a12c8 100644 (file)
@@ -42,8 +42,8 @@ import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.ActionList;
 import org.onap.policy.rest.jpa.AddressGroup;
-import org.onap.policy.rest.jpa.FWTag;
-import org.onap.policy.rest.jpa.FWTagPicker;
+import org.onap.policy.rest.jpa.FwTag;
+import org.onap.policy.rest.jpa.FwTagPicker;
 import org.onap.policy.rest.jpa.FirewallDictionaryList;
 import org.onap.policy.rest.jpa.GroupServiceList;
 import org.onap.policy.rest.jpa.PortList;
@@ -1013,7 +1013,7 @@ public class FirewallDictionaryController {
             produces = MediaType.APPLICATION_JSON_VALUE)
     public void getTagPickerNameEntityDataByName(HttpServletResponse response) {
         DictionaryUtils utils = getDictionaryUtilsInstance();
-        utils.getDataByEntity(response, fwTagPickerDatas, tagPickerName, FWTagPicker.class);
+        utils.getDataByEntity(response, fwTagPickerDatas, tagPickerName, FwTagPicker.class);
     }
 
     @RequestMapping(
@@ -1022,7 +1022,7 @@ public class FirewallDictionaryController {
             produces = MediaType.APPLICATION_JSON_VALUE)
     public void getTagPickerDictionaryEntityData(HttpServletResponse response) {
         DictionaryUtils utils = getDictionaryUtilsInstance();
-        utils.getData(response, fwTagPickerDatas, FWTagPicker.class);
+        utils.getData(response, fwTagPickerDatas, FwTagPicker.class);
     }
 
     @RequestMapping(value = {"/fw_dictionary/save_fwTagPicker"}, method = {RequestMethod.POST})
@@ -1034,15 +1034,15 @@ public class FirewallDictionaryController {
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             JsonNode root = mapper.readTree(request.getReader());
-            FWTagPicker fwTagPicker;
+            FwTagPicker fwTagPicker;
             TagGridValues data;
             String userId = "";
             if (fromAPI) {
-                fwTagPicker = mapper.readValue(root.get(dictionaryFields).toString(), FWTagPicker.class);
+                fwTagPicker = mapper.readValue(root.get(dictionaryFields).toString(), FwTagPicker.class);
                 data = mapper.readValue(root.get(dictionaryFields).toString(), TagGridValues.class);
                 userId = "API";
             } else {
-                fwTagPicker = mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), FWTagPicker.class);
+                fwTagPicker = mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), FwTagPicker.class);
                 data = mapper.readValue(root.get("fwTagPickerDictionaryData").toString(), TagGridValues.class);
                 userId = root.get(userid).textValue();
             }
@@ -1051,10 +1051,10 @@ public class FirewallDictionaryController {
             UserInfo userInfo = utils.getUserInfo(userId);
 
             List<Object> duplicateData = commonClassDao.checkDuplicateEntry(fwTagPicker.getTagPickerName(),
-                    tagPickerName, FWTagPicker.class);
+                    tagPickerName, FwTagPicker.class);
             boolean duplicateflag = false;
             if (!duplicateData.isEmpty()) {
-                FWTagPicker data1 = (FWTagPicker) duplicateData.get(0);
+                FwTagPicker data1 = (FwTagPicker) duplicateData.get(0);
                 if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
                     fwTagPicker.setId(data1.getId());
                 } else if ((request.getParameter(operation) != null
@@ -1073,7 +1073,7 @@ public class FirewallDictionaryController {
                     fwTagPicker.setModifiedDate(new Date());
                     commonClassDao.update(fwTagPicker);
                 }
-                responseString = mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class));
+                responseString = mapper.writeValueAsString(commonClassDao.getData(FwTagPicker.class));
             } else {
                 responseString = duplicateResponseString;
             }
@@ -1092,7 +1092,7 @@ public class FirewallDictionaryController {
     public void removeFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response)
             throws IOException {
         DictionaryUtils utils = getDictionaryUtilsInstance();
-        utils.removeData(request, response, fwTagPickerDatas, FWTagPicker.class);
+        utils.removeData(request, response, fwTagPickerDatas, FwTagPicker.class);
     }
 
     @RequestMapping(
@@ -1101,7 +1101,7 @@ public class FirewallDictionaryController {
             produces = MediaType.APPLICATION_JSON_VALUE)
     public void getTagDictionaryEntityData(HttpServletResponse response) {
         DictionaryUtils utils = getDictionaryUtilsInstance();
-        utils.getData(response, fwTagDatas, FWTag.class);
+        utils.getData(response, fwTagDatas, FwTag.class);
     }
 
     @RequestMapping(
@@ -1110,7 +1110,7 @@ public class FirewallDictionaryController {
             produces = MediaType.APPLICATION_JSON_VALUE)
     public void getTagNameEntityDataByName(HttpServletResponse response) {
         DictionaryUtils utils = getDictionaryUtilsInstance();
-        utils.getDataByEntity(response, fwTagDatas, "fwTagName", FWTag.class);
+        utils.getDataByEntity(response, fwTagDatas, "fwTagName", FwTag.class);
     }
 
     @RequestMapping(value = {"/fw_dictionary/save_fwTag"}, method = {RequestMethod.POST})
@@ -1122,15 +1122,15 @@ public class FirewallDictionaryController {
             ObjectMapper mapper = new ObjectMapper();
             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
             JsonNode root = mapper.readTree(request.getReader());
-            FWTag fwTag;
+            FwTag fwTag;
             TagGridValues tagGridValues;
             String userId = "";
             if (fromAPI) {
-                fwTag = mapper.readValue(root.get(dictionaryFields).toString(), FWTag.class);
+                fwTag = mapper.readValue(root.get(dictionaryFields).toString(), FwTag.class);
                 tagGridValues = mapper.readValue(root.get(dictionaryFields).toString(), TagGridValues.class);
                 userId = "API";
             } else {
-                fwTag = mapper.readValue(root.get("fwTagDictionaryData").toString(), FWTag.class);
+                fwTag = mapper.readValue(root.get("fwTagDictionaryData").toString(), FwTag.class);
                 tagGridValues = mapper.readValue(root.get("fwTagDictionaryData").toString(), TagGridValues.class);
                 userId = root.get(userid).textValue();
             }
@@ -1138,10 +1138,10 @@ public class FirewallDictionaryController {
 
             UserInfo userInfo = utils.getUserInfo(userId);
             List<Object> duplicateData =
-                    commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(), "fwTagName", FWTag.class);
+                    commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(), "fwTagName", FwTag.class);
             boolean duplicateflag = false;
             if (!duplicateData.isEmpty()) {
-                FWTag data = (FWTag) duplicateData.get(0);
+                FwTag data = (FwTag) duplicateData.get(0);
                 if (request.getParameter(operation) != null && "update".equals(request.getParameter(operation))) {
                     fwTag.setId(data.getId());
                 } else if ((request.getParameter(operation) != null
@@ -1160,7 +1160,7 @@ public class FirewallDictionaryController {
                     fwTag.setModifiedDate(new Date());
                     commonClassDao.update(fwTag);
                 }
-                responseString = mapper.writeValueAsString(commonClassDao.getData(FWTag.class));
+                responseString = mapper.writeValueAsString(commonClassDao.getData(FwTag.class));
             } else {
                 responseString = duplicateResponseString;
             }
@@ -1179,7 +1179,7 @@ public class FirewallDictionaryController {
     public void removeFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response)
             throws IOException {
         DictionaryUtils utils = getDictionaryUtilsInstance();
-        utils.removeData(request, response, fwTagDatas, FWTag.class);
+        utils.removeData(request, response, fwTagDatas, FwTag.class);
     }
 }
 
index dfd7af4..b9e1ce1 100644 (file)
@@ -658,7 +658,7 @@ public class MicroServiceDictionaryController {
                     MSAttributeObject mainClass = classMap.get(this.newModel.getModelName());
                     this.newModel.setDependency("[]");
                     String value = new Gson().toJson(mainClass.getSubClass());
-                    this.newModel.setSub_attributes(value);
+                    this.newModel.setSubAttributes(value);
                     String attributes = mainClass.getAttribute().toString().replace("{", "").replace("}", "");
                     int equalsIndexForAttributes = attributes.indexOf('=');
                     String atttributesAfterFirstEquals = attributes.substring(equalsIndexForAttributes + 1);
@@ -666,7 +666,7 @@ public class MicroServiceDictionaryController {
                     String refAttributes = mainClass.getRefAttribute().toString().replace("{", "").replace("}", "");
                     int equalsIndex = refAttributes.indexOf("=");
                     String refAttributesAfterFirstEquals = refAttributes.substring(equalsIndex + 1);
-                    this.newModel.setRef_attributes(refAttributesAfterFirstEquals);
+                    this.newModel.setRefAttributes(refAttributesAfterFirstEquals);
                     this.newModel.setEnumValues(mainClass.getEnumType().toString().replace("{", "").replace("}", ""));
                     this.newModel
                             .setAnnotation(mainClass.getMatchingSet().toString().replace("{", "").replace("}", ""));
@@ -713,10 +713,10 @@ public class MicroServiceDictionaryController {
                 }
             }
             microServiceModels.setAttributes(this.newModel.getAttributes());
-            microServiceModels.setRef_attributes(this.newModel.getRef_attributes());
+            microServiceModels.setRefAttributes(this.newModel.getRefAttributes());
             microServiceModels.setDependency(this.newModel.getDependency());
             microServiceModels.setModelName(this.newModel.getModelName());
-            microServiceModels.setSub_attributes(this.newModel.getSub_attributes());
+            microServiceModels.setSubAttributes(this.newModel.getSubAttributes());
             microServiceModels.setVersion(this.newModel.getVersion());
             microServiceModels.setEnumValues(this.newModel.getEnumValues());
             microServiceModels.setAnnotation(this.newModel.getAnnotation());
@@ -798,9 +798,9 @@ public class MicroServiceDictionaryController {
         }
         if (mainClass != null) {
             this.newModel.setDependency(mainClass.getDependency());
-            this.newModel.setSub_attributes(subAttribute);
+            this.newModel.setSubAttributes(subAttribute);
             this.newModel.setAttributes(mainClass.getAttribute().toString().replace("{", "").replace("}", ""));
-            this.newModel.setRef_attributes(mainClass.getRefAttribute().toString().replace("{", "").replace("}", ""));
+            this.newModel.setRefAttributes(mainClass.getRefAttribute().toString().replace("{", "").replace("}", ""));
             this.newModel.setEnumValues(mainClass.getEnumType().toString().replace("{", "").replace("}", ""));
             this.newModel.setAnnotation(mainClass.getMatchingSet().toString().replace("{", "").replace("}", ""));
         }
index ad6b9cf..f21ac60 100644 (file)
@@ -58,7 +58,7 @@ import org.onap.policy.rest.jpa.GroupPolicyScopeList;
 import org.onap.policy.rest.jpa.MicroServiceLocation;
 import org.onap.policy.rest.jpa.MicroServiceModels;
 import org.onap.policy.rest.jpa.OnapName;
-import org.onap.policy.rest.jpa.PEPOptions;
+import org.onap.policy.rest.jpa.PepOptions;
 import org.onap.policy.rest.jpa.RiskType;
 import org.onap.policy.rest.jpa.SafePolicyWarning;
 import org.onap.policy.rest.jpa.TermList;
@@ -340,7 +340,7 @@ public class PolicyElasticSearchController {
                     break;
                 case onapName:
                     OnapName onapName = mapper.readValue(root.get("data").toString(), OnapName.class);
-                    value = onapName.getOnapName();
+                    value = onapName.getName();
                     policyList = searchElkDatabase(all, "onapName", value);
                     break;
                 case actionPolicy:
@@ -356,7 +356,7 @@ public class PolicyElasticSearchController {
                     policyList = searchElkDatabase(config, "ruleName", value);
                     break;
                 case pepOptions:
-                    PEPOptions pEPOptions = mapper.readValue(root.get("data").toString(), PEPOptions.class);
+                    PepOptions pEPOptions = mapper.readValue(root.get("data").toString(), PepOptions.class);
                     value = pEPOptions.getPepName();
                     policyList = searchElkDatabase(closedloop, "jsonBodyData.pepName", value);
                     break;
index 65c50b1..f16c203 100644 (file)
@@ -56,7 +56,7 @@ public class DictionaryHandlerImpl implements DictionaryHandler {
                 case "VNFType":
                     dictionary.getVnfType(response);
                     break;
-                case "PEPOptions":
+                case "PepOptions":
                     dictionary.getPEPOptions(response);
                     break;
                 case "Varbind":
@@ -206,7 +206,7 @@ public class DictionaryHandlerImpl implements DictionaryHandler {
                 case "VNFType":
                     result = dictionary.saveVnfType(request, response);
                     break;
-                case "PEPOptions":
+                case "PepOptions":
                     result = dictionary.savePEPOptions(request, response);
                     break;
                 case "Varbind":
index 0621693..d28a00d 100644 (file)
@@ -20,7 +20,7 @@
 
 DROP TABLE IF EXISTS ConfigurationDataEntity
 DROP TABLE IF EXISTS PolicyEntity
-DROP TABLE IF EXISTS PolicyDBDaoEntity
+DROP TABLE IF EXISTS PolicyDbDaoEntity
 DROP TABLE IF EXISTS ActionBodyEntity
 DROP SEQUENCE IF EXISTS seqPolicy
 DROP SEQUENCE IF EXISTS seqConfig
index 7be9501..0280219 100644 (file)
@@ -22,7 +22,7 @@
        <persistence-unit name="XACML-PAP-REST">
                <class>org.onap.policy.rest.jpa.PolicyEntity</class>
                <class>org.onap.policy.rest.jpa.ConfigurationDataEntity</class>         
-               <class>org.onap.policy.rest.jpa.PolicyDBDaoEntity</class>
+               <class>org.onap.policy.rest.jpa.PolicyDbDaoEntity</class>
                <class>org.onap.policy.rest.jpa.GroupEntity</class>
                <class>org.onap.policy.rest.jpa.PdpEntity</class>
                <class>org.onap.policy.rest.jpa.ActionBodyEntity</class>
@@ -40,7 +40,7 @@
                <class>org.onap.policy.rest.jpa.ActionPolicyDict</class>
                <class>org.onap.policy.rest.jpa.DecisionSettings</class>
                <class>org.onap.policy.rest.jpa.MicroServiceModels</class>
-               <class>org.onap.policy.rest.jpa.BRMSParamTemplate</class>
+               <class>org.onap.policy.rest.jpa.BrmsParamTemplate</class>
                <class>org.onap.policy.rest.jpa.PolicyEditorScopes</class>
                <!-- unique to PolicyEngineUtils - will be audited from PAP -->
                <class>org.onap.policy.jpa.BackUpMonitorEntity</class>
         <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
                <class>org.onap.policy.rest.jpa.PolicyEntity</class>
                <class>org.onap.policy.rest.jpa.ConfigurationDataEntity</class>         
-               <class>org.onap.policy.rest.jpa.PolicyDBDaoEntity</class>
+               <class>org.onap.policy.rest.jpa.PolicyDbDaoEntity</class>
                <class>org.onap.policy.rest.jpa.GroupEntity</class>
                <class>org.onap.policy.rest.jpa.PdpEntity</class>
                <class>org.onap.policy.rest.jpa.ActionBodyEntity</class>
                <class>org.onap.policy.rest.jpa.ActionList</class>
                <class>org.onap.policy.rest.jpa.AddressGroup</class>
                <class>org.onap.policy.rest.jpa.AttributeAssignment</class>
-               <class>org.onap.policy.rest.jpa.BRMSParamTemplate</class>
+               <class>org.onap.policy.rest.jpa.BrmsParamTemplate</class>
                <class>org.onap.policy.rest.jpa.ClosedLoopD2Services</class>
                <class>org.onap.policy.rest.jpa.ClosedLoopSite</class>
-               <class>org.onap.policy.rest.jpa.DCAEUsers</class>
-               <class>org.onap.policy.rest.jpa.DCAEuuid</class>
+               <class>org.onap.policy.rest.jpa.DcaeUsers</class>
+               <class>org.onap.policy.rest.jpa.Dcaeuuid</class>
                <class>org.onap.policy.rest.jpa.DescriptiveScope</class>
                <class>org.onap.policy.rest.jpa.OnapName</class>
                <class>org.onap.policy.rest.jpa.EnforcingType</class>
                <class>org.onap.policy.rest.jpa.MicroServiceLocation</class>
                <class>org.onap.policy.rest.jpa.Obadvice</class>
                <class>org.onap.policy.rest.jpa.ObadviceExpression</class>
-               <class>org.onap.policy.rest.jpa.PEPOptions</class>
-               <class>org.onap.policy.rest.jpa.PIPConfigParam</class>
-               <class>org.onap.policy.rest.jpa.PIPConfiguration</class>
-               <class>org.onap.policy.rest.jpa.PIPResolver</class>
-               <class>org.onap.policy.rest.jpa.PIPResolverParam</class>
-               <class>org.onap.policy.rest.jpa.PIPType</class> 
+               <class>org.onap.policy.rest.jpa.PepOptions</class>
+               <class>org.onap.policy.rest.jpa.PipConfigParam</class>
+               <class>org.onap.policy.rest.jpa.PipConfiguration</class>
+               <class>org.onap.policy.rest.jpa.PipResolver</class>
+               <class>org.onap.policy.rest.jpa.PipResolverParam</class>
+               <class>org.onap.policy.rest.jpa.PipType</class> 
                <class>org.onap.policy.rest.jpa.PolicyAlgorithms</class>
                <class>org.onap.policy.rest.jpa.PolicyManagement</class>
                <class>org.onap.policy.rest.jpa.PolicyScopeService</class>
index 9990201..ffac655 100644 (file)
@@ -43,7 +43,7 @@ import org.onap.policy.pap.xacml.rest.UpdateOthersPAPS;
 import org.onap.policy.pap.xacml.rest.adapters.UpdateObjectData;
 import org.onap.policy.pap.xacml.rest.components.Policy;
 import org.onap.policy.rest.dao.CommonClassDao;
-import org.onap.policy.rest.jpa.PolicyDBDaoEntity;
+import org.onap.policy.rest.jpa.PolicyDbDaoEntity;
 import org.powermock.api.mockito.PowerMockito;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
@@ -65,20 +65,20 @@ public class UpdateOthersPAPSTest {
         request = mock(HttpServletRequest.class);
         response = new MockHttpServletResponse();
         List<Object> data = new ArrayList<>();
-        PolicyDBDaoEntity entity = new PolicyDBDaoEntity();
-        entity.setPolicyDBDaoUrl("http://localhost:8070/pap");
+        PolicyDbDaoEntity entity = new PolicyDbDaoEntity();
+        entity.setPolicyDbDaoUrl("http://localhost:8070/pap");
         entity.setUsername("test");
         entity.setPassword("test");
 
-        PolicyDBDaoEntity entity1 = new PolicyDBDaoEntity();
-        entity1.setPolicyDBDaoUrl("http://localhost:8071/pap");
+        PolicyDbDaoEntity entity1 = new PolicyDbDaoEntity();
+        entity1.setPolicyDbDaoUrl("http://localhost:8071/pap");
         entity1.setUsername("test");
         entity1.setPassword("test");
 
         data.add(entity);
         data.add(entity1);
         System.setProperty("xacml.rest.pap.url", "http://localhost:8070/pap");
-        when(commonClassDao.getData(PolicyDBDaoEntity.class)).thenReturn(data);
+        when(commonClassDao.getData(PolicyDbDaoEntity.class)).thenReturn(data);
     }
 
     @Test
index 10fcd30..f978d74 100644 (file)
@@ -499,14 +499,14 @@ public class XACMLPAPTest {
         // Verify
         Mockito.verify(httpServletResponse).setStatus(HttpServletResponse.SC_OK);
         //
-        // Check PEPOptions
+        // Check PepOptions
         //
         httpServletRequest = Mockito.mock(HttpServletRequest.class);
         httpServletResponse = Mockito.mock(MockHttpServletResponse.class);
         json = "{\"dictionaryFields\":{\"pepName\":\"testRestAPI\",\"description\":\"testing create\","
                 + "\"attributes\":[{\"option\":\"test1\",\"number\":\"test\"},{\"option\":\"test2\","
                 + "\"number\":\"test\"}]}}";
-        dictionaryTestSetup(false, "PEPOptions", json);
+        dictionaryTestSetup(false, "PepOptions", json);
         // send Request to PAP
         pap.service(httpServletRequest, httpServletResponse);
         // Verify
@@ -886,7 +886,7 @@ public class XACMLPAPTest {
     @Test
     public void getDictionary() throws ServletException, IOException {
         String[] dictionarys = new String[] {"Attribute", "OnapName", "Action", "BRMSParamTemplate", "VSCLAction",
-                "VNFType", "PEPOptions", "Varbind", "Service", "Site", "Settings", "RainyDayTreatments",
+                "VNFType", "PepOptions", "Varbind", "Service", "Site", "Settings", "RainyDayTreatments",
                 "DescriptiveScope", "ActionList", "ProtocolList", "Zone", "SecurityZone", "PrefixList", "AddressGroup",
                 "ServiceGroup", "ServiceList", "TermList", "MicroServiceLocation", "MicroServiceConfigName", "DCAEUUID",
                 "MicroServiceModels", "PolicyScopeService", "PolicyScopeResource", "PolicyScopeType",
index 13fb81d..33b7f8b 100644 (file)
 
 package org.onap.policy.pap.xacml.rest;
 
+import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import com.att.research.xacml.api.pap.PAPException;
 import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
 import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.policy.xacml.api.pap.OnapPDP;
+import org.onap.policy.xacml.api.pap.OnapPDPGroup;
+import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
+import org.onap.policy.xacml.std.pap.StdPDP;
+import org.onap.policy.xacml.std.pap.StdPDPGroup;
 
 public class HeartbeatTest {
     @Test
@@ -38,4 +49,43 @@ public class HeartbeatTest {
         hb.terminate();
         assertFalse(hb.isHeartBeatRunning());
     }
+
+    @Test
+    public void testGetPdps() throws PAPException, IOException {
+        Set<OnapPDPGroup> pdpGroups = new HashSet<OnapPDPGroup>();
+        StdPDPGroup pdpGroup = new StdPDPGroup();
+        OnapPDP pdp = new StdPDP();
+        pdpGroup.addPDP(pdp);
+        pdpGroups.add(pdpGroup);
+        PAPPolicyEngine pap = Mockito.mock(PAPPolicyEngine.class);
+        Mockito.when(pap.getOnapPDPGroups()).thenReturn(pdpGroups);
+        Heartbeat hb = new Heartbeat(pap);
+        hb.getPdpsFromGroup();
+        assertFalse(hb.isHeartBeatRunning());
+
+        assertThatCode(hb::notifyEachPdp).doesNotThrowAnyException();
+        assertThatThrownBy(hb::run).isInstanceOf(Exception.class);
+        assertThatThrownBy(hb::notifyEachPdp).isInstanceOf(Exception.class);
+    }
+
+    @Test
+    public void testOpen() throws MalformedURLException {
+        Heartbeat hb = new Heartbeat(null);
+        OnapPDP pdp = new StdPDP();
+
+        assertThatCode(() -> {
+            URL url = new URL("http://onap.org");
+            hb.openPdpConnection(url, pdp);
+        }).doesNotThrowAnyException();
+
+        assertThatCode(() -> {
+            URL url = new URL("http://1.2.3.4");
+            hb.openPdpConnection(url, pdp);
+        }).doesNotThrowAnyException();
+
+        assertThatCode(() -> {
+            URL url = new URL("http://fakesite.fakenews");
+            hb.openPdpConnection(url, pdp);
+        }).doesNotThrowAnyException();
+    }
 }
index 333d878..5c1d3dd 100644 (file)
 
 package org.onap.policy.pap.xacml.rest.components;
 
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
+import com.att.research.xacml.api.pap.PAPException;
 import java.io.IOException;
-
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 import org.mockito.Mockito;
+import org.onap.policy.rest.adapter.PolicyRestAdapter;
 import org.onap.policy.rest.dao.CommonClassDao;
 
 public class BRMSPolicyTest {
@@ -68,4 +75,42 @@ public class BRMSPolicyTest {
         String userID = "testID";
         assertEquals(1, template.addRule(rule, ruleName, description, userID).size());
     }
+
+    @Test
+    public void testCreateBrmsParamPolicyAdapter() throws PAPException {
+        Map<String, String> brmsParamBody = new HashMap<String, String>();
+        brmsParamBody.put("key", "value");
+
+        PolicyRestAdapter adapter = new PolicyRestAdapter();
+        adapter.setHighestVersion(1);
+        adapter.setPolicyType("Config");
+        adapter.setBrmsParamBody(brmsParamBody);
+        adapter.setNewFileName("policyName.1.xml");
+        Map<String, String> dynamicFieldConfigAttributes = new HashMap<String, String>();
+        dynamicFieldConfigAttributes.put("key", "value");
+        adapter.setDynamicFieldConfigAttributes(dynamicFieldConfigAttributes);
+        CreateBrmsParamPolicy policy = new CreateBrmsParamPolicy(adapter);
+        String ruleContents = "contents";
+
+        assertThatCode(() -> policy.saveConfigurations("name.xml", "rules")).doesNotThrowAnyException();
+        try {
+            policy.prepareToSave();
+            policy.savePolicies();
+        } catch (Exception ex) {
+            // Ignore
+        }
+
+        assertThatThrownBy(() -> policy.expandConfigBody(ruleContents, brmsParamBody))
+            .isInstanceOf(NullPointerException.class);
+        assertTrue(policy.validateConfigForm());
+        policy.getAdviceExpressions(1, "name.1.xml");
+        assertNotNull(policy.getCorrectPolicyDataObject());
+    }
+
+    @Test
+    public void testRead() {
+        Charset encoding = Charset.defaultCharset();
+        assertThatCode(() -> CreateBrmsParamPolicy.readFile("xacml.pap.properties", encoding))
+            .doesNotThrowAnyException();
+    }
 }
index 50c166a..7156ec7 100644 (file)
@@ -28,7 +28,7 @@ import java.util.List;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.onap.policy.rest.jpa.PolicyDBDaoEntity;
+import org.onap.policy.rest.jpa.PolicyDbDaoEntity;
 
 public class NotifyOtherPapsTest {
     private static final String systemKey = XACMLProperties.XACML_PROPERTIES_NAME;
@@ -43,9 +43,9 @@ public class NotifyOtherPapsTest {
     @Test
     public void negTestNotify() {
         NotifyOtherPaps notify = new NotifyOtherPaps();
-        List<PolicyDBDaoEntity> otherServers = new ArrayList<PolicyDBDaoEntity>();
-        PolicyDBDaoEntity dbdaoEntity = new PolicyDBDaoEntity();
-        dbdaoEntity.setPolicyDBDaoUrl("http://test");
+        List<PolicyDbDaoEntity> otherServers = new ArrayList<PolicyDbDaoEntity>();
+        PolicyDbDaoEntity dbdaoEntity = new PolicyDbDaoEntity();
+        dbdaoEntity.setPolicyDbDaoUrl("http://test");
         otherServers.add(dbdaoEntity);
         long entityId = 0;
         String entityType = "entityType";
index 05f6330..99cc47c 100644 (file)
@@ -312,7 +312,7 @@ public class PolicyDBDaoTest {
         getGroup.setParameter("deleted", false);
         List<?> groups = getGroup.list();
         GroupEntity groupEntity = (GroupEntity) groups.get(0);
-        Assert.assertEquals(groupName, groupEntity.getgroupName());
+        Assert.assertEquals(groupName, groupEntity.getGroupName());
         Assert.assertEquals("this is a test group", groupEntity.getDescription());
         session.getTransaction().commit();
         session.close();
@@ -375,7 +375,7 @@ public class PolicyDBDaoTest {
             Assert.fail();
         }
         PdpEntity pdp = (PdpEntity) pdps.get(0);
-        Assert.assertEquals(groupName, pdp.getGroup().getgroupName());
+        Assert.assertEquals(groupName, pdp.getGroup().getGroupName());
         Assert.assertEquals(pdp.getPdpName(), "primary");
         session3.getTransaction().commit();
         session3.close();
@@ -451,7 +451,7 @@ public class PolicyDBDaoTest {
         getPdp3.setParameter("deleted", false);
         List<?> pdps3 = getPdp3.list();
         for (Object obj : pdps3) {
-            Assert.assertEquals("testgroup1", ((PdpEntity) obj).getGroup().getgroupName());
+            Assert.assertEquals("testgroup1", ((PdpEntity) obj).getGroup().getGroupName());
         }
 
         session5.getTransaction().commit();
@@ -490,7 +490,7 @@ public class PolicyDBDaoTest {
         getPdp4.setParameter("deleted", false);
         List<?> pdps4 = getPdp4.list();
         for (Object obj : pdps4) {
-            Assert.assertEquals("testgroup2", ((PdpEntity) obj).getGroup().getgroupName());
+            Assert.assertEquals("testgroup2", ((PdpEntity) obj).getGroup().getGroupName());
         }
 
         session7.getTransaction().commit();
index 3472b0d..fab3611 100644 (file)
@@ -42,7 +42,7 @@ import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.ClosedLoopD2Services;
 import org.onap.policy.rest.jpa.ClosedLoopSite;
-import org.onap.policy.rest.jpa.PEPOptions;
+import org.onap.policy.rest.jpa.PepOptions;
 import org.onap.policy.rest.jpa.UserInfo;
 import org.onap.policy.rest.jpa.VNFType;
 import org.onap.policy.rest.jpa.VSCLAction;
@@ -140,7 +140,7 @@ public class ClosedLoopDictionaryControllerTest {
 
     @Test
     public void testGetPEPOptionsDictionaryByNameEntityData() {
-        when(commonClassDao.getDataByColumn(PEPOptions.class, "pepName")).thenReturn(data);
+        when(commonClassDao.getDataByColumn(PepOptions.class, "pepName")).thenReturn(data);
         controller.getPEPOptionsDictionaryByNameEntityData(response);
         try {
             assertTrue(response.getContentAsString() != null
@@ -153,7 +153,7 @@ public class ClosedLoopDictionaryControllerTest {
 
     @Test
     public void testGetPEPOptionsDictionaryEntityData() {
-        when(commonClassDao.getData(PEPOptions.class)).thenReturn(new ArrayList<>());
+        when(commonClassDao.getData(PepOptions.class)).thenReturn(new ArrayList<>());
         controller.getPEPOptionsDictionaryEntityData(response);
         try {
             assertTrue(response.getContentAsString() != null
index ef723a3..ee4dff8 100644 (file)
@@ -96,7 +96,7 @@ public class DictionaryImportControllerTest extends Mockito {
         fileNames.add("SearchCriteria.csv");
         fileNames.add("VNFType.csv");
         fileNames.add("VSCLAction.csv");
-        fileNames.add("PEPOptions.csv");
+        fileNames.add("PepOptions.csv");
         fileNames.add("Settings.csv");
         fileNames.add("Zone.csv");
         fileNames.add("ActionList.csv");
index b94e8d3..3359a7a 100644 (file)
@@ -47,8 +47,8 @@ import org.onap.policy.rest.adapter.Term;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.ActionList;
 import org.onap.policy.rest.jpa.AddressGroup;
-import org.onap.policy.rest.jpa.FWTag;
-import org.onap.policy.rest.jpa.FWTagPicker;
+import org.onap.policy.rest.jpa.FwTag;
+import org.onap.policy.rest.jpa.FwTagPicker;
 import org.onap.policy.rest.jpa.FirewallDictionaryList;
 import org.onap.policy.rest.jpa.GroupServiceList;
 import org.onap.policy.rest.jpa.PortList;
@@ -228,25 +228,25 @@ public class FirewallDictionaryControllerTest {
 
     @Test
     public void testGetTagPickerNameEntityDataByName() {
-        test_WithGetDataByColumn(FWTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
+        test_WithGetDataByColumn(FwTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
                 () -> controller.getTagPickerNameEntityDataByName(response));
     }
 
     @Test
     public void testGetTagPickerDictionaryEntityData() {
-        test_WithGetData(FWTagPicker.class, "fwTagPickerDictionaryDatas",
+        test_WithGetData(FwTagPicker.class, "fwTagPickerDictionaryDatas",
                 () -> controller.getTagPickerDictionaryEntityData(response));
     }
 
     @Test
     public void testGetTagNameEntityDataByName() {
-        test_WithGetDataByColumn(FWTag.class, "fwTagDictionaryDatas", "fwTagName",
+        test_WithGetDataByColumn(FwTag.class, "fwTagDictionaryDatas", "fwTagName",
                 () -> controller.getTagNameEntityDataByName(response));
     }
 
     @Test
     public void testGetTagDictionaryEntityData() {
-        test_WithGetData(FWTag.class, "fwTagDictionaryDatas", () -> controller.getTagDictionaryEntityData(response));
+        test_WithGetData(FwTag.class, "fwTagDictionaryDatas", () -> controller.getTagDictionaryEntityData(response));
     }
 
     @Test
@@ -563,7 +563,7 @@ public class FirewallDictionaryControllerTest {
                 "{\"fwTagPickerDictionaryData\":{\"description\":\"test\",\"networkRole\":\"test\",\"tagPickerName\":"
                 + "\"Test\",\"tags\":[{\"$$hashKey\":\"object:1855\",\"id\":\"choice1\",\"number\":\"test\",\"option\":"
                 + "\"Test\"}]},\"userid\":\"demo\"}";
-        testSave(FWTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
+        testSave(FwTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
                 () -> controller.saveFirewallTagPickerDictionary(request, response));
     }
 
@@ -573,14 +573,14 @@ public class FirewallDictionaryControllerTest {
                 "{\"fwTagPickerDictionaryData\":{\"id\":1,\"description\":\"test\",\"networkRole\":"
                 + "\"test\",\"tagPickerName\":\"Test\",\"tags\":[{\"$$hashKey\":\"object:1855\",\"id\":"
                 + "\"choice1\",\"number\":\"test\",\"option\":\"Test\"}]},\"userid\":\"demo\"}";
-        testUpdate(FWTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
+        testUpdate(FwTagPicker.class, "fwTagPickerDictionaryDatas", "tagPickerName",
                 () -> controller.saveFirewallTagPickerDictionary(request, response));
     }
 
     @Test
     public void testRemoveFirewallTagPickerDictionary() {
         jsonString = "{\"userid\":\"demo\",\"data\":{\"id\":1,\"description\":\"test\",\"tagPickerName\":\"Test\"}}";
-        testRemove(FWTagPicker.class, "fwTagPickerDictionaryDatas",
+        testRemove(FwTagPicker.class, "fwTagPickerDictionaryDatas",
                 () -> controller.removeFirewallTagPickerDictionary(request, response));
     }
 
@@ -589,7 +589,7 @@ public class FirewallDictionaryControllerTest {
         jsonString =
                 "{\"fwTagDictionaryData\":{\"description\":\"test\",\"fwTagName\":\"Test\",\"tags\":[{\"$$hashKey\":"
                 + "\"object:1690\",\"id\":\"choice1\",\"tags\":\"test\"}]},\"userid\":\"demo\"}";
-        testSave(FWTag.class, "fwTagDictionaryDatas", "fwTagName",
+        testSave(FwTag.class, "fwTagDictionaryDatas", "fwTagName",
                 () -> controller.saveFirewallTagDictionary(request, response));
     }
 
@@ -598,14 +598,14 @@ public class FirewallDictionaryControllerTest {
         jsonString =
                 "{\"fwTagDictionaryData\":{\"id\":1,\"description\":\"test\",\"fwTagName\":\"Test\",\"tags\":"
                 + "[{\"$$hashKey\":\"object:1690\",\"id\":\"choice1\",\"tags\":\"test\"}]},\"userid\":\"demo\"}";
-        testUpdate(FWTag.class, "fwTagDictionaryDatas", "fwTagName",
+        testUpdate(FwTag.class, "fwTagDictionaryDatas", "fwTagName",
                 () -> controller.saveFirewallTagDictionary(request, response));
     }
 
     @Test
     public void testRemoveFirewallTagDictionary() {
         jsonString = "{\"userid\":\"demo\",\"data\":{\"id\":1,\"description\":\"test\",\"fwTagName\":\"Test\"}}";
-        testRemove(FWTag.class, "fwTagDictionaryDatas",
+        testRemove(FwTag.class, "fwTagDictionaryDatas",
                 () -> controller.removeFirewallTagDictionary(request, response));
     }
 
index 451989c..d990b90 100644 (file)
 
 package org.onap.policy.pap.xacml.rest.controller;
 
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import com.mockrunner.mock.web.MockHttpServletRequest;
 import java.io.BufferedReader;
 import java.io.StringReader;
 import javax.servlet.http.HttpServletRequest;
-
+import javax.ws.rs.core.Response;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -72,16 +76,16 @@ public class OptimizationDictionaryControllerTest {
         HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
 
         jsonString = "{\"optimizationModelsDictionaryData\": {\"modelName\": \"test\",\"inprocess\": false,\"model\":"
-                + " {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],\"type\": \"dir\","
-                + "\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", \"version\": \"\","
-                + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\"," + "\"recursive\": false},"
-                + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
-                + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
-                + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
-                + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
-                + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
-                + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
-                + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
+            + " {\"name\": \"testingdata\",\"subScopename\": \"\",\"path\": [],\"type\": \"dir\","
+            + "\"size\": 0,\"date\": \"2017-04-12T21:26:57.000Z\", \"version\": \"\","
+            + "\"createdBy\": \"someone\",\"modifiedBy\": \"someone\",\"content\": \"\"," + "\"recursive\": false},"
+            + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+            + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
 
         br = new BufferedReader(new StringReader(jsonString));
         // --- mock the getReader() call
@@ -108,7 +112,7 @@ public class OptimizationDictionaryControllerTest {
             controller.getOptimizationModelsDictionaryEntityData(response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
             assertTrue(response.getContentAsString() != null
-                    && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+                && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -130,7 +134,7 @@ public class OptimizationDictionaryControllerTest {
             controller.saveOptimizationModelsDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
             assertTrue(response.getContentAsString() != null
-                    && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+                && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
@@ -149,28 +153,59 @@ public class OptimizationDictionaryControllerTest {
         try {
             // mock the getReader() call
             jsonString =
-                    "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\","
-                            + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
-                            + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
-                            + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
-                            + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
-                            + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
-                            + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
-                            + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
-                            + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
-                            + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
-                            + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
+                "{\"data\": {\"modelName\": \"test\",\"inprocess\": false,\"model\": {\"name\": \"testingdata\","
+                    + "\"subScopename\": \"\",\"path\": [],\"type\": \"dir\",\"size\": 0,"
+                    + "\"date\": \"2017-04-12T21:26:57.000Z\",\"version\": \"\",\"createdBy\": \"someone\","
+                    + "\"modifiedBy\": \"someone\",\"content\": \"\",\"recursive\": false},"
+                    + "\"tempModel\": {\"name\": \"testingdata\",\"subScopename\": \"\"},"
+                    + "\"policy\": {\"policyType\": \"Config\",\"configPolicyType\": \"Micro Service\","
+                    + "\"policyName\": \"may1501\",\"policyDescription\": \"testing input\","
+                    + "\"onapName\": \"RaviTest\",\"guard\": \"False\",\"riskType\": \"Risk12345\","
+                    + "\"riskLevel\": \"2\",\"priority\": \"6\",\"serviceType\": \"DkatPolicyBody\","
+                    + "\"version\": \"1707.41.02\",\"ruleGridData\": [[\"fileId\"]],\"ttlDate\": null}},"
+                    + "\"policyJSON\": {\"pmTableName\": \"test\",\"dmdTopic\": \"1\",\"fileId\": \"56\"}}";
 
             BufferedReader br = new BufferedReader(new StringReader(jsonString));
             when(request.getReader()).thenReturn(br);
             controller.removeOptimizationModelsDictionary(request, response);
             logger.info("response.getContentAsString(): " + response.getContentAsString());
             assertTrue(response.getContentAsString() != null
-                    && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
+                && response.getContentAsString().contains("optimizationModelsDictionaryDatas"));
 
         } catch (Exception e) {
             fail("Exception: " + e);
         }
         logger.info("testRemoveOptimizationModelsDictionary: exit");
     }
+
+    @Test
+    public void testGet() {
+        OptimizationDictionaryController controller = new OptimizationDictionaryController(commonClassDao);
+        MockHttpServletResponse response = new MockHttpServletResponse();
+        controller.getOptimizationModelsDictionaryByNameEntityData(response);
+        assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+    }
+
+    @Test
+    public void testSave() {
+        OptimizationDictionaryController controller = new OptimizationDictionaryController(commonClassDao);
+        MockHttpServletRequest req = new MockHttpServletRequest();
+        MockHttpServletResponse response = new MockHttpServletResponse();
+        req.setBodyContent("{\n\"modelType\": \"type.yml\", \"dataOrderInfo\": \"info\", \"userid\": \"id\", "
+            + "\"optimizationModelsDictionaryData\": {\"description\": \"desc\", \"modelName\": \"name\", \"version\": \"1.0\"}, "
+            + "\"classMap\": \"{\\\"dep\\\":\\\"{\\\"dependency\\\":\\\"depval\\\"}\\\"}\" }\n");
+        // + "\"classMap\": \"{\\\"dep\\\":\\\"dependency\\\"}\" }\n");
+        assertThatThrownBy(() -> controller.saveOptimizationModelsDictionary(req, response))
+            .isInstanceOf(NullPointerException.class);
+
+        req.setBodyContent("{\n\"modelType\": \"type.xml\", \"dataOrderInfo\": \"info\", \"userid\": \"id\", "
+            + "\"optimizationModelsDictionaryData\": {\"description\": \"desc\", \"modelName\": \"name\", \"version\": \"1.0\"}, "
+            + "\"classMap\": \"{\\\"dep\\\": {\\\"dependency\\\":\\\"depval\\\"} }\" }\n");
+        assertThatCode(() -> controller.saveOptimizationModelsDictionary(req, response)).doesNotThrowAnyException();
+
+        req.setupAddParameter("apiflag", "api");
+        assertThatThrownBy(() -> controller.saveOptimizationModelsDictionary(req, response))
+            .isInstanceOf(NullPointerException.class);
+    }
+
 }
index a9da00d..d0e4416 100644 (file)
@@ -25,11 +25,13 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.when;
 
 import com.mockrunner.mock.web.MockHttpServletRequest;
 import com.mockrunner.mock.web.MockHttpServletResponse;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import org.hibernate.Session;
@@ -45,6 +47,7 @@ import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
 import org.onap.policy.pap.xacml.rest.elk.client.PolicyElasticSearchController;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.PolicyEntity;
+import org.onap.policy.rest.jpa.PolicyVersion;
 import org.onap.policy.xacml.api.pap.PAPPolicyEngine;
 import org.onap.policy.xacml.std.pap.StdEngine;
 import org.powermock.api.mockito.PowerMockito;
@@ -120,12 +123,74 @@ public class DeleteHandlerTest {
         CommonClassDao dao = Mockito.mock(CommonClassDao.class);
         DeleteHandler handler = new DeleteHandler(dao);
 
-        // Mock request
+        // Request #1
         MockHttpServletRequest request = new MockHttpServletRequest();
         request.setBodyContent(
             "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Config_name.1.xml\", \"deleteCondition\": \"All Versions\"\n}\n");
         MockHttpServletResponse response = new MockHttpServletResponse();
+        handler.doApiDeleteFromPap(request, response);
+        assertTrue(response.containsHeader("error"));
+
+        // Request #2
+        request.setBodyContent(
+            "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Action_name.1.xml\", \"deleteCondition\": \"All Versions\"\n}\n");
+        handler.doApiDeleteFromPap(request, response);
+        assertTrue(response.containsHeader("error"));
+
+        // Request #3
+        request.setBodyContent(
+            "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Decision_name.1.xml\", \"deleteCondition\": \"All Versions\"\n}\n");
+        handler.doApiDeleteFromPap(request, response);
+        assertTrue(response.containsHeader("error"));
+
+        // Request #4
+        request.setBodyContent(
+            "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Bar_name.1.xml\", \"deleteCondition\": \"All Versions\"\n}\n");
+        handler.doApiDeleteFromPap(request, response);
+        assertTrue(response.containsHeader("error"));
+
+        // Request #5
+        request.setBodyContent(
+            "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Config_name.1.xml\", \"deleteCondition\": \"Current Version\"\n}\n");
+        handler.doApiDeleteFromPap(request, response);
+        assertTrue(response.containsHeader("error"));
+
+        // Request #6
+        request.setBodyContent(
+            "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Action_name.1.xml\", \"deleteCondition\": \"Current Version\"\n}\n");
+        handler.doApiDeleteFromPap(request, response);
+        assertTrue(response.containsHeader("error"));
+
+        // Request #7
+        request.setBodyContent(
+            "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Decision_name.1.xml\", \"deleteCondition\": \"Current Version\"\n}\n");
+        handler.doApiDeleteFromPap(request, response);
+        assertTrue(response.containsHeader("error"));
+
+        // Mock dao
+        List<PolicyVersion> pePVs = new ArrayList<PolicyVersion>();
+        PolicyVersion pv = new PolicyVersion();
+        pePVs.add(pv);
+        List<Object> peObjs = new ArrayList<Object>(pePVs);
+        List<PolicyEntity> peEnts = new ArrayList<PolicyEntity>();
+        PolicyEntity peEnt = new PolicyEntity();
+        peEnts.add(peEnt);
+        List<Object> peEntObjs = new ArrayList<Object>(peEnts);
+        Mockito.when(dao.getDataByQuery(eq("Select p from PolicyVersion p where p.policyName=:pname"), any()))
+            .thenReturn(peObjs);
+        Mockito.when(
+            dao.getDataByQuery(eq("SELECT p FROM PolicyEntity p WHERE p.policyName=:pName and p.scope=:pScope"), any()))
+            .thenReturn(peEntObjs);
+
+        // Request #8
+        request.setBodyContent(
+            "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Decision_name.1.xml\", \"deleteCondition\": \"Current Version\"\n}\n");
+        handler.doApiDeleteFromPap(request, response);
+        assertTrue(response.containsHeader("error"));
 
+        // Request #9
+        request.setBodyContent(
+            "{\n\"PAPPolicyType\": \"StdPAPPolicy\", \"policyName\": \"foo.Decision_name.1.xml\", \"deleteCondition\": \"Current Version\"\n, \"deleteCondition\": \"All Versions\"}\n");
         handler.doApiDeleteFromPap(request, response);
         assertTrue(response.containsHeader("error"));
     }
index 9da3f8b..d7fbda2 100644 (file)
@@ -38,7 +38,7 @@ import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.rest.XacmlRestProperties;
 import org.onap.policy.rest.jpa.ActionBodyEntity;
 import org.onap.policy.rest.jpa.ConfigurationDataEntity;
-import org.onap.policy.rest.jpa.PolicyDBDaoEntity;
+import org.onap.policy.rest.jpa.PolicyDbDaoEntity;
 import org.onap.policy.rest.jpa.PolicyEntity;
 
 public class PolicyEntityTest {
@@ -59,7 +59,7 @@ public class PolicyEntityTest {
 
         et.begin();
         // Make sure the DB is clean
-        em.createQuery("DELETE FROM PolicyDBDaoEntity").executeUpdate();
+        em.createQuery("DELETE FROM PolicyDbDaoEntity").executeUpdate();
         em.createQuery("DELETE FROM PolicyEntity").executeUpdate();
         em.createQuery("DELETE FROM ConfigurationDataEntity").executeUpdate();
         em.createQuery("DELETE FROM ActionBodyEntity").executeUpdate();
@@ -605,7 +605,7 @@ public class PolicyEntityTest {
                     + "\n   with exception: " + e);
         }
 
-        // ****************Test the PolicyDBDaoEntity************************
+        // ****************Test the PolicyDbDaoEntity************************
 
         // Create a transaction
         EntityTransaction et3 = em.getTransaction();
@@ -613,29 +613,29 @@ public class PolicyEntityTest {
         et3.begin();
 
         // create one
-        PolicyDBDaoEntity pe1 = new PolicyDBDaoEntity();
+        PolicyDbDaoEntity pe1 = new PolicyDbDaoEntity();
         em.persist(pe1);
 
         pe1.setDescription("This is pe1");
 
-        pe1.setPolicyDBDaoUrl("http://123.45.2.456:2345");
+        pe1.setPolicyDbDaoUrl("http://123.45.2.456:2345");
 
         // push it to the DB
         em.flush();
 
         // create another
-        PolicyDBDaoEntity pe2 = new PolicyDBDaoEntity();
+        PolicyDbDaoEntity pe2 = new PolicyDbDaoEntity();
         em.persist(pe2);
 
         pe2.setDescription("This is pe2");
 
-        pe2.setPolicyDBDaoUrl("http://789.01.2.345:2345");
+        pe2.setPolicyDbDaoUrl("http://789.01.2.345:2345");
 
         // Print them to the log before flushing
-        logger.debug("\n\n***********PolicyEntityTest: PolicyDBDaoEntity objects before flush********"
-                + "\n   policyDBDaoUrl-1 = " + pe1.getPolicyDBDaoUrl() + "\n   description-1 = " + pe1.getDescription()
+        logger.debug("\n\n***********PolicyEntityTest: PolicyDbDaoEntity objects before flush********"
+                + "\n   policyDbDaoUrl-1 = " + pe1.getPolicyDbDaoUrl() + "\n   description-1 = " + pe1.getDescription()
                 + "\n   createdDate-1 = " + pe1.getCreatedDate() + "\n   modifiedDate-1 " + pe1.getModifiedDate()
-                + "\n*****************************************" + "\n   policyDBDaoUrl-2 = " + pe2.getPolicyDBDaoUrl()
+                + "\n*****************************************" + "\n   policyDbDaoUrl-2 = " + pe2.getPolicyDbDaoUrl()
                 + "\n   description-2 = " + pe2.getDescription() + "\n   createdDate-2 = " + pe2.getCreatedDate()
                 + "\n   modifiedDate-2 " + pe2.getModifiedDate());
 
@@ -644,36 +644,36 @@ public class PolicyEntityTest {
 
         // Now let's retrieve them from the DB using the named query
 
-        resultList = em.createNamedQuery("PolicyDBDaoEntity.findAll").getResultList();
+        resultList = em.createNamedQuery("PolicyDbDaoEntity.findAll").getResultList();
 
-        PolicyDBDaoEntity pex = null;
-        PolicyDBDaoEntity pey = null;
+        PolicyDbDaoEntity pex = null;
+        PolicyDbDaoEntity pey = null;
 
         if (!resultList.isEmpty()) {
             if (resultList.size() != 2) {
-                fail("\nPolicyEntityTest: Number of PolicyDBDaoEntity entries = " + resultList.size()
+                fail("\nPolicyEntityTest: Number of PolicyDbDaoEntity entries = " + resultList.size()
                         + " instead of 2");
             }
             for (Object policyDBDaoEntity : resultList) {
-                PolicyDBDaoEntity pdbdao = (PolicyDBDaoEntity) policyDBDaoEntity;
-                if (pdbdao.getPolicyDBDaoUrl().equals("http://123.45.2.456:2345")) {
+                PolicyDbDaoEntity pdbdao = (PolicyDbDaoEntity) policyDBDaoEntity;
+                if (pdbdao.getPolicyDbDaoUrl().equals("http://123.45.2.456:2345")) {
                     pex = pdbdao;
-                } else if (pdbdao.getPolicyDBDaoUrl().equals("http://789.01.2.345:2345")) {
+                } else if (pdbdao.getPolicyDbDaoUrl().equals("http://789.01.2.345:2345")) {
                     pey = pdbdao;
                 }
             }
 
             // Print them to the log before flushing
-            logger.debug("\n\n***********PolicyEntityTest: PolicyDBDaoEntity objects retrieved from DB********"
-                    + "\n   policyDBDaoUrl-x = " + pex.getPolicyDBDaoUrl() + "\n   description-x = "
+            logger.debug("\n\n***********PolicyEntityTest: PolicyDbDaoEntity objects retrieved from DB********"
+                    + "\n   policyDbDaoUrl-x = " + pex.getPolicyDbDaoUrl() + "\n   description-x = "
                     + pex.getDescription() + "\n   createdDate-x = " + pex.getCreatedDate() + "\n   modifiedDate-x "
                     + pex.getModifiedDate() + "\n*****************************************"
-                    + "\n   policyDBDaoUrl-y = "
-                    + pey.getPolicyDBDaoUrl() + "\n   description-y = " + pey.getDescription()
+                    + "\n   policyDbDaoUrl-y = "
+                    + pey.getPolicyDbDaoUrl() + "\n   description-y = " + pey.getDescription()
                     + "\n   createdDate-y = "
                     + pey.getCreatedDate() + "\n   modifiedDate-y " + pey.getModifiedDate());
             // Verify the retrieved objects are the same as the ones we stored in the DB
-            if (pex.getPolicyDBDaoUrl().equals("http://123.45.2.456:2345")) {
+            if (pex.getPolicyDbDaoUrl().equals("http://123.45.2.456:2345")) {
                 assertSame(pe1, pex);
                 assertSame(pe2, pey);
             } else {
@@ -682,46 +682,46 @@ public class PolicyEntityTest {
             }
 
         } else {
-            fail("\nPolicyEntityTest: No PolicyDBDaoEntity DB entry found");
+            fail("\nPolicyEntityTest: No PolicyDbDaoEntity DB entry found");
         }
 
-        // Now let's see if we can do an update on the PolicyDBDaoEntity which we retrieved.
+        // Now let's see if we can do an update on the PolicyDbDaoEntity which we retrieved.
         // em.persist(pex);
         pex.setDescription("This is pex");
         em.flush();
 
         // retrieve it
-        Query createPolicyQuery = em.createQuery("SELECT p FROM PolicyDBDaoEntity p WHERE p.description=:desc");
+        Query createPolicyQuery = em.createQuery("SELECT p FROM PolicyDbDaoEntity p WHERE p.description=:desc");
         resultList = createPolicyQuery.setParameter("desc", "This is pex").getResultList();
 
-        PolicyDBDaoEntity pez = null;
+        PolicyDbDaoEntity pez = null;
 
         if (!resultList.isEmpty()) {
             if (resultList.size() != 1) {
-                fail("\nPolicyEntityTest: Update Test - Number of PolicyDBDaoEntity entries = " + resultList.size()
+                fail("\nPolicyEntityTest: Update Test - Number of PolicyDbDaoEntity entries = " + resultList.size()
                         + " instead of 1");
             }
-            pez = (PolicyDBDaoEntity) resultList.get(0);
+            pez = (PolicyDbDaoEntity) resultList.get(0);
 
             // Print them to the log before flushing
             logger.debug(
-                    "\n\n***********PolicyEntityTest: Update Test - PolicyDBDaoEntity objects retrieved from "
+                    "\n\n***********PolicyEntityTest: Update Test - PolicyDbDaoEntity objects retrieved from "
                     + "DB********"
-                            + "\n   policyDBDaoUrl-x = " + pex.getPolicyDBDaoUrl() + "\n   description-x = "
+                            + "\n   policyDbDaoUrl-x = " + pex.getPolicyDbDaoUrl() + "\n   description-x = "
                             + pex.getDescription() + "\n   createdDate-x = " + pex.getCreatedDate()
                             + "\n   modifiedDate-x " + pex.getModifiedDate()
-                            + "\n*****************************************" + "\n   policyDBDaoUrl-z = "
-                            + pez.getPolicyDBDaoUrl() + "\n   description-z = " + pez.getDescription()
+                            + "\n*****************************************" + "\n   policyDbDaoUrl-z = "
+                            + pez.getPolicyDbDaoUrl() + "\n   description-z = " + pez.getDescription()
                             + "\n   createdDate-z = " + pez.getCreatedDate() + "\n   modifiedDate-z "
                             + pez.getModifiedDate());
             // Verify the retrieved objects are the same as the ones we stored in the DB
             assertSame(pex, pez);
         } else {
-            fail("\nPolicyEntityTest: Update Test - No PolicyDBDaoEntity DB updated entry found");
+            fail("\nPolicyEntityTest: Update Test - No PolicyDbDaoEntity DB updated entry found");
         }
 
         // Clean up the DB
-        em.createQuery("DELETE FROM PolicyDBDaoEntity").executeUpdate();
+        em.createQuery("DELETE FROM PolicyDbDaoEntity").executeUpdate();
         em.createQuery("DELETE FROM PolicyEntity").executeUpdate();
         em.createQuery("DELETE FROM ConfigurationDataEntity").executeUpdate();
         em.createQuery("DELETE FROM ActionBodyEntity").executeUpdate();
index 3b826f6..b7d6bac 100644 (file)
@@ -37,7 +37,7 @@ public class ImportServiceTest {
         HttpServletRequest request = new MockHttpServletRequest();
         HttpServletResponse response = new MockHttpServletResponse();
         service.doImportMicroServicePut(request, response);
-        assertEquals(response.getHeader("error"), "missing");
+        assertEquals("missing", response.getHeader("error"));
     }
 
     @Test
index 44cc764..1f0700f 100644 (file)
@@ -158,7 +158,7 @@ public class GetDictionaryService {
             case "VNFType":
                 jsonString = jsonString.replace("vnfTypeDictionaryDatas", "DictionaryDatas");
                 break;
-            case "PEPOptions":
+            case "PepOptions":
                 jsonString = jsonString.replace("pepOptionsDictionaryDatas", "DictionaryDatas");
                 break;
             case "Varbind":
index 4544b6b..1904b4b 100644 (file)
@@ -76,7 +76,7 @@ public class GetDictionaryServiceTest {
         result = (String) formatDictionary.invoke(gds, input);
         assertNotNull(result);
         //
-        dp.setDictionary("PEPOptions");
+        dp.setDictionary("PepOptions");
         gds = new GetDictionaryService(dp, null);
         result = (String) formatDictionary.invoke(gds, input);
         assertNotNull(result);
index 0621693..d28a00d 100644 (file)
@@ -20,7 +20,7 @@
 
 DROP TABLE IF EXISTS ConfigurationDataEntity
 DROP TABLE IF EXISTS PolicyEntity
-DROP TABLE IF EXISTS PolicyDBDaoEntity
+DROP TABLE IF EXISTS PolicyDbDaoEntity
 DROP TABLE IF EXISTS ActionBodyEntity
 DROP SEQUENCE IF EXISTS seqPolicy
 DROP SEQUENCE IF EXISTS seqConfig
index b44841c..4362be9 100644 (file)
@@ -22,7 +22,7 @@
        <persistence-unit name="XACML-PAP-REST">
                <class>org.onap.policy.rest.jpa.PolicyEntity</class>
                <class>org.onap.policy.rest.jpa.ConfigurationDataEntity</class>         
-               <class>org.onap.policy.rest.jpa.PolicyDBDaoEntity</class>
+               <class>org.onap.policy.rest.jpa.PolicyDbDaoEntity</class>
                <class>org.onap.policy.rest.jpa.GroupEntity</class>
                <class>org.onap.policy.rest.jpa.PdpEntity</class>
                <class>org.onap.policy.rest.jpa.ActionBodyEntity</class>
@@ -40,7 +40,7 @@
                <class>org.onap.policy.rest.jpa.ActionPolicyDict</class>
                <class>org.onap.policy.rest.jpa.DecisionSettings</class>
                <class>org.onap.policy.rest.jpa.MicroServiceModels</class>
-               <class>org.onap.policy.rest.jpa.BRMSParamTemplate</class>
+               <class>org.onap.policy.rest.jpa.BrmsParamTemplate</class>
                <class>org.onap.policy.rest.jpa.PolicyEditorScopes</class>
                <!-- unique to PolicyEngineUtils - will be audited from PAP -->
                <class>org.onap.policy.jpa.BackUpMonitorEntity</class>
         <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
                <class>org.onap.policy.rest.jpa.PolicyEntity</class>
                <class>org.onap.policy.rest.jpa.ConfigurationDataEntity</class>         
-               <class>org.onap.policy.rest.jpa.PolicyDBDaoEntity</class>
+               <class>org.onap.policy.rest.jpa.PolicyDbDaoEntity</class>
                <class>org.onap.policy.rest.jpa.GroupEntity</class>
                <class>org.onap.policy.rest.jpa.PdpEntity</class>
                <class>org.onap.policy.rest.jpa.ActionBodyEntity</class>
                <class>org.onap.policy.rest.jpa.ActionList</class>
                <class>org.onap.policy.rest.jpa.AddressGroup</class>
                <class>org.onap.policy.rest.jpa.AttributeAssignment</class>
-               <class>org.onap.policy.rest.jpa.BRMSParamTemplate</class>
+               <class>org.onap.policy.rest.jpa.BrmsParamTemplate</class>
                <class>org.onap.policy.rest.jpa.ClosedLoopD2Services</class>
                <class>org.onap.policy.rest.jpa.ClosedLoopSite</class>
-               <class>org.onap.policy.rest.jpa.DCAEUsers</class>
-               <class>org.onap.policy.rest.jpa.DCAEuuid</class>
+               <class>org.onap.policy.rest.jpa.DcaeUsers</class>
+               <class>org.onap.policy.rest.jpa.Dcaeuuid</class>
                <class>org.onap.policy.rest.jpa.DescriptiveScope</class>
                <class>org.onap.policy.rest.jpa.OnapName</class>
                <class>org.onap.policy.rest.jpa.EnforcingType</class>
                <class>org.onap.policy.rest.jpa.MicroServiceLocation</class>
                <class>org.onap.policy.rest.jpa.Obadvice</class>
                <class>org.onap.policy.rest.jpa.ObadviceExpression</class>
-               <class>org.onap.policy.rest.jpa.PEPOptions</class>
-               <class>org.onap.policy.rest.jpa.PIPConfigParam</class>
-               <class>org.onap.policy.rest.jpa.PIPConfiguration</class>
-               <class>org.onap.policy.rest.jpa.PIPResolver</class>
-               <class>org.onap.policy.rest.jpa.PIPResolverParam</class>
-               <class>org.onap.policy.rest.jpa.PIPType</class> 
+               <class>org.onap.policy.rest.jpa.PepOptions</class>
+               <class>org.onap.policy.rest.jpa.PipConfigParam</class>
+               <class>org.onap.policy.rest.jpa.PipConfiguration</class>
+               <class>org.onap.policy.rest.jpa.PipResolver</class>
+               <class>org.onap.policy.rest.jpa.PipResolverParam</class>
+               <class>org.onap.policy.rest.jpa.PipType</class> 
                <class>org.onap.policy.rest.jpa.PolicyAlgorithms</class>
                <class>org.onap.policy.rest.jpa.PolicyManagement</class>
                <class>org.onap.policy.rest.jpa.PolicyScopeService</class>
index 6805918..028b70c 100644 (file)
@@ -20,7 +20,8 @@
   -->
 <!-- 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">
+<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>tomcat-dbcp</artifactId>
             <version>8.5.9</version>
         </dependency>
+        <dependency>
+            <groupId>org.onap.policy.common</groupId>
+            <artifactId>utils-test</artifactId>
+            <version>${version.policy.common}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
index 97e6e9e..e7879a8 100644 (file)
@@ -23,7 +23,9 @@ package org.onap.policy.rest.adapter;
 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 {
@@ -1160,7 +1162,7 @@ public class PolicyRestAdapter {
             case "ONAPName":
                 this.setOnapName(value);
                 OnapName tempOnapName = new OnapName();
-                tempOnapName.setOnapName(value);
+                tempOnapName.setName(value);
                 this.setOnapNameField(tempOnapName);
                 return true;
             case "RiskType":
index f47e474..c0c009f 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -41,7 +41,9 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Version;
 
-import lombok.Data;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 
 /*
  * The Entity class to persist a policy object Action Body
@@ -55,8 +57,10 @@ import lombok.Data;
         @NamedQuery(name = "ActionBodyEntity.deleteAll", query = "DELETE FROM ActionBodyEntity WHERE 1=1")
     }
 )
-@Data
-//@foramtter:on
+@Getter
+@Setter
+@NoArgsConstructor
+// @foramtter:on
 
 public class ActionBodyEntity implements Serializable {
     private static final long serialVersionUID = 1L;
@@ -95,10 +99,6 @@ public class ActionBodyEntity implements Serializable {
     @Column(name = "deleted", nullable = false)
     private boolean deleted = false;
 
-    public ActionBodyEntity() {
-        // An empty constructor
-    }
-
     /**
      * Called before an instance is persisted.
      */
index a0f4a30..e72c402 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,12 +32,14 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
 @Table(name = "actionlist")
 @NamedQuery(name = "ActionList.findAll", query = "SELECT e FROM ActionList e ")
-@Data
+@Getter
+@Setter
 public class ActionList implements Serializable {
     private static final long serialVersionUID = 1L;
 
index 07e62f3..7847585 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,7 +40,8 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
 
 // @formatter:off
 @Entity
@@ -50,7 +51,8 @@ import lombok.Data;
         @NamedQuery(name = "ActionPolicyDict.findAll", query = "SELECT e FROM ActionPolicyDict e")
     }
 )
-@Data
+@Getter
+@Setter
 //@formatter:on
 public class ActionPolicyDict implements Serializable {
     private static final long serialVersionUID = 1L;
index efefad2..3d2c69a 100644 (file)
@@ -32,7 +32,9 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
-import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
 
 /**
  * The Class AddressGroup is a JPA class for address groups.
@@ -41,10 +43,9 @@ import lombok.Data;
 @Table(name = "AddressGroup")
 @NamedQuery(name = "AddressGroup.findAll", query = "SELECT e FROM AddressGroup e ")
 
-/**
- * Instantiates a new address group.
- */
-@Data
+@Getter
+@Setter
+@ToString
 public class AddressGroup implements Serializable {
     private static final long serialVersionUID = 1L;
 
index a084f2c..4b8059e 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,29 +47,20 @@ import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 
 import lombok.Getter;
+import lombok.NoArgsConstructor;
 import lombok.Setter;
 
 /**
  * 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")
 
-/**
- * Gets the user modified by.
- *
- * @return the user modified by
- */
 @Getter
-
-/**
- * Sets the user modified by.
- *
- * @param userModifiedBy the new user modified by
- */
 @Setter
+@NoArgsConstructor
 public class Attribute implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -144,16 +135,9 @@ public class Attribute implements Serializable {
     @JoinColumn(name = "modified_by")
     private UserInfo userModifiedBy;
 
-    /**
-     * Default constructor.
-     */
-    public Attribute() {
-        // An empty constructor
-    }
-
     /**
      * Constructor with domain.
-     * 
+     *
      * @param domain the domain to use to construct the object
      */
     public Attribute(String domain) {
@@ -162,7 +146,7 @@ public class Attribute implements Serializable {
 
     /**
      * Copy constructor.
-     * 
+     *
      * @param copy the copy to copy from
      */
     public Attribute(Attribute copy) {
index 5fb7c9c..8a40f4c 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,16 +32,20 @@ import javax.persistence.ManyToOne;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 
-import lombok.Data;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 
 /**
  * The persistent class for the ObadviceExpressions database table.
- * 
+ *
  */
 @Entity
 @Table(name = "AttributeAssignment")
 @NamedQuery(name = "AttributeAssignment.findAll", query = "SELECT a FROM AttributeAssignment a")
-@Data
+@Getter
+@Setter
+@NoArgsConstructor
 public class AttributeAssignment implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -67,8 +71,4 @@ public class AttributeAssignment implements Serializable {
     // bi-directional many-to-one association to Obadvice
     @ManyToOne
     private Obadvice obadvice;
-
-    public AttributeAssignment() {
-        // An empty constructor
-    }
 }
index a17d8b6..7eaf075 100644 (file)
@@ -39,12 +39,17 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * The Class BRMSController.
  */
 @Entity
 @Table(name = "BrmsController")
 @NamedQuery(name = "BrmsController.findAll", query = "SELECT b from BrmsController b ")
+@Getter
+@Setter
 public class BrmsController implements Serializable {
     private static final long serialVersionUID = -8666947569754164177L;
 
@@ -96,149 +101,4 @@ public class BrmsController implements Serializable {
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    /**
-     * Gets the description.
-     *
-     * @return the description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Sets the description.
-     *
-     * @param description the new description
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Gets the created date.
-     *
-     * @return the created date
-     */
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    /**
-     * Sets the created date.
-     *
-     * @param createdDate the new created date
-     */
-    public void setCreatedDate(Date createdDate) {
-        this.createdDate = createdDate;
-    }
-
-    /**
-     * Gets the user created by.
-     *
-     * @return the user created by
-     */
-    public UserInfo getUserCreatedBy() {
-        return userCreatedBy;
-    }
-
-    /**
-     * Sets the user created by.
-     *
-     * @param userCreatedBy the new user created by
-     */
-    public void setUserCreatedBy(UserInfo userCreatedBy) {
-        this.userCreatedBy = userCreatedBy;
-    }
-
-    /**
-     * Gets the modified date.
-     *
-     * @return the modified date
-     */
-    public Date getModifiedDate() {
-        return modifiedDate;
-    }
-
-    /**
-     * Sets the modified date.
-     *
-     * @param modifiedDate the new modified date
-     */
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
-    /**
-     * Gets the user modified by.
-     *
-     * @return the user modified by
-     */
-    public UserInfo getUserModifiedBy() {
-        return userModifiedBy;
-    }
-
-    /**
-     * Sets the user modified by.
-     *
-     * @param userModifiedBy the new user modified by
-     */
-    public void setUserModifiedBy(UserInfo userModifiedBy) {
-        this.userModifiedBy = userModifiedBy;
-    }
-
-    /**
-     * Gets the controller.
-     *
-     * @return the controller
-     */
-    public String getController() {
-        return controller;
-    }
-
-    /**
-     * Sets the controller.
-     *
-     * @param controller the new controller
-     */
-    public void setController(String controller) {
-        this.controller = controller;
-    }
-
-    /**
-     * Gets the id.
-     *
-     * @return the id
-     */
-    public int getId() {
-        return id;
-    }
-
-    /**
-     * Sets the id.
-     *
-     * @param id the new id
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets the controller name.
-     *
-     * @return the controller name
-     */
-    public String getControllerName() {
-        return controllerName;
-    }
-
-    /**
-     * Sets the controller name.
-     *
-     * @param controllerName the new controller name
-     */
-    public void setControllerName(String controllerName) {
-        this.controllerName = controllerName;
-    }
-
 }
index c04957d..1b6c89f 100644 (file)
@@ -39,12 +39,17 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * The Class BrmsDependency.
  */
 @Entity
 @Table(name = "BrmsDependency")
 @NamedQuery(name = "BrmsDependency.findAll", query = "SELECT b from BrmsDependency b ")
+@Getter
+@Setter
 public class BrmsDependency implements Serializable {
     private static final long serialVersionUID = -7005622785653160761L;
 
@@ -96,148 +101,4 @@ public class BrmsDependency implements Serializable {
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    /**
-     * Gets the description.
-     *
-     * @return the description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Sets the description.
-     *
-     * @param description the new description
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Gets the created date.
-     *
-     * @return the created date
-     */
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    /**
-     * Sets the created date.
-     *
-     * @param createdDate the new created date
-     */
-    public void setCreatedDate(Date createdDate) {
-        this.createdDate = createdDate;
-    }
-
-    /**
-     * Gets the user created by.
-     *
-     * @return the user created by
-     */
-    public UserInfo getUserCreatedBy() {
-        return userCreatedBy;
-    }
-
-    /**
-     * Sets the user created by.
-     *
-     * @param userCreatedBy the new user created by
-     */
-    public void setUserCreatedBy(UserInfo userCreatedBy) {
-        this.userCreatedBy = userCreatedBy;
-    }
-
-    /**
-     * Gets the modified date.
-     *
-     * @return the modified date
-     */
-    public Date getModifiedDate() {
-        return modifiedDate;
-    }
-
-    /**
-     * Sets the modified date.
-     *
-     * @param modifiedDate the new modified date
-     */
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
-    /**
-     * Gets the user modified by.
-     *
-     * @return the user modified by
-     */
-    public UserInfo getUserModifiedBy() {
-        return userModifiedBy;
-    }
-
-    /**
-     * Sets the user modified by.
-     *
-     * @param userModifiedBy the new user modified by
-     */
-    public void setUserModifiedBy(UserInfo userModifiedBy) {
-        this.userModifiedBy = userModifiedBy;
-    }
-
-    /**
-     * Gets the dependency.
-     *
-     * @return the dependency
-     */
-    public String getDependency() {
-        return dependency;
-    }
-
-    /**
-     * Sets the dependency.
-     *
-     * @param dependency the new dependency
-     */
-    public void setDependency(String dependency) {
-        this.dependency = dependency;
-    }
-
-    /**
-     * Gets the id.
-     *
-     * @return the id
-     */
-    public int getId() {
-        return id;
-    }
-
-    /**
-     * Sets the id.
-     *
-     * @param id the new id
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets the dependency name.
-     *
-     * @return the dependency name
-     */
-    public String getDependencyName() {
-        return dependencyName;
-    }
-
-    /**
-     * Sets the dependency name.
-     *
-     * @param dependencyName the new dependency name
-     */
-    public void setDependencyName(String dependencyName) {
-        this.dependencyName = dependencyName;
-    }
 }
index ae4feda..e3531fe 100644 (file)
@@ -39,15 +39,18 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
-/*
+import lombok.Getter;
+import lombok.Setter;
+
+/**
  * JPA for the BRMS Param Template.
- *
- * @version: 0.1
  */
 
 @Entity
 @Table(name = "BrmsParamTemplate")
 @NamedQuery(name = "BrmsParamTemplate.findAll", query = "SELECT b FROM BrmsParamTemplate b ")
+@Getter
+@Setter
 public class BrmsParamTemplate implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -75,57 +78,9 @@ public class BrmsParamTemplate implements Serializable {
     @JoinColumn(name = "created_by")
     private UserInfo userCreatedBy;
 
-    public UserInfo getUserCreatedBy() {
-        return userCreatedBy;
-    }
-
-    public void setUserCreatedBy(UserInfo userCreatedBy) {
-        this.userCreatedBy = userCreatedBy;
-    }
-
     @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;
-    }
 }
index 4b06707..d417b37 100644 (file)
@@ -41,6 +41,10 @@ import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.persistence.Transient;
 
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
 /**
  * The persistent class for the Categories database table.
  *
@@ -48,6 +52,9 @@ import javax.persistence.Transient;
 @Entity
 @Table(name = "Category")
 @NamedQuery(name = "Category.findAll", query = "SELECT c FROM Category c")
+@Getter
+@Setter
+@ToString
 public class Category implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -134,114 +141,6 @@ public class Category implements Serializable {
         this(cat, Category.STANDARD);
     }
 
-    /**
-     * Gets the id.
-     *
-     * @return the id
-     */
-    public int getId() {
-        return this.id;
-    }
-
-    /**
-     * Sets the id.
-     *
-     * @param id the new id
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets the grouping.
-     *
-     * @return the grouping
-     */
-    public String getGrouping() {
-        return this.grouping;
-    }
-
-    /**
-     * Sets the grouping.
-     *
-     * @param grouping the new grouping
-     */
-    public void setGrouping(String grouping) {
-        this.grouping = grouping;
-    }
-
-    /**
-     * Gets the checks if is standard.
-     *
-     * @return the checks if is standard
-     */
-    public char getIsStandard() {
-        return this.isStandard;
-    }
-
-    /**
-     * Sets the checks if is standard.
-     *
-     * @param isStandard the new checks if is standard
-     */
-    public void setIsStandard(char isStandard) {
-        this.isStandard = isStandard;
-    }
-
-    /**
-     * Gets the xacml id.
-     *
-     * @return the xacml id
-     */
-    public String getXacmlId() {
-        return this.xacmlId;
-    }
-
-    /**
-     * Sets the xacml id.
-     *
-     * @param xacmlId the new xacml id
-     */
-    public void setXacmlId(String xacmlId) {
-        this.xacmlId = xacmlId;
-    }
-
-    /**
-     * Gets the short name.
-     *
-     * @return the short name
-     */
-    public String getShortName() {
-        return this.shortName;
-    }
-
-    /**
-     * Sets the short name.
-     *
-     * @param shortName the new short name
-     */
-    public void setShortName(String shortName) {
-        this.shortName = shortName;
-    }
-
-    /**
-     * Gets the attributes.
-     *
-     * @return the attributes
-     */
-    public Set<Attribute> getAttributes() {
-        return this.attributes;
-    }
-
-    /**
-     * Sets the attributes.
-     *
-     * @param attributes the new attributes
-     */
-    public void setAttributes(Set<Attribute> attributes) {
-        this.attributes = attributes;
-    }
-
     /**
      * Adds the attribute.
      *
@@ -322,17 +221,4 @@ public class Category implements Serializable {
     public Identifier getIdentifer() {
         return new IdentifierImpl(this.xacmlId);
     }
-
-    /**
-     * To string.
-     *
-     * @return the string
-     */
-    @Transient
-    @Override
-    public String toString() {
-        return "Category [id=" + id + ", grouping=" + grouping + ", isStandard=" + isStandard + ", xacmlId=" + xacmlId
-                        + ", attributes=" + attributes + "]";
-    }
-
 }
index 4f6b1d7..41a2b2a 100644 (file)
@@ -21,9 +21,6 @@
 
 package org.onap.policy.rest.jpa;
 
-/*
- *
- */
 import java.io.Serializable;
 import java.util.Date;
 
@@ -42,12 +39,17 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * The Class ClosedLoopD2Services.
  */
 @Entity
 @Table(name = "ClosedLoopD2Services")
 @NamedQuery(name = "ClosedLoopD2Services.findAll", query = "SELECT c FROM ClosedLoopD2Services c ")
+@Getter
+@Setter
 public class ClosedLoopD2Services implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -86,42 +88,6 @@ public class ClosedLoopD2Services implements Serializable {
         this.setModifiedDate(new Date());
     }
 
-    /**
-     * Gets the user created by.
-     *
-     * @return the user created by
-     */
-    public UserInfo getUserCreatedBy() {
-        return userCreatedBy;
-    }
-
-    /**
-     * Sets the user created by.
-     *
-     * @param userCreatedBy the new user created by
-     */
-    public void setUserCreatedBy(UserInfo userCreatedBy) {
-        this.userCreatedBy = userCreatedBy;
-    }
-
-    /**
-     * Gets the user modified by.
-     *
-     * @return the user modified by
-     */
-    public UserInfo getUserModifiedBy() {
-        return userModifiedBy;
-    }
-
-    /**
-     * Sets the user modified by.
-     *
-     * @param userModifiedBy the new user modified by
-     */
-    public void setUserModifiedBy(UserInfo userModifiedBy) {
-        this.userModifiedBy = userModifiedBy;
-    }
-
     /**
      * Pre persist.
      */
@@ -139,95 +105,4 @@ public class ClosedLoopD2Services implements Serializable {
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    /**
-     * Gets the id.
-     *
-     * @return the id
-     */
-    public int getId() {
-        return id;
-    }
-
-    /**
-     * Sets the id.
-     *
-     * @param id the new id
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets the service name.
-     *
-     * @return the service name
-     */
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    /**
-     * Sets the service name.
-     *
-     * @param serviceName the new service name
-     */
-    public void setServiceName(String serviceName) {
-        this.serviceName = serviceName;
-    }
-
-    /**
-     * Gets the description.
-     *
-     * @return the description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Sets the description.
-     *
-     * @param description the new description
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Gets the created date.
-     *
-     * @return the created date
-     */
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    /**
-     * Sets the created date.
-     *
-     * @param createdDate the new created date
-     */
-    public void setCreatedDate(Date createdDate) {
-        this.createdDate = createdDate;
-    }
-
-    /**
-     * Gets the modified date.
-     *
-     * @return the modified date
-     */
-    public Date getModifiedDate() {
-        return modifiedDate;
-    }
-
-    /**
-     * Sets the modified date.
-     *
-     * @param modifiedDate the new modified date
-     */
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
 }
index fc88010..fb220d7 100644 (file)
@@ -21,9 +21,6 @@
 
 package org.onap.policy.rest.jpa;
 
-/*
- *
- */
 import java.io.Serializable;
 import java.util.Date;
 
@@ -42,12 +39,17 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * The Class ClosedLoopSite.
  */
 @Entity
 @Table(name = "ClosedLoopSite")
 @NamedQuery(name = "ClosedLoopSite.findAll", query = "SELECT c FROM ClosedLoopSite c ")
+@Getter
+@Setter
 public class ClosedLoopSite implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -86,42 +88,6 @@ public class ClosedLoopSite implements Serializable {
         this.setModifiedDate(new Date());
     }
 
-    /**
-     * Gets the user created by.
-     *
-     * @return the user created by
-     */
-    public UserInfo getUserCreatedBy() {
-        return userCreatedBy;
-    }
-
-    /**
-     * Sets the user created by.
-     *
-     * @param userCreatedBy the new user created by
-     */
-    public void setUserCreatedBy(UserInfo userCreatedBy) {
-        this.userCreatedBy = userCreatedBy;
-    }
-
-    /**
-     * Gets the user modified by.
-     *
-     * @return the user modified by
-     */
-    public UserInfo getUserModifiedBy() {
-        return userModifiedBy;
-    }
-
-    /**
-     * Sets the user modified by.
-     *
-     * @param userModifiedBy the new user modified by
-     */
-    public void setUserModifiedBy(UserInfo userModifiedBy) {
-        this.userModifiedBy = userModifiedBy;
-    }
-
     /**
      * Pre persist.
      */
@@ -139,95 +105,4 @@ public class ClosedLoopSite implements Serializable {
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    /**
-     * Gets the id.
-     *
-     * @return the id
-     */
-    public int getId() {
-        return id;
-    }
-
-    /**
-     * Sets the id.
-     *
-     * @param id the new id
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets the site name.
-     *
-     * @return the site name
-     */
-    public String getSiteName() {
-        return siteName;
-    }
-
-    /**
-     * Sets the site name.
-     *
-     * @param siteName the new site name
-     */
-    public void setSiteName(String siteName) {
-        this.siteName = siteName;
-    }
-
-    /**
-     * Gets the description.
-     *
-     * @return the description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Sets the description.
-     *
-     * @param description the new description
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Gets the created date.
-     *
-     * @return the created date
-     */
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    /**
-     * Sets the created date.
-     *
-     * @param createdDate the new created date
-     */
-    public void setCreatedDate(Date createdDate) {
-        this.createdDate = createdDate;
-    }
-
-    /**
-     * Gets the modified date.
-     *
-     * @return the modified date
-     */
-    public Date getModifiedDate() {
-        return modifiedDate;
-    }
-
-    /**
-     * Sets the modified date.
-     *
-     * @param modifiedDate the new modified date
-     */
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
 }
index edeabce..3b1be82 100644 (file)
@@ -33,11 +33,23 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+// @formatter:off
 @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") })
+    {
+        @NamedQuery(name = "ClosedLoops.findAll", query = "SELECT e FROM ClosedLoops e"),
+        @NamedQuery(name = "ClosedLoops.deleteAll", query = "DELETE FROM ClosedLoops WHERE 1=1")
+    }
+)
+@Getter
+@Setter
+@NoArgsConstructor
+//@formatter:on
 public class ClosedLoops implements Serializable {
     private static final long serialVersionUID = -7796845092457926842L;
 
@@ -55,41 +67,4 @@ public class ClosedLoops implements Serializable {
 
     @Column(name = "yaml", nullable = true, length = 1028)
     private String yaml;
-
-    public ClosedLoops() {
-        // An empty constructor
-    }
-
-    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
index 8fd839a..f5ae181 100644 (file)
@@ -46,7 +46,10 @@ import javax.persistence.Version;
  * The Entity class to persist a policy object configuration data
  */
 
-import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 
 /**
  * The Class ConfigurationDataEntity.
@@ -60,7 +63,10 @@ import lombok.EqualsAndHashCode;
         @NamedQuery(name = "ConfigurationDataEntity.deleteAll", query = "DELETE FROM ConfigurationDataEntity WHERE 1=1")
     }
 )
-@EqualsAndHashCode
+@Getter
+@Setter
+@ToString
+@NoArgsConstructor
 //@formatter:on
 
 public class ConfigurationDataEntity implements Serializable {
@@ -106,13 +112,6 @@ public class ConfigurationDataEntity implements Serializable {
     @Column(name = "deleted", nullable = false)
     private boolean deleted = false;
 
-    /**
-     * Instantiates a new configuration data entity.
-     */
-    public ConfigurationDataEntity() {
-        // An empty constructor
-    }
-
     /**
      * Pre persist.
      */
@@ -130,175 +129,4 @@ public class ConfigurationDataEntity implements Serializable {
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    /**
-     * Gets the configuration data id.
-     *
-     * @return the configurationDataId
-     */
-    public long getConfigurationDataId() {
-        return configurationDataId;
-    }
-
-    /**
-     * Sets the configuration name.
-     *
-     * @param configurationName the new configuration name
-     */
-    public void setConfigurationName(String configurationName) {
-        this.configurationName = configurationName;
-    }
-
-    /**
-     * Gets the configuration name.
-     *
-     * @return the configuration name
-     */
-    public String getConfigurationName() {
-        return this.configurationName;
-    }
-
-    /**
-     * Gets the config type.
-     *
-     * @return the configType
-     */
-    public String getConfigType() {
-        return configType;
-    }
-
-    /**
-     * Sets the config type.
-     *
-     * @param configType the configType to set
-     */
-    public void setConfigType(String configType) {
-        this.configType = configType;
-    }
-
-    /**
-     * Gets the config body.
-     *
-     * @return the configBody
-     */
-    public String getConfigBody() {
-        return configBody;
-    }
-
-    /**
-     * Sets the config body.
-     *
-     * @param configBody the configBody to set
-     */
-    public void setConfigBody(String configBody) {
-        this.configBody = configBody;
-    }
-
-    /**
-     * Gets the created by.
-     *
-     * @return the createdBy
-     */
-    public String getCreatedBy() {
-        return createdBy;
-    }
-
-    /**
-     * Sets the created by.
-     *
-     * @param createdBy the createdBy to set
-     */
-    public void setCreatedBy(String createdBy) {
-        this.createdBy = createdBy;
-    }
-
-    /**
-     * Gets the description.
-     *
-     * @return the description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Sets the description.
-     *
-     * @param description the description to set
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Gets the modified by.
-     *
-     * @return the modifiedBy
-     */
-    public String getModifiedBy() {
-        return modifiedBy;
-    }
-
-    /**
-     * Sets the modified by.
-     *
-     * @param modifiedBy the modifiedBy to set
-     */
-    public void setModifiedBy(String modifiedBy) {
-        this.modifiedBy = modifiedBy;
-    }
-
-    /**
-     * Gets the modified date.
-     *
-     * @return the modifiedDate
-     */
-    public Date getModifiedDate() {
-        return modifiedDate;
-    }
-
-    /**
-     * Sets the modified date.
-     *
-     * @param modifiedDate the modifiedDate to set
-     */
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
-    /**
-     * Gets the version.
-     *
-     * @return the version
-     */
-    public int getVersion() {
-        return version;
-    }
-
-    /**
-     * Gets the created date.
-     *
-     * @return the createdDate
-     */
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    /**
-     * Checks if is deleted.
-     *
-     * @return the deleted
-     */
-    public boolean isDeleted() {
-        return deleted;
-    }
-
-    /**
-     * Sets the deleted.
-     *
-     * @param deleted the deleted to set
-     */
-    public void setDeleted(boolean deleted) {
-        this.deleted = deleted;
-    }
 }
index f763701..10394ae 100644 (file)
@@ -36,9 +36,16 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
 @Entity
 @Table(name = "ConstraintType")
 @NamedQuery(name = "ConstraintType.findAll", query = "SELECT a FROM ConstraintType a")
+@Getter
+@Setter
+@NoArgsConstructor
 public class ConstraintType implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -66,7 +73,7 @@ public class ConstraintType implements Serializable {
     private int id;
 
     @Column(name = "constraint_type", nullable = false, length = 64)
-    private String constraintType;
+    private String theConstraintType;
 
     @Column(name = "description", nullable = false, length = 255)
     private String description;
@@ -75,13 +82,9 @@ public class ConstraintType implements Serializable {
     @OneToMany(mappedBy = "constraintType")
     private Set<Attribute> attributes = new HashSet<>();
 
-    public ConstraintType() {
-        // An empty constructor
-    }
-
     public ConstraintType(String constraintType) {
         this();
-        this.constraintType = constraintType;
+        this.theConstraintType = constraintType;
     }
 
     public ConstraintType(String constraintType, String description) {
@@ -89,40 +92,15 @@ public class ConstraintType implements Serializable {
         this.description = description;
     }
 
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
+    public static String[] getRangeTypes() {
+        return RANGE_TYPES;
     }
 
     public String getConstraintType() {
-        return constraintType;
-    }
-
-    public void setConstraintType(String constraintType) {
-        this.constraintType = constraintType;
+        return theConstraintType;
     }
 
-    public String getDescription() {
-        return description;
+    public void setConstraintType(final String theConstraintType) {
+        this.theConstraintType = theConstraintType;
     }
-
-    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;
-    }
-
 }
index c30af1f..d404396 100644 (file)
@@ -33,6 +33,10 @@ import javax.persistence.ManyToOne;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
 /**
  * The persistent class for the ConstraintValues database table.
  *
@@ -40,6 +44,9 @@ import javax.persistence.Table;
 @Entity
 @Table(name = "ConstraintValues")
 @NamedQuery(name = "ConstraintValue.findAll", query = "SELECT c FROM ConstraintValue c")
+@Getter
+@Setter
+@NoArgsConstructor
 public class ConstraintValue implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -59,10 +66,6 @@ public class ConstraintValue implements Serializable {
     @JoinColumn(name = "attribute_id")
     private Attribute attribute;
 
-    public ConstraintValue() {
-        // An empty constructor
-    }
-
     public ConstraintValue(String property, String value) {
         this.property = property;
         this.value = value;
@@ -73,38 +76,6 @@ public class ConstraintValue implements Serializable {
         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;
-    }
-
     @Override
     public ConstraintValue clone() {
         ConstraintValue constraint = new ConstraintValue();
index 73d2c99..0ea3b71 100644 (file)
@@ -28,24 +28,18 @@ import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
 @Entity
 @Table(name = "DatabaseLockEntity")
+@Getter
+@Setter
+@NoArgsConstructor
 public class DatabaseLockEntity implements Serializable {
     private static final long serialVersionUID = 1L;
     @Id
     @Column(name = "lock_key")
-    private int lockKey = 1;
-
-    public DatabaseLockEntity() {
-        // An empty constructor
-    }
-
-    public int getKey() {
-        return lockKey;
-    }
-
-    public void setKey(int key) {
-        this.lockKey = key;
-    }
-
+    private int key = 1;
 }
index 9da83ff..9bb2340 100644 (file)
@@ -41,6 +41,10 @@ import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.persistence.Transient;
 
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
 /**
  * The persistent class for the Datatype database table.
  *
@@ -48,6 +52,9 @@ import javax.persistence.Transient;
 @Entity
 @Table(name = "Datatype")
 @NamedQuery(name = "Datatype.findAll", query = "SELECT d FROM Datatype d")
+@Getter
+@Setter
+@ToString
 public class Datatype implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -131,96 +138,6 @@ public class Datatype implements Serializable {
         this(identifier, Datatype.STANDARD);
     }
 
-    /**
-     * Gets the id.
-     *
-     * @return the id
-     */
-    public int getId() {
-        return this.id;
-    }
-
-    /**
-     * Sets the id.
-     *
-     * @param id the new id
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets the checks if is standard.
-     *
-     * @return the checks if is standard
-     */
-    public char getIsStandard() {
-        return this.isStandard;
-    }
-
-    /**
-     * Sets the checks if is standard.
-     *
-     * @param isStandard the new checks if is standard
-     */
-    public void setIsStandard(char isStandard) {
-        this.isStandard = isStandard;
-    }
-
-    /**
-     * Gets the xacml id.
-     *
-     * @return the xacml id
-     */
-    public String getXacmlId() {
-        return this.xacmlId;
-    }
-
-    /**
-     * Sets the xacml id.
-     *
-     * @param xacmlId the new xacml id
-     */
-    public void setXacmlId(String xacmlId) {
-        this.xacmlId = xacmlId;
-    }
-
-    /**
-     * Gets the short name.
-     *
-     * @return the short name
-     */
-    public String getShortName() {
-        return shortName;
-    }
-
-    /**
-     * Sets the short name.
-     *
-     * @param shortName the new short name
-     */
-    public void setShortName(String shortName) {
-        this.shortName = shortName;
-    }
-
-    /**
-     * Gets the attributes.
-     *
-     * @return the attributes
-     */
-    public Set<Attribute> getAttributes() {
-        return this.attributes;
-    }
-
-    /**
-     * Sets the attributes.
-     *
-     * @param attributes the new attributes
-     */
-    public void setAttributes(Set<Attribute> attributes) {
-        this.attributes = attributes;
-    }
-
     /**
      * Adds the attribute.
      *
@@ -260,24 +177,6 @@ public class Datatype implements Serializable {
         return function;
     }
 
-    /**
-     * Gets the functions.
-     *
-     * @return the functions
-     */
-    public Set<FunctionDefinition> getFunctions() {
-        return this.functions;
-    }
-
-    /**
-     * Sets the functions.
-     *
-     * @param functions the new functions
-     */
-    public void setFunctions(Set<FunctionDefinition> functions) {
-        this.functions = functions;
-    }
-
     /**
      * Adds the function.
      *
@@ -291,24 +190,6 @@ public class Datatype implements Serializable {
         return function;
     }
 
-    /**
-     * Gets the arguments.
-     *
-     * @return the arguments
-     */
-    public Set<FunctionArgument> getArguments() {
-        return this.arguments;
-    }
-
-    /**
-     * Sets the arguments.
-     *
-     * @param argument the new arguments
-     */
-    public void setArguments(Set<FunctionArgument> argument) {
-        this.arguments = argument;
-    }
-
     /**
      * Adds the argument.
      *
@@ -374,17 +255,4 @@ public class Datatype implements Serializable {
     public boolean isCustom() {
         return this.isStandard == Datatype.CUSTOM;
     }
-
-    /**
-     * To string.
-     *
-     * @return the string
-     */
-    @Transient
-    @Override
-    public String toString() {
-        return "Datatype [id=" + id + ", isStandard=" + isStandard + ", xacmlId=" + xacmlId + ", shortName=" + shortName
-                        + ", attributes=" + attributes + ", functions=" + functions + ", arguments=" + arguments + "]";
-    }
-
 }
index 1408c9f..3313d03 100644 (file)
@@ -21,8 +21,6 @@
 
 package org.onap.policy.rest.jpa;
 
-/*
- */
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -34,9 +32,14 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
 @Table(name = "DcaeUsers")
 @NamedQuery(name = "DcaeUsers.findAll", query = "SELECT e FROM DcaeUsers e ")
+@Getter
+@Setter
 public class DcaeUsers implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -52,23 +55,6 @@ public class DcaeUsers implements Serializable {
     @Column(name = "description ")
     private String 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;
-
-    }
-
     public String getDescriptionValue() {
         return this.description;
     }
@@ -76,5 +62,4 @@ public class DcaeUsers implements Serializable {
     public void setDescriptionValue(String description) {
         this.description = description;
     }
-
 }
index 8464ef7..990f396 100644 (file)
@@ -21,8 +21,6 @@
 
 package org.onap.policy.rest.jpa;
 
-/*
- */
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -34,9 +32,14 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
 @Table(name = "DcaeUuid")
 @NamedQuery(name = "DcaeUuid.findAll", query = "SELECT e FROM DcaeUuid e ")
+@Getter
+@Setter
 public class DcaeUuid implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -51,30 +54,4 @@ public class DcaeUuid implements Serializable {
 
     @Column(name = "description")
     private String description;
-
-    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;
-
-    }
-
 }
index 693641e..bfa2176 100644 (file)
@@ -40,6 +40,9 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * The Class DecisionSettings.
  */
@@ -50,6 +53,8 @@ import javax.persistence.Transient;
     name = "DecisionSettings.findAll",
     query = "SELECT a FROM DecisionSettings a order by  a.priority asc, a.xacmlId asc"
 )
+@Getter
+@Setter
 //@formatter:on
 public class DecisionSettings implements Serializable {
     private static final long serialVersionUID = 1L;
@@ -97,42 +102,6 @@ public class DecisionSettings implements Serializable {
     @JoinColumn(name = "modified_by")
     private UserInfo userModifiedBy;
 
-    /**
-     * Gets the user created by.
-     *
-     * @return the user created by
-     */
-    public UserInfo getUserCreatedBy() {
-        return userCreatedBy;
-    }
-
-    /**
-     * Sets the user created by.
-     *
-     * @param userCreatedBy the new user created by
-     */
-    public void setUserCreatedBy(UserInfo userCreatedBy) {
-        this.userCreatedBy = userCreatedBy;
-    }
-
-    /**
-     * Gets the user modified by.
-     *
-     * @return the user modified by
-     */
-    public UserInfo getUserModifiedBy() {
-        return userModifiedBy;
-    }
-
-    /**
-     * Sets the user modified by.
-     *
-     * @param userModifiedBy the new user modified by
-     */
-    public void setUserModifiedBy(UserInfo userModifiedBy) {
-        this.userModifiedBy = userModifiedBy;
-    }
-
     /**
      * Pre persist.
      */
@@ -150,170 +119,4 @@ public class DecisionSettings implements Serializable {
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    /**
-     * Gets the id.
-     *
-     * @return the id
-     */
-    public int getId() {
-        return this.id;
-    }
-
-    /**
-     * Sets the id.
-     *
-     * @param id the new id
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    /**
-     * Gets the created date.
-     *
-     * @return the created date
-     */
-    public Date getCreatedDate() {
-        return this.createdDate;
-    }
-
-    /**
-     * Sets the created date.
-     *
-     * @param createdDate the new created date
-     */
-    public void setCreatedDate(Date createdDate) {
-        this.createdDate = createdDate;
-    }
-
-    /**
-     * Gets the description.
-     *
-     * @return the description
-     */
-    public String getDescription() {
-        return this.description;
-    }
-
-    /**
-     * Sets the description.
-     *
-     * @param description the new description
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Gets the modified date.
-     *
-     * @return the modified date
-     */
-    public Date getModifiedDate() {
-        return this.modifiedDate;
-    }
-
-    /**
-     * Sets the modified date.
-     *
-     * @param modifiedDate the new modified date
-     */
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
-    /**
-     * Gets the xacml id.
-     *
-     * @return the xacml id
-     */
-    public String getXacmlId() {
-        return this.xacmlId;
-    }
-
-    /**
-     * Sets the xacml id.
-     *
-     * @param xacmlId the new xacml id
-     */
-    public void setXacmlId(String xacmlId) {
-        this.xacmlId = xacmlId;
-    }
-
-    /**
-     * Gets the datatype bean.
-     *
-     * @return the datatype bean
-     */
-    public Datatype getDatatypeBean() {
-        return this.datatypeBean;
-    }
-
-    /**
-     * Sets the datatype bean.
-     *
-     * @param datatypeBean the new datatype bean
-     */
-    public void setDatatypeBean(Datatype datatypeBean) {
-        this.datatypeBean = datatypeBean;
-    }
-
-    /**
-     * Gets the issuer.
-     *
-     * @return the issuer
-     */
-    @Transient
-    public String getIssuer() {
-        return issuer;
-    }
-
-    /**
-     * Sets the issuer.
-     *
-     * @param issuer the new issuer
-     */
-    @Transient
-    public void setIssuer(String issuer) {
-        this.issuer = issuer;
-    }
-
-    /**
-     * Checks if is must be present.
-     *
-     * @return true, if is must be present
-     */
-    @Transient
-    public boolean isMustBePresent() {
-        return mustBePresent;
-    }
-
-    /**
-     * Sets the must be present.
-     *
-     * @param mustBePresent the new must be present
-     */
-    @Transient
-    public void setMustBePresent(boolean mustBePresent) {
-        this.mustBePresent = mustBePresent;
-    }
-
-    /**
-     * Gets the priority.
-     *
-     * @return the priority
-     */
-    public String getPriority() {
-        return priority;
-    }
-
-    /**
-     * Sets the priority.
-     *
-     * @param priority the new priority
-     */
-    public void setPriority(String priority) {
-        this.priority = priority;
-    }
 }
index d571ed7..4360131 100644 (file)
@@ -39,12 +39,17 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
+
 /**
  * The Class DescriptiveScope.
  */
 @Entity
 @Table(name = "DescriptiveScope")
 @NamedQuery(name = "DescriptiveScope.findAll", query = "Select p from DescriptiveScope p")
+@Getter
+@Setter
 public class DescriptiveScope implements Serializable {
     private static final long serialVersionUID = 1L;
     @Id
@@ -79,42 +84,6 @@ public class DescriptiveScope implements Serializable {
     @JoinColumn(name = "modified_by")
     private UserInfo userModifiedBy;
 
-    /**
-     * Gets the user created by.
-     *
-     * @return the user created by
-     */
-    public UserInfo getUserCreatedBy() {
-        return userCreatedBy;
-    }
-
-    /**
-     * Sets the user created by.
-     *
-     * @param userCreatedBy the new user created by
-     */
-    public void setUserCreatedBy(UserInfo userCreatedBy) {
-        this.userCreatedBy = userCreatedBy;
-    }
-
-    /**
-     * Gets the user modified by.
-     *
-     * @return the user modified by
-     */
-    public UserInfo getUserModifiedBy() {
-        return userModifiedBy;
-    }
-
-    /**
-     * Sets the user modified by.
-     *
-     * @param userModifiedBy the new user modified by
-     */
-    public void setUserModifiedBy(UserInfo userModifiedBy) {
-        this.userModifiedBy = userModifiedBy;
-    }
-
     /**
      * Pre persist.
      */
@@ -133,24 +102,6 @@ public class DescriptiveScope implements Serializable {
         this.modifiedDate = new Date();
     }
 
-    /**
-     * Gets the id.
-     *
-     * @return the id
-     */
-    public int getId() {
-        return this.id;
-    }
-
-    /**
-     * Sets the id.
-     *
-     * @param id the new id
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
     /**
      * Gets the scope name.
      *
@@ -168,77 +119,4 @@ public class DescriptiveScope implements Serializable {
     public void setScopeName(String descriptiveScopeName) {
         this.descriptiveScopeName = descriptiveScopeName;
     }
-
-    /**
-     * Gets the search.
-     *
-     * @return the search
-     */
-    public String getSearch() {
-        return search;
-    }
-
-    /**
-     * Sets the search.
-     *
-     * @param search the new search
-     */
-    public void setSearch(String search) {
-        this.search = search;
-    }
-
-    /**
-     * Gets the created date.
-     *
-     * @return the created date
-     */
-    public Date getCreatedDate() {
-        return this.createdDate;
-    }
-
-    /**
-     * Sets the created date.
-     *
-     * @param createdDate the new created date
-     */
-    public void setCreatedDate(Date createdDate) {
-        this.createdDate = createdDate;
-    }
-
-    /**
-     * Gets the description.
-     *
-     * @return the description
-     */
-    public String getDescription() {
-        return this.description;
-    }
-
-    /**
-     * Sets the description.
-     *
-     * @param description the new description
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Gets the modified date.
-     *
-     * @return the modified date
-     */
-    public Date getModifiedDate() {
-        return this.modifiedDate;
-    }
-
-    /**
-     * Sets the modified date.
-     *
-     * @param modifiedDate the new modified date
-     */
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
 }
index 40b8fcc..a3db91b 100644 (file)
@@ -29,9 +29,14 @@ import javax.persistence.Id;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
 @Table(name = "DictionaryData")
 @NamedQuery(name = "DictionaryData.findAll", query = "SELECT v FROM DictionaryData v ")
+@Getter
+@Setter
 public class DictionaryData {
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
@@ -46,37 +51,4 @@ public class DictionaryData {
 
     @Column(name = "dictionaryDataByName", nullable = false, length = 1024)
     private String dictionaryDataByName;
-
-    public String getDictionaryUrl() {
-        return dictionaryUrl;
-    }
-
-    public void setDictionaryUrl(String dictionaryUrl) {
-        this.dictionaryUrl = dictionaryUrl;
-    }
-
-    public String getDictionaryDataByName() {
-        return dictionaryDataByName;
-    }
-
-    public void setDictionaryDataByName(String dictionaryDataByName) {
-        this.dictionaryDataByName = dictionaryDataByName;
-    }
-
-    public String getDictionaryName() {
-        return dictionaryName;
-    }
-
-    public void setDictionaryName(String dictionaryName) {
-        this.dictionaryName = dictionaryName;
-    }
-
-    public int getId() {
-        return this.id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
 }
index 6ef5f60..8581cdf 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -31,68 +32,32 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="parentdictionaryitems")
-@NamedQuery(name="FirewallDictionaryList.findAll", query="SELECT e FROM FirewallDictionaryList e")
+@Table(name = "parentdictionaryitems")
+@NamedQuery(name = "FirewallDictionaryList.findAll", query = "SELECT e FROM FirewallDictionaryList e")
+@Getter
+@Setter
 public class FirewallDictionaryList implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="parentItemName", nullable=false)
+    @Column(name = "parentItemName", nullable = false)
     @OrderBy("asc")
     private String parentItemName;
 
-    @Column(name="description")
+    @Column(name = "description")
     private String description;
 
-    @Column(name="addressList")
+    @Column(name = "addressList")
     private String addressList;
 
-    @Column(name="serviceList")
+    @Column(name = "serviceList")
     private String serviceList;
-
-    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;
-    }
 }
index a0d14e6..f978cf0 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -22,44 +23,62 @@ package org.onap.policy.rest.jpa;
 
 import java.io.Serializable;
 
-import javax.persistence.*;
-
+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;
+import javax.persistence.Transient;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 
 /**
  * The persistent class for the FunctionArguments database table.
- * 
+ *
  */
 @Entity
-@Table(name="FunctionArguments")
-@NamedQuery(name="FunctionArgument.findAll", query="SELECT f FROM FunctionArgument f")
+@Table(name = "FunctionArguments")
+@NamedQuery(name = "FunctionArgument.findAll", query = "SELECT f FROM FunctionArgument f")
+@Getter
+@Setter
+@ToString
+@NoArgsConstructor
 public class FunctionArgument implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
-    @GeneratedValue(strategy=GenerationType.AUTO)
-    @Column(name="id")
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    @Column(name = "id")
     private int id;
 
-    @Column(name="is_bag", nullable=false)
+    @Column(name = "is_bag", nullable = false)
     private int isBag;
 
-    //bi-directional many-to-one association to FunctionDefinition
+    // bi-directional many-to-one association to FunctionDefinition
     @ManyToOne
-    @JoinColumn(name="function_id")
+    @JoinColumn(name = "function_id")
     private FunctionDefinition functionDefinition;
 
-    @Column(name="arg_index", nullable=false)
+    @Column(name = "arg_index", nullable = false)
     private int argIndex;
 
-    //bi-directional many-to-one association to Datatype
+    // bi-directional many-to-one association to Datatype
     @ManyToOne
-    @JoinColumn(name="datatype_id")
+    @JoinColumn(name = "datatype_id")
     private Datatype datatypeBean;
 
-    public FunctionArgument() {
-        //An empty constructor
-    }
-
+    /**
+     * Copy constructor.
+     *
+     * @param argument the object to copy from
+     */
     public FunctionArgument(final FunctionArgument argument) {
         this.argIndex = argument.argIndex;
         this.datatypeBean = argument.datatypeBean;
@@ -67,57 +86,12 @@ public class FunctionArgument implements Serializable {
         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;
     }
-
 }
index 80c9beb..9201eec 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
 package org.onap.policy.rest.jpa;
 
 import java.io.Serializable;
-
-import javax.persistence.*;
-
 import java.util.List;
 
+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.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
 
 /**
  * The persistent class for the FunctionDefinition database table.
- * 
+ *
  */
+// @formatter:off
 @Entity
-@Table(name="FunctionDefinition")
-@NamedQueries({
-    @NamedQuery(name="FunctionDefinition.findAll", query="SELECT f FROM FunctionDefinition f")
-})
+@Table(name = "FunctionDefinition")
+@NamedQueries(
+    {
+        @NamedQuery(name = "FunctionDefinition.findAll", query = "SELECT f FROM FunctionDefinition f")
+    }
+)
+@Getter
+@Setter
+@ToString
+@NoArgsConstructor
+// @formatter:on
 public class FunctionDefinition implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
-    @GeneratedValue(strategy=GenerationType.AUTO)
-    @Column(name="id")
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    @Column(name = "id")
     private int id;
 
-    @Column(name="short_name", nullable=false, length=64)
+    @Column(name = "short_name", nullable = false, length = 64)
     private String shortname;
 
-    @Column(name="xacml_id", nullable=false, length=255)
+    @Column(name = "xacml_id", nullable = false, length = 255)
     private String xacmlid;
 
-    //bi-directional many-to-one association to Datatype
+    // bi-directional many-to-one association to Datatype
     @ManyToOne
-    @JoinColumn(name="return_datatype", nullable=true)
+    @JoinColumn(name = "return_datatype", nullable = true)
     private Datatype datatypeBean;
 
-    @Column(name="is_bag_return", nullable=false)
+    @Column(name = "is_bag_return", nullable = false)
     private Integer isBagReturn;
 
-    @Column(name="is_higher_order", nullable=false)
+    @Column(name = "is_higher_order", nullable = false)
     private Integer isHigherOrder;
 
-    @Column(name="arg_lb", nullable=false)
+    @Column(name = "arg_lb", nullable = false)
     private Integer argLb;
 
-    @Column(name="arg_ub", nullable=false)
+    @Column(name = "arg_ub", nullable = false)
     private Integer argUb;
 
-    @Column(name="ho_arg_lb", nullable=true)
-    private Integer higherOrderArg_LB;
+    @Column(name = "ho_arg_lb", nullable = true)
+    private Integer higherOrderArgLb;
 
-    @Column(name="ho_arg_ub", nullable=true)
-    private Integer higherOrderArg_UB;
+    @Column(name = "ho_arg_ub", nullable = true)
+    private Integer higherOrderArgUb;
 
-    @Column(name="ho_primitive", nullable=true)
+    @Column(name = "ho_primitive", nullable = true)
     private Character higherOrderIsPrimitive;
 
-    //bi-directional many-to-one association to FunctionArgument
-    @OneToMany(mappedBy="functionDefinition")
+    // bi-directional many-to-one association to FunctionArgument
+    @OneToMany(mappedBy = "functionDefinition")
     private List<FunctionArgument> functionArguments;
 
-    public FunctionDefinition() {
-        //An empty constructor
-    }
-
-    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;
-    }
-
+    /**
+     * Adds the function argument.
+     *
+     * @param functionArgument the function argument
+     * @return the function argument
+     */
     public FunctionArgument addFunctionArgument(FunctionArgument functionArgument) {
         getFunctionArguments().add(functionArgument);
         functionArgument.setFunctionDefinition(this);
@@ -187,6 +116,12 @@ public class FunctionDefinition implements Serializable {
         return functionArgument;
     }
 
+    /**
+     * Removes the function argument.
+     *
+     * @param functionArgument the function argument
+     * @return the function argument
+     */
     public FunctionArgument removeFunctionArgument(FunctionArgument functionArgument) {
         getFunctionArguments().remove(functionArgument);
         functionArgument.setFunctionDefinition(null);
@@ -194,24 +129,21 @@ public class FunctionDefinition implements Serializable {
         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 + "]";
-    }
-
+    /**
+     * Checks if is bag return.
+     *
+     * @return true, if is bag return
+     */
     @Transient
     public boolean isBagReturn() {
         return this.isBagReturn == 1;
     }
 
+    /**
+     * Checks if is higher order.
+     *
+     * @return true, if is higher order
+     */
     @Transient
     public boolean isHigherOrder() {
         return this.isHigherOrder == 1;
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -38,117 +39,63 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
-@Table(name = "FWTag")
-@NamedQuery(name = "FWTag.findAll", query= "Select p from FWTag p")
-public class FWTag implements Serializable {
+@Table(name = "FwTag")
+@NamedQuery(name = "FwTag.findAll", query = "Select p from FwTag p")
+@Getter
+@Setter
+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)
+    @Column(name = "tagName", nullable = false)
     @OrderBy("asc")
     private String fwTagName;
 
-    @Column(name="description", nullable=true, length=2048)
+    @Column(name = "description", nullable = true, length = 2048)
     private String description;
 
-    @Column(name="tagValues", nullable=true)
+    @Column(name = "tagValues", nullable = true)
     @OrderBy("asc")
     private String tagValues;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", updatable=false)
+    @Column(name = "created_date", updatable = false)
     private Date createdDate;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="created_by")
+    @JoinColumn(name = "created_by")
     private UserInfo userCreatedBy;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="modified_by")
+    @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;
-    }
-
+    /**
+     * Called before an instance is persisted.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Called before an instance is updated.
+     */
     @PreUpdate
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    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;
-    }
-
 }
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
 import java.io.Serializable;
@@ -37,127 +39,66 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
 @Table(name = "FWTagPicker")
-@NamedQuery(name = "FWTagPicker.findAll", query= "Select p from FWTagPicker p")
-public class FWTagPicker implements Serializable {
+@NamedQuery(name = "FwTagPicker.findAll", query = "Select p from FwTagPicker p")
+@Getter
+@Setter
+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)
+    @Column(name = "tagPickerName", nullable = false)
     @OrderBy("asc")
     private String tagPickerName;
 
-    @Column(name="description", nullable=true, length=2048)
+    @Column(name = "description", nullable = true, length = 2048)
     private String description;
 
-    @Column(name="networkRole", nullable=true)
+    @Column(name = "networkRole", nullable = true)
     private String networkRole;
 
-    @Column(name="tags", nullable=true)
+    @Column(name = "tags", nullable = true)
     @OrderBy("asc")
     private String tagValues;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", updatable=false)
+    @Column(name = "created_date", updatable = false)
     private Date createdDate;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="created_by")
+    @JoinColumn(name = "created_by")
     private UserInfo userCreatedBy;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="modified_by")
+    @JoinColumn(name = "modified_by")
     private UserInfo userModifiedBy;
 
+    /**
+     * Called before an instance is persisted.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Called before an instance is updated.
+     */
     @PreUpdate
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    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;
-    }
-
 }
index 1b871d1..b895479 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -28,22 +29,25 @@ import javax.persistence.Id;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 /**
- * Entity implementation class for Entity: Administration
- *
+ * 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 {      
+@Table(name = "GlobalRoleSettings")
+@NamedQuery(name = "GlobalRoleSettings.findAll", query = "SELECT g FROM GlobalRoleSettings g")
+@Getter
+@Setter
+public class GlobalRoleSettings implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
-    @Column(name="role", length=45)
+    @Column(name = "role", length = 45)
     private String role;
 
-    @Column(name="lockdown")
+    @Column(name = "lockdown")
     private boolean lockdown;
 
     public GlobalRoleSettings() {
@@ -54,40 +58,4 @@ public class GlobalRoleSettings implements Serializable {
         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;
-    }
 }
index 9b0ea0d..71e0bc4 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
+
 import com.fasterxml.jackson.annotation.JsonManagedReference;
+
 /*
  */
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -43,216 +49,125 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Version;
 
-/*
- * The Entity class to persist a policy object and its configuration data
- */
+import lombok.Getter;
+import lombok.Setter;
 
 /**
- *
+ * The Entity class to persist a policy object and its configuration data.
  */
+// @formatter:off
 @Entity
-//Add a non-unique index and a constraint that says the combo of policyName and scopeId must be unique
-@Table(name="GroupEntity")
+// 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")
+    }
+)
 
-@NamedQueries({
-    @NamedQuery(name="GroupEntity.findAll", query="SELECT e FROM GroupEntity e "),
-    @NamedQuery(name="GroupEntity.deleteAll", query="DELETE FROM GroupEntity WHERE 1=1")
-})
+@Getter
+@Setter
+//@formatter:on
 
 public class GroupEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
-    @Column (name="groupKey", nullable=false)
+    @Column(name = "groupKey", nullable = false)
     @GeneratedValue(strategy = GenerationType.AUTO)
     private long groupKey;
 
-    @Column (name="groupId", nullable=false)
+    @Column(name = "groupId", nullable = false)
     private String groupId;
 
-    @Column(name="groupName", nullable=false, unique=false, length=255)
+    @Column(name = "groupName", nullable = false, unique = false, length = 255)
     private String groupName;
 
     @Version
-    @Column(name="version")
+    @Column(name = "version")
     private int version;
 
     @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
-    @JoinTable(name="PolicyGroupEntity",joinColumns={@JoinColumn(name="groupKey")}, inverseJoinColumns={@JoinColumn(name="policyId")})
+    @JoinTable(name = "PolicyGroupEntity", joinColumns =
+        { @JoinColumn(name = "groupKey") }, inverseJoinColumns =
+        { @JoinColumn(name = "policyId") })
     @JsonManagedReference
     private List<PolicyEntity> policies;
 
-    @Column(name="created_by", nullable=false, length=255)
+    @Column(name = "created_by", nullable = false, length = 255)
     private String createdBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", updatable=false)
+    @Column(name = "created_date", updatable = false)
     private Date createdDate;
 
-    @Column(name="description", nullable=false, length=2048)
+    @Column(name = "description", nullable = false, length = 2048)
     private String description = "NoDescription";
 
-    @Column(name="modified_by", nullable=false, length=255)
+    @Column(name = "modified_by", nullable = false, length = 255)
     private String modifiedBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
-    @Column(name="defaultGroup", nullable=false)
+    @Column(name = "defaultGroup", nullable = false)
     private boolean defaultGroup = false;
-    @Column(name="deleted", nullable=false)
+    @Column(name = "deleted", nullable = false)
     private boolean deleted = false;
 
+    /**
+     * Instantiates a new group entity.
+     */
     public GroupEntity() {
         super();
     }
 
+    /**
+     * Called before an instance is persisted.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Called before an instance is updated.
+     */
     @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
+     * Adds the policy to group.
+     *
+     * @param policy the policy
      */
     public void addPolicyToGroup(PolicyEntity policy) {
-        if(!this.policies.contains(policy)){
-            this.policies.add(policy);
+        if (policies == null) {
+            policies = new ArrayList<>();
         }
-    }
-    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;
+        if (!this.policies.contains(policy)) {
+            this.policies.add(policy);
+        }
     }
 
     /**
-     * @return the deleted
+     * Removes the policy from group.
+     *
+     * @param policy the policy
      */
-    public boolean isDeleted() {
-        return deleted;
-    }
+    public void removePolicyFromGroup(PolicyEntity policy) {
+        this.policies.remove(policy);
 
-    /**
-     * @param deleted the deleted to set
-     */
-    public void setDeleted(boolean deleted) {
-        this.deleted = deleted;
+        if (policies.isEmpty()) {
+            policies = null;
+        }
     }
-
-
 }
index 8b10083..71eb19e 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,35 +32,32 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="GroupPolicyScopeList")
-@NamedQuery(name="GroupPolicyScopeList.findAll", query="SELECT e FROM GroupPolicyScopeList e ")
+@Table(name = "GroupPolicyScopeList")
+@NamedQuery(name = "GroupPolicyScopeList.findAll", query = "SELECT e FROM GroupPolicyScopeList e ")
+@Getter
+@Setter
 public class GroupPolicyScopeList implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="groupList")
+    @Column(name = "groupList")
     private String groupList;
 
-    @Column(name="description")
+    @Column(name = "description")
     private String description;
 
-    public int getId() {
-        return this.id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
     public String getGroupName() {
         return this.name;
     }
@@ -69,19 +66,4 @@ public class GroupPolicyScopeList implements Serializable {
         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;
-    }
 }
index 63f673f..6d11203 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,48 +32,34 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="GroupServiceList")
-@NamedQuery(name="GroupServiceList.findAll", query="SELECT e FROM GroupServiceList e ")
+@Table(name = "GroupServiceList")
+@NamedQuery(name = "GroupServiceList.findAll", query = "SELECT e FROM GroupServiceList e ")
+@Getter
+@Setter
 public class GroupServiceList implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="serviceList ")
+    @Column(name = "serviceList ")
     private String serviceList;
 
-    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;
-
-    }
-
 }
index 5742120..8ae81b9 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -31,54 +32,30 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
-@Table(name="MicroServiceAttribute")
-@NamedQuery(name="MicroServiceAttribute.findAll", query="SELECT e FROM MicroServiceAttribute e ")
+@Table(name = "MicroServiceAttribute")
+@NamedQuery(name = "MicroServiceAttribute.findAll", query = "SELECT e FROM MicroServiceAttribute e ")
+@Getter
+@Setter
+
 public class MicroServiceAttribute implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="value")
-    private String value ;
+    @Column(name = "value")
+    private String value;
 
-    @Column(name="modelName")
+    @Column(name = "modelName")
     private String modelName;
-
-    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
index 9719abb..ab80c58 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,46 +32,27 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="MicroServiceConfigName")
-@NamedQuery(name="MicroServiceConfigName.findAll", query="SELECT e FROM MicroServiceConfigName e ")
+@Table(name = "MicroServiceConfigName")
+@NamedQuery(name = "MicroServiceConfigName.findAll", query = "SELECT e FROM MicroServiceConfigName e ")
+@Getter
+@Setter
+
 public class MicroServiceConfigName implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="description ")
-    private String 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;
-
-    }
-    public String getDescriptionValue() {
-        return this.description ;
-    }
-
-    public void setDescriptionValue(String description ) {
-        this.description  = description ;
-    }
-
+    @Column(name = "description ")
+    private String description;
 }
index 669b191..84962d5 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,46 +32,26 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="MicroServiceLocation")
-@NamedQuery(name="MicroServiceLocation.findAll", query="SELECT e FROM MicroServiceLocation e ")
+@Table(name = "MicroServiceLocation")
+@NamedQuery(name = "MicroServiceLocation.findAll", query = "SELECT e FROM MicroServiceLocation e ")
+@Getter
+@Setter
 public class MicroServiceLocation implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="description ")
-    private String 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;
-
-    }
-    public String getDescriptionValue() {
-        return this.description ;
-    }
-
-    public void setDescriptionValue(String description ) {
-        this.description  = description ;
-    }
-
+    @Column(name = "description ")
+    private String description;
 }
index 1c6d811..ccedd6b 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
 package org.onap.policy.rest.jpa;
 
 import java.io.Serializable;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -38,12 +40,23 @@ import javax.persistence.Table;
  * @version: 0.1
  */
 
+import lombok.Getter;
+import lombok.Setter;
 
+// @formatter:off
 @Entity
 @Table(name = "MicroServiceModels")
-@NamedQueries({@NamedQuery(name = "MicroServiceModels.findAll", query = "SELECT b FROM MicroServiceModels b "),
-        @NamedQuery(name = "MicroServiceModels.findAllDecision",
-                query = "SELECT b FROM MicroServiceModels b WHERE b.decisionModel=1")})
+@NamedQueries(
+    {
+        @NamedQuery(name = "MicroServiceModels.findAll", query = "SELECT b FROM MicroServiceModels b "),
+        @NamedQuery(
+                        name = "MicroServiceModels.findAllDecision",
+                        query = "SELECT b FROM MicroServiceModels b WHERE b.decisionModel=1")
+    }
+)
+@Getter
+@Setter
+// @formatter:on
 public class MicroServiceModels implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -66,10 +79,10 @@ public class MicroServiceModels implements Serializable {
     private String attributes;
 
     @Column(name = "ref_attributes", nullable = false, length = 255)
-    private String ref_attributes;
+    private String refAttributes;
 
     @Column(name = "sub_attributes", nullable = false, length = 2000)
-    private String sub_attributes;
+    private String subAttributes;
 
     @Column(name = "dataOrderInfo", nullable = true, length = 2000)
     private String dataOrderInfo;
@@ -89,120 +102,11 @@ public class MicroServiceModels implements Serializable {
     @Column(name = "ruleFormation", nullable = true)
     private String ruleFormation;
 
-    public String getRuleFormation() {
-        return ruleFormation;
-    }
-
-    public void setRuleFormation(String ruleFormation) {
-        this.ruleFormation = ruleFormation;
-    }
-
-    public String getSub_attributes() {
-        return sub_attributes;
-    }
-
-    public void setSub_attributes(String sub_attributes) {
-        this.sub_attributes = sub_attributes;
-    }
-
-    public String getDataOrderInfo() {
-        return dataOrderInfo;
-    }
-
-    public void setDataOrderInfo(String dataOrderInfo) {
-        this.dataOrderInfo = dataOrderInfo;
-    }
-
-    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 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;
-    }
-
-    public Boolean isDecisionModel() {
+    public boolean isDecisionModel() {
         return decisionModel;
     }
-
-    public void setDecisionModel(boolean decisionModel) {
-        this.decisionModel = decisionModel;
-    }
 }
-
index 5098628..c7708ab 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,89 +34,55 @@ import javax.persistence.PrePersist;
 import javax.persistence.PreUpdate;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
-@Table(name="MicroserviceHeaderdeFaults")
-@NamedQuery(name="MicroserviceHeaderdeFaults.findAll", query="SELECT e FROM MicroserviceHeaderdeFaults e ")
+@Table(name = "MicroserviceHeaderdeFaults")
+@NamedQuery(name = "MicroserviceHeaderdeFaults.findAll", query = "SELECT e FROM MicroserviceHeaderdeFaults e ")
+@Getter
+@Setter
 public class MicroserviceHeaderdeFaults implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="onapName")
+    @Column(name = "onapName")
     private String onapName;
 
-    @Column(name="guard")
-    private String guard ;
+    @Column(name = "guard")
+    private String guard;
 
-    @Column(name="priority")
+    @Column(name = "priority")
     private String priority;
 
-    @Column(name="riskType")
-    private String riskType ;
+    @Column(name = "riskType")
+    private String riskType;
 
-    @Column(name="riskLevel")
+    @Column(name = "riskLevel")
 
     private String riskLevel;
 
-    @Column(name="modelName", nullable=false)
+    @Column(name = "modelName", nullable = false)
     @OrderBy("asc")
     private String modelName;
 
+    /**
+     * Called before persisting the object.
+     */
     @PrePersist
-    public void        prePersist() {
-
+    public void prePersist() {
+        // Required for testing
     }
+
+    /**
+     * Called before updating the object.
+     */
     @PreUpdate
     public void preUpdate() {
+        // Required for testing
     }
-
-
-    public int getId() {
-        return this.id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getModelName() {
-        return modelName;
-    }
-    public void setModelName(String modelName) {
-        this.modelName = modelName;
-    }
-    public String getOnapName() {
-        return onapName;
-    }
-    public void setOnapName(String onapName) {
-        this.onapName = onapName;
-    }
-    public String getGuard() {
-        return guard;
-    }
-    public void setGuard(String guard) {
-        this.guard = guard;
-    }
-    public String getPriority() {
-        return priority;
-    }
-    public void setPriority(String priority) {
-        this.priority = priority;
-    }
-    public String getRiskType() {
-        return riskType;
-    }
-    public void setRiskType(String riskType) {
-        this.riskType = riskType;
-    }
-    public String getRiskLevel() {
-        return riskLevel;
-    }
-    public void setRiskLevel(String riskLevel) {
-        this.riskLevel = riskLevel;
-    }
-
 }
\ No newline at end of file
index 1c6b75d..0734203 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -20,6 +21,8 @@
 
 package org.onap.policy.rest.jpa;
 
+import com.att.research.xacml.api.Identifier;
+
 import java.io.Serializable;
 import java.util.Date;
 import java.util.HashSet;
@@ -40,15 +43,17 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 
-import com.att.research.xacml.api.Identifier;
+import lombok.Getter;
+import lombok.Setter;
 
 /**
  * The persistent class for the Obadvice database table.
- * 
  */
 @Entity
-@Table(name="Obadvice")
-@NamedQuery(name="Obadvice.findAll", query="SELECT o FROM Obadvice o")
+@Table(name = "Obadvice")
+@NamedQuery(name = "Obadvice.findAll", query = "SELECT o FROM Obadvice o")
+@Getter
+@Setter
 public class Obadvice implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -58,44 +63,53 @@ public class Obadvice implements Serializable {
     public static final String EFFECT_DENY = "Deny";
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="type", nullable=false)
+    @Column(name = "type", nullable = false)
     private String type;
 
-    @Column(name="xacml_id", nullable=false, length=255)
+    @Column(name = "xacml_id", nullable = false, length = 255)
     private String xacmlId;
 
-    @Column(name="fulfill_on", nullable=true, length=32)
+    @Column(name = "fulfill_on", nullable = true, length = 32)
     private String fulfillOn;
 
-    @Column(name="description", nullable=true, length=2048)
+    @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)
+    // 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)
+    @Column(name = "created_by", nullable = false, length = 255)
     private String createdBy;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", nullable=false, updatable=false)
+    @Column(name = "created_date", nullable = false, updatable = false)
     private Date createdDate;
 
-    @Column(name="modified_by", nullable=false, length=255)
+    @Column(name = "modified_by", nullable = false, length = 255)
     private String modifiedBy;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
+    /**
+     * Instantiates a new obadvice.
+     */
     public Obadvice() {
         this.type = Obadvice.OBLIGATION;
         this.fulfillOn = Obadvice.EFFECT_PERMIT;
     }
 
+    /**
+     * Instantiates a new obadvice.
+     *
+     * @param domain the domain
+     * @param userid the userid
+     */
     public Obadvice(String domain, String userid) {
         this.xacmlId = domain;
         this.type = Obadvice.OBLIGATION;
@@ -104,86 +118,40 @@ public class Obadvice implements Serializable {
         this.modifiedBy = userid;
     }
 
+    /**
+     * Instantiates a new obadvice.
+     *
+     * @param id the id
+     * @param userid the userid
+     */
     public Obadvice(Identifier id, String userid) {
         this(id.stringValue(), userid);
     }
 
+    /**
+     * Pre persist.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @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;
-    }
-
+    /**
+     * Adds the obadvice expression.
+     *
+     * @param obadviceExpression the obadvice expression
+     * @return the obadvice expression
+     */
     public ObadviceExpression addObadviceExpression(ObadviceExpression obadviceExpression) {
         this.obadviceExpressions.add(obadviceExpression);
         obadviceExpression.setObadvice(this);
@@ -191,6 +159,12 @@ public class Obadvice implements Serializable {
         return obadviceExpression;
     }
 
+    /**
+     * Removes the obadvice expression.
+     *
+     * @param obadviceExpression the obadvice expression
+     * @return the obadvice expression
+     */
     public ObadviceExpression removeObadviceExpression(ObadviceExpression obadviceExpression) {
         this.obadviceExpressions.remove(obadviceExpression);
         obadviceExpression.setObadvice(null);
@@ -198,6 +172,9 @@ public class Obadvice implements Serializable {
         return obadviceExpression;
     }
 
+    /**
+     * Removes the all expressions.
+     */
     public void removeAllExpressions() {
         if (this.obadviceExpressions == null) {
             return;
@@ -208,6 +185,11 @@ public class Obadvice implements Serializable {
         this.obadviceExpressions.clear();
     }
 
+    /**
+     * Clone.
+     *
+     * @return the obadvice
+     */
     @Transient
     @Override
     public Obadvice clone() {
@@ -219,7 +201,7 @@ public class Obadvice implements Serializable {
         obadvice.description = this.description;
         obadvice.createdBy = this.createdBy;
         obadvice.modifiedBy = this.modifiedBy;
-        for (ObadviceExpression exp: this.obadviceExpressions) {
+        for (ObadviceExpression exp : this.obadviceExpressions) {
             obadvice.addObadviceExpression(exp.clone());
         }
 
index 9d82b73..db43709 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -33,14 +34,17 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 /**
  * The persistent class for the ObadviceExpressions database table.
- * 
  */
 @Entity
-@Table(name="ObadviceExpressions")
-@NamedQuery(name="ObadviceExpression.findAll", query="SELECT o FROM ObadviceExpression o")
+@Table(name = "ObadviceExpressions")
+@NamedQuery(name = "ObadviceExpression.findAll", query = "SELECT o FROM ObadviceExpression o")
+@Getter
+@Setter
 public class ObadviceExpression implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -53,58 +57,26 @@ public class ObadviceExpression implements Serializable {
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    //unidirectional one-to-one association to Attribute
+    // unidirectional one-to-one association to Attribute
     @OneToOne
-    @JoinColumn(name="attribute_id")
+    @JoinColumn(name = "attribute_id")
     private Attribute attribute;
 
-    @Column(name="type", nullable=false)
+    @Column(name = "type", nullable = false)
     private String type;
 
-    //bi-directional many-to-one association to Obadvice
+    // bi-directional many-to-one association to Obadvice
     @ManyToOne
-    @JoinColumn(name="obadvice_id")
+    @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;
-    }
-
     @Override
     public ObadviceExpression clone() {
         ObadviceExpression expression = new ObadviceExpression();
index 0b39129..e128241 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -39,106 +39,63 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
 
+/**
+ * The Class OnapName.
+ */
 @Entity
-@Table(name="OnapName")
-@NamedQuery(name="OnapName.findAll", query="SELECT e FROM OnapName e ")
+@Table(name = "OnapName")
+@NamedQuery(name = "OnapName.findAll", query = "SELECT e FROM OnapName e ")
+@Getter
+@Setter
 public class OnapName implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="onap_Name", nullable=false, unique=true)
+    @Column(name = "onap_Name", nullable = false, unique = true)
     @OrderBy("asc")
-    private String onapName;
+    private String name;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", updatable=false)
+    @Column(name = "created_date", updatable = false)
     private Date createdDate;
 
-    @Column(name="description", nullable=true, length=2048)
+    @Column(name = "description", nullable = true, length = 2048)
     private String description;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="created_by")
+    @JoinColumn(name = "created_by")
     private UserInfo userCreatedBy;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="modified_by")
+    @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;
-    }
-
+    /**
+     * Pre persist.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @PreUpdate
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-    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;
-    }
-
 }
index 60b3600..457ca73 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
 import java.io.Serializable;
@@ -32,151 +34,59 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 /*
- * JPA for the OOF Models. 
- * 
+ * JPA for the OOF Models.
+ *
  * @version: 0.1
  */
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="OptimizationModels")
-@NamedQuery(name="OptimizationModels.findAll", query="SELECT b FROM OptimizationModels b ")
-public class OptimizationModels implements Serializable{
+@Table(name = "OptimizationModels")
+@NamedQuery(name = "OptimizationModels.findAll", query = "SELECT b FROM OptimizationModels b ")
+@Getter
+@Setter
+public class OptimizationModels implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="modelName", nullable=false, unique=true)
+    @Column(name = "modelName", nullable = false, unique = true)
     @OrderBy("asc")
     private String modelName;
 
-    @Column(name="description", nullable=true, length=2048)
+    @Column(name = "description", nullable = true, length = 2048)
     private String description;
 
-    @Column(name="dependency", nullable=true, length=2048)
+    @Column(name = "dependency", nullable = true, length = 2048)
     private String dependency;
 
-    @Column(name="attributes", nullable=false, length=255)
+    @Column(name = "attributes", nullable = false, length = 255)
     private String attributes;
 
-    @Column(name="ref_attributes", nullable=false, length=255)
+    @Column(name = "ref_attributes", nullable = false, length = 255)
     private String refattributes;
 
-    @Column (name="sub_attributes", nullable=false, length=2000)
+    @Column(name = "sub_attributes", nullable = false, length = 2000)
     private String subattributes;
 
-    @Column (name="dataOrderInfo", nullable=true, length=2000)
+    @Column(name = "dataOrderInfo", nullable = true, length = 2000)
     private String dataOrderInfo;
 
-    @Column (name="version", nullable=false, length=2000)
+    @Column(name = "version", nullable = false, length = 2000)
     private String version;
 
-    @Column (name="enumValues", nullable=false, length=2000)
+    @Column(name = "enumValues", nullable = false, length = 2000)
     private String enumValues;
 
-    @Column (name="annotation", nullable=false, length=2000)
+    @Column(name = "annotation", nullable = false, length = 2000)
     private String annotation;
 
-    public String getSubattributes() {
-        return subattributes;
-    }
-
-    public void setSubattributes(String subattributes) {
-        this.subattributes = subattributes;
-    }
-
-    public String getDataOrderInfo() {
-        return dataOrderInfo;
-    }
-
-    public void setDataOrderInfo(String dataOrderInfo) {
-        this.dataOrderInfo = dataOrderInfo;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
     @ManyToOne
-    @JoinColumn(name="imported_by")
+    @JoinColumn(name = "imported_by")
     private UserInfo userCreatedBy;
-
-    public UserInfo getUserCreatedBy() {
-        return userCreatedBy;
-    }
-
-    public void setUserCreatedBy(UserInfo userCreatedBy) {
-        this.userCreatedBy = userCreatedBy;
-    }
-
-    public String getAttributes() {
-        return attributes;
-    }
-
-    public void setAttributes(String attributes) {
-        this.attributes = attributes;
-    }
-
-    public String getRefattributes() {
-        return refattributes;
-    }
-
-    public void setRefattributes(String refattributes) {
-        this.refattributes = refattributes;
-    }
-
-    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/PIPConfigParam.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPConfigParam.java
deleted file mode 100644 (file)
index 0f32de6..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============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() {
-        //An empty constructor
-    }
-
-    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/PIPResolverParam.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PIPResolverParam.java
deleted file mode 100644 (file)
index 7356eeb..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============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() {
-        // Empty constructor
-    }
-
-    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 + "]";
-    }
-
-}
index 92c0c9d..69ad3f5 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -39,108 +39,95 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
-/*
- * The Entity class to persist a policy object and its configuration data
- */
+import lombok.Getter;
+import lombok.Setter;
 
 /**
- *
+ * The Entity class to persist a policy object and its configuration data.
  */
+// @formatter:off
 @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")
-})
-
+// 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")
+    }
+)
+@Getter
+@Setter
+// @formatter:on
 public class PdpEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
-    //@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqPdp")
+    // @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seqPdp")
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column (name="pdpKey")
+    @Column(name = "pdpKey")
     private long pdpKey;
 
-    @Column (name="pdpId", nullable=false, unique=false, length=255)
+    @Column(name = "pdpId", nullable = false, unique = false, length = 255)
     private String pdpId;
 
-    @Column(name="pdpName", nullable=false, unique=false, length=255)
+    @Column(name = "pdpName", nullable = false, unique = false, length = 255)
     private String pdpName;
 
-    @Column(name="jmxPort", nullable=false, unique=false)
+    @Column(name = "jmxPort", nullable = false, unique = false)
     private int jmxPort;
 
-
-    @ManyToOne(optional=false)
-    @JoinColumn(name="groupKey", referencedColumnName="groupKey")
+    @ManyToOne(optional = false)
+    @JoinColumn(name = "groupKey", referencedColumnName = "groupKey")
     private GroupEntity groupEntity;
 
-    @Column(name="created_by", nullable=false, length=255)
+    @Column(name = "created_by", nullable = false, length = 255)
     private String createdBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", updatable=false)
+    @Column(name = "created_date", updatable = false)
     private Date createdDate;
 
-    @Column(name="description", nullable=false, length=2048)
+    @Column(name = "description", nullable = false, length = 2048)
     private String description = "NoDescription";
 
-    @Column(name="modified_by", nullable=false, length=255)
+    @Column(name = "modified_by", nullable = false, length = 255)
     private String modifiedBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
-    @Column(name="deleted", nullable=false)
+    @Column(name = "deleted", nullable = false)
     private boolean deleted = false;
 
+    /**
+     * Instantiates a new pdp entity.
+     */
     public PdpEntity() {
         super();
     }
 
+    /**
+     * Pre persist.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @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;
-    }
-
-
-
     /**
+     * Gets the group.
+     *
      * @return the configurationDataEntity
      */
     public GroupEntity getGroup() {
@@ -148,94 +135,11 @@ public class PdpEntity implements Serializable {
     }
 
     /**
-     * @param configurationDataEntity the configurationDataEntity to set
+     * Sets the group.
+     *
+     * @param group the new group
      */
     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;
-    }
-
-
 }
@@ -3,6 +3,7 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 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;
@@ -39,121 +42,73 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
 
+/**
+ * The Class PepOptions.
+ */
 @Entity
-@Table(name = "PEPOptions")
-@NamedQuery(name = "PEPOptions.findAll", query= "Select p from PEPOptions p")
-public class PEPOptions implements Serializable {
+@Table(name = "PepOptions")
+@NamedQuery(name = "PepOptions.findAll", query = "Select p from PepOptions p")
+@Getter
+@Setter
+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)
+    @Column(name = "PEP_NAME", nullable = false)
     @OrderBy("asc")
     private String pepName;
 
-    @Column(name="description", nullable=true, length=2048)
+    @Column(name = "description", nullable = true, length = 2048)
     private String description;
 
-    @Column(name="Actions", nullable=true)
+    @Column(name = "Actions", nullable = true)
     @OrderBy("asc")
     private String actions;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", updatable=false)
+    @Column(name = "created_date", updatable = false)
     private Date createdDate;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="created_by")
+    @JoinColumn(name = "created_by")
     private UserInfo userCreatedBy;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="modified_by")
+    @JoinColumn(name = "modified_by")
     private UserInfo userModifiedBy;
 
-    public PEPOptions() {
+    /**
+     * Instantiates a new PEP options.
+     */
+    public PepOptions() {
         this.modifiedDate = new Date();
     }
 
-    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;
-    }
-
+    /**
+     * Pre persist.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @PreUpdate
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    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 (file)
index 0000000..06f6bef
--- /dev/null
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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;
+import javax.persistence.Transient;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * The persistent class for the PipConfigParams database table.
+ *
+ */
+@Entity
+@Table(name = "PipConfigParams")
+@NamedQuery(name = "PipConfigParam.findAll", query = "SELECT p FROM PipConfigParam p")
+@Getter
+@Setter
+@ToString
+/**
+ * Instantiates a new PIP config param.
+ */
+@NoArgsConstructor
+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;
+
+    /**
+     * Instantiates a new PIP config param.
+     *
+     * @param param the param
+     */
+    public PipConfigParam(String param) {
+        this.paramName = param;
+    }
+
+    /**
+     * Instantiates a new PIP config param.
+     *
+     * @param param the param
+     * @param value the value
+     */
+    public PipConfigParam(String param, String value) {
+        this(param);
+        this.paramValue = value;
+    }
+
+    /**
+     * Instantiates a new PIP config param.
+     *
+     * @param param the param
+     */
+    public PipConfigParam(PipConfigParam param) {
+        this(param.getParamName(), param.getParamValue());
+        this.paramDefault = param.getParamDefault();
+        this.required = param.required;
+    }
+
+    /**
+     * Checks if is required.
+     *
+     * @return true, if is required
+     */
+    @Transient
+    public boolean isRequired() {
+        return this.required == '1';
+    }
+
+    /**
+     * Sets the required flag.
+     *
+     * @param required the new required flag
+     */
+    @Transient
+    public void setRequiredFlag(boolean required) {
+        if (required) {
+            this.setRequired('1');
+        } else {
+            this.setRequired('0');
+        }
+    }
+}
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
 
 package org.onap.policy.rest.jpa;
 
+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;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -49,85 +56,89 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
 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.
- * 
+ * 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 {
+@Table(name = "PipConfiguration")
+@NamedQuery(name = "PipConfiguration.findAll", query = "SELECT p FROM PipConfiguration p")
+@Getter
+@Setter
+@NoArgsConstructor
+@ToString
+public class PipConfiguration implements Serializable {
     private static final long serialVersionUID = 1L;
-    private static final Log logger    = LogFactory.getLog(PIPConfiguration.class);
+    private static final Log logger = LogFactory.getLog(PipConfiguration.class);
 
     @Id
-    @GeneratedValue(strategy=GenerationType.AUTO)
-    @Column(name="id")
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    @Column(name = "id")
     private int id;
 
-    @Column(name="DESCRIPTION", nullable=true, length=2048)
+    @Column(name = "DESCRIPTION", nullable = true, length = 2048)
     private String description;
 
-    @Column(name="NAME", nullable=false, length=255)
+    @Column(name = "NAME", nullable = false, length = 255)
     private String name;
 
-    @Column(name="CLASSNAME", nullable=false, length=2048)
+    @Column(name = "CLASSNAME", nullable = false, length = 2048)
     private String classname;
 
-    @Column(name="ISSUER", nullable=true, length=1024)
+    @Column(name = "ISSUER", nullable = true, length = 1024)
     private String issuer;
 
-    @Column(name="READ_ONLY", nullable=false)
+    @Column(name = "READ_ONLY", nullable = false)
     private char readOnly = '0';
 
-    @Column(name="REQUIRES_RESOLVER", nullable=false)
+    @Column(name = "REQUIRES_RESOLVER", nullable = false)
     private char requiresResolvers;
 
-    @Column(name="CREATED_BY", nullable=false, length=255)
+    @Column(name = "CREATED_BY", nullable = false, length = 255)
     private String createdBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="CREATED_DATE", nullable=false, updatable=false)
+    @Column(name = "CREATED_DATE", nullable = false, updatable = false)
     private Date createdDate;
 
-    @Column(name="MODIFIED_BY", nullable=false, length=255)
+    @Column(name = "MODIFIED_BY", nullable = false, length = 255)
     private String modifiedBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="MODIFIED_DATE", nullable=false)
+    @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 PipConfigParam
+    @OneToMany(mappedBy = "pipconfiguration", orphanRemoval = true, cascade = CascadeType.REMOVE)
+    private Set<PipConfigParam> pipconfigParams = new HashSet<>();
 
-    //bi-directional many-to-one association to PIPType
+    // 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() {
-        //An empty constructor
-    }
-
-    public PIPConfiguration(PIPConfiguration config, String user) {
+    @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<>();
+
+    /**
+     * Instantiates a new PIP configuration.
+     *
+     * @param config the config
+     * @param user the user
+     */
+    public PipConfiguration(PipConfiguration config, String user) {
         this.description = config.description;
         this.name = config.name;
         this.classname = config.classname;
@@ -135,108 +146,77 @@ public class PIPConfiguration implements Serializable {
         this.requiresResolvers = config.requiresResolvers;
         this.readOnly = config.readOnly;
         this.piptype = config.piptype;
-        for (PIPConfigParam param : config.pipconfigParams) {
-            this.addPipconfigParam(new PIPConfigParam(param));
+        for (PipConfigParam param : config.pipconfigParams) {
+            this.addPipconfigParam(new PipConfigParam(param));
         }
-        for (PIPResolver resolver : config.pipresolvers) {
-            this.addPipresolver(new PIPResolver(resolver));
+        for (PipResolver resolver : config.pipresolvers) {
+            this.addPipresolver(new PipResolver(resolver));
         }
     }
 
-    public PIPConfiguration(String id, Properties properties) throws PIPException {
+    /**
+     * Instantiates a new PIP configuration.
+     *
+     * @param id the id
+     * @param properties the properties
+     * @throws PIPException the PIP exception
+     */
+    public PipConfiguration(String id, Properties properties) throws PIPException {
         this.readProperties(id, properties);
     }
 
-    public PIPConfiguration(String id, Properties properties, String user) throws PIPException {
+    /**
+     * Instantiates a new PIP configuration.
+     *
+     * @param id the id
+     * @param properties the properties
+     * @param user the user
+     * @throws PIPException the PIP exception
+     */
+    public PipConfiguration(String id, Properties properties, String user) throws PIPException {
         this.createdBy = user;
         this.modifiedBy = user;
         this.readProperties(id, properties);
     }
 
+    /**
+     * Pre persist.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @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) {
+    /**
+     * Adds the pipconfig param.
+     *
+     * @param pipconfigParam the pipconfig param
+     * @return the PIP config param
+     */
+    public PipConfigParam addPipconfigParam(PipConfigParam pipconfigParam) {
         getPipconfigParams().add(pipconfigParam);
         pipconfigParam.setPipconfiguration(this);
 
         return pipconfigParam;
     }
 
-    public PIPConfigParam removePipconfigParam(PIPConfigParam pipconfigParam) {
+    /**
+     * Removes the pipconfig param.
+     *
+     * @param pipconfigParam the pipconfig param
+     * @return the PIP config param
+     */
+    public PipConfigParam removePipconfigParam(PipConfigParam pipconfigParam) {
         if (pipconfigParam == null) {
             return pipconfigParam;
         }
@@ -246,6 +226,9 @@ public class PIPConfiguration implements Serializable {
         return pipconfigParam;
     }
 
+    /**
+     * Clear config params.
+     */
     @Transient
     public void clearConfigParams() {
         while (!this.pipconfigParams.isEmpty()) {
@@ -253,75 +236,49 @@ public class PIPConfiguration implements Serializable {
         }
     }
 
-    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) {
+    /**
+     * Adds the pipresolver.
+     *
+     * @param pipresolver the pipresolver
+     * @return the PIP resolver
+     */
+    public PipResolver addPipresolver(PipResolver pipresolver) {
         getPipresolvers().add(pipresolver);
         pipresolver.setPipconfiguration(this);
 
         return pipresolver;
     }
 
-    public PIPResolver removePipresolver(PIPResolver pipresolver) {
+    /**
+     * Removes the pipresolver.
+     *
+     * @param pipresolver the pipresolver
+     * @return the PIP resolver
+     */
+    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;
-    }
-
+    /**
+     * Checks if is read only.
+     *
+     * @return true, if is read only
+     */
     @Transient
     public boolean isReadOnly() {
         return this.readOnly == '1';
     }
 
+    /**
+     * Sets the read only flag.
+     *
+     * @param readOnly the new read only flag
+     */
     @Transient
-    public void setReadOnly(boolean readOnly) {
+    public void setReadOnlyFlag(boolean readOnly) {
         if (readOnly) {
             this.readOnly = '1';
         } else {
@@ -329,13 +286,23 @@ public class PIPConfiguration implements Serializable {
         }
     }
 
+    /**
+     * Requires resolvers.
+     *
+     * @return true, if successful
+     */
     @Transient
     public boolean requiresResolvers() {
         return this.requiresResolvers == '1';
     }
 
+    /**
+     * Sets the requires resolvers flag.
+     *
+     * @param requires the new requires resolvers flag
+     */
     @Transient
-    public void        setRequiresResolvers(boolean requires) {
+    public void setRequiresResolversFlag(boolean requires) {
         if (requires) {
             this.requiresResolvers = '1';
         } else {
@@ -343,32 +310,45 @@ public class PIPConfiguration implements Serializable {
         }
     }
 
+    /**
+     * Import PIP configurations.
+     *
+     * @param properties the properties
+     * @return the collection
+     */
     @Transient
-    public static Collection<PIPConfiguration>         importPIPConfigurations(Properties properties) {
-        Collection<PIPConfiguration> configurations = new ArrayList<>();
+    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;
+            PipConfiguration configuration;
             try {
                 String user = "super-admin";
-                configuration = new PIPConfiguration(id, properties, user);
+                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");
+                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PipConfiguration", "Import failed");
             }
         }
 
         return configurations;
     }
 
+    /**
+     * Read properties.
+     *
+     * @param id the id
+     * @param properties the properties
+     * @throws PIPException the PIP exception
+     */
     @Transient
-    protected  void            readProperties(String id, Properties properties) throws PIPException {
+    protected void readProperties(String id, Properties properties) throws PIPException {
         //
         // Save the id if we don't have one already
         //
@@ -378,7 +358,7 @@ public class PIPConfiguration implements Serializable {
                 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");
+                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PipConfiguration", "Convert id to integer failed");
             }
         }
         //
@@ -391,47 +371,8 @@ public class PIPConfiguration implements Serializable {
         //
         // Go through each property
         //
-        for (Object nme : properties.keySet()) {
-            if (!nme.toString().startsWith(id)) {
-                continue;
-            }
-            if (nme.equals(id + ".classname")) {
-                //
-                // We already saved this
-                //
-            } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_NAME)) {
-                this.name = properties.getProperty(nme.toString());
-            } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) {
-                this.description = properties.getProperty(nme.toString());
-            } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) {
-                this.issuer = properties.getProperty(nme.toString());
-            } else if (nme.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(nme.toString()),
-                                                                        properties,"super-admin"
-                                                                        );
-                for (PIPResolver resolver : resolvers) {
-                    this.addPipresolver(resolver);
-                }
-            } else if (nme.toString().startsWith(id + ".resolver")) {
-                //
-                // Ignore, the PIPResolver will parse these values
-                //
-            } else {
-                //
-                // Config Parameter
-                //
-                this.addPipconfigParam(new PIPConfigParam(nme.toString().substring(id.length() + 1),
-                                                    properties.getProperty(nme.toString())));
-            }
+        for (Object propertyKey : properties.keySet()) {
+            readProperty(id, properties, propertyKey);
         }
         //
         // Make sure we have a name at least
@@ -441,7 +382,61 @@ public class PIPConfiguration implements Serializable {
         }
     }
 
+    /**
+     * Read a property into the PIP configuration.
+     *
+     * @param id the ID of the property
+     * @param properties the properties object to read from
+     * @param key the key of the property being checked
+     * @throws PIPException on exceptions thrown on reading the property
+     */
+    private void readProperty(String id, Properties properties, Object key) throws PIPException {
+        if (!key.toString().startsWith(id)) {
+            return;
+        }
+        if (key.equals(id + ".classname")) {
+            //
+            // We already saved this
+            //
+        } else if (key.equals(id + "." + StdConfigurableEngine.PROP_NAME)) {
+            this.name = properties.getProperty(key.toString());
+        } else if (key.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) {
+            this.description = properties.getProperty(key.toString());
+        } else if (key.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) {
+            this.issuer = properties.getProperty(key.toString());
+        } else if (key.equals(id + ".resolvers")) {
+            //
+            // It has resolvers, make sure this is set to true if
+            // it has been already.
+            //
+            this.setRequiresResolversFlag(true);
+            //
+            // Parse the resolvers
+            //
+            Collection<PipResolver> resolvers = PipResolver.importResolvers(id + ".resolver",
+                            properties.getProperty(key.toString()), properties, "super-admin");
+            for (PipResolver resolver : resolvers) {
+                this.addPipresolver(resolver);
+            }
+        } else if (key.toString().startsWith(id + ".resolver")) {
+            //
+            // Ignore, the PipResolver will parse these values
+            //
+        } else {
+            //
+            // Config Parameter
+            //
+            this.addPipconfigParam(new PipConfigParam(key.toString().substring(id.length() + 1),
+                            properties.getProperty(key.toString())));
+        }
+    }
 
+    /**
+     * Gets the configuration.
+     *
+     * @param name the name
+     * @return the configuration
+     */
     @Transient
     public Map<String, String> getConfiguration(String name) {
         String prefix;
@@ -463,14 +458,14 @@ public class PIPConfiguration implements Serializable {
             map.put(prefix + "issuer", this.issuer);
         }
 
-        for (PIPConfigParam param : this.pipconfigParams) {
+        for (PipConfigParam param : this.pipconfigParams) {
             map.put(prefix + param.getParamName(), param.getParamValue());
         }
 
         List<String> ids = new ArrayList<>();
-        Iterator<PIPResolver> iter = this.pipresolvers.iterator();
+        Iterator<PipResolver> iter = this.pipresolvers.iterator();
         while (iter.hasNext()) {
-            PIPResolver resolver = iter.next();
+            PipResolver resolver = iter.next();
             String idd = Integer.toString(resolver.getId());
             Map<String, String> resolverMap = resolver.getConfiguration(prefix + "resolver." + idd);
             map.putAll(resolverMap);
@@ -482,8 +477,14 @@ public class PIPConfiguration implements Serializable {
         return map;
     }
 
+    /**
+     * Generate properties.
+     *
+     * @param name the name
+     * @return the properties
+     */
     @Transient
-    public Properties  generateProperties(String name) {
+    public Properties generateProperties(String name) {
         String prefix;
         if (name == null) {
             prefix = Integer.toString(this.id);
@@ -492,10 +493,14 @@ public class PIPConfiguration implements Serializable {
                 prefix = name;
             } else {
                 prefix = name + ".";
+                /**
+                 * Instantiates a new PIP configuration.
+                 */
+
             }
         }
         Properties props = new Properties();
-        props.setProperty("xacml.pip.engines", name);
+        props.setProperty("xacml.pip.engines", prefix);
         props.setProperty(prefix + "classname", this.classname);
         props.setProperty(prefix + "name", this.name);
         if (this.description != null) {
@@ -505,14 +510,14 @@ public class PIPConfiguration implements Serializable {
             props.setProperty(prefix + "issuer", this.issuer);
         }
 
-        for (PIPConfigParam param : this.pipconfigParams) {
+        for (PipConfigParam param : this.pipconfigParams) {
             props.setProperty(prefix + param.getParamName(), param.getParamValue());
         }
 
         List<String> ids = new ArrayList<>();
-        Iterator<PIPResolver> iter = this.pipresolvers.iterator();
+        Iterator<PipResolver> iter = this.pipresolvers.iterator();
         while (iter.hasNext()) {
-            PIPResolver resolver = iter.next();
+            PipResolver resolver = iter.next();
             String idd = Integer.toString(resolver.getId());
             resolver.generateProperties(props, prefix + "resolver." + idd);
             ids.add(idd);
@@ -522,17 +527,4 @@ public class PIPConfiguration implements Serializable {
         }
         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 + "]";
-    }
 }
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
 
 package org.onap.policy.rest.jpa;
 
+import com.att.research.xacml.api.pip.PIPException;
+import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
+import com.google.common.base.Splitter;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -47,202 +52,135 @@ 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;
-
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 
 /**
- * The persistent class for the PIPResolver database table.
- * 
+ * 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 {
+@Table(name = "PipResolver")
+@NamedQuery(name = "PipResolver.findAll", query = "SELECT p FROM PipResolver p")
+@Getter
+@Setter
+@NoArgsConstructor
+public class PipResolver implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
-    @GeneratedValue(strategy=GenerationType.AUTO)
-    @Column(name="id")
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    @Column(name = "id")
     private int id;
 
-    @Column(name="DESCRIPTION", nullable=true, length=2048)
+    @Column(name = "DESCRIPTION", nullable = true, length = 2048)
     private String description;
 
-    @Column(name="NAME", nullable=false, length=255)
+    @Column(name = "NAME", nullable = false, length = 255)
     private String name;
 
-    @Column(name="ISSUER", nullable=true, length=1024)
+    @Column(name = "ISSUER", nullable = true, length = 1024)
     private String issuer;
 
-    @Column(name="CLASSNAME", nullable=false, length=2048)
+    @Column(name = "CLASSNAME", nullable = false, length = 2048)
     private String classname;
 
-    @Column(name="READ_ONLY", nullable=false)
+    @Column(name = "READ_ONLY", nullable = false)
     private char readOnly = '0';
 
-    @Column(name="CREATED_BY", nullable=false, length=255)
+    @Column(name = "CREATED_BY", nullable = false, length = 255)
     private String createdBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="CREATED_DATE", nullable=false, updatable=false)
+    @Column(name = "CREATED_DATE", nullable = false, updatable = false)
     private Date createdDate;
 
-    @Column(name="MODIFIED_BY", nullable=false, length=255)
+    @Column(name = "MODIFIED_BY", nullable = false, length = 255)
     private String modifiedBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="MODIFIED_DATE", nullable=false)
+    @Column(name = "MODIFIED_DATE", nullable = false)
     private Date modifiedDate;
 
-    //bi-directional many-to-one association to PIPConfiguration
+    // 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() {
-        //An empty constructor
-    }
-
-    public PIPResolver(String prefix, Properties properties, String user) throws PIPException {
+    @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<>();
+
+    /**
+     * Instantiates a new PIP resolver.
+     *
+     * @param prefix the prefix
+     * @param properties the properties
+     * @param user the user
+     * @throws PIPException the PIP exception
+     */
+    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) {
+    /**
+     * Instantiates a new PIP resolver.
+     *
+     * @param resolver the resolver
+     */
+    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));
+        for (PipResolverParam param : resolver.pipresolverParams) {
+            this.addPipresolverParam(new PipResolverParam(param));
         }
     }
 
+    /**
+     * Pre persist.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @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) {
+    /**
+     * Adds the pipresolver param.
+     *
+     * @param pipresolverParam the pipresolver param
+     * @return the PIP resolver param
+     */
+    public PipResolverParam addPipresolverParam(PipResolverParam pipresolverParam) {
         getPipresolverParams().add(pipresolverParam);
         pipresolverParam.setPipresolver(this);
 
         return pipresolverParam;
     }
 
-    public PIPResolverParam removePipresolverParam(PIPResolverParam pipresolverParam) {
+    /**
+     * Removes the pipresolver param.
+     *
+     * @param pipresolverParam the pipresolver param
+     * @return the PIP resolver param
+     */
+    public PipResolverParam removePipresolverParam(PipResolverParam pipresolverParam) {
         if (pipresolverParam == null) {
             return pipresolverParam;
         }
@@ -252,6 +190,9 @@ public class PIPResolver implements Serializable {
         return pipresolverParam;
     }
 
+    /**
+     * Clear params.
+     */
     @Transient
     public void clearParams() {
         while (!this.pipresolverParams.isEmpty()) {
@@ -259,11 +200,21 @@ public class PIPResolver implements Serializable {
         }
     }
 
+    /**
+     * Checks if is read only.
+     *
+     * @return true, if is read only
+     */
     @Transient
     public boolean isReadOnly() {
         return this.readOnly == '1';
     }
 
+    /**
+     * Sets the read only.
+     *
+     * @param readOnly the new read only
+     */
     @Transient
     public void setReadOnly(boolean readOnly) {
         if (readOnly) {
@@ -273,15 +224,33 @@ public class PIPResolver implements Serializable {
         }
     }
 
+    /**
+     * Import resolvers.
+     *
+     * @param prefix the prefix
+     * @param list the list
+     * @param properties the properties
+     * @param user the user
+     * @return the collection
+     * @throws PIPException the PIP exception
+     */
     @Transient
-    public static Collection<PIPResolver>      importResolvers(String prefix, String list, Properties properties, String user) throws PIPException {
-        Collection<PIPResolver> resolvers = new ArrayList<>();
+    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));
+            resolvers.add(new PipResolver(prefix + "." + id, properties, user));
         }
         return resolvers;
     }
 
+    /**
+     * Read properties.
+     *
+     * @param prefix the prefix
+     * @param properties the properties
+     * @throws PIPException the PIP exception
+     */
     @Transient
     protected void readProperties(String prefix, Properties properties) throws PIPException {
         //
@@ -309,12 +278,18 @@ public class PIPResolver implements Serializable {
             } else if (nme.equals(prefix + "." + StdConfigurableEngine.PROP_ISSUER)) {
                 this.issuer = properties.getProperty(nme.toString());
             } else {
-                this.addPipresolverParam(new PIPResolverParam(nme.toString().substring(prefix.length() + 1),
-                                                            properties.getProperty(nme.toString())));
+                this.addPipresolverParam(new PipResolverParam(nme.toString().substring(prefix.length() + 1),
+                                properties.getProperty(nme.toString())));
             }
         }
     }
 
+    /**
+     * Gets the configuration.
+     *
+     * @param prefix the prefix
+     * @return the configuration
+     */
     @Transient
     public Map<String, String> getConfiguration(String prefix) {
         String pref = prefix;
@@ -330,14 +305,20 @@ public class PIPResolver implements Serializable {
         if (this.issuer != null && this.issuer.isEmpty()) {
             map.put(pref + "issuer", this.issuer);
         }
-        for (PIPResolverParam param : this.pipresolverParams) {
+        for (PipResolverParam param : this.pipresolverParams) {
             map.put(pref + param.getParamName(), param.getParamValue());
         }
         return map;
     }
 
+    /**
+     * Generate properties.
+     *
+     * @param props the props
+     * @param prefix the prefix
+     */
     @Transient
-    public void        generateProperties(Properties props, String prefix) {
+    public void generateProperties(Properties props, String prefix) {
         String pref = prefix;
         if (!prefix.endsWith(".")) {
             pref = prefix + ".";
@@ -350,19 +331,22 @@ public class PIPResolver implements Serializable {
         if (this.issuer != null && this.issuer.isEmpty()) {
             props.setProperty(pref + "issuer", this.issuer);
         }
-        for (PIPResolverParam param : this.pipresolverParams) {
+        for (PipResolverParam param : this.pipresolverParams) {
             props.setProperty(pref + param.getParamName(), param.getParamValue());
         }
     }
 
+    /**
+     * To string.
+     *
+     * @return the string
+     */
     @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 + "]";
+        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 (file)
index 0000000..3dd0968
--- /dev/null
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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;
+import javax.persistence.Transient;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * The persistent class for the PipResolverParam database table.
+ *
+ */
+@Entity
+@Table(name = "PipResolverParams")
+@NamedQuery(name = "PipResolverParam.findAll", query = "SELECT p FROM PipResolverParam p")
+@Getter
+@Setter
+@NoArgsConstructor
+@ToString
+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;
+
+    /**
+     * Instantiates a new PIP resolver param.
+     *
+     * @param name the name
+     */
+    public PipResolverParam(String name) {
+        this.paramName = name;
+    }
+
+    /**
+     * Instantiates a new PIP resolver param.
+     *
+     * @param name the name
+     * @param value the value
+     */
+    public PipResolverParam(String name, String value) {
+        this(name);
+        this.paramValue = value;
+    }
+
+    /**
+     * Instantiates a new PIP resolver param.
+     *
+     * @param param the param
+     */
+    public PipResolverParam(PipResolverParam param) {
+        this(param.getParamName(), param.getParamValue());
+        this.paramDefault = param.getParamDefault();
+        this.required = param.required;
+    }
+
+    /**
+     * Checks if is required.
+     *
+     * @return true, if is required
+     */
+    @Transient
+    public boolean isRequired() {
+        return this.required == '1';
+    }
+
+    /**
+     * Sets the required.
+     *
+     * @param required the new required
+     */
+    @Transient
+    public void setRequired(boolean required) {
+        if (required) {
+            this.required = '1';
+        } else {
+            this.required = '0';
+        }
+    }
+}
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -33,15 +34,21 @@ import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.persistence.Transient;
 
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 
 /**
- * The persistent class for the PIPType database table.
- * 
+ * 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 {
+@Table(name = "PipType")
+@NamedQuery(name = "PipType.findAll", query = "SELECT p FROM PipType p")
+@Getter
+@Setter
+@NoArgsConstructor
+public class PipType implements Serializable {
     private static final long serialVersionUID = 1L;
 
     public static final String TYPE_SQL = "SQL";
@@ -51,81 +58,90 @@ public class PIPType implements Serializable {
     public static final String TYPE_CUSTOM = "Custom";
 
     @Id
-    @GeneratedValue(strategy=GenerationType.AUTO)
-    @Column(name="id")
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    @Column(name = "id")
     private int id;
 
-    @Column(name="type", nullable=false, length=45)
+    @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() {
-        // Empty constructor
-    }
-
-    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) {
+    // bi-directional many-to-one association to PipConfiguration
+    @OneToMany(mappedBy = "piptype")
+    private Set<PipConfiguration> pipconfigurations;
+
+    /**
+     * Adds the pipconfiguration.
+     *
+     * @param pipconfiguration the pipconfiguration
+     * @return the PIP configuration
+     */
+    public PipConfiguration addPipconfiguration(PipConfiguration pipconfiguration) {
         getPipconfigurations().add(pipconfiguration);
         pipconfiguration.setPiptype(this);
 
         return pipconfiguration;
     }
 
-    public PIPConfiguration removePipconfiguration(PIPConfiguration pipconfiguration) {
+    /**
+     * Removes the pipconfiguration.
+     *
+     * @param pipconfiguration the pipconfiguration
+     * @return the PIP configuration
+     */
+    public PipConfiguration removePipconfiguration(PipConfiguration pipconfiguration) {
         getPipconfigurations().remove(pipconfiguration);
         pipconfiguration.setPiptype(null);
 
         return pipconfiguration;
     }
 
+    /**
+     * Checks if is sql.
+     *
+     * @return true, if is sql
+     */
     @Transient
-    public boolean     isSQL() {
+    public boolean isSql() {
         return this.type.equals(TYPE_SQL);
     }
 
+    /**
+     * Checks if is ldap.
+     *
+     * @return true, if is ldap
+     */
     @Transient
-    public boolean     isLDAP() {
+    public boolean isLdap() {
         return this.type.equals(TYPE_LDAP);
     }
 
+    /**
+     * Checks if is csv.
+     *
+     * @return true, if is csv
+     */
     @Transient
-    public boolean     isCSV() {
+    public boolean isCsv() {
         return this.type.equals(TYPE_CSV);
     }
 
+    /**
+     * Checks if is hyper CSV.
+     *
+     * @return true, if is hyper CSV
+     */
     @Transient
-    public boolean     isHyperCSV() {
+    public boolean isHyperCsv() {
         return this.type.equals(TYPE_HYPERCSV);
     }
 
+    /**
+     * Checks if is custom.
+     *
+     * @return true, if is custom
+     */
     @Transient
-    public boolean     isCustom() {
+    public boolean isCustom() {
         return this.type.equals(TYPE_CUSTOM);
     }
 
index ba10975..0f23f55 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -20,6 +21,8 @@
 
 package org.onap.policy.rest.jpa;
 
+import com.att.research.xacml.api.Identifier;
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -31,11 +34,17 @@ import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 import javax.persistence.Transient;
 
-import com.att.research.xacml.api.Identifier;
+import lombok.Getter;
+import lombok.Setter;
 
+/**
+ * The Class PolicyAlgorithms.
+ */
 @Entity
-@Table(name="PolicyAlgorithms")
-@NamedQuery(name="PolicyAlgorithms.findAll", query="SELECT d FROM PolicyAlgorithms d")
+@Table(name = "PolicyAlgorithms")
+@NamedQuery(name = "PolicyAlgorithms.findAll", query = "SELECT d FROM PolicyAlgorithms d")
+@Getter
+@Setter
 public class PolicyAlgorithms implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -44,18 +53,24 @@ public class PolicyAlgorithms implements Serializable {
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="is_standard", nullable=false)
+    @Column(name = "is_standard", nullable = false)
     private char isStandard;
 
-    @Column(name="xacml_id", nullable=false, unique=true, length=255)
+    @Column(name = "xacml_id", nullable = false, unique = true, length = 255)
     private String xacmlId;
 
-    @Column(name="short_name", nullable=false, length=64)
+    @Column(name = "short_name", nullable = false, length = 64)
     private String shortName;
 
+    /**
+     * Instantiates a new policy algorithms.
+     *
+     * @param identifier the identifier
+     * @param standard the standard
+     */
     public PolicyAlgorithms(Identifier identifier, char standard) {
         this.isStandard = standard;
         if (identifier != null) {
@@ -63,54 +78,39 @@ public class PolicyAlgorithms implements Serializable {
         }
     }
 
+    /**
+     * Instantiates a new policy algorithms.
+     *
+     * @param identifier the identifier
+     */
     public PolicyAlgorithms(Identifier identifier) {
         this(identifier, PolicyAlgorithms.STANDARD);
     }
 
+    /**
+     * Instantiates a new policy algorithms.
+     */
     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;
-    }
-
+    /**
+     * Checks if is standard.
+     *
+     * @return true, if is standard
+     */
     @Transient
     public boolean isStandard() {
         return this.isStandard == PolicyAlgorithms.STANDARD;
     }
 
+    /**
+     * Checks if is custom.
+     *
+     * @return true, if is custom
+     */
     @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;
-    }
-
 }
index bfd7769..75924e8 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-PAP-REST
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,6 +22,7 @@
 package org.onap.policy.rest.jpa;
 
 import java.util.Date;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -29,11 +31,15 @@ import javax.persistence.Id;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
 @Table(name = "policyAuditlog")
 @NamedQuery(name = "policyAuditlog.findAll", query = "SELECT v FROM PolicyAuditlog v ")
+@Getter
+@Setter
 public class PolicyAuditlog {
-    private static final long serialVersionUID = 1L;
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
     @Column(name = "id", nullable = false, unique = true)
@@ -50,44 +56,4 @@ public class PolicyAuditlog {
 
     @Column(name = "dateAndTime", nullable = false)
     private Date dateAndTime;
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getPolicyName() {
-        return policyName;
-    }
-
-    public void setPolicyName(String policyName) {
-        this.policyName = policyName;
-    }
-
-    public String getActions() {
-        return actions;
-    }
-
-    public void setActions(String actions) {
-        this.actions = actions;
-    }
-
-    public Date getDateAndTime() {
-        return dateAndTime;
-    }
-
-    public void setDateAndTime(Date dateAndTime) {
-        this.dateAndTime = dateAndTime;
-    }
 }
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
deleted file mode 100644 (file)
index 7a0c2fe..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * ============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/PolicyDbDaoEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyDbDaoEntity.java
new file mode 100644 (file)
index 0000000..fbad217
--- /dev/null
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * The Entity class to persist a PolicyDbDaoEntity object for registration of PolicyDBDao.
+ */
+// @formatter:off
+@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")
+    }
+)
+@Getter
+@Setter
+//@formatter:on
+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;
+
+    /**
+     * Instantiates a new policy DB dao entity.
+     */
+    public PolicyDbDaoEntity() {
+        super();
+    }
+
+    /**
+     * Pre persist.
+     */
+    @PrePersist
+    public void prePersist() {
+        Date date = new Date();
+        this.createdDate = date;
+        this.modifiedDate = date;
+    }
+
+    /**
+     * Pre update.
+     */
+    @PreUpdate
+    public void preUpdate() {
+        this.modifiedDate = new Date();
+    }
+}
index 62fd026..7642a14 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ 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;
@@ -37,99 +39,67 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * The Class PolicyEditorScopes.
+ */
 @Entity
-@Table(name="PolicyEditorScopes")
-@NamedQuery(name="PolicyEditorScopes.findAll", query="SELECT p FROM PolicyEditorScopes p ")
-public class PolicyEditorScopes implements Serializable{
+@Table(name = "PolicyEditorScopes")
+@NamedQuery(name = "PolicyEditorScopes.findAll", query = "SELECT p FROM PolicyEditorScopes p ")
+@Getter
+@Setter
+public class PolicyEditorScopes implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="scopeName", nullable=false, unique=true)
+    @Column(name = "scopeName", nullable = false, unique = true)
     @OrderBy("asc")
     private String scopeName;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", updatable=false)
+    @Column(name = "created_date", updatable = false)
     private Date createdDate;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="created_by")
+    @JoinColumn(name = "created_by")
     private UserInfo userCreatedBy;
 
     @ManyToOne(optional = false)
-    @JoinColumn(name="modified_by")
+    @JoinColumn(name = "modified_by")
     private UserInfo userModifiedBy;
 
+    /**
+     * Instantiates a new policy editor scopes.
+     */
     public PolicyEditorScopes() {
         this.modifiedDate = new Date();
     }
 
+    /**
+     * Pre persist.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @PreUpdate
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
-
-    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;
-    }
-
 }
index 40ddb43..8fa80e6 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -24,9 +25,10 @@ package org.onap.policy.rest.jpa;
  */
 import com.fasterxml.jackson.annotation.JsonBackReference;
 import com.fasterxml.jackson.annotation.JsonManagedReference;
+
 import java.io.Serializable;
 import java.util.Date;
-import java.util.Objects;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -44,23 +46,45 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Version;
 
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
 
-/*
- * The Entity class to persist a policy object and its configuration data
+/**
+ * The Entity class to persist a policy object and its configuration data.
  */
-
+// @formatter:off
 @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")
-})
+@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"
+        )
+    }
+)
+@Getter
+@Setter
+@EqualsAndHashCode
+// @formatter:on
 public class PolicyEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -144,44 +168,9 @@ public class PolicyEntity implements Serializable {
         this.modifiedDate = new Date();
     }
 
-    /**
-     * Returns Policy Id.
-     * @return the policyId
-     */
-    public long getPolicyId() {
-        return policyId;
-    }
-
-    /**
-     * Returns policy name.
-     * @return the policy name
-     */
-    public String getPolicyName() {
-        return policyName;
-    }
-
-    public void setPolicyName(String policyName) {
-        this.policyName = policyName;
-    }
-
-    /**
-     * Returns policy data.
-     * @return the policyData
-     */
-    public String getPolicyData() {
-        return policyData;
-    }
-
-    /**
-     * Set policy data.
-     * @param policyData the policyData to set
-     */
-    public void setPolicyData(String policyData) {
-        this.policyData = policyData;
-    }
-
     /**
      * Returns configurationDataEntity.
+     *
      * @return the configurationDataEntity
      */
     public ConfigurationDataEntity getConfigurationData() {
@@ -190,200 +179,10 @@ public class PolicyEntity implements Serializable {
 
     /**
      * Set configurationDataEntity.
+     *
      * @param configurationDataEntity the configurationDataEntity to set
      */
     public void setConfigurationData(ConfigurationDataEntity configurationDataEntity) {
         this.configurationDataEntity = configurationDataEntity;
     }
-
-    /**
-     * Returns actionBodyEntity.
-     * @return the actionBodyEntity
-     */
-    public ActionBodyEntity getActionBodyEntity() {
-        return actionBodyEntity;
-    }
-
-    /**
-     * Set actionBodyEntity.
-     * @param actionBodyEntity the actionBodyEntity to set
-     */
-    public void setActionBodyEntity(ActionBodyEntity actionBodyEntity) {
-        this.actionBodyEntity = actionBodyEntity;
-    }
-
-    /**
-     * Returns scope.
-     * @return the scope
-     */
-    public String getScope() {
-        return scope;
-    }
-
-    /**
-     * Set scope.
-     * @param scope the scope to set
-     */
-    public void setScope(String scope) {
-        this.scope = scope;
-    }
-
-    /**
-     * Returns createdBy.
-     * @return the createdBy
-     */
-    public String getCreatedBy() {
-        return createdBy;
-    }
-
-    /**
-     * Set createdBy. 
-     * @param createdBy the createdBy to set
-     */
-    public void setCreatedBy(String createdBy) {
-        this.createdBy = createdBy;
-    }
-
-    /**
-     * Returns description.
-     * @return the description
-     */
-    public String getDescription() {
-        return description;
-    }
-
-    /**
-     * Set description.
-     * @param description the description to set
-     */
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    /**
-     * Returns modifiedBy.
-     * @return the modifiedBy
-     */
-    public String getModifiedBy() {
-        return modifiedBy;
-    }
-
-    /**
-     * Set modifiedBy.
-     * @param modifiedBy the modifiedBy to set
-     */
-    public void setModifiedBy(String modifiedBy) {
-        this.modifiedBy = modifiedBy;
-    }
-
-    /**
-     * Returns version.
-     * @return version
-     */
-    public int getVersion() {
-        return version;
-    }
-
-    /**
-     * Returns createdDate.
-     * @return the createdDate
-     */
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    /**
-     * Returns modifiedDate.
-     * @return the modifiedDate
-     */
-    public Date getModifiedDate() {
-        return modifiedDate;
-    }
-
-    /**
-     * Return deleted.
-     * @return the deleted
-     */
-    public boolean isDeleted() {
-        return deleted;
-    }
-
-    /**
-     * Set deleted.
-     * @param deleted the deleted to set
-     */
-    public void setDeleted(boolean deleted) {
-        this.deleted = deleted;
-    }
-
-    /**
-     * Return the reason code.
-     * @return deleted reason code
-     */
-    public String getDeleteReasonCode() {
-        return deleteReasonCode;
-    }
-
-    /**
-     * Set the reason of deletion.
-     * @param deleteReasonCode String object
-     */
-    public void setDeleteReasonCode(String deleteReasonCode) {
-        this.deleteReasonCode = deleteReasonCode;
-    }
-
-    /**
-     * Return deleted By.
-     * @return deletedBy
-     */
-    public String getDeletedBy() {
-        return deletedBy;
-    }
-
-    /**
-     * Set deleted By.
-     * @param deletedBy String object
-     */
-    public void setDeletedBy(String deletedBy) {
-        this.deletedBy = deletedBy;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(policyId, policyName, scope, version, policyVersion, policyData, configurationDataEntity,
-                actionBodyEntity, createdBy, createdDate, description, modifiedBy, modifiedDate, deleted);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (obj == this) {
-            return true;
-        }
-        if (!(obj instanceof PolicyEntity)) {
-            return false;
-        }
-
-        PolicyEntity p = (PolicyEntity) obj;
-
-        return policyId == p.policyId
-                && policyName.equals(p.policyName)
-                && scope.equals(p.scope)
-                && version == p.version
-                && policyVersion == p.policyVersion
-                && policyData.equals(p.policyData)
-                && ((configurationDataEntity == null && p.configurationDataEntity == null) 
-                        || (configurationDataEntity != null
-                && configurationDataEntity
-                        .equals(p.configurationDataEntity)))
-                && ((actionBodyEntity == null && p.actionBodyEntity == null) || (actionBodyEntity != null 
-                && actionBodyEntity
-                        .equals(p.actionBodyEntity))) && createdBy.equals(p.createdBy)
-                && createdDate.equals(p.createdDate) && description.equals(p.description)
-                && modifiedBy.equals(p.modifiedBy) && modifiedDate.equals(p.modifiedDate) && deleted == p.deleted;
-    }
-
-
 }
index 52f8177..175db57 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
 import java.io.Serializable;
@@ -27,34 +29,23 @@ import javax.persistence.Id;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
-@Table(name="PolicyGroupEntity")
-@NamedQuery(name="PolicyGroupEntity.findAll", query="SELECT p FROM PolicyGroupEntity p ")
-public class PolicyGroupEntity implements Serializable{
+@Table(name = "PolicyGroupEntity")
+@NamedQuery(name = "PolicyGroupEntity.findAll", query = "SELECT p FROM PolicyGroupEntity p ")
+@Getter
+@Setter
+public class PolicyGroupEntity implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
     @Id
-    @Column(name="groupKey")
+    @Column(name = "groupKey")
     private int groupKey;
 
     @Id
-    @Column(name="policyid")
+    @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;
-    }
 }
index f220570..1068031 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,6 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
+
 /*
  */
 import java.io.Serializable;
@@ -34,70 +36,44 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
-import org.onap.policy.rest.jpa.UserInfo;
-
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 
 /**
  * The persistent class for the roles database table.
- * 
  */
 @Entity
-@Table(name="roles")
-@NamedQuery(name="PolicyRoles.findAll", query="SELECT r FROM PolicyRoles r ")
+@Table(name = "roles")
+@NamedQuery(name = "PolicyRoles.findAll", query = "SELECT r FROM PolicyRoles r ")
+@Getter
+@Setter
+@NoArgsConstructor
 public class PolicyRoles implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
 
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
     @ManyToOne
-    @JoinColumn(name="loginid")
+    @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)
+    @Column(name = "scope", nullable = true, length = 45)
     private String scope;
 
-    @Column(name="role", nullable=false, length=45)
+    @Column(name = "role", nullable = false, length = 45)
     private String role;
 
-    public PolicyRoles() {
-        // Empty constructor
-    }
-
-    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 UserInfo getLoginId() {
+        return loginId;
     }
 
-    public void setRole(String role) {
-        this.role = role;
+    public void setLoginId(UserInfo loginId) {
+        this.loginId = loginId;
     }
-
 }
index c159774..7e0bba3 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,46 +32,26 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="PolicyScopeClosedLoop")
-@NamedQuery(name="PolicyScopeClosedLoop.findAll", query="SELECT e FROM PolicyScopeClosedLoop e ")
+@Table(name = "PolicyScopeClosedLoop")
+@NamedQuery(name = "PolicyScopeClosedLoop.findAll", query = "SELECT e FROM PolicyScopeClosedLoop e ")
+@Getter
+@Setter
 public class PolicyScopeClosedLoop implements Serializable {
     private static final long serialVersionUID = 1L;
 
-
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="description ")
-    private String 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;
-
-    }
-    public String getDescriptionValue() {
-        return this.description ;
-    }
-
-    public void setDescriptionValue(String description ) {
-        this.description  = description ;
-    }
+    @Column(name = "description ")
+    private String description;
 }
index 3232756..ebc570f 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,45 +32,26 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="PolicyScopeResource")
-@NamedQuery(name="PolicyScopeResource.findAll", query="SELECT e FROM PolicyScopeResource e ")
+@Table(name = "PolicyScopeResource")
+@NamedQuery(name = "PolicyScopeResource.findAll", query = "SELECT e FROM PolicyScopeResource e ")
+@Getter
+@Setter
 public class PolicyScopeResource implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="description ")
-    private String 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;
-
-    }
-    public String getDescriptionValue() {
-        return this.description ;
-    }
-
-    public void setDescriptionValue(String description ) {
-        this.description  = description ;
-    }
+    @Column(name = "description ")
+    private String description;
 }
index 8238110..7af22e3 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,46 +32,26 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="PolicyScopeService")
-@NamedQuery(name="PolicyScopeService.findAll", query="SELECT e FROM PolicyScopeService e ")
+@Table(name = "PolicyScopeService")
+@NamedQuery(name = "PolicyScopeService.findAll", query = "SELECT e FROM PolicyScopeService e ")
+@Getter
+@Setter
 public class PolicyScopeService implements Serializable {
     private static final long serialVersionUID = 1L;
 
-
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="description ")
-    private String 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;
-
-    }
-    public String getDescriptionValue() {
-        return this.description ;
-    }
-
-    public void setDescriptionValue(String description ) {
-        this.description  = description ;
-    }
+    @Column(name = "description ")
+    private String description;
 }
index 04f20c3..e53a1ac 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,45 +32,26 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
 @Entity
-@Table(name="PolicyScopeType")
-@NamedQuery(name="PolicyScopeType.findAll", query="SELECT e FROM PolicyScopeType e ")
+@Table(name = "PolicyScopeType")
+@NamedQuery(name = "PolicyScopeType.findAll", query = "SELECT e FROM PolicyScopeType e ")
+@Getter
+@Setter
 public class PolicyScopeType implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="name", nullable=false)
+    @Column(name = "name", nullable = false)
     @OrderBy("asc")
     private String name;
 
-    @Column(name="description ")
-    private String 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;
-
-    }
-    public String getDescriptionValue() {
-        return this.description ;
-    }
-
-    public void setDescriptionValue(String description ) {
-        this.description  = description ;
-    }
+    @Column(name = "description ")
+    private String description;
 }
index 3bb0919..74b53ba 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,6 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -31,60 +33,45 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
 
+// @formatter:off
 @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")
-})
+@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"
+        )
+    }
+)
+@Getter
+@Setter
+// @formatter:on
 public class PolicyScore implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="POLICY_NAME", nullable=false)
+    @Column(name = "POLICY_NAME", nullable = false)
     @OrderBy("asc")
-    private String PolicyName;
+    private String policyName;
 
-    @Column(name="VERSIONEXTENSION", nullable=false)
+    @Column(name = "VERSIONEXTENSION", nullable = false)
     @OrderBy("asc")
-    private String VersionExtension;
-
-    @Column(name="POLICY_SCORE", nullable=true)
-    private String PolicyScore;
-
-    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;
-    }
-
+    private String versionExtension;
 
+    @Column(name = "POLICY_SCORE", nullable = true)
+    private String score;
 }
index f6512af..0332dcb 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,7 +23,7 @@ package org.onap.policy.rest.jpa;
 
 import java.io.Serializable;
 import java.util.Date;
-import java.util.Objects;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -36,169 +37,112 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
 
+/**
+ * The Class PolicyVersion.
+ */
+// @formatter:off
 @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")
-})
+@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"
+        )
+    }
+)
+@Getter
+@Setter
+@EqualsAndHashCode
+// @formatter:on
 public class PolicyVersion implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
 
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="POLICY_NAME", nullable=false, length=255)
+    @Column(name = "POLICY_NAME", nullable = false, length = 255)
     private String policyName;
 
-    @Column(name="ACTIVE_VERSION")
+    @Column(name = "ACTIVE_VERSION")
     private int activeVersion;
 
-    @Column(name="HIGHEST_VERSION")
+    @Column(name = "HIGHEST_VERSION")
     private int higherVersion;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="created_date", nullable=false)
+    @Column(name = "created_date", nullable = false)
     private Date createdDate;
 
-    @Column(name="CREATED_BY", nullable=false, length=45)
+    @Column(name = "CREATED_BY", nullable = false, length = 45)
     private String createdBy;
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="modified_date", nullable=false)
+    @Column(name = "modified_date", nullable = false)
     private Date modifiedDate;
 
-
-    @Column(name="modified_by", nullable=false, length=45)
+    @Column(name = "modified_by", nullable = false, length = 45)
     private String modifiedBy;
 
+    /**
+     * Instantiates a new policy version.
+     */
     public PolicyVersion() {
         this.modifiedDate = new Date();
         this.createdDate = new Date();
     }
 
+    /**
+     * Instantiates a new policy version.
+     *
+     * @param domain the domain
+     * @param loginUserId the login user id
+     */
     public PolicyVersion(String domain, String loginUserId) {
         this(domain);
         this.createdBy = loginUserId;
         this.modifiedBy = loginUserId;
     }
 
+    /**
+     * Instantiates a new policy version.
+     *
+     * @param domain the domain
+     */
     public PolicyVersion(String domain) {
         this.policyName = domain;
     }
 
-    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;
-    }
-
-
+    /**
+     * Pre persist.
+     */
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @PreUpdate
     public void preUpdate() {
-        this.modifiedDate =  new Date();
-    }
-
-    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(Date 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(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
-    public String getModifiedBy() {
-        return modifiedBy;
-    }
-
-    public void setModifiedBy(String modifiedBy) {
-        this.modifiedBy = modifiedBy;
-    }
-
-    @Override
-    public int hashCode() {
-    return Objects.hash(id, policyName,        activeVersion, higherVersion, createdDate,
-            createdBy, modifiedDate, modifiedBy);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if(obj == null){
-            return false;
-        }
-        if(obj == this){
-            return true;
-        }
-        if(!(obj instanceof PolicyVersion)){
-            return false;
-        }
-
-        PolicyVersion p = (PolicyVersion) obj;
-
-        return id == p.id &&
-                policyName.equals(p.policyName) &&
-                activeVersion == p.activeVersion &&
-                higherVersion == p.higherVersion &&
-                createdDate.equals(p.createdDate) &&
-                createdBy.equals(p.createdBy) &&
-                modifiedDate.equals(p.modifiedDate) &&
-                modifiedBy.equals(p.modifiedBy);
+        this.modifiedDate = new Date();
     }
-
 }
-
index 93732ff..6e26ed9 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,45 +32,26 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
-@Table(name="portlist")
-@NamedQuery(name="PortList.findAll", query="SELECT e FROM PortList e ")
+@Table(name = "portlist")
+@NamedQuery(name = "PortList.findAll", query = "SELECT e FROM PortList e ")
+@Getter
+@Setter
 public class PortList implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="portname", nullable=false)
+    @Column(name = "portname", nullable = false)
     @OrderBy("asc")
     private String portName;
 
-    @Column(name="description")
+    @Column(name = "description")
     private String description;
-
-    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;
-    }
-
 }
index 9a0e8ae..c723ebe 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,57 +32,29 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
-@Table(name="PrefixList")
-@NamedQuery(name="PrefixList.findAll", query="SELECT e FROM PrefixList e ")
+@Table(name = "PrefixList")
+@NamedQuery(name = "PrefixList.findAll", query = "SELECT e FROM PrefixList e ")
+@Getter
+@Setter
 public class PrefixList implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="pl_name", nullable=false)
+    @Column(name = "pl_name", nullable = false)
     @OrderBy("asc")
     private String prefixListName;
 
-    @Column(name="description", nullable=false)
+    @Column(name = "description", nullable = false)
     private String description;
 
-    @Column(name="pl_value", nullable=false)
+    @Column(name = "pl_value", nullable = false)
     private String prefixListValue;
-
-    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;
-    }
-
 }
index 5e79e67..edb514b 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -19,8 +20,7 @@
  */
 
 package org.onap.policy.rest.jpa;
-/*
- */
+
 import java.io.Serializable;
 
 import javax.persistence.Column;
@@ -32,48 +32,26 @@ import javax.persistence.NamedQuery;
 import javax.persistence.OrderBy;
 import javax.persistence.Table;
 
+import lombok.Getter;
+import lombok.Setter;
+
 @Entity
-@Table(name="protocollist")
-@NamedQuery(name="ProtocolList.findAll", query="SELECT e FROM ProtocolList e ")
+@Table(name = "protocollist")
+@NamedQuery(name = "ProtocolList.findAll", query = "SELECT e FROM ProtocolList e ")
+@Getter
+@Setter
 public class ProtocolList implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
-    @Column(name="id")
+    @Column(name = "id")
     private int id;
 
-    @Column(name="protocolname", nullable=false)
+    @Column(name = "protocolname", nullable = false)
     @OrderBy("asc")
     private String protocolName;
 
-    @Column(name="description")
+    @Column(name = "description")
     private String description;
-
-    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/package-info.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/package-info.java
deleted file mode 100644 (file)
index 72a36f4..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*-
- * ============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;
index de20cd3..da54b05 100644 (file)
@@ -1089,8 +1089,8 @@ public class PolicyValidation {
                 if (returnModel != null) {
 
                     String annotation = returnModel.getAnnotation();
-                    String refAttributes = returnModel.getRef_attributes();
-                    String subAttributes = returnModel.getSub_attributes();
+                    String refAttributes = returnModel.getRefAttributes();
+                    String subAttributes = returnModel.getSubAttributes();
                     String modelAttributes = returnModel.getAttributes();
 
                     if (!Strings.isNullOrEmpty(annotation)) {
@@ -1384,4 +1384,4 @@ public class PolicyValidation {
     }
 
 
-}
\ No newline at end of file
+}
index 860e08d..61a63ce 100644 (file)
@@ -33,14 +33,14 @@ import org.onap.policy.rest.jpa.OnapName;
 public class PolicyRestAdapterTest {
 
     @Test
-    public void testPolicyExportAdapter(){
+    public void testPolicyExportAdapter() {
         PolicyExportAdapter adapter = new PolicyExportAdapter();
         adapter.setPolicyDatas(new ArrayList<>());
         assertTrue(adapter.getPolicyDatas() != null);
     }
 
     @Test
-    public void testPolicyRestAdapter(){
+    public void testPolicyRestAdapter() {
         PolicyRestAdapter adapter = new PolicyRestAdapter();
         adapter.setData(new Object());
         assertTrue(adapter.getData() != null);
@@ -117,27 +117,27 @@ public class PolicyRestAdapterTest {
         adapter.setExistingCLName("Test");
         assertTrue("Test".equals(adapter.getExistingCLName()));
         adapter.setOnapNameField(new OnapName());
-        assertTrue(adapter.getOnapNameField()!=null);
+        assertTrue(adapter.getOnapNameField() != null);
         adapter.setJsonBodyData(new Object());
-        assertTrue(adapter.getJsonBodyData()!=null);
+        assertTrue(adapter.getJsonBodyData() != null);
         adapter.setDirPath("Test");
         assertTrue("Test".equals(adapter.getDirPath()));
         adapter.setConfigBodyPath("Test");
         assertTrue("Test".equals(adapter.getConfigBodyPath()));
         adapter.setAttributes(new ArrayList<>());
-        assertTrue(adapter.getAttributes()!=null);
+        assertTrue(adapter.getAttributes() != null);
         adapter.setSettings(new ArrayList<>());
-        assertTrue(adapter.getSettings()!=null);
+        assertTrue(adapter.getSettings() != null);
         adapter.setRuleAlgorithmschoices(new ArrayList<>());
-        assertTrue(adapter.getRuleAlgorithmschoices()!=null);
+        assertTrue(adapter.getRuleAlgorithmschoices() != null);
         adapter.setServiceTypePolicyName(new HashMap<>());
-        assertTrue(adapter.getServiceTypePolicyName()!=null);
+        assertTrue(adapter.getServiceTypePolicyName() != null);
         adapter.setVerticaMetrics(new HashMap<>());
-        assertTrue(adapter.getVerticaMetrics()!=null);
+        assertTrue(adapter.getVerticaMetrics() != null);
         adapter.setDescription(new LinkedHashMap<>());
-        assertTrue(adapter.getVerticaMetrics()!=null);
+        assertTrue(adapter.getVerticaMetrics() != null);
         adapter.setAttributeFields(new LinkedHashMap<>());
-        assertTrue(adapter.getAttributeFields()!=null);
+        assertTrue(adapter.getAttributeFields() != null);
         adapter.setClearTimeOut("Test");
         assertTrue("Test".equals(adapter.getClearTimeOut()));
         adapter.setTrapMaxAge("Test");
@@ -145,15 +145,15 @@ public class PolicyRestAdapterTest {
         adapter.setVerificationclearTimeOut("Test");
         assertTrue("Test".equals(adapter.getVerificationclearTimeOut()));
         adapter.setDynamicLayoutMap(new HashMap<>());
-        assertTrue(adapter.getDynamicLayoutMap()!=null);
+        assertTrue(adapter.getDynamicLayoutMap() != null);
         adapter.setTrapDatas(new ClosedLoopFaultTrapDatas());
-        assertTrue(adapter.getTrapDatas()!=null);
+        assertTrue(adapter.getTrapDatas() != null);
         adapter.setFaultDatas(new ClosedLoopFaultTrapDatas());
-        assertTrue(adapter.getFaultDatas()!=null);
+        assertTrue(adapter.getFaultDatas() != null);
         adapter.setFwPolicyType("Test");
         assertTrue("Test".equals(adapter.getFwPolicyType()));
         adapter.setFwattributes(new ArrayList<>());
-        assertTrue(adapter.getFwattributes()!=null);
+        assertTrue(adapter.getFwattributes() != null);
         adapter.setParentForChild("Test");
         assertTrue("Test".equals(adapter.getParentForChild()));
         adapter.setSecurityZone("Test");
@@ -161,27 +161,27 @@ public class PolicyRestAdapterTest {
         adapter.setRuleCombiningAlgId("Test");
         assertTrue("Test".equals(adapter.getRuleCombiningAlgId()));
         adapter.setDynamicFieldConfigAttributes(new HashMap<>());
-        assertTrue(adapter.getDynamicFieldConfigAttributes()!=null);
+        assertTrue(adapter.getDynamicFieldConfigAttributes() != null);
         adapter.setDynamicSettingsMap(new HashMap<>());
-        assertTrue(adapter.getDynamicSettingsMap()!=null);
+        assertTrue(adapter.getDynamicSettingsMap() != null);
         adapter.setDropDownMap(new HashMap<>());
-        assertTrue(adapter.getDropDownMap()!=null);
+        assertTrue(adapter.getDropDownMap() != null);
         adapter.setActionPerformer("Test");
         assertTrue("Test".equals(adapter.getActionPerformer()));
         adapter.setActionAttribute("Test");
         assertTrue("Test".equals(adapter.getActionAttribute()));
         adapter.setDynamicRuleAlgorithmLabels(new ArrayList<>());
-        assertTrue(adapter.getDynamicRuleAlgorithmLabels()!=null);
+        assertTrue(adapter.getDynamicRuleAlgorithmLabels() != null);
         adapter.setDynamicRuleAlgorithmCombo(new ArrayList<>());
-        assertTrue(adapter.getDynamicRuleAlgorithmCombo()!=null);
+        assertTrue(adapter.getDynamicRuleAlgorithmCombo() != null);
         adapter.setDynamicRuleAlgorithmField1(new ArrayList<>());
-        assertTrue(adapter.getDynamicRuleAlgorithmField1()!=null);
+        assertTrue(adapter.getDynamicRuleAlgorithmField1() != null);
         adapter.setDynamicRuleAlgorithmField2(new ArrayList<>());
-        assertTrue(adapter.getDynamicRuleAlgorithmField2()!=null);
+        assertTrue(adapter.getDynamicRuleAlgorithmField2() != null);
         adapter.setDynamicVariableList(new ArrayList<>());
-        assertTrue(adapter.getDynamicVariableList()!=null);
+        assertTrue(adapter.getDynamicVariableList() != null);
         adapter.setDataTypeList(new ArrayList<>());
-        assertTrue(adapter.getDataTypeList()!=null);
+        assertTrue(adapter.getDataTypeList() != null);
         adapter.setActionAttributeValue("Test");
         assertTrue("Test".equals(adapter.getActionAttributeValue()));
         adapter.setRuleProvider("Test");
@@ -197,15 +197,15 @@ public class PolicyRestAdapterTest {
         adapter.setActionDictMethod("Test");
         assertTrue("Test".equals(adapter.getActionDictMethod()));
         adapter.setYamlparams(new YAMLParams());
-        assertTrue(adapter.getYamlparams()!=null);
+        assertTrue(adapter.getYamlparams() != null);
         adapter.setRainyday(new RainyDayParams());
-        assertTrue(adapter.getRainyday()!=null);
+        assertTrue(adapter.getRainyday() != null);
         adapter.setRainydayMap(new HashMap<>());
-        assertTrue(adapter.getRainydayMap()!=null);
+        assertTrue(adapter.getRainydayMap() != null);
         adapter.setErrorCodeList(new ArrayList<>());
-        assertTrue(adapter.getErrorCodeList()!=null);
+        assertTrue(adapter.getErrorCodeList() != null);
         adapter.setTreatmentList(new ArrayList<>());
-        assertTrue(adapter.getTreatmentList()!=null);
+        assertTrue(adapter.getTreatmentList() != null);
         adapter.setServiceType("Test");
         assertTrue("Test".equals(adapter.getServiceType()));
         adapter.setUuid("Test");
@@ -221,17 +221,17 @@ public class PolicyRestAdapterTest {
         adapter.setRuleName("Test");
         assertTrue("Test".equals(adapter.getRuleName()));
         adapter.setBrmsParamBody(new HashMap<>());
-        assertTrue(adapter.getBrmsParamBody()!=null);
+        assertTrue(adapter.getBrmsParamBody() != null);
         adapter.setBrmsController("Test");
         assertTrue("Test".equals(adapter.getBrmsController()));
         adapter.setBrmsDependency(new ArrayList<>());
-        assertTrue(adapter.getBrmsDependency()!=null);
+        assertTrue(adapter.getBrmsDependency() != null);
         adapter.setRuleData(new LinkedHashMap<>());
-        assertTrue(adapter.getRuleData()!=null);
+        assertTrue(adapter.getRuleData() != null);
         adapter.setRuleListData(new LinkedHashMap<>());
-        assertTrue(adapter.getRuleListData()!=null);
+        assertTrue(adapter.getRuleListData() != null);
         adapter.setDrlRuleAndUIParams(new LinkedHashMap<>());
-        assertTrue(adapter.getDrlRuleAndUIParams()!=null);
+        assertTrue(adapter.getDrlRuleAndUIParams() != null);
         adapter.setPolicyScope("Test");
         assertTrue("Test".equals(adapter.getPolicyScope()));
         adapter.setProviderComboBox("Test");
@@ -245,11 +245,11 @@ public class PolicyRestAdapterTest {
         adapter.setTtlDate("Test");
         assertTrue("Test".equals(adapter.getTtlDate()));
         adapter.setMatching(new LinkedHashMap<>());
-        assertTrue(adapter.getMatching()!=null);
+        assertTrue(adapter.getMatching() != null);
         adapter.setTriggerSignatures(new ArrayList<>());
-        assertTrue(adapter.getTriggerSignatures()!=null);
+        assertTrue(adapter.getTriggerSignatures() != null);
         adapter.setSymptomSignatures(new ArrayList<>());
-        assertTrue(adapter.getSymptomSignatures()!=null);
+        assertTrue(adapter.getSymptomSignatures() != null);
         adapter.setLogicalConnector("Test");
         assertTrue("Test".equals(adapter.getLogicalConnector()));
         adapter.setPolicyStatus("Test");
@@ -274,7 +274,7 @@ public class PolicyRestAdapterTest {
         assertEquals("risklevel", adapter.getRiskLevel());
         assertEquals("guardvalue", adapter.getGuard());
         assertEquals("onapvalue", adapter.getOnapName());
-        assertEquals("onapvalue", adapter.getOnapNameField().getOnapName());
+        assertEquals("onapvalue", adapter.getOnapNameField().getName());
         assertEquals("uuidvalue", adapter.getUuid());
         assertEquals("locationvalue", adapter.getLocation());
         assertEquals("configvalue", adapter.getConfigName());
index 4d9d1c5..4745610 100644 (file)
@@ -70,6 +70,7 @@ public class PolicyValidationDaoImplTest {
 
     /**
      * Set up all unit tests.
+     * 
      * @throws SQLException on SQL exceptions
      */
     @BeforeClass
@@ -136,13 +137,12 @@ public class PolicyValidationDaoImplTest {
         userinfo.setUserName("Test");
         commonClassDao.save(userinfo);
         OnapName onapName = new OnapName();
-        onapName.setOnapName("Test");
+        onapName.setName("Test");
         onapName.setUserCreatedBy(userinfo);
         onapName.setUserModifiedBy(userinfo);
         onapName.setModifiedDate(new Date());
         commonClassDao.save(onapName);
 
-
         List<Object> list = commonClassDao.getData(OnapName.class);
         assertTrue(list.size() == 1);
         logger.debug(list.size());
@@ -160,7 +160,6 @@ public class PolicyValidationDaoImplTest {
         userinfo.setUserName(loginIdUserName);
         commonClassDao.save(userinfo);
 
-
         List<Object> dataCur = commonClassDao.getDataByQuery("from UserInfo", new SimpleBindings());
 
         assertEquals(1, dataCur.size());
@@ -224,7 +223,6 @@ public class PolicyValidationDaoImplTest {
         params.put("scope", scope);
         List<Object> dataCur = commonClassDao.getDataByQuery(query, params);
 
-
         assertTrue(1 == dataCur.size());
         assertEquals(pv, dataCur.get(0));
     }
@@ -244,7 +242,6 @@ public class PolicyValidationDaoImplTest {
         userinfo.setUserName(loginIdUserName);
         commonClassDao.save(userinfo);
 
-
         List<Object> dataCur = commonClassDao.getDataByQuery("from UserInfo", new SimpleBindings());
 
         assertEquals(1, dataCur.size());
@@ -254,7 +251,6 @@ public class PolicyValidationDaoImplTest {
 
         assertFalse(dataCur.isEmpty());
 
-
         watch.setPolicyName("bananaWatch");
         commonClassDao.save(watch);
 
@@ -281,7 +277,6 @@ public class PolicyValidationDaoImplTest {
         assertEquals(watch, dataCur.get(0));
     }
 
-
     @Test
     @Transactional
     @Rollback(true)
@@ -326,7 +321,6 @@ public class PolicyValidationDaoImplTest {
         watch.setPolicyName(finalName);
         commonClassDao.save(watch);
 
-
         // Current Implementation
         String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId";
         SimpleBindings params = new SimpleBindings();
@@ -363,7 +357,6 @@ public class PolicyValidationDaoImplTest {
         // SQL Injection attempt
         String finalName = "banana' OR '1'='1";
 
-
         // Current Implementation
         String query = "from WatchPolicyNotificationTable where POLICYNAME = :finalName and LOGINIDS = :userId";
         SimpleBindings params = new SimpleBindings();
@@ -394,8 +387,8 @@ public class PolicyValidationDaoImplTest {
         commonClassDao.update(userInfoUpdate);
         List<String> data1 = commonClassDao.getDataByColumn(UserInfo.class, "userLoginId");
         assertTrue(data1.size() == 1);
-        UserInfo data2 =
-                (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName", "TestID:Test1");
+        UserInfo data2 = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName",
+                        "TestID:Test1");
         assertTrue("TestID".equals(data2.getUserLoginId()));
         List<Object> data3 = commonClassDao.checkDuplicateEntry("TestID:Test1", "userLoginId:userName", UserInfo.class);
         assertTrue(data3.size() == 1);
@@ -408,8 +401,8 @@ public class PolicyValidationDaoImplTest {
         assertTrue(roles1.size() == 1);
         List<String> multipleData = new ArrayList<>();
         multipleData.add("TestID:Test1");
-        List<Object> data4 =
-                commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName", multipleData);
+        List<Object> data4 = commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName",
+                        multipleData);
         assertTrue(data4.size() == 1);
         commonClassDao.delete(data2);
     }
@@ -433,7 +426,7 @@ public class PolicyValidationDaoImplTest {
         data = commonClassDao.getDataById(UserInfo.class, "userLoginIduserName", "TestIDTest");
         assertNull(data);
         data = commonClassDao.getDataById(UserInfo.class, "userLoginId   data2.getUserLoginId()" + ":userName",
-                "TestIDTest");
+                        "TestIDTest");
         assertNull(data);
         commonClassDao.delete(data);
     }
@@ -463,8 +456,8 @@ public class PolicyValidationDaoImplTest {
         commonClassDao.save(userInfo);
         List<String> multipleData = new ArrayList<>();
         multipleData.add("TestID:Test1");
-        List<Object> data =
-                commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName", multipleData);
+        List<Object> data = commonClassDao.getMultipleDataOnAddingConjunction(UserInfo.class, "userLoginId:userName",
+                        multipleData);
         assertTrue(data.size() == 0);
         data = commonClassDao.getMultipleDataOnAddingConjunction(null, null, null);
         assertNull(data);
@@ -506,7 +499,6 @@ public class PolicyValidationDaoImplTest {
         commonClassDao.delete(data);
     }
 
-
     @Test
     public void testGetEntityItemParameters() {
         UserInfo userInfo = new UserInfo();
@@ -520,8 +512,8 @@ public class PolicyValidationDaoImplTest {
         commonClassDao.update(userInfoUpdate);
         List<String> data1 = commonClassDao.getDataByColumn(UserInfo.class, "userLoginId");
         assertTrue(data1.size() == 1);
-        UserInfo data2 =
-                (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName", "TestID:Test1");
+        UserInfo data2 = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId:userName",
+                        "TestID:Test1");
         assertTrue("TestID".equals(data2.getUserLoginId()));
         data2 = (UserInfo) commonClassDao.getEntityItem(null, null, null);
         assertNull(data2);
@@ -587,7 +579,6 @@ public class PolicyValidationDaoImplTest {
         commonClassDao.delete(data);
     }
 
-
     @Test
     public void testGetDataByQueryParameters() {
         // Add data
index 047053a..3967bb4 100644 (file)
@@ -23,6 +23,7 @@ package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
@@ -98,9 +99,10 @@ public class ActionDictionaryJpaTest {
         assertTrue(data.getFunctionDefinition() != null);
         data.setId(1);
         assertTrue(1 == data.getId());
-        data.isBag();
-        data.toString();
+        assertFalse(data.isBag());
+        assertEquals("FunctionArgument(id=1", data.toString().substring(0, 21));
         data.setIsBag(1);
+        assertTrue(data.isBag());
         assertTrue(1 == data.getIsBag());
         new FunctionArgument(data);
     }
@@ -116,10 +118,10 @@ public class ActionDictionaryJpaTest {
         assertTrue(data.getDatatypeBean() != null);
         data.setFunctionArguments(new ArrayList<>());
         assertTrue(data.getFunctionArguments() != null);
-        data.setHigherOrderArg_LB(1);
-        assertTrue(1 == data.getHigherOrderArg_LB());
-        data.setHigherOrderArg_UB(1);
-        assertTrue(1 == data.getHigherOrderArg_UB());
+        data.setHigherOrderArgLb(1);
+        assertTrue(1 == data.getHigherOrderArgLb());
+        data.setHigherOrderArgUb(1);
+        assertTrue(1 == data.getHigherOrderArgUb());
         data.setId(1);
         assertTrue(1 == data.getId());
         data.setIsBagReturn(1);
@@ -130,11 +132,19 @@ public class ActionDictionaryJpaTest {
         assertTrue("Test".equals(data.getShortname()));
         data.setXacmlid("Test");
         assertTrue("Test".equals(data.getXacmlid()));
-        data.toString();
-        data.isBagReturn();
-        data.isHigherOrder();
-        data.addFunctionArgument(new FunctionArgument());
-        data.removeFunctionArgument(new FunctionArgument());
+        assertTrue(data.toString().startsWith("FunctionDefinition(id=1"));
+        assertTrue(data.isBagReturn());
+        data.setIsBagReturn(0);
+        assertTrue(data.isHigherOrder());
+        assertFalse(data.isBagReturn());
+        data.setIsHigherOrder(0);
+        assertFalse(data.isHigherOrder());
+        FunctionArgument functionArgument = new FunctionArgument();
+        functionArgument.setId(12345);
+        data.addFunctionArgument(functionArgument);
+        assertEquals(12345, data.getFunctionArguments().iterator().next().getId());
+        data.removeFunctionArgument(functionArgument);
+        assertTrue(data.getFunctionArguments().isEmpty());
     }
 
     @Test
@@ -219,13 +229,19 @@ public class ActionDictionaryJpaTest {
 
     @Test
     public void testObadvice() {
-        Obadvice data = new Obadvice();
         new Obadvice();
         new Obadvice("Test", "Test");
+        new Obadvice(new DummyIdentifier(), "Test");
+        Obadvice data = new Obadvice();
         data.clone();
         data.addObadviceExpression(new ObadviceExpression());
+        assertNotNull(data.clone());
         data.removeObadviceExpression(new ObadviceExpression());
         data.removeAllExpressions();
+        assertEquals(0, data.getObadviceExpressions().size());
+        data.setObadviceExpressions(null);
+        assertNull(data.getObadviceExpressions());
+        data.removeAllExpressions();
         data.prePersist();
         data.preUpdate();
         data.setId(1);
@@ -244,6 +260,7 @@ public class ActionDictionaryJpaTest {
         assertTrue("Test".equals(data.getType()));
         data.setXacmlId("Test");
         assertTrue("Test".equals(data.getXacmlId()));
+
     }
 
     @Test
@@ -340,5 +357,13 @@ public class ActionDictionaryJpaTest {
         assertTrue("Test".equals(data.getXacmlId()));
         data.setIsStandard(PolicyAlgorithms.STANDARD);
         assertTrue(data.isStandard());
+        assertFalse(data.isCustom());
+        data.setIsStandard(PolicyAlgorithms.CUSTOM);
+        assertFalse(data.isStandard());
+        assertTrue(data.isCustom());
+
+        DummyIdentifier identifier = new DummyIdentifier();
+        assertNotNull(new PolicyAlgorithms(identifier));
+        assertNotNull(new PolicyAlgorithms(identifier, 'C'));
     }
 }
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertTrue;
@@ -28,11 +30,19 @@ import org.junit.Test;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 
-public class ClosedLoopPolicyDictionaryJPATest {
+/**
+ * The Class ClosedLoopPolicyDictionaryJpaTest.
+ */
+public class ClosedLoopPolicyDictionaryJpaTest {
 
-    private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJPATest.class);
+    private static Logger logger = FlexLogger.getLogger(ClosedLoopPolicyDictionaryJpaTest.class);
     private UserInfo userInfo;
 
+    /**
+     * Sets the up.
+     *
+     * @throws Exception the exception
+     */
     @Before
     public void setUp() throws Exception {
         logger.info("setUp: Entering");
@@ -42,8 +52,11 @@ public class ClosedLoopPolicyDictionaryJPATest {
         logger.info("setUp: exit");
     }
 
+    /**
+     * Test VSCL action.
+     */
     @Test
-    public void testVSCLAction(){
+    public void testVsclAction() {
         VSCLAction data = new VSCLAction();
         data.preUpdate();
         data.prePersist();
@@ -54,17 +67,20 @@ public class ClosedLoopPolicyDictionaryJPATest {
         data.setDescription("Test");
         assertTrue("Test".equals(data.getDescription()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!= null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!= null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!= null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!= null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test VNF type.
+     */
     @Test
-    public void testVNFType(){
+    public void testVnfType() {
         VNFType data = new VNFType();
         data.preUpdate();
         data.prePersist();
@@ -75,18 +91,21 @@ public class ClosedLoopPolicyDictionaryJPATest {
         data.setDescription("Test");
         assertTrue("Test".equals(data.getDescription()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!= null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!= null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!= null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!= null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test PEP options.
+     */
     @Test
-    public void testPEPOptions(){
-        PEPOptions data = new PEPOptions();
+    public void testPepOptions() {
+        PepOptions data = new PepOptions();
         data.preUpdate();
         data.prePersist();
         data.setId(1);
@@ -96,17 +115,20 @@ public class ClosedLoopPolicyDictionaryJPATest {
         data.setDescription("Test");
         assertTrue("Test".equals(data.getDescription()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!= null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!= null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!= null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!= null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test varbind dictionary.
+     */
     @Test
-    public void testVarbindDictionary(){
+    public void testVarbindDictionary() {
         VarbindDictionary data = new VarbindDictionary();
         data.preUpdate();
         data.prePersist();
@@ -119,17 +141,20 @@ public class ClosedLoopPolicyDictionaryJPATest {
         data.setVarbindOID("Test");
         assertTrue("Test".equals(data.getVarbindOID()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!= null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!= null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!= null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!= null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test closed loop D 2 services.
+     */
     @Test
-    public void testClosedLoopD2Services(){
+    public void testClosedLoopD2Services() {
         ClosedLoopD2Services data = new ClosedLoopD2Services();
         data.preUpdate();
         data.prePersist();
@@ -140,17 +165,20 @@ public class ClosedLoopPolicyDictionaryJPATest {
         data.setDescription("Test");
         assertTrue("Test".equals(data.getDescription()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!= null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!= null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!= null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!= null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test closed loop site.
+     */
     @Test
-    public void testClosedLoopSite(){
+    public void testClosedLoopSite() {
         ClosedLoopSite data = new ClosedLoopSite();
         data.preUpdate();
         data.prePersist();
@@ -161,12 +189,12 @@ public class ClosedLoopPolicyDictionaryJPATest {
         data.setDescription("Test");
         assertTrue("Test".equals(data.getDescription()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!= null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!= null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!= null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!= null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 }
index fa83017..caeb808 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@ public class CommonDictionaryJpaTest {
 
     /**
      * Initiations for testing.
-     * 
+     *
      * @throws Exception on test initiation errors
      */
     @Before
@@ -157,8 +157,8 @@ public class CommonDictionaryJpaTest {
         data.prePersist();
         data.setId(1);
         assertTrue(1 == data.getId());
-        data.setOnapName("Test");
-        assertTrue("Test".equals(data.getOnapName()));
+        data.setName("Test");
+        assertTrue("Test".equals(data.getName()));
         data.setDescription("Test");
         assertTrue("Test".equals(data.getDescription()));
         data.setCreatedDate(new Date());
index da5dd50..a18fcba 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -25,47 +26,51 @@ import static org.hamcrest.CoreMatchers.not;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
+
 import java.util.Date;
+
 import org.junit.Test;
 
 public class ConfigurationDataEntityTest {
-  @Test
-  public void testEquals() {
-    // Set up test data
-    String value = "testVal";
-    Date date = new Date();
-    ConfigurationDataEntity entity = new ConfigurationDataEntity();
-    entity.prePersist();
-    ConfigurationDataEntity entity2 = new ConfigurationDataEntity();
-    ConfigurationDataEntity entity3 = new ConfigurationDataEntity();
+    @Test
+    public void testEquals() {
+        // Set up test data
+        String value = "testVal";
+        ConfigurationDataEntity entity = new ConfigurationDataEntity();
+        entity.prePersist();
+        ConfigurationDataEntity entity3 = new ConfigurationDataEntity();
+
+        // Test set and get
+        entity3.preUpdate();
+        entity3.setConfigBody(value);
+        assertEquals(value, entity3.getConfigBody());
+        entity3.setCreatedBy(value);
+        assertEquals(value, entity3.getCreatedBy());
+        entity3.setModifiedBy(value);
+        assertEquals(value, entity3.getModifiedBy());
+
+        Date date = new Date();
+        entity3.setModifiedDate(date);
+        assertEquals(date, entity3.getModifiedDate());
+        assertEquals(0, entity3.getVersion());
+        assertNull(entity3.getCreatedDate());
+        entity3.setDeleted(true);
+        assertEquals(true, entity3.isDeleted());
+        entity3.setDescription(value);
+        assertEquals(value, entity3.getDescription());
+        entity3.setConfigType(value);
+        assertEquals(value, entity3.getConfigType());
+        entity3.setConfigurationName(value);
+        assertEquals(value, entity3.getConfigurationName());
+        assertEquals(0, entity3.getConfigurationDataId());
 
-    // Test set and get
-    entity3.preUpdate();
-    entity3.setConfigBody(value);
-    assertEquals(value, entity3.getConfigBody());
-    entity3.setCreatedBy(value);
-    assertEquals(value, entity3.getCreatedBy());
-    entity3.setModifiedBy(value);
-    assertEquals(value, entity3.getModifiedBy());
-    entity3.setModifiedDate(date);
-    assertEquals(date, entity3.getModifiedDate());
-    assertEquals(0, entity3.getVersion());
-    assertNull(entity3.getCreatedDate());
-    entity3.setDeleted(true);
-    assertEquals(true, entity3.isDeleted());
-    entity3.setDescription(value);
-    assertEquals(value, entity3.getDescription());
-    entity3.setConfigType(value);
-    assertEquals(value, entity3.getConfigType());
-    entity3.setConfigurationName(value);
-    assertEquals(value, entity3.getConfigurationName());
-    assertEquals(0, entity3.getConfigurationDataId());
+        // Test method combinations
+        assertEquals(false, entity.equals(null));
+        assertEquals(true, entity.equals(entity));
+        assertEquals(false, entity.equals(value));
 
-    // Test method combinations
-    assertEquals(false, entity.equals(null));
-    assertEquals(true, entity.equals(entity));
-    assertEquals(false, entity.equals(value));
-    assertEquals(false, entity.equals(entity2));
-    assertThat(entity.hashCode(), is(not(0)));
-  }
+        ConfigurationDataEntity entity2 = new ConfigurationDataEntity();
+        assertEquals(false, entity.equals(entity2));
+        assertThat(entity.hashCode(), is(not(0)));
+    }
 }
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertTrue;
@@ -28,11 +30,19 @@ import org.junit.Test;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 
-public class DecisionDictionaryJPATest {
+/**
+ * The Class DecisionDictionaryJpaTest.
+ */
+public class DecisionDictionaryJpaTest {
 
-    private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJPATest.class);
+    private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJpaTest.class);
     private UserInfo userInfo;
 
+    /**
+     * Sets the up.
+     *
+     * @throws Exception the exception
+     */
     @Before
     public void setUp() throws Exception {
         logger.info("setUp: Entering");
@@ -42,8 +52,11 @@ public class DecisionDictionaryJPATest {
         logger.info("setUp: exit");
     }
 
+    /**
+     * Test decision settings.
+     */
     @Test
-    public void testDecisionSettings(){
+    public void testDecisionSettings() {
         DecisionSettings data = new DecisionSettings();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -54,7 +67,7 @@ public class DecisionDictionaryJPATest {
         data.setXacmlId("Test");
         assertTrue("Test".equals(data.getXacmlId()));
         data.setDatatypeBean(new Datatype());
-        assertTrue(data.getDatatypeBean()!=null);
+        assertTrue(data.getDatatypeBean() != null);
         data.setIssuer("Test");
         assertTrue("Test".equals(data.getIssuer()));
         data.setMustBePresent(true);
@@ -62,17 +75,20 @@ public class DecisionDictionaryJPATest {
         data.setPriority("Test");
         assertTrue("Test".equals(data.getPriority()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!=null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!=null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test rainy day treatments.
+     */
     @Test
-    public void testRainyDayTreatments(){
+    public void testRainyDayTreatments() {
         RainyDayTreatments data = new RainyDayTreatments();
         data.setId(1);
         assertTrue(1 == data.getId());
index 486d364..1b4bb71 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,6 +24,7 @@
 package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertEquals;
+
 import org.junit.Test;
 
 public class DictionaryDataTest {
@@ -34,7 +36,7 @@ public class DictionaryDataTest {
         String value = "testData1";
 
         // Set Data
-        dictData.setId(1);;
+        dictData.setId(1);
         dictData.setDictionaryDataByName(value);
         dictData.setDictionaryName(value);
         dictData.setDictionaryUrl(value);
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertTrue;
@@ -28,11 +30,19 @@ import org.junit.Test;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 
-public class FWDictionaryJPATest {
+/**
+ * The Class FWDictionaryJPATest.
+ */
+public class FwDictionaryJpaTest {
 
-    private static Logger logger = FlexLogger.getLogger(FWDictionaryJPATest.class);
+    private static Logger logger = FlexLogger.getLogger(FwDictionaryJpaTest.class);
     private UserInfo userInfo;
 
+    /**
+     * Sets the up.
+     *
+     * @throws Exception the exception
+     */
     @Before
     public void setUp() throws Exception {
         logger.info("setUp: Entering");
@@ -42,8 +52,11 @@ public class FWDictionaryJPATest {
         logger.info("setUp: exit");
     }
 
+    /**
+     * Test action list.
+     */
     @Test
-    public void testActionList(){
+    public void testActionList() {
         ActionList data = new ActionList();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -53,8 +66,11 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getDescription()));
     }
 
+    /**
+     * Test port list.
+     */
     @Test
-    public void testPortList(){
+    public void testPortList() {
         PortList data = new PortList();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -64,8 +80,11 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getDescription()));
     }
 
+    /**
+     * Test protocol list.
+     */
     @Test
-    public void testProtocolList(){
+    public void testProtocolList() {
         ProtocolList data = new ProtocolList();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -75,8 +94,11 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getDescription()));
     }
 
+    /**
+     * Test security zone.
+     */
     @Test
-    public void testSecurityZone(){
+    public void testSecurityZone() {
         SecurityZone data = new SecurityZone();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -86,8 +108,11 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getZoneValue()));
     }
 
+    /**
+     * Test zone.
+     */
     @Test
-    public void testZone(){
+    public void testZone() {
         Zone data = new Zone();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -97,8 +122,11 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getZoneValue()));
     }
 
+    /**
+     * Test address group.
+     */
     @Test
-    public void testAddressGroup(){
+    public void testAddressGroup() {
         AddressGroup data = new AddressGroup();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -110,8 +138,11 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getDescription()));
     }
 
+    /**
+     * Test prefix list.
+     */
     @Test
-    public void testPrefixList(){
+    public void testPrefixList() {
         PrefixList data = new PrefixList();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -123,8 +154,11 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getDescription()));
     }
 
+    /**
+     * Test FW dictionary list.
+     */
     @Test
-    public void testFWDictionaryList(){
+    public void testFwDictionaryList() {
         FirewallDictionaryList data = new FirewallDictionaryList();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -138,9 +172,12 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getServiceList()));
     }
 
+    /**
+     * Test FW tag.
+     */
     @Test
-    public void testFWTag(){
-        FWTag data = new FWTag();
+    public void testFwTag() {
+        FwTag data = new FwTag();
         data.preUpdate();
         data.prePersist();
         data.setId(1);
@@ -152,18 +189,21 @@ public class FWDictionaryJPATest {
         data.setTagValues("Test");
         assertTrue("Test".equals(data.getTagValues()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!=null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!=null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test FW tag picker.
+     */
     @Test
-    public void testFWTagPicker(){
-        FWTagPicker data = new FWTagPicker();
+    public void testFwTagPicker() {
+        FwTagPicker data = new FwTagPicker();
         data.preUpdate();
         data.prePersist();
         data.setId(1);
@@ -177,17 +217,20 @@ public class FWDictionaryJPATest {
         data.setTagValues("Test");
         assertTrue("Test".equals(data.getTagValues()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!=null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!=null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test service list.
+     */
     @Test
-    public void testServiceList(){
+    public void testServiceList() {
         ServiceList data = new ServiceList();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -205,8 +248,11 @@ public class FWDictionaryJPATest {
         assertTrue("Test".equals(data.getServicePorts()));
     }
 
+    /**
+     * Test term list.
+     */
     @Test
-    public void testTermList(){
+    public void testTermList() {
         TermList data = new TermList();
         data.preUpdate();
         data.prePersist();
@@ -235,17 +281,20 @@ public class FWDictionaryJPATest {
         data.setAction("Test");
         assertTrue("Test".equals(data.getAction()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!=null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!=null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test group service list.
+     */
     @Test
-    public void testGroupServiceList(){
+    public void testGroupServiceList() {
         GroupServiceList data = new GroupServiceList();
         data.setId(1);
         assertTrue(1 == data.getId());
index 5ea92fd..1fcc7ba 100644 (file)
@@ -21,6 +21,7 @@
 
 package org.onap.policy.rest.jpa;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Before;
@@ -88,8 +89,8 @@ public class MicroServiceDictionaryJpaTest {
         assertTrue(1 == data.getId());
         data.setName("Test");
         assertTrue("Test".equals(data.getName()));
-        data.setDescriptionValue("Test");
-        assertTrue("Test".equals(data.getDescriptionValue()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
     }
 
     /**
@@ -102,8 +103,8 @@ public class MicroServiceDictionaryJpaTest {
         assertTrue(1 == data.getId());
         data.setName("Test");
         assertTrue("Test".equals(data.getName()));
-        data.setDescriptionValue("Test");
-        assertTrue("Test".equals(data.getDescriptionValue()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
     }
 
     /**
@@ -126,14 +127,15 @@ public class MicroServiceDictionaryJpaTest {
         assertTrue("Test".equals(data.getAnnotation()));
         data.setAttributes("Test");
         assertTrue("Test".equals(data.getAttributes()));
-        data.setRef_attributes("Test");
-        assertTrue("Test".equals(data.getRef_attributes()));
+        data.setRefAttributes("Test");
+        assertTrue("Test".equals(data.getRefAttributes()));
         data.setUserCreatedBy(userInfo);
         assertTrue(data.getUserCreatedBy() != null);
-        data.setSub_attributes("Test");
-        assertTrue("Test".equals(data.getSub_attributes()));
+        data.setSubAttributes("Test");
+        assertTrue("Test".equals(data.getSubAttributes()));
         data.setVersion("Test");
         assertTrue("Test".equals(data.getVersion()));
+        assertFalse(data.isDecisionModel());
     }
 
     /**
@@ -162,8 +164,8 @@ public class MicroServiceDictionaryJpaTest {
         assertTrue(1 == data.getId());
         data.setName("Test");
         assertTrue("Test".equals(data.getName()));
-        data.setDescriptionValue("Test");
-        assertTrue("Test".equals(data.getDescriptionValue()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
     }
 
     /**
@@ -176,8 +178,8 @@ public class MicroServiceDictionaryJpaTest {
         assertTrue(1 == data.getId());
         data.setName("Test");
         assertTrue("Test".equals(data.getName()));
-        data.setDescriptionValue("Test");
-        assertTrue("Test".equals(data.getDescriptionValue()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
     }
 
     /**
@@ -190,8 +192,8 @@ public class MicroServiceDictionaryJpaTest {
         assertTrue(1 == data.getId());
         data.setName("Test");
         assertTrue("Test".equals(data.getName()));
-        data.setDescriptionValue("Test");
-        assertTrue("Test".equals(data.getDescriptionValue()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
     }
 
     /**
@@ -204,8 +206,8 @@ public class MicroServiceDictionaryJpaTest {
         assertTrue(1 == data.getId());
         data.setName("Test");
         assertTrue("Test".equals(data.getName()));
-        data.setDescriptionValue("Test");
-        assertTrue("Test".equals(data.getDescriptionValue()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
     }
 
     /**
index 62452dc..cbccc3b 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
 package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertEquals;
+
 import org.junit.Test;
 
 public class MicroserviceHeaderdeFaultsTest {
-  @Test
-  public void testHeader() {
-    // Set up test data
-    String value = "testVal";
-    MicroserviceHeaderdeFaults header = new MicroserviceHeaderdeFaults();
-    header.prePersist();
-    header.preUpdate();
+    @Test
+    public void testHeader() {
+        // Set up test data
+        String value = "testVal";
+        MicroserviceHeaderdeFaults header = new MicroserviceHeaderdeFaults();
+        header.prePersist();
+        header.preUpdate();
 
-    // Set data
-    header.setGuard(value);
-    header.setId(1);
-    header.setModelName(value);
-    header.setOnapName(value);
-    header.setPriority(value);
-    header.setRiskLevel(value);
-    header.setRiskType(value);
+        // Set data
+        header.setGuard(value);
+        header.setId(1);
+        header.setModelName(value);
+        header.setOnapName(value);
+        header.setPriority(value);
+        header.setRiskLevel(value);
+        header.setRiskType(value);
 
-    // Test gets
-    assertEquals(value, header.getGuard());
-    assertEquals(1, header.getId());
-    assertEquals(value, header.getModelName());
-    assertEquals(value, header.getOnapName());
-    assertEquals(value, header.getPriority());
-    assertEquals(value, header.getRiskLevel());
-    assertEquals(value, header.getRiskType());
-  }
+        // Test gets
+        assertEquals(value, header.getGuard());
+        assertEquals(1, header.getId());
+        assertEquals(value, header.getModelName());
+        assertEquals(value, header.getOnapName());
+        assertEquals(value, header.getPriority());
+        assertEquals(value, header.getRiskLevel());
+        assertEquals(value, header.getRiskType());
+    }
 }
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ModelsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ModelsTest.java
new file mode 100644 (file)
index 0000000..fb1b8a5
--- /dev/null
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.rest.jpa;
+
+import com.openpojo.reflection.filters.FilterClassName;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+import org.junit.Test;
+import org.onap.policy.common.utils.test.ToStringTester;
+
+/**
+ * Class to perform unit testing of POJOs.
+ */
+public class ModelsTest {
+    private static final String POJO_PACKAGE = "org.onap.policy.rest.jpa";
+
+    @Test
+    public void testPdpModels() {
+        // @formatter:off
+        final Validator validator =
+            ValidatorBuilder.create()
+            .with(new ToStringTester())
+            .with(new SetterTester())
+            .with(new GetterTester())
+            .build();
+
+        // exclude Test classes and PdpMessage
+        validator.validate(
+            POJO_PACKAGE,
+            new FilterPackageInfo(),
+            new FilterClassName("^((?!Test$).)*$")
+        );
+        // @formatter:on
+    }
+}
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
@@ -17,6 +18,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertTrue;
@@ -26,11 +28,19 @@ import org.junit.Test;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 
-public class OptimizationModelsJPATest {
+/**
+ * The Class OptimizationModelsJpaTest.
+ */
+public class OptimizationModelsJpaTest {
 
-    private static Logger logger = FlexLogger.getLogger(OptimizationModelsJPATest.class);
+    private static Logger logger = FlexLogger.getLogger(OptimizationModelsJpaTest.class);
     private UserInfo userInfo;
 
+    /**
+     * Sets the up.
+     *
+     * @throws Exception the exception
+     */
     @Before
     public void setUp() throws Exception {
         logger.info("setUp: Entering");
@@ -40,8 +50,11 @@ public class OptimizationModelsJPATest {
         logger.info("setUp: exit");
     }
 
+    /**
+     * Test ms models.
+     */
     @Test
-    public void testMSModels(){
+    public void testMsModels() {
         OptimizationModels data = new OptimizationModels();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -60,12 +73,11 @@ public class OptimizationModelsJPATest {
         data.setRefattributes("Test");
         assertTrue("Test".equals(data.getRefattributes()));
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!=null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setSubattributes("Test");
         assertTrue("Test".equals(data.getSubattributes()));
         data.setVersion("Test");
         assertTrue("Test".equals(data.getVersion()));
     }
 
-
 }
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java
deleted file mode 100644 (file)
index 1a4c275..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP-REST
- * ================================================================================
- * Copyright (C) 2018 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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-import org.junit.Test;
-import com.att.research.xacml.api.pip.PIPException;
-import com.att.research.xacml.util.XACMLProperties;
-
-public class PIPConfigurationTest {
-  @Test
-  public void testConfig() throws PIPException {
-    String value = "testVal";
-    String id = "1";
-    PIPConfigParam param = new PIPConfigParam();
-    param.setParamName(value);
-    param.setParamValue(value);
-    Set<PIPConfigParam> params = new HashSet<PIPConfigParam>();
-    PIPResolver resolver = new PIPResolver();
-    resolver.setClassname(value);
-    resolver.setName(value);
-    params.add(param);
-    Set<PIPResolver> resolvers = new HashSet<PIPResolver>();
-    resolvers.add(resolver);
-    Properties props = new Properties();
-    props.setProperty(id + ".classname", value);
-    props.setProperty(XACMLProperties.PROP_PIP_ENGINES, id);
-    PIPType type = new PIPType();
-    Date date = new Date();
-
-    // Test constructors
-    PIPConfiguration config = new PIPConfiguration();
-    assertNotNull(config);
-    config.setPipconfigParams(params);
-    config.setPipresolvers(resolvers);
-    PIPConfiguration config2 = new PIPConfiguration(config, value);
-    assertNotNull(config2);
-    config2.prePersist();
-    config2.preUpdate();
-    PIPConfiguration config3 = new PIPConfiguration(id, props);
-    assertNotNull(config3);
-    PIPConfiguration config4 = new PIPConfiguration(id, props, value);
-    assertNotNull(config4);
-
-    // Test set and get
-    config.setId(1);
-    assertEquals(1, config.getId());
-    config.setDescription(value);
-    assertEquals(value, config.getDescription());
-    config.setName(id);
-    assertEquals(id, config.getName());
-    config.setClassname(value);
-    assertEquals(value, config.getClassname());
-    config.setIssuer(value);
-    assertEquals(value, config.getIssuer());
-    config.setReadOnly(true);
-    assertEquals('1', config.getReadOnly());
-    config.setReadOnly('0');
-    assertEquals('0', config.getReadOnly());
-    assertEquals(false, config.isReadOnly());
-    config.setRequiresResolvers('t');
-    assertEquals('t', config.getRequiresResolvers());
-    config.setReadOnly(false);
-    assertEquals('0', config.getReadOnly());
-    config.setPiptype(type);
-    assertEquals(type, config.getPiptype());
-    config.setRequiresResolvers(false);
-    assertEquals('0', config.getRequiresResolvers());
-    config.setCreatedBy(value);
-    assertEquals(value, config.getCreatedBy());
-    config.setCreatedDate(date);
-    assertEquals(date, config.getCreatedDate());
-    config.setModifiedBy(value);
-    assertEquals(value, config.getModifiedBy());
-    config.setModifiedDate(date);
-    assertEquals(date, config.getModifiedDate());
-    config.setRequiresResolvers(true);
-    assertEquals(true, config.requiresResolvers());
-    assertEquals(8, config.getConfiguration(id).size());
-    assertEquals(9, config.generateProperties(id).size());
-
-    // Test remove and clear
-    assertEquals(param, config.removePipconfigParam(param));
-    config.clearConfigParams();
-    assertEquals(0, config.getPipconfigParams().size());
-    config.removePipresolver(resolver);
-    assertEquals(0, config.getPipresolvers().size());
-
-    // Test import
-    assertEquals(1, PIPConfiguration.importPIPConfigurations(props).size());
-    config.readProperties(id, props);
-    assertEquals(id, config.getName());
-
-    // Test toString
-    String configString = config.toString().replaceAll("@[0-9a-f]*", "");
-    assertEquals(323, configString.length());
-  }
-}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PipConfigurationTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PipConfigurationTest.java
new file mode 100644 (file)
index 0000000..9bc95dc
--- /dev/null
@@ -0,0 +1,196 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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 static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+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 java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Test;
+
+public class PipConfigurationTest {
+    @Test
+    public void testConfig() throws PIPException {
+        String value = "testVal";
+        PipConfigParam param = new PipConfigParam();
+        param.setParamName(value);
+        param.setParamValue(value);
+        Set<PipConfigParam> params = new HashSet<PipConfigParam>();
+        PipResolver resolver = new PipResolver();
+        resolver.setClassname(value);
+        resolver.setName(value);
+        params.add(param);
+        Set<PipResolver> resolvers = new HashSet<PipResolver>();
+        resolvers.add(resolver);
+        Properties props = new Properties();
+
+        String id = "1";
+        props.setProperty(id + ".classname", value);
+        props.setProperty(XACMLProperties.PROP_PIP_ENGINES, id);
+
+        // Test constructors
+        PipConfiguration config = new PipConfiguration();
+        assertNotNull(config);
+        config.setPipconfigParams(params);
+        config.setPipresolvers(resolvers);
+        PipConfiguration config2 = new PipConfiguration(config, value);
+        assertNotNull(config2);
+        config2.prePersist();
+        config2.preUpdate();
+        PipConfiguration config3 = new PipConfiguration(id, props);
+        assertNotNull(config3);
+        PipConfiguration config4 = new PipConfiguration(id, props, value);
+        assertNotNull(config4);
+
+        // Test set and get
+        config.setId(1);
+        assertEquals(1, config.getId());
+        config.setDescription(value);
+        assertEquals(value, config.getDescription());
+        config.setName(id);
+        assertEquals(id, config.getName());
+        config.setClassname(value);
+        assertEquals(value, config.getClassname());
+        config.setIssuer(value);
+        assertEquals(value, config.getIssuer());
+        config.setReadOnlyFlag(true);
+        assertEquals('1', config.getReadOnly());
+        config.setReadOnly('0');
+        assertEquals('0', config.getReadOnly());
+        assertEquals(false, config.isReadOnly());
+        config.setRequiresResolvers('t');
+        assertEquals('t', config.getRequiresResolvers());
+        config.setReadOnlyFlag(false);
+        assertEquals('0', config.getReadOnly());
+
+        PipType type = new PipType();
+        config.setPiptype(type);
+        assertEquals(type, config.getPiptype());
+        config.setRequiresResolversFlag(false);
+        assertEquals('0', config.getRequiresResolvers());
+        config.setCreatedBy(value);
+        assertEquals(value, config.getCreatedBy());
+
+        Date date = new Date();
+        config.setCreatedDate(date);
+        assertEquals(date, config.getCreatedDate());
+        config.setModifiedBy(value);
+        assertEquals(value, config.getModifiedBy());
+        config.setModifiedDate(date);
+        assertEquals(date, config.getModifiedDate());
+        config.setRequiresResolversFlag(true);
+        assertTrue(config.requiresResolvers());
+        config.setRequiresResolversFlag(false);
+        assertFalse(config.requiresResolvers());
+        assertEquals(8, config.getConfiguration(id).size());
+        assertEquals(9, config.generateProperties(id).size());
+
+        // Test remove and clear
+        assertEquals(param, config.removePipconfigParam(param));
+        assertNull(config.removePipconfigParam(null));
+        config.clearConfigParams();
+        assertEquals(0, config.getPipconfigParams().size());
+        config.removePipresolver(resolver);
+        assertEquals(0, config.getPipresolvers().size());
+
+        assertEquals(param, config.addPipconfigParam(param));
+        config.clearConfigParams();
+        assertEquals(0, config.getPipconfigParams().size());
+        config.removePipresolver(resolver);
+        assertEquals(0, config.getPipresolvers().size());
+
+        // Test import
+        assertEquals(1, PipConfiguration.importPipConfigurations(props).size());
+        config.readProperties(id, props);
+        assertEquals(id, config.getName());
+
+        // Test toString
+        String configString = config.toString().replaceAll("@[0-9a-f]*", "");
+        assertEquals(322, configString.length());
+
+        assertEquals(0, PipConfiguration.importPipConfigurations(new Properties()).size());
+
+        Properties otherProperties = new Properties();
+        otherProperties.put(XACMLProperties.PROP_PIP_ENGINES, "");
+        assertEquals(0, PipConfiguration.importPipConfigurations(otherProperties).size());
+
+        otherProperties.put(XACMLProperties.PROP_PIP_ENGINES, "badvalue:evenworse");
+        assertEquals(0, PipConfiguration.importPipConfigurations(otherProperties).size());
+
+        // Test readProperties
+        props.setProperty(id + "." + StdConfigurableEngine.PROP_ISSUER, "himself");
+        props.setProperty(id + ".resolvers", "");
+        props.setProperty(id + ".resolver", "");
+        props.setProperty(id + ".anotherproperty", "");
+        config.readProperties(id, props);
+        assertEquals("himself", config.getIssuer());
+        assertEquals(49, config.getRequiresResolvers());
+
+        props.setProperty(id + ".resolvers", "aaa");
+        assertThatThrownBy(() -> config.readProperties(id, props)).hasMessage("PIP Engine defined without a classname");
+
+        props.setProperty(id + ".resolver.aaa.classname", "somewhere.over.the.Rainbow");
+        props.setProperty(id + ".resolver.aaa." + StdConfigurableEngine.PROP_NAME, "Dorothy");
+        props.setProperty(id + ".resolver.aaa." + StdConfigurableEngine.PROP_DESCRIPTION, "Oz");
+        props.setProperty(id + ".resolver.aaa." + StdConfigurableEngine.PROP_ISSUER, "Wizard");
+        props.setProperty(id + ".resolver.aaa.witch", "North");
+        config.readProperties(id, props);
+
+        PipResolver pipResolver = config.getPipresolvers().iterator().next();
+
+        assertEquals("somewhere.over.the.Rainbow", pipResolver.getClassname());
+        assertEquals("Dorothy", pipResolver.getName());
+        assertEquals("Oz", pipResolver.getDescription());
+        assertEquals("Wizard", pipResolver.getIssuer());
+
+        // Test getConfiguration
+        assertEquals(10, config.getConfiguration(null).size());
+        assertEquals(10, config.getConfiguration("kansas").size());
+        assertEquals(10, config.getConfiguration("kansas.").size());
+        config.setDescription(null);
+        assertEquals(9, config.getConfiguration(null).size());
+        config.setIssuer(null);
+        assertEquals(8, config.getConfiguration(null).size());
+        config.setPipresolvers(new LinkedHashSet<PipResolver>());
+        assertEquals(3, config.getConfiguration(null).size());
+
+        // Test generateProperties
+        assertEquals(4, config.generateProperties(null).size());
+        assertEquals(4, config.generateProperties("kansas").size());
+        assertEquals(4, config.generateProperties("kansas.").size());
+        config.setIssuer("");
+        assertEquals(4, config.generateProperties("kansas.").size());
+    }
+}
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.att.research.xacml.api.pip.PIPException;
 
 import java.util.Date;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Properties;
+import java.util.Set;
 
 import org.junit.Test;
 
-import com.att.research.xacml.api.pip.PIPException;
-
-public class PIPJPATest {
+public class PipJpaTest {
 
     @Test
-    public void testPIPConfigParam(){
-        PIPConfigParam data = new PIPConfigParam();
-        new PIPConfigParam("test");
-        new PIPConfigParam(new PIPConfigParam());
+    public void testPipConfigParam() {
+        PipConfigParam data = new PipConfigParam();
+        new PipConfigParam("test");
+        new PipConfigParam(new PipConfigParam());
         data.setId(1);
         assertTrue(1 == data.getId());
         data.setParamName("Test");
@@ -44,18 +53,20 @@ public class PIPJPATest {
         assertTrue("Test".equals(data.getParamValue()));
         data.setParamDefault("Test");
         assertTrue("Test".equals(data.getParamDefault()));
-        data.setPipconfiguration(new PIPConfiguration());
-        assertTrue(data.getPipconfiguration()!=null);
-        data.setRequired(true);
+        data.setPipconfiguration(new PipConfiguration());
+        assertTrue(data.getPipconfiguration() != null);
+        data.setRequiredFlag(true);
         assertTrue(data.isRequired());
+        data.setRequiredFlag(false);
+        assertFalse(data.isRequired());
         data.toString();
     }
 
     @Test
-    public void testPIPResolverParam(){
-        PIPResolverParam data = new PIPResolverParam();
-        new PIPResolverParam("test");
-        new PIPResolverParam(new PIPResolverParam());
+    public void testPipResolverParam() {
+        PipResolverParam data = new PipResolverParam();
+        new PipResolverParam("test");
+        new PipResolverParam(new PipResolverParam());
         data.setId(1);
         assertTrue(1 == data.getId());
         data.setParamName("Test");
@@ -64,40 +75,42 @@ public class PIPJPATest {
         assertTrue("Test".equals(data.getParamValue()));
         data.setParamDefault("Test");
         assertTrue("Test".equals(data.getParamDefault()));
-        data.setPipresolver(new PIPResolver());
-        assertTrue(data.getPipresolver()!=null);
+        data.setPipresolver(new PipResolver());
+        assertTrue(data.getPipresolver() != null);
         data.setRequired(true);
         assertTrue(data.isRequired());
+        data.setRequired(false);
+        assertFalse(data.isRequired());
         data.toString();
     }
 
     @Test
-    public void testPIPType(){
-        PIPType data = new PIPType();
+    public void testPipType() {
+        PipType data = new PipType();
         data.setId(1);
         assertTrue(1 == data.getId());
         data.setType("Test");
         assertTrue("Test".equals(data.getType()));
         data.setPipconfigurations(new HashSet<>());
-        assertTrue(data.getPipconfigurations()!=null);
-        data.addPipconfiguration(new PIPConfiguration());
-        data.removePipconfiguration(new PIPConfiguration());
+        assertTrue(data.getPipconfigurations() != null);
+        data.addPipconfiguration(new PipConfiguration());
+        data.removePipconfiguration(new PipConfiguration());
         data.setType("SQL");
-        assertTrue(data.isSQL());
+        assertTrue(data.isSql());
         data.setType("LDAP");
-        assertTrue(data.isLDAP());
+        assertTrue(data.isLdap());
         data.setType("CSV");
-        assertTrue(data.isCSV());
+        assertTrue(data.isCsv());
         data.setType("Hyper-CSV");
-        assertTrue(data.isHyperCSV());
+        assertTrue(data.isHyperCsv());
         data.setType("Custom");
         assertTrue(data.isCustom());
     }
 
     @Test
-    public void testPIPResolver(){
-        PIPResolver data = new PIPResolver();
-        new PIPResolver(new PIPResolver());
+    public void testPipResolver() {
+        PipResolver data = new PipResolver();
+        new PipResolver(new PipResolver());
         data.prePersist();
         data.preUpdate();
         data.setId(1);
@@ -115,32 +128,50 @@ public class PIPJPATest {
         data.setModifiedBy("Test");
         assertTrue("Test".equals(data.getModifiedBy()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
-        data.setPipconfiguration(new PIPConfiguration());
-        assertTrue(data.getPipconfiguration()!=null);
+        assertTrue(data.getModifiedDate() != null);
+        data.setPipconfiguration(new PipConfiguration());
+        assertTrue(data.getPipconfiguration() != null);
         data.setPipresolverParams(new HashSet<>());
-        assertTrue(data.getPipresolverParams()!=null);
-        data.addPipresolverParam(new PIPResolverParam());
-        data.removePipresolverParam(new PIPResolverParam());
+        assertTrue(data.getPipresolverParams() != null);
+        data.addPipresolverParam(new PipResolverParam());
+        data.removePipresolverParam(new PipResolverParam());
+        assertNull(data.removePipresolverParam(null));
         data.clearParams();
         data.getConfiguration("test");
+        assertNotNull(data.getConfiguration("test."));
         data.setReadOnly(true);
         assertTrue(data.isReadOnly());
+        data.setReadOnly(false);
+        assertFalse(data.isReadOnly());
         data.toString();
         Properties properties = new Properties();
-        data.generateProperties(properties,"test");
+        data.generateProperties(properties, "test");
         try {
             data.readProperties("test", properties);
         } catch (PIPException e) {
             fail();
         }
+        data.setIssuer("");
+        assertEquals(4, data.getConfiguration("test").size());
+        data.generateProperties(properties, "test.");
+        assertEquals(4, data.getConfiguration("test").size());
+
+        Set<PipResolverParam> pipresolverParams = new LinkedHashSet<>();
+        PipResolverParam prp = new PipResolverParam();
+        prp.setParamName("Dorothy");
+        prp.setParamValue("Gale");
+        pipresolverParams.add(prp);
+        data.setPipresolverParams(pipresolverParams);
+        data.generateProperties(properties, "test");
+        assertEquals(5, data.getConfiguration("test").size());
+        assertEquals(5, new PipResolver(data).getConfiguration("test").size());
     }
 
     @Test
-    public void testPIPConfiguration(){
-        PIPConfiguration data = new PIPConfiguration();
+    public void testPipConfiguration() {
+        PipConfiguration data = new PipConfiguration();
         data.prePersist();
         data.preUpdate();
         data.setId(1);
@@ -158,24 +189,24 @@ public class PIPJPATest {
         data.setModifiedBy("Test");
         assertTrue("Test".equals(data.getModifiedBy()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
+        assertTrue(data.getModifiedDate() != null);
         try {
             data.readProperties("test", data.generateProperties("test"));
         } catch (PIPException e) {
             fail();
         }
-        data.setPiptype(new PIPType());
-        assertTrue(data.getPiptype()!=null);
+        data.setPiptype(new PipType());
+        assertTrue(data.getPiptype() != null);
         data.setPipresolvers(new HashSet<>());
-        assertTrue(data.getPipresolvers()!=null);
-        data.addPipresolver(new PIPResolver());
-        data.removePipresolver(new PIPResolver());
+        assertTrue(data.getPipresolvers() != null);
+        data.addPipresolver(new PipResolver());
+        data.removePipresolver(new PipResolver());
         data.getConfiguration("test");
-        data.setReadOnly(true);
+        data.setReadOnlyFlag(true);
         assertTrue(data.isReadOnly());
-        data.setRequiresResolvers(true);
+        data.setRequiresResolversFlag(true);
         assertTrue(data.requiresResolvers());
         data.toString();
     }
index 15e28b1..1ae1cb3 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,7 +22,9 @@
 package org.onap.policy.rest.jpa;
 
 import static org.junit.Assert.assertEquals;
+
 import java.text.ParseException;
+
 import org.junit.Test;
 
 public class PolicyAuditlogTest {
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJPATest.java
deleted file mode 100644 (file)
index 7064712..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP-REST
- * ================================================================================
- * Copyright (C) 2018 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 static org.junit.Assert.assertTrue;
-
-import java.util.Date;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
-
-public class PolicyEntityJPATest {
-
-    private static Logger logger = FlexLogger.getLogger(PolicyEntityJPATest.class);
-    private UserInfo userInfo;
-
-    @Before
-    public void setUp() throws Exception {
-        logger.info("setUp: Entering");
-        userInfo = new UserInfo();
-        userInfo.setUserLoginId("Test");
-        userInfo.setUserName("Test");
-        logger.info("setUp: exit");
-    }
-
-    @Test
-    public void testPolicyGroupEntity(){
-        PolicyGroupEntity data = new PolicyGroupEntity();
-        data.setGroupKey(1);
-        assertTrue(1 == data.getGroupKey());
-        data.setPolicyid(1);
-        assertTrue(1 == data.getPolicyid());
-    }
-
-    @Test
-    public void testPolicyDBDaoEntity(){
-        PolicyDBDaoEntity data = new PolicyDBDaoEntity();
-        data.prePersist();
-        data.preUpdate();
-        data.setPolicyDBDaoUrl("Test");
-        assertTrue("Test".equals(data.getPolicyDBDaoUrl()));
-        data.setDescription("Test");
-        assertTrue("Test".equals(data.getDescription()));
-        assertTrue(data.getCreatedDate()!=null);
-        assertTrue(data.getModifiedDate()!=null);
-        data.setUsername("Test");
-        assertTrue("Test".equals(data.getUsername()));
-        data.setPassword("Test");
-        assertTrue("Test".equals(data.getPassword()));
-    }
-
-    @Test
-    public void testDatabaseLockEntity(){
-        DatabaseLockEntity data = new DatabaseLockEntity();
-        data.setKey(1);
-        assertTrue(1 == data.getKey());
-    }
-
-    @Test
-    public void testPolicyEntity(){
-        PolicyEntity data = new PolicyEntity();
-        data.prePersist();
-        data.preUpdate();
-        data.setPolicyName("Test");
-        assertTrue("Test".equals(data.getPolicyName()));
-        data.setDescription("Test");
-        assertTrue("Test".equals(data.getDescription()));
-        assertTrue(data.getCreatedDate()!=null);
-        assertTrue(data.getModifiedDate()!=null);
-        data.setPolicyData("Test");
-        assertTrue("Test".equals(data.getPolicyData()));
-        data.setConfigurationData(new ConfigurationDataEntity());
-        assertTrue(data.getConfigurationData()!=null);
-        data.setActionBodyEntity(new ActionBodyEntity());
-        assertTrue(data.getActionBodyEntity()!=null);
-        data.setScope("Test");
-        assertTrue("Test".equals(data.getScope()));
-        data.setCreatedBy("Test");
-        assertTrue("Test".equals(data.getCreatedBy()));
-        data.setModifiedBy("Test");
-        assertTrue("Test".equals(data.getModifiedBy()));
-        data.setDeleted(true);
-        assertTrue(data.isDeleted());
-        data.equals(new PolicyEntity());
-        data.hashCode();
-    }
-
-    @Test
-    public void testActionBodyEntity(){
-        ActionBodyEntity data = new ActionBodyEntity();
-        data.prePersist();
-        data.preUpdate();
-        data.setActionBodyName("Test");
-        assertTrue("Test".equals(data.getActionBodyName()));
-        data.setActionBody("Test");
-        assertTrue("Test".equals(data.getActionBody()));
-        data.setCreatedBy("Test");
-        assertTrue("Test".equals(data.getCreatedBy()));
-        data.setModifiedBy("Test");
-        assertTrue("Test".equals(data.getModifiedBy()));
-        data.setModifiedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
-        assertTrue(data.getModifiedDate()!=null);
-        data.setDeleted(true);
-        assertTrue(data.isDeleted());
-        assertTrue(data.getCreatedDate()!=null);
-        assertTrue(data.getModifiedDate()!=null);
-        data.equals(new ConfigurationDataEntity());
-        data.hashCode();
-    }
-
-    @Test
-    public void testConfigurationDataEntity(){
-        ConfigurationDataEntity data = new ConfigurationDataEntity();
-        data.prePersist();
-        data.preUpdate();
-        data.setConfigurationName("Test");
-        assertTrue("Test".equals(data.getConfigurationName()));
-        data.setConfigType("Test");
-        assertTrue("Test".equals(data.getConfigType()));
-        data.setConfigBody("Test");
-        assertTrue("Test".equals(data.getConfigBody()));
-        data.setCreatedBy("Test");
-        assertTrue("Test".equals(data.getCreatedBy()));
-        data.setDescription("Test");
-        assertTrue("Test".equals(data.getDescription()));
-        data.setModifiedBy("Test");
-        assertTrue("Test".equals(data.getModifiedBy()));
-        data.setModifiedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
-        assertTrue(data.getModifiedDate()!=null);
-        data.setDeleted(true);
-        assertTrue(data.isDeleted());
-        assertTrue(data.getCreatedDate()!=null);
-        assertTrue(data.getModifiedDate()!=null);
-        data.equals(new ConfigurationDataEntity());
-        data.hashCode();
-    }
-
-    @Test
-    public void testPdpEntity(){
-        PdpEntity data = new PdpEntity();
-        data.prePersist();
-        data.preUpdate();
-        data.setPdpId("Test");
-        assertTrue("Test".equals(data.getPdpId()));
-        data.setPdpName("Test");
-        assertTrue("Test".equals(data.getPdpName()));
-        data.setGroup(new GroupEntity());
-        assertTrue(data.getGroup()!=null);
-        data.setCreatedBy("Test");
-        assertTrue("Test".equals(data.getCreatedBy()));
-        data.setDescription("Test");
-        assertTrue("Test".equals(data.getDescription()));
-        data.setModifiedBy("Test");
-        assertTrue("Test".equals(data.getModifiedBy()));
-        data.setJmxPort(1);
-        assertTrue(1 == data.getJmxPort());
-        data.setDeleted(true);
-        assertTrue(data.isDeleted());
-        assertTrue(data.getCreatedDate()!=null);
-        assertTrue(data.getModifiedDate()!=null);
-    }
-
-    @Test
-    public void testGroupEntity(){
-        GroupEntity data = new GroupEntity();
-        data.prePersist();
-        data.preUpdate();
-        data.setGroupId("Test");
-        assertTrue("Test".equals(data.getGroupId()));
-        data.setGroupName("Test");
-        assertTrue("Test".equals(data.getgroupName()));
-        data.setCreatedBy("Test");
-        assertTrue("Test".equals(data.getCreatedBy()));
-        data.setDescription("Test");
-        assertTrue("Test".equals(data.getDescription()));
-        data.setModifiedBy("Test");
-        assertTrue("Test".equals(data.getModifiedBy()));
-        data.setDefaultGroup(true);
-        assertTrue(data.isDefaultGroup());
-        data.setDeleted(true);
-        assertTrue(data.isDeleted());
-        assertTrue(data.getCreatedDate()!=null);
-        assertTrue(data.getModifiedDate()!=null);
-    }
-}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PolicyEntityJpaTest.java
new file mode 100644 (file)
index 0000000..b392b6f
--- /dev/null
@@ -0,0 +1,519 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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 static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+
+/**
+ * The Class PolicyEntityJpaTest.
+ */
+public class PolicyEntityJpaTest {
+
+    private static Logger logger = FlexLogger.getLogger(PolicyEntityJpaTest.class);
+    private UserInfo userInfo;
+
+    /**
+     * Sets the up.
+     *
+     * @throws Exception the exception
+     */
+    @Before
+    public void setUp() throws Exception {
+        logger.info("setUp: Entering");
+        userInfo = new UserInfo();
+        userInfo.setUserLoginId("Test");
+        userInfo.setUserName("Test");
+        logger.info("setUp: exit");
+    }
+
+    /**
+     * Test policy group entity.
+     */
+    @Test
+    public void testPolicyGroupEntity() {
+        PolicyGroupEntity data = new PolicyGroupEntity();
+        data.setGroupKey(1);
+        assertTrue(1 == data.getGroupKey());
+        data.setPolicyid(1);
+        assertTrue(1 == data.getPolicyid());
+    }
+
+    /**
+     * Test policy DB dao entity.
+     */
+    @Test
+    public void testPolicyDbDaoEntity() {
+        PolicyDbDaoEntity data = new PolicyDbDaoEntity();
+        data.prePersist();
+        data.preUpdate();
+        data.setPolicyDbDaoUrl("Test");
+        assertTrue("Test".equals(data.getPolicyDbDaoUrl()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
+        assertTrue(data.getCreatedDate() != null);
+        assertTrue(data.getModifiedDate() != null);
+        data.setUsername("Test");
+        assertTrue("Test".equals(data.getUsername()));
+        data.setPassword("Test");
+        assertTrue("Test".equals(data.getPassword()));
+    }
+
+    /**
+     * Test database lock entity.
+     */
+    @Test
+    public void testDatabaseLockEntity() {
+        DatabaseLockEntity data = new DatabaseLockEntity();
+        data.setKey(1);
+        assertTrue(1 == data.getKey());
+    }
+
+    /**
+     * Test policy entity.
+     */
+    @Test
+    public void testPolicyEntity() {
+        PolicyEntity data = new PolicyEntity();
+        data.prePersist();
+        data.preUpdate();
+        data.setPolicyName("Test");
+        assertTrue("Test".equals(data.getPolicyName()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
+        assertTrue(data.getCreatedDate() != null);
+        assertTrue(data.getModifiedDate() != null);
+        data.setPolicyData("Test");
+        assertTrue("Test".equals(data.getPolicyData()));
+        data.setConfigurationData(new ConfigurationDataEntity());
+        assertTrue(data.getConfigurationData() != null);
+        data.setActionBodyEntity(new ActionBodyEntity());
+        assertTrue(data.getActionBodyEntity() != null);
+        data.setScope("Test");
+        assertTrue("Test".equals(data.getScope()));
+        data.setCreatedBy("Test");
+        assertTrue("Test".equals(data.getCreatedBy()));
+        data.setModifiedBy("Test");
+        assertTrue("Test".equals(data.getModifiedBy()));
+        data.setDeleted(true);
+        assertTrue(data.isDeleted());
+        data.equals(new PolicyEntity());
+        data.hashCode();
+
+        PolicyEntity entity0 = new PolicyEntity();
+        PolicyEntity entity1 = new PolicyEntity();
+        assertTrue(entity0.equals(entity0));
+        assertTrue(entity0.equals(entity1));
+        assertFalse(entity0.equals(null));
+        String helloString = "Hello";
+        Object helloObject = helloString;
+        assertFalse(entity0.equals(helloObject));
+
+        entity0.setPolicyId(1);
+        assertFalse(entity0.equals(entity1));
+        entity1.setPolicyId(1);
+        assertTrue(entity0.equals(entity1));
+        entity0.setPolicyId(2);
+        assertFalse(entity0.equals(entity1));
+        entity1.setPolicyId(2);
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setPolicyName("GoToOz");
+        assertFalse(entity0.equals(entity1));
+        entity1.setPolicyName("GoToOz");
+        assertTrue(entity0.equals(entity1));
+        entity1.setPolicyName(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setPolicyName(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setPolicyName("GoToOz");
+        assertFalse(entity0.equals(entity1));
+        entity0.setPolicyName("GoToOz");
+        assertTrue(entity0.equals(entity1));
+        entity1.setPolicyName("GoToOzNow");
+        assertFalse(entity0.equals(entity1));
+        entity0.setPolicyName("GoToOzNow");
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setScope("All");
+        assertFalse(entity0.equals(entity1));
+        entity1.setScope("All");
+        assertTrue(entity0.equals(entity1));
+        entity1.setScope(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setScope(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setScope("All");
+        assertFalse(entity0.equals(entity1));
+        entity0.setScope("All");
+        assertTrue(entity0.equals(entity1));
+        entity1.setScope("AllIn");
+        assertFalse(entity0.equals(entity1));
+        entity0.setScope("AllIn");
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setVersion(1);
+        assertFalse(entity0.equals(entity1));
+        entity1.setVersion(1);
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setPolicyVersion(1);
+        assertFalse(entity0.equals(entity1));
+        entity1.setPolicyVersion(1);
+        assertTrue(entity0.equals(entity1));
+        entity0.setPolicyVersion(2);
+        assertFalse(entity0.equals(entity1));
+        entity1.setPolicyVersion(2);
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setPolicyData("SomeData");
+        assertFalse(entity0.equals(entity1));
+        entity1.setPolicyData("SomeData");
+        assertTrue(entity0.equals(entity1));
+        entity1.setPolicyData(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setPolicyData(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setPolicyData("SomeData");
+        assertFalse(entity0.equals(entity1));
+        entity0.setPolicyData("SomeData");
+        assertTrue(entity0.equals(entity1));
+        entity1.setPolicyData("SomeMoreData");
+        assertFalse(entity0.equals(entity1));
+        entity0.setPolicyData("SomeMoreData");
+        assertTrue(entity0.equals(entity1));
+
+        ConfigurationDataEntity cde0 = new ConfigurationDataEntity();
+        entity0.setConfigurationDataEntity(cde0);
+        assertFalse(entity0.equals(entity1));
+        entity1.setConfigurationDataEntity(cde0);
+        assertTrue(entity0.equals(entity1));
+        entity1.setConfigurationDataEntity(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setConfigurationDataEntity(null);
+        assertTrue(entity0.equals(entity1));
+        ConfigurationDataEntity cde1 = new ConfigurationDataEntity();
+        entity1.setConfigurationDataEntity(cde1);
+        assertFalse(entity0.equals(entity1));
+        entity0.setConfigurationDataEntity(cde1);
+        assertTrue(entity0.equals(entity1));
+
+        ActionBodyEntity abe0 = new ActionBodyEntity();
+        entity0.setActionBodyEntity(abe0);
+        assertFalse(entity0.equals(entity1));
+        entity1.setActionBodyEntity(abe0);
+        assertTrue(entity0.equals(entity1));
+        entity1.setActionBodyEntity(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setActionBodyEntity(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setActionBodyEntity(abe0);
+        assertFalse(entity0.equals(entity1));
+        entity0.setActionBodyEntity(abe0);
+        assertTrue(entity0.equals(entity1));
+        ActionBodyEntity abe1 = new ActionBodyEntity();
+        entity1.setActionBodyEntity(abe1);
+        assertFalse(entity0.equals(entity1));
+        entity0.setActionBodyEntity(abe1);
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setDescription("Description");
+        assertFalse(entity0.equals(entity1));
+        entity1.setDescription("Description");
+        assertTrue(entity0.equals(entity1));
+        entity1.setDescription(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setDescription(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setDescription("Description");
+        assertFalse(entity0.equals(entity1));
+        entity0.setDescription("Description");
+        assertTrue(entity0.equals(entity1));
+        assertTrue(entity0.equals(entity1));
+        entity1.setDescription("Description Extra");
+        assertFalse(entity0.equals(entity1));
+        entity0.setDescription("Description Extra");
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setDeleted(true);
+        assertFalse(entity0.equals(entity1));
+        entity1.setDeleted(true);
+        assertTrue(entity0.equals(entity1));
+        entity0.setDeleted(false);
+        assertFalse(entity0.equals(entity1));
+        entity1.setDeleted(false);
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setDeleteReasonCode("NoReason");
+        assertFalse(entity0.equals(entity1));
+        entity1.setDeleteReasonCode("NoReason");
+        assertTrue(entity0.equals(entity1));
+        entity1.setDeleteReasonCode(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setDeleteReasonCode(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setDeleteReasonCode("NoReason");
+        assertFalse(entity0.equals(entity1));
+        entity0.setDeleteReasonCode("NoReason");
+        assertTrue(entity0.equals(entity1));
+        assertTrue(entity0.equals(entity1));
+        entity1.setDeleteReasonCode("NoOtherReason");
+        assertFalse(entity0.equals(entity1));
+        entity0.setDeleteReasonCode("NoOtherReason");
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setCreatedBy("Dorothy");
+        assertFalse(entity0.equals(entity1));
+        entity1.setCreatedBy("Dorothy");
+        assertTrue(entity0.equals(entity1));
+        entity1.setCreatedBy(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setCreatedBy(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setCreatedBy("Dorothy");
+        assertFalse(entity0.equals(entity1));
+        entity0.setCreatedBy("Dorothy");
+        assertTrue(entity0.equals(entity1));
+        entity1.setCreatedBy("Toto");
+        assertFalse(entity0.equals(entity1));
+        entity0.setCreatedBy("Toto");
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setCreatedDate(new Date(12345L));
+        assertFalse(entity0.equals(entity1));
+        entity1.setCreatedDate(new Date(12345L));
+        assertTrue(entity0.equals(entity1));
+        entity1.setCreatedDate(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setCreatedDate(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setCreatedDate(new Date(12345L));
+        assertFalse(entity0.equals(entity1));
+        entity0.setCreatedDate(new Date(12345L));
+        assertTrue(entity0.equals(entity1));
+        assertTrue(entity0.equals(entity1));
+        entity1.setCreatedDate(new Date(123456L));
+        assertFalse(entity0.equals(entity1));
+        entity0.setCreatedDate(new Date(123456L));
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setModifiedBy("Dorothy");
+        assertFalse(entity0.equals(entity1));
+        entity1.setModifiedBy("Dorothy");
+        assertTrue(entity0.equals(entity1));
+        entity1.setModifiedBy(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setModifiedBy(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setModifiedBy("Dorothy");
+        assertFalse(entity0.equals(entity1));
+        entity0.setModifiedBy("Dorothy");
+        assertTrue(entity0.equals(entity1));
+        entity1.setModifiedBy("Toto");
+        assertFalse(entity0.equals(entity1));
+        entity0.setModifiedBy("Toto");
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setModifiedDate(new Date(12345L));
+        assertFalse(entity0.equals(entity1));
+        entity1.setModifiedDate(new Date(12345L));
+        assertTrue(entity0.equals(entity1));
+        entity1.setModifiedDate(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setModifiedDate(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setModifiedDate(new Date(12345L));
+        assertFalse(entity0.equals(entity1));
+        entity0.setModifiedDate(new Date(12345L));
+        assertTrue(entity0.equals(entity1));
+        assertTrue(entity0.equals(entity1));
+        entity1.setModifiedDate(new Date(123456L));
+        assertFalse(entity0.equals(entity1));
+        entity0.setModifiedDate(new Date(123456L));
+        assertTrue(entity0.equals(entity1));
+
+        entity0.setDeletedBy("Dorothy");
+        assertFalse(entity0.equals(entity1));
+        entity1.setDeletedBy("Dorothy");
+        assertTrue(entity0.equals(entity1));
+        entity1.setDeletedBy(null);
+        assertFalse(entity0.equals(entity1));
+        entity0.setDeletedBy(null);
+        assertTrue(entity0.equals(entity1));
+        entity1.setDeletedBy("Dorothy");
+        assertFalse(entity0.equals(entity1));
+        entity0.setDeletedBy("Dorothy");
+        assertTrue(entity0.equals(entity1));
+        assertTrue(entity0.equals(entity1));
+        entity1.setDeletedBy("Toto");
+        assertFalse(entity0.equals(entity1));
+        entity0.setDeletedBy("Toto");
+        assertTrue(entity0.equals(entity1));
+
+        assertNotNull(entity0.hashCode());
+        assertNotNull(entity1.hashCode());
+    }
+
+    /**
+     * Test action body entity.
+     */
+    @Test
+    public void testActionBodyEntity() {
+        ActionBodyEntity data = new ActionBodyEntity();
+        data.prePersist();
+        data.preUpdate();
+        data.setActionBodyName("Test");
+        assertTrue("Test".equals(data.getActionBodyName()));
+        data.setActionBody("Test");
+        assertTrue("Test".equals(data.getActionBody()));
+        data.setCreatedBy("Test");
+        assertTrue("Test".equals(data.getCreatedBy()));
+        data.setModifiedBy("Test");
+        assertTrue("Test".equals(data.getModifiedBy()));
+        data.setModifiedDate(new Date());
+        assertTrue(data.getCreatedDate() != null);
+        assertTrue(data.getModifiedDate() != null);
+        data.setDeleted(true);
+        assertTrue(data.isDeleted());
+        assertTrue(data.getCreatedDate() != null);
+        assertTrue(data.getModifiedDate() != null);
+        data.equals(new ConfigurationDataEntity());
+        data.hashCode();
+    }
+
+    /**
+     * Test configuration data entity.
+     */
+    @Test
+    public void testConfigurationDataEntity() {
+        ConfigurationDataEntity data = new ConfigurationDataEntity();
+        data.prePersist();
+        data.preUpdate();
+        data.setConfigurationName("Test");
+        assertTrue("Test".equals(data.getConfigurationName()));
+        data.setConfigType("Test");
+        assertTrue("Test".equals(data.getConfigType()));
+        data.setConfigBody("Test");
+        assertTrue("Test".equals(data.getConfigBody()));
+        data.setCreatedBy("Test");
+        assertTrue("Test".equals(data.getCreatedBy()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
+        data.setModifiedBy("Test");
+        assertTrue("Test".equals(data.getModifiedBy()));
+        data.setModifiedDate(new Date());
+        assertTrue(data.getCreatedDate() != null);
+        assertTrue(data.getModifiedDate() != null);
+        data.setDeleted(true);
+        assertTrue(data.isDeleted());
+        assertTrue(data.getCreatedDate() != null);
+        assertTrue(data.getModifiedDate() != null);
+        data.equals(new ConfigurationDataEntity());
+        data.hashCode();
+    }
+
+    /**
+     * Test pdp entity.
+     */
+    @Test
+    public void testPdpEntity() {
+        PdpEntity data = new PdpEntity();
+        data.prePersist();
+        data.preUpdate();
+        data.setPdpId("Test");
+        assertTrue("Test".equals(data.getPdpId()));
+        data.setPdpName("Test");
+        assertTrue("Test".equals(data.getPdpName()));
+        data.setGroup(new GroupEntity());
+        assertTrue(data.getGroup() != null);
+        data.setCreatedBy("Test");
+        assertTrue("Test".equals(data.getCreatedBy()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
+        data.setModifiedBy("Test");
+        assertTrue("Test".equals(data.getModifiedBy()));
+        data.setJmxPort(1);
+        assertTrue(1 == data.getJmxPort());
+        data.setDeleted(true);
+        assertTrue(data.isDeleted());
+        assertTrue(data.getCreatedDate() != null);
+        assertTrue(data.getModifiedDate() != null);
+    }
+
+    /**
+     * Test group entity.
+     */
+    @Test
+    public void testGroupEntity() {
+        GroupEntity data = new GroupEntity();
+        data.prePersist();
+        data.preUpdate();
+        data.setGroupId("Test");
+        assertTrue("Test".equals(data.getGroupId()));
+        data.setGroupName("Test");
+        assertTrue("Test".equals(data.getGroupName()));
+        data.setCreatedBy("Test");
+        assertTrue("Test".equals(data.getCreatedBy()));
+        data.setDescription("Test");
+        assertTrue("Test".equals(data.getDescription()));
+        data.setModifiedBy("Test");
+        assertTrue("Test".equals(data.getModifiedBy()));
+        data.setDefaultGroup(true);
+        assertTrue(data.isDefaultGroup());
+        data.setDeleted(true);
+        assertTrue(data.isDeleted());
+        assertTrue(data.getCreatedDate() != null);
+        assertTrue(data.getModifiedDate() != null);
+
+        assertNull(data.getPolicies());
+        PolicyEntity policy0 = new PolicyEntity();
+        policy0.setPolicyName("PolicyName0");
+        data.addPolicyToGroup(policy0);
+        PolicyEntity policy1 = new PolicyEntity();
+        policy1.setPolicyName("PolicyName1");
+        assertTrue(data.getPolicies().contains(policy0));
+        assertFalse(data.getPolicies().contains(policy1));
+        data.addPolicyToGroup(policy1);
+        assertTrue(data.getPolicies().contains(policy0));
+        assertTrue(data.getPolicies().contains(policy1));
+        data.addPolicyToGroup(policy1);
+        assertTrue(data.getPolicies().contains(policy0));
+        assertTrue(data.getPolicies().contains(policy1));
+        data.removePolicyFromGroup(policy0);
+        assertFalse(data.getPolicies().contains(policy0));
+        assertTrue(data.getPolicies().contains(policy1));
+        data.removePolicyFromGroup(policy0);
+        assertFalse(data.getPolicies().contains(policy0));
+        assertTrue(data.getPolicies().contains(policy1));
+        data.removePolicyFromGroup(policy1);
+        assertNull(data.getPolicies());
+    }
+}
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * 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.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.rest.jpa;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Date;
@@ -28,11 +32,19 @@ import org.junit.Test;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 
-public class PolicyUtilsJPATest {
+/**
+ * The Class PolicyUtilsJpaTest.
+ */
+public class PolicyUtilsJpaTest {
 
-    private static Logger logger = FlexLogger.getLogger(PolicyUtilsJPATest.class);
+    private static Logger logger = FlexLogger.getLogger(PolicyUtilsJpaTest.class);
     private UserInfo userInfo;
 
+    /**
+     * Sets the up.
+     *
+     * @throws Exception the exception
+     */
     @Before
     public void setUp() throws Exception {
         logger.info("setUp: Entering");
@@ -42,8 +54,11 @@ public class PolicyUtilsJPATest {
         logger.info("setUp: exit");
     }
 
+    /**
+     * Test watch policy notification table.
+     */
     @Test
-    public void testWatchPolicyNotificationTable(){
+    public void testWatchPolicyNotificationTable() {
         WatchPolicyNotificationTable data = new WatchPolicyNotificationTable();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -55,8 +70,11 @@ public class PolicyUtilsJPATest {
         data.hashCode();
     }
 
+    /**
+     * Test policy roles.
+     */
     @Test
-    public void testPolicyRoles(){
+    public void testPolicyRoles() {
         PolicyRoles data = new PolicyRoles();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -68,8 +86,11 @@ public class PolicyUtilsJPATest {
         assertTrue("Test".equals(data.getLoginId().getUserLoginId()));
     }
 
+    /**
+     * Test policy version.
+     */
     @Test
-    public void testPolicyVersion(){
+    public void testPolicyVersion() {
         PolicyVersion data = new PolicyVersion();
         new PolicyVersion("Test", "Test");
         data.prePersist();
@@ -87,17 +108,105 @@ public class PolicyUtilsJPATest {
         data.setModifiedBy("Test");
         assertTrue("Test".equals(data.getModifiedBy()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
-        data.equals(data);
-        data.hashCode();
+        assertTrue(data.getModifiedDate() != null);
+
+        assertNotNull(data.hashCode());
+
+        PolicyVersion version0 = new PolicyVersion();
+        PolicyVersion version1 = new PolicyVersion();
+        assertTrue(version0.equals(version0));
+        assertTrue(version0.equals(version1));
+        assertFalse(version0.equals(null));
+        String helloString = "Hello";
+        Object helloObject = helloString;
+        assertFalse(version0.equals(helloObject));
+
+        version0.setId(1);
+        assertFalse(version0.equals(version1));
+        version1.setId(1);
+        assertTrue(version0.equals(version1));
+        version0.setActiveVersion(1);
+        assertFalse(version0.equals(version1));
+        version1.setActiveVersion(1);
+        assertTrue(version0.equals(version1));
+        version0.setCreatedBy("Dorothy");
+        assertFalse(version0.equals(version1));
+        version1.setCreatedBy("Dorothy");
+        assertTrue(version0.equals(version1));
+        version1.setCreatedBy(null);
+        assertFalse(version0.equals(version1));
+        version0.setCreatedBy(null);
+        assertTrue(version0.equals(version1));
+        version1.setCreatedBy("Dorothy");
+        assertFalse(version0.equals(version1));
+        version0.setCreatedBy("Dorothy");
+        assertTrue(version0.equals(version1));
+        version0.setCreatedDate(new Date(12345L));
+        assertFalse(version0.equals(version1));
+        version1.setCreatedDate(new Date(12345L));
+        assertTrue(version0.equals(version1));
+        version1.setCreatedDate(null);
+        assertFalse(version0.equals(version1));
+        version0.setCreatedDate(null);
+        assertTrue(version0.equals(version1));
+        version1.setCreatedDate(new Date(12345L));
+        assertFalse(version0.equals(version1));
+        version0.setCreatedDate(new Date(12345L));
+        assertTrue(version0.equals(version1));
+        version0.setHigherVersion(1);
+        assertFalse(version0.equals(version1));
+        version1.setHigherVersion(1);
+        assertTrue(version0.equals(version1));
+        version0.setModifiedBy("Dorothy");
+        assertFalse(version0.equals(version1));
+        version1.setModifiedBy("Dorothy");
+        assertTrue(version0.equals(version1));
+        version1.setModifiedBy(null);
+        assertFalse(version0.equals(version1));
+        version0.setModifiedBy(null);
+        assertTrue(version0.equals(version1));
+        version1.setModifiedBy("Dorothy");
+        assertFalse(version0.equals(version1));
+        version0.setModifiedBy("Dorothy");
+        assertTrue(version0.equals(version1));
+        version0.setModifiedDate(new Date(12345L));
+        assertFalse(version0.equals(version1));
+        version1.setModifiedDate(new Date(12345L));
+        assertTrue(version0.equals(version1));
+        version1.setModifiedDate(null);
+        assertFalse(version0.equals(version1));
+        version0.setModifiedDate(null);
+        assertTrue(version0.equals(version1));
+        version1.setModifiedDate(new Date(12345L));
+        assertFalse(version0.equals(version1));
+        version0.setModifiedDate(new Date(12345L));
+        assertTrue(version0.equals(version1));
+        version0.setPolicyName("GoToOz");
+        assertFalse(version0.equals(version1));
+        version1.setPolicyName("GoToOz");
+        assertTrue(version0.equals(version1));
+        version1.setPolicyName(null);
+        assertFalse(version0.equals(version1));
+        version0.setPolicyName(null);
+        assertTrue(version0.equals(version1));
+        version1.setPolicyName("GoToOz");
+        assertFalse(version0.equals(version1));
+        version0.setPolicyName("GoToOz");
+        assertTrue(version0.equals(version1));
+
+        assertNotNull(version0.hashCode());
+        assertNotNull(version1.hashCode());
     }
 
+    /**
+     * Test system log DB.
+     */
     @Test
-    public void testSystemLogDB(){
+    public void testSystemLogDB() {
         SystemLogDB data = new SystemLogDB();
-        new SystemLogDB(1, "","","","","");
+        new SystemLogDB(1, "", "", "", "", "");
         data.setId(1);
         assertTrue(1 == data.getId());
         data.setDescription("Test");
@@ -111,11 +220,14 @@ public class PolicyUtilsJPATest {
         data.setLogtype("Test");
         assertTrue("Test".equals(data.getLogtype()));
         data.setDate(new Date());
-        assertTrue(data.getDate()!=null);
+        assertTrue(data.getDate() != null);
     }
 
+    /**
+     * Test remote catalog values.
+     */
     @Test
-    public void testRemoteCatalogValues(){
+    public void testRemoteCatalogValues() {
         RemoteCatalogValues data = new RemoteCatalogValues();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -125,8 +237,11 @@ public class PolicyUtilsJPATest {
         assertTrue("Test".equals(data.getValue()));
     }
 
+    /**
+     * Test policy score.
+     */
     @Test
-    public void testPolicyScore(){
+    public void testPolicyScore() {
         PolicyScore data = new PolicyScore();
         data.setId(1);
         assertTrue(1 == data.getId());
@@ -134,12 +249,15 @@ public class PolicyUtilsJPATest {
         assertTrue("Test".equals(data.getPolicyName()));
         data.setVersionExtension("Test");
         assertTrue("Test".equals(data.getVersionExtension()));
-        data.setPolicyScore("Test");
-        assertTrue("Test".equals(data.getPolicyScore()));
+        data.setScore("Test");
+        assertTrue("Test".equals(data.getScore()));
     }
 
+    /**
+     * Test policy editor scopes.
+     */
     @Test
-    public void testPolicyEditorScopes(){
+    public void testPolicyEditorScopes() {
         PolicyEditorScopes data = new PolicyEditorScopes();
         data.prePersist();
         data.preUpdate();
@@ -148,17 +266,20 @@ public class PolicyUtilsJPATest {
         data.setScopeName("Test");
         assertTrue("Test".equals(data.getScopeName()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!=null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!=null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test descriptive scope.
+     */
     @Test
-    public void testDescriptiveScope(){
+    public void testDescriptiveScope() {
         DescriptiveScope data = new DescriptiveScope();
         data.prePersist();
         data.preUpdate();
@@ -169,17 +290,20 @@ public class PolicyUtilsJPATest {
         data.setSearch("Test");
         assertTrue("Test".equals(data.getSearch()));
         data.setCreatedDate(new Date());
-        assertTrue(data.getCreatedDate()!=null);
+        assertTrue(data.getCreatedDate() != null);
         data.setModifiedDate(new Date());
-        assertTrue(data.getModifiedDate()!=null);
+        assertTrue(data.getModifiedDate() != null);
         data.setUserCreatedBy(userInfo);
-        assertTrue(data.getUserCreatedBy()!=null);
+        assertTrue(data.getUserCreatedBy() != null);
         data.setUserModifiedBy(userInfo);
-        assertTrue(data.getUserModifiedBy()!=null);
+        assertTrue(data.getUserModifiedBy() != null);
     }
 
+    /**
+     * Test global role settings.
+     */
     @Test
-    public void testGlobalRoleSettings(){
+    public void testGlobalRoleSettings() {
         GlobalRoleSettings data = new GlobalRoleSettings();
         new GlobalRoleSettings(true);
         data.setRole("Test");
index 1cc41f9..2e7654e 100644 (file)
@@ -903,8 +903,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
 
         // Get all keys with "MANY-true" defined in their value from subAttribute
         Set<String> allkeys = null;
-        if (returnModel.getSub_attributes() != null && !returnModel.getSub_attributes().isEmpty()) {
-            JSONObject json = new JSONObject(returnModel.getSub_attributes());
+        if (returnModel.getSubAttributes() != null && !returnModel.getSubAttributes().isEmpty()) {
+            JSONObject json = new JSONObject(returnModel.getSubAttributes());
             getAllKeys(json);
             allkeys = allManyTrueKeys;
             allManyTrueKeys = new TreeSet<>();
@@ -942,8 +942,8 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
             jsonModel = finalJsonObject.toString();
         }
 
-        // get all properties with "MANY-true" defined in Ref_attributes
-        Set<String> manyTrueProperties = getManyTrueProperties(returnModel.getRef_attributes());
+        // get all properties with "MANY-true" defined in RefAttributes
+        Set<String> manyTrueProperties = getManyTrueProperties(returnModel.getRefAttributes());
         if (manyTrueProperties != null) {
             JSONObject jsonObj = new JSONObject(jsonModel);
             for (String s : manyTrueProperties) {
@@ -988,7 +988,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
         if (attribute != null) {
             attribute = attribute.trim();
         }
-        String refAttribute = returnModel.getRef_attributes();
+        String refAttribute = returnModel.getRefAttributes();
         if (refAttribute != null) {
             refAttribute = refAttribute.trim();
         }
@@ -1005,7 +1005,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
 
         Gson gson = new Gson();
 
-        String subAttributes = returnModel.getSub_attributes();
+        String subAttributes = returnModel.getSubAttributes();
         if (subAttributes != null) {
             subAttributes = subAttributes.trim();
         } else {
index cb0263f..446e124 100644 (file)
@@ -66,7 +66,7 @@ import org.onap.policy.rest.adapter.TermCollector;
 import org.onap.policy.rest.adapter.VendorSpecificData;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.AddressGroup;
-import org.onap.policy.rest.jpa.FWTagPicker;
+import org.onap.policy.rest.jpa.FwTagPicker;
 import org.onap.policy.rest.jpa.GroupServiceList;
 import org.onap.policy.rest.jpa.PolicyEntity;
 import org.onap.policy.rest.jpa.PrefixList;
@@ -490,9 +490,9 @@ public class CreateFirewallController extends RestrictedBaseController {
             String networkRole = "";
             for (String tag : tagCollectorList) {
                 tags = new Tags();
-                List<Object> tagListData = commonClassDao.getData(FWTagPicker.class);
+                List<Object> tagListData = commonClassDao.getData(FwTagPicker.class);
                 for (int tagCounter = 0; tagCounter < tagListData.size(); tagCounter++) {
-                    FWTagPicker jpaTagPickerList = (FWTagPicker) tagListData.get(tagCounter);
+                    FwTagPicker jpaTagPickerList = (FwTagPicker) tagListData.get(tagCounter);
                     if (jpaTagPickerList.getTagPickerName().equals(tag)) {
                         String tagValues = jpaTagPickerList.getTagValues();
                         tagList = new ArrayList<>();
index 0a24713..77d6636 100644 (file)
@@ -46,7 +46,7 @@ import org.onap.policy.controller.PolicyController;
 import org.onap.policy.rest.dao.CommonClassDao;
 import org.onap.policy.rest.jpa.ActionList;
 import org.onap.policy.rest.jpa.AddressGroup;
-import org.onap.policy.rest.jpa.FWTagPicker;
+import org.onap.policy.rest.jpa.FwTagPicker;
 import org.onap.policy.rest.jpa.GroupServiceList;
 import org.onap.policy.rest.jpa.PrefixList;
 import org.onap.policy.rest.jpa.SecurityZone;
@@ -198,11 +198,11 @@ public class PolicyRestControllerTest {
         when(commonClassDao.getData(GroupServiceList.class)).thenReturn(serviceGroupData);
 
         tagListData = new ArrayList<>();
-        FWTagPicker fwPicker = new FWTagPicker();
+        FwTagPicker fwPicker = new FwTagPicker();
         fwPicker.setTagPickerName("Test");
         fwPicker.setTagValues("Test:8080");
         tagListData.add(fwPicker);
-        when(commonClassDao.getData(FWTagPicker.class)).thenReturn(tagListData);
+        when(commonClassDao.getData(FwTagPicker.class)).thenReturn(tagListData);
 
         termListData = new ArrayList<>();
         TermList termList = new TermList();
index 1a99fdf..cb7ffbb 100644 (file)
@@ -108,11 +108,11 @@ public class CreateDcaeMicroServiceControllerTest {
                         + "CorrelationWindow=String:defaultValue-null:required-true:MANY-false:description-null,"
                         + "EmailNotification=String:defaultValue-null:required-true:MANY-false:description-null,"
                         + "CorrelationPriority=string:defaultValue-null:required-true:MANY-false:description-null,");
-        testData.setRef_attributes("SymptomTriggerSignature=resource-model-symptomEntity:MANY-true:description-null,"
+        testData.setRefAttributes("SymptomTriggerSignature=resource-model-symptomEntity:MANY-true:description-null,"
                 + "triggerSignature=resource-model-entity:MANY-true:description-null,"
                 + "SelectServerScope=SELECTSERVERSCOPE:MANY-false,logicalConnector=LOGICALCONNECTOR:MANY-false,"
                 + "ParentCorrelationTraversal=PARENTCORRELATIONTRAVERSAL:MANY-false,");
-        testData.setSub_attributes(
+        testData.setSubAttributes(
                 "{\"symptomAlarms\":{\"symptomContains\":\"SYMPTOMCONTAINS:defaultValue-null:required-true:MANY-false:"
                         + "description-null\",\"symptomFilterValue\":\"string:defaultValue-null:"
                         + "required-true:MANY-false:"
index 16c5384..0a9f9a3 100644 (file)
@@ -130,7 +130,7 @@ public class CommonClassDaoImplTest {
             userinfo.setUserName("Test");
             commonClassDao.save(userinfo);
             OnapName onapName = new OnapName();
-            onapName.setOnapName("Test");
+            onapName.setName("Test");
             onapName.setUserCreatedBy(userinfo);
             onapName.setUserModifiedBy(userinfo);
             onapName.setModifiedDate(new Date());
index dbab6ac..b3589b0 100755 (executable)
@@ -6320,7 +6320,7 @@ INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id)
 INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (452,0,254,2,28);
 INSERT INTO FunctionArguments (id, is_bag, function_id, arg_index, datatype_id) VALUES (453,0,92,3,16);
 
-INSERT INTO PIPType VALUES (500,'SQL'), (501,'LDAP'), (502,'CSV'), (503,'Hyper-CSV'), (504,'Custom');
+INSERT INTO PipType VALUES (500,'SQL'), (501,'LDAP'), (502,'CSV'), (503,'Hyper-CSV'), (504,'Custom');
 
 INSERT INTO GlobalRoleSettings (role, lockdown) values ('super-admin', '0');
 
index 8271f27..58f92a6 100644 (file)
@@ -18,9 +18,9 @@
 
 use onap_sdk;
 ALTER TABLE fwtagpicker drop networkRole;
-alter table microservicemodels drop column enumValues, drop column annotation; 
-drop table if exists FWTag; 
-drop table if exists FWTagPicker; 
+alter table microservicemodels drop column enumValues, drop column annotation;
+drop table if exists FwTag;
+drop table if exists FwTagPicker;
 drop table if exists brmsdependency;
 drop table if exists brmscontroller;
-drop table if exists microserviceattribute; 
+drop table if exists microserviceattribute;
index f8ed771..c2343b7 100644 (file)
@@ -20,14 +20,14 @@ use onap_sdk;
 
 INSERT INTO policyeditorscopes (`id`, `scopename`, `created_date`, `created_by`, `modified_date`, `modified_by`) VALUES ('1', 'com', '2017-06-01 11:45:36', 'demo', '2017-06-01 11:45:36', 'demo');
 
-alter table IntegrityAuditEntity modify jdbcUrl varchar(200) not null; 
+alter table IntegrityAuditEntity modify jdbcUrl varchar(200) not null;
 
-alter table `onap_sdk`.`microservicemodels` 
-add column `enumValues` longtext null default null after `version`, 
+alter table `onap_sdk`.`microservicemodels`
+add column `enumValues` longtext null default null after `version`,
 add column `annotation` longtext null after `enumValues`;
 
-drop table if exists FWTag; 
-CREATE TABLE FWTag(
+drop table if exists FwTag;
+CREATE TABLE FwTag(
 Id int NOT NULL AUTO_INCREMENT,
 tagName VARCHAR(45) NOT NULL,
 description VARCHAR(1024),
@@ -39,8 +39,8 @@ MODIFIED_BY VARCHAR(45) NOT NULL,
 PRIMARY KEY(ID)
 );
 
-drop table if exists FWTagPicker; 
-CREATE TABLE FWTagPicker(
+drop table if exists FwTagPicker;
+CREATE TABLE FwTagPicker(
 ID INT NOT NULL AUTO_INCREMENT,
 tagPickerName VARCHAR(45) NOT NULL,
 DESCRIPTION VARCHAR(1024),
@@ -79,7 +79,7 @@ controller longtext not null,
 primary key(id)
 );
 
-drop table if exists microserviceattribute; 
+drop table if exists microserviceattribute;
 CREATE TABLE microserviceattribute(
 ID INT NOT NULL AUTO_INCREMENT,
 name VARCHAR(255) NOT NULL,
index 6d8b852..138d04f 100644 (file)
@@ -84,7 +84,6 @@
             <plugin>
                 <groupId>io.fabric8</groupId>
                 <artifactId>docker-maven-plugin</artifactId>
-                <version>0.30.0</version> <!-- Extract this as a property from the policy-parent -->
                 <configuration>
                     <verbose>true</verbose>
                     <apiVersion>1.23</apiVersion>