diff options
author | liamfallon <liam.fallon@est.tech> | 2019-11-08 16:11:50 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-11-12 09:20:22 +0000 |
commit | 0c20d1c294fe146e1018f14b07a8d861c29fe527 (patch) | |
tree | 04d82d897c7ecf69771a5810443109e17749eae5 | |
parent | 2ee068fed59becbd3327937125264bdcf651f7b8 (diff) |
JUnit/SONAR/Checkstyle in ONAP-REST
Third batch of JPA pojos (E-M), with JUnit added and SONAR/Checkstyle
issues addressed. In cases where a class name change caused an update in
another package, the license header on files for those knock on changes
are not updated.
Issue-ID: POLICY-2131
Change-Id: I4fee1e9fb9c8a69dd6f2f15d3e3a8844473b857b
Signed-off-by: liamfallon <liam.fallon@est.tech>
47 files changed, 744 insertions, 2447 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java index 4e4c02672..72e6f488a 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/HandleIncomingNotifications.java @@ -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())) { diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java index 882169a34..67214acf2 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDbDaoTransactionInstance.java @@ -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); diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java index 8dda4ddc7..39a12c81a 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryController.java @@ -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); } } diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java index 05f633099..99cc47c23 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDaoTest.java @@ -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(); diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java index b94e8d338..3359a7aed 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/controller/FirewallDictionaryControllerTest.java @@ -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)); } diff --git a/ONAP-REST/pom.xml b/ONAP-REST/pom.xml index 680591854..028b70c1e 100644 --- a/ONAP-REST/pom.xml +++ b/ONAP-REST/pom.xml @@ -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> @@ -168,5 +169,11 @@ <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> diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java index f47e474c6..c0c009fb9 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionBodyEntity.java @@ -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. */ diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java index a0f4a301d..e72c4022d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionList.java @@ -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; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java index 07e62f302..7847585c3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ActionPolicyDict.java @@ -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; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java index efefad2d2..3d2c69aa0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AddressGroup.java @@ -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; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java index a084f2c85..4b8059e9c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Attribute.java @@ -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; @@ -145,15 +136,8 @@ public class Attribute implements Serializable { 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) { diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java index 5fb7c9c2c..8a40f4cf3 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/AttributeAssignment.java @@ -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 - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsController.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsController.java index a17d8b643..7eaf075fb 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsController.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsController.java @@ -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; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsDependency.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsDependency.java index c04957dda..1b6c89f89 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsDependency.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsDependency.java @@ -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; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsParamTemplate.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsParamTemplate.java index ae4fedab8..e3531fedd 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsParamTemplate.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/BrmsParamTemplate.java @@ -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; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java index 4b0670752..d417b37db 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Category.java @@ -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; @@ -135,114 +142,6 @@ public class Category implements Serializable { } /** - * 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. * * @param attribute 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 + "]"; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java index 4f6b1d7cb..41a2b2a56 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java @@ -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; @@ -87,42 +89,6 @@ public class ClosedLoopD2Services implements Serializable { } /** - * 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. */ @PrePersist @@ -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; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java index fc8801042..fb220d7c0 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java @@ -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; @@ -87,42 +89,6 @@ public class ClosedLoopSite implements Serializable { } /** - * 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. */ @PrePersist @@ -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; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java index edeabce4b..3b1be82cf 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoops.java @@ -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 diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java index 8fd839a18..f5ae1817b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConfigurationDataEntity.java @@ -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 { @@ -107,13 +113,6 @@ public class ConfigurationDataEntity implements Serializable { private boolean deleted = false; /** - * Instantiates a new configuration data entity. - */ - public ConfigurationDataEntity() { - // An empty constructor - } - - /** * Pre persist. */ @PrePersist @@ -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; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java index f7637013b..a79866a36 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintType.java @@ -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; @@ -75,10 +82,6 @@ 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; @@ -89,38 +92,6 @@ public class ConstraintType implements Serializable { this.description = description; } - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getConstraintType() { - return constraintType; - } - - public void setConstraintType(String constraintType) { - this.constraintType = constraintType; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Set<Attribute> getAttributes() { - return attributes; - } - - public void setAttributes(Set<Attribute> attributes) { - this.attributes = attributes; - } - public static String[] getRangeTypes() { return RANGE_TYPES; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java index c30af1fd6..d4043962f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ConstraintValue.java @@ -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(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java index 73d2c99f9..0ea3b71c4 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DatabaseLockEntity.java @@ -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; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java index 9da83ffb2..9bb2340c7 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/Datatype.java @@ -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; @@ -132,96 +139,6 @@ public class Datatype implements Serializable { } /** - * 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. * * @param attribute the attribute @@ -261,24 +178,6 @@ public class Datatype implements Serializable { } /** - * 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. * * @param function the function @@ -292,24 +191,6 @@ public class Datatype implements Serializable { } /** - * 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. * * @param argument 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 + "]"; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUsers.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUsers.java index 1408c9fd4..3313d0310 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUsers.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUsers.java @@ -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; } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUuid.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUuid.java index 8464ef7e8..990f396eb 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUuid.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DcaeUuid.java @@ -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; - - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java index 693641e43..bfa217674 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DecisionSettings.java @@ -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; @@ -98,42 +103,6 @@ public class DecisionSettings implements Serializable { 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. */ @PrePersist @@ -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; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java index d571ed719..4360131a4 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DescriptiveScope.java @@ -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 @@ -80,42 +85,6 @@ public class DescriptiveScope implements Serializable { 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. */ @PrePersist @@ -134,24 +103,6 @@ public class DescriptiveScope implements Serializable { } /** - * 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. * * @return 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; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DictionaryData.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DictionaryData.java index 40b8fcc33..a3db91b75 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DictionaryData.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/DictionaryData.java @@ -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; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java index 6ef5f60e0..8581cdf51 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FirewallDictionaryList.java @@ -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; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java index a0d14e66b..f978cf089 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionArgument.java @@ -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; } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java index 80c9beb2c..9201eec32 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FunctionDefinition.java @@ -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. @@ -21,165 +22,93 @@ 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; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FwTag.java index 75710d5b6..d19615d6c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTag.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FwTag.java @@ -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; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FwTagPicker.java index 0910d60d7..aa01433ff 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FWTagPicker.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/FwTagPicker.java @@ -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; - } - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java index 1b871d183..b89547927 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GlobalRoleSettings.java @@ -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; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java index 9b0ea0d7f..71e0bc4a2 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java @@ -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. @@ -17,13 +18,18 @@ * 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; + } } - - } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java index 8b10083d8..394b6dc59 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupPolicyScopeList.java @@ -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; @@ -32,35 +34,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 +68,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; - } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java index 63f673f59..e97a26ebc 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupServiceList.java @@ -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; @@ -32,48 +34,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; - - } - } 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 index 72a36f4f4..000000000 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/package-info.java +++ /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; diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java index 047053a83..a840f9d9d 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionDictionaryJpaTest.java @@ -98,9 +98,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 +117,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 +131,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 diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java index b3b23e429..cee9dde78 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FWDictionaryJPATest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/FwDictionaryJpaTest.java @@ -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()); 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 index 000000000..fb1b8a527 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ModelsTest.java @@ -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 + } +} 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 index 706471281..224513eee 100644 --- 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 @@ -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,8 +18,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.rest.jpa; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; 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 PolicyEntityJPATest { +/** + * The Class PolicyEntityJpaTest. + */ +public class PolicyEntityJpaTest { - private static Logger logger = FlexLogger.getLogger(PolicyEntityJPATest.class); + 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"); @@ -42,8 +54,11 @@ public class PolicyEntityJPATest { logger.info("setUp: exit"); } + /** + * Test policy group entity. + */ @Test - public void testPolicyGroupEntity(){ + public void testPolicyGroupEntity() { PolicyGroupEntity data = new PolicyGroupEntity(); data.setGroupKey(1); assertTrue(1 == data.getGroupKey()); @@ -51,8 +66,11 @@ public class PolicyEntityJPATest { assertTrue(1 == data.getPolicyid()); } + /** + * Test policy DB dao entity. + */ @Test - public void testPolicyDBDaoEntity(){ + public void testPolicyDbDaoEntity() { PolicyDBDaoEntity data = new PolicyDBDaoEntity(); data.prePersist(); data.preUpdate(); @@ -60,23 +78,29 @@ public class PolicyEntityJPATest { assertTrue("Test".equals(data.getPolicyDBDaoUrl())); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); + 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(){ + public void testDatabaseLockEntity() { DatabaseLockEntity data = new DatabaseLockEntity(); data.setKey(1); assertTrue(1 == data.getKey()); } + /** + * Test policy entity. + */ @Test - public void testPolicyEntity(){ + public void testPolicyEntity() { PolicyEntity data = new PolicyEntity(); data.prePersist(); data.preUpdate(); @@ -84,14 +108,14 @@ public class PolicyEntityJPATest { assertTrue("Test".equals(data.getPolicyName())); data.setDescription("Test"); assertTrue("Test".equals(data.getDescription())); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); + assertTrue(data.getCreatedDate() != null); + assertTrue(data.getModifiedDate() != null); data.setPolicyData("Test"); assertTrue("Test".equals(data.getPolicyData())); data.setConfigurationData(new ConfigurationDataEntity()); - assertTrue(data.getConfigurationData()!=null); + assertTrue(data.getConfigurationData() != null); data.setActionBodyEntity(new ActionBodyEntity()); - assertTrue(data.getActionBodyEntity()!=null); + assertTrue(data.getActionBodyEntity() != null); data.setScope("Test"); assertTrue("Test".equals(data.getScope())); data.setCreatedBy("Test"); @@ -104,8 +128,11 @@ public class PolicyEntityJPATest { data.hashCode(); } + /** + * Test action body entity. + */ @Test - public void testActionBodyEntity(){ + public void testActionBodyEntity() { ActionBodyEntity data = new ActionBodyEntity(); data.prePersist(); data.preUpdate(); @@ -118,18 +145,21 @@ public class PolicyEntityJPATest { data.setModifiedBy("Test"); assertTrue("Test".equals(data.getModifiedBy())); data.setModifiedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); + assertTrue(data.getCreatedDate() != null); + assertTrue(data.getModifiedDate() != null); data.setDeleted(true); assertTrue(data.isDeleted()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); + assertTrue(data.getCreatedDate() != null); + assertTrue(data.getModifiedDate() != null); data.equals(new ConfigurationDataEntity()); data.hashCode(); } + /** + * Test configuration data entity. + */ @Test - public void testConfigurationDataEntity(){ + public void testConfigurationDataEntity() { ConfigurationDataEntity data = new ConfigurationDataEntity(); data.prePersist(); data.preUpdate(); @@ -146,18 +176,21 @@ public class PolicyEntityJPATest { data.setModifiedBy("Test"); assertTrue("Test".equals(data.getModifiedBy())); data.setModifiedDate(new Date()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); + assertTrue(data.getCreatedDate() != null); + assertTrue(data.getModifiedDate() != null); data.setDeleted(true); assertTrue(data.isDeleted()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); + assertTrue(data.getCreatedDate() != null); + assertTrue(data.getModifiedDate() != null); data.equals(new ConfigurationDataEntity()); data.hashCode(); } + /** + * Test pdp entity. + */ @Test - public void testPdpEntity(){ + public void testPdpEntity() { PdpEntity data = new PdpEntity(); data.prePersist(); data.preUpdate(); @@ -166,7 +199,7 @@ public class PolicyEntityJPATest { data.setPdpName("Test"); assertTrue("Test".equals(data.getPdpName())); data.setGroup(new GroupEntity()); - assertTrue(data.getGroup()!=null); + assertTrue(data.getGroup() != null); data.setCreatedBy("Test"); assertTrue("Test".equals(data.getCreatedBy())); data.setDescription("Test"); @@ -177,19 +210,22 @@ public class PolicyEntityJPATest { assertTrue(1 == data.getJmxPort()); data.setDeleted(true); assertTrue(data.isDeleted()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); + assertTrue(data.getCreatedDate() != null); + assertTrue(data.getModifiedDate() != null); } + /** + * Test group entity. + */ @Test - public void testGroupEntity(){ + 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())); + assertTrue("Test".equals(data.getGroupName())); data.setCreatedBy("Test"); assertTrue("Test".equals(data.getCreatedBy())); data.setDescription("Test"); @@ -200,7 +236,30 @@ public class PolicyEntityJPATest { assertTrue(data.isDefaultGroup()); data.setDeleted(true); assertTrue(data.isDeleted()); - assertTrue(data.getCreatedDate()!=null); - assertTrue(data.getModifiedDate()!=null); + 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()); } } diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java index cb0263f2f..446e124ed 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java @@ -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<>(); diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java index 0a24713a6..77d66367b 100644 --- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java +++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java @@ -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(); diff --git a/packages/base/src/files/install/mysql/data/170701_downgrade_script.sql b/packages/base/src/files/install/mysql/data/170701_downgrade_script.sql index 8271f27ce..58f92a6cd 100644 --- a/packages/base/src/files/install/mysql/data/170701_downgrade_script.sql +++ b/packages/base/src/files/install/mysql/data/170701_downgrade_script.sql @@ -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; diff --git a/packages/base/src/files/install/mysql/data/170701_upgrade_script.sql b/packages/base/src/files/install/mysql/data/170701_upgrade_script.sql index f8ed77182..c2343b720 100644 --- a/packages/base/src/files/install/mysql/data/170701_upgrade_script.sql +++ b/packages/base/src/files/install/mysql/data/170701_upgrade_script.sql @@ -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, |