improved coverage for catalog db beans 89/39689/2
authorBenjamin, Max (mb388a) <mb388a@us.att.com>
Wed, 28 Mar 2018 14:12:15 +0000 (10:12 -0400)
committerBenjamin, Max (mb388a) <mb388a@us.att.com>
Wed, 28 Mar 2018 16:08:08 +0000 (12:08 -0400)
Change-Id: Ibf1fd21dc81f0a3e16447b05dfce1761efa69237
Issue-ID: SO-541
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
36 files changed:
common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java
mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java

index f4192e6..9540409 100644 (file)
@@ -23,6 +23,7 @@ package org.openecomp.mso.openpojo.rules;
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.anything;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -44,6 +45,7 @@ public class EqualsAndHashCodeTester implements Tester {
 
        
        private final Matcher m;
+       private boolean onlyDeclaredMethods = false;
        public EqualsAndHashCodeTester() {
                m = anything();
        }
@@ -51,12 +53,33 @@ public class EqualsAndHashCodeTester implements Tester {
        public EqualsAndHashCodeTester(Matcher m) {
                this.m = m;
        }
+       
+       public EqualsAndHashCodeTester onlyDeclaredMethods() {
+               this.onlyDeclaredMethods = true;
+               return this;
+       }
        @Override
        public void run(PojoClass pojoClass) {
                Class<?> clazz = pojoClass.getClazz();
                if (anyOf(m).matches(clazz)) {
                        final Object classInstanceOne = ValidationHelper.getBasicInstance(pojoClass);
                        final Object classInstanceTwo = ValidationHelper.getBasicInstance(pojoClass);
+                       if (onlyDeclaredMethods) {
+                               Method[] methods = classInstanceOne.getClass().getDeclaredMethods();
+                               boolean hasEquals = false;
+                               boolean hasHashcode = false;
+                               for (Method method : methods) {
+                                       if (method.getName().equals("equals")) {
+                                               hasEquals = true;
+                                       } else if (method.getName().equals("hashCode")) {
+                                               hasHashcode = true;
+                                       }
+                               }
+                               
+                               if (!(hasEquals && hasHashcode)) {
+                                       return;
+                               }
+                       }
                        Set<PojoField> identityFields = hasIdOrBusinessKey(pojoClass);
                        List<PojoField> otherFields = new ArrayList<>(pojoClass.getPojoFields());
                        otherFields.removeAll(identityFields);
index 0cd9487..a0af4b2 100644 (file)
@@ -1,93 +1,93 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-\r
-import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;\r
-\r
-public class AllottedResource extends MavenLikeVersioning implements Serializable {\r
-       \r
-       private static final long serialVersionUID = 768026109321305392L;\r
-       \r
-       private String modelUuid;\r
-       private String modelInvariantUuid;\r
-       private String modelVersion\r
-       private String modelName;\r
-       private String toscaNodeType;\r
-       private String subcategory;\r
-       private String description;\r
-       private Timestamp created;\r
-\r
-       public AllottedResource() {\r
-       }\r
-       \r
-       public String getModelUuid() {\r
-               return this.modelUuid;\r
-       }\r
-       public void setModelUuid(String modelUuid) {\r
-               this.modelUuid = modelUuid;\r
-       }\r
-       public String getModelInvariantUuid() {\r
-               return this.modelInvariantUuid;\r
-       }\r
-       public void setModelInvariantUuid(String modelInvariantUuid) {\r
-               this.modelInvariantUuid = modelInvariantUuid;\r
-       }\r
-       public String getModelVersion() {\r
-               return this.modelVersion;\r
-       }\r
-       public void setModelVersion(String modelVersion) {\r
-               this.modelVersion = modelVersion;\r
-       }\r
-       public String getModelName() {\r
-               return this.modelName;\r
-       }\r
-       public void setModelName(String modelName) {\r
-               this.modelName = modelName;\r
-       }\r
-       public String getToscaNodeType() {\r
-               return this.toscaNodeType;\r
-       }\r
-       public void setToscaNodeType(String toscaNodeType) {\r
-               this.toscaNodeType = toscaNodeType;\r
-       }       \r
-       public String getSubcategory() {\r
-               return this.subcategory;\r
-       }\r
-       public void setSubcategory(String subcategory) {\r
-               this.subcategory = subcategory;\r
-       }       \r
-       public String getDescription() {\r
-               return this.description;\r
-       }\r
-       public void setDescription(String description) {\r
-               this.description = description;\r
-       }\r
-       public Timestamp getCreated() {\r
-               return created;\r
-       }\r
-       public void setCreated(Timestamp created) {\r
-               this.created = created;\r
-       }       \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
+
+public class AllottedResource extends MavenLikeVersioning implements Serializable {
+       
+       private static final long serialVersionUID = 768026109321305392L;
+       
+       private String modelUuid = null;
+       private String modelInvariantUuid = null;
+       private String modelVersion = null; 
+       private String modelName = null;
+       private String toscaNodeType = null;
+       private String subcategory = null;
+       private String description = null;
+       private Timestamp created = null;
+
+       public AllottedResource() {
+       }
+       
+       public String getModelUuid() {
+               return this.modelUuid;
+       }
+       public void setModelUuid(String modelUuid) {
+               this.modelUuid = modelUuid;
+       }
+       public String getModelInvariantUuid() {
+               return this.modelInvariantUuid;
+       }
+       public void setModelInvariantUuid(String modelInvariantUuid) {
+               this.modelInvariantUuid = modelInvariantUuid;
+       }
+       public String getModelVersion() {
+               return this.modelVersion;
+       }
+       public void setModelVersion(String modelVersion) {
+               this.modelVersion = modelVersion;
+       }
+       public String getModelName() {
+               return this.modelName;
+       }
+       public void setModelName(String modelName) {
+               this.modelName = modelName;
+       }
+       public String getToscaNodeType() {
+               return this.toscaNodeType;
+       }
+       public void setToscaNodeType(String toscaNodeType) {
+               this.toscaNodeType = toscaNodeType;
+       }       
+       public String getSubcategory() {
+               return this.subcategory;
+       }
+       public void setSubcategory(String subcategory) {
+               this.subcategory = subcategory;
+       }       
+       public String getDescription() {
+               return this.description;
+       }
+       public void setDescription(String description) {
+               this.description = description;
+       }
+       public Timestamp getCreated() {
+               return created;
+       }
+       public void setCreated(Timestamp created) {
+               this.created = created;
+       }       
+
+}
index 2dcc2e8..e5a6537 100644 (file)
@@ -29,21 +29,21 @@ public class AllottedResourceCustomization extends MavenLikeVersioning implement
        
        private static final long serialVersionUID = 768026109321305392L;
 
-       private String modelCustomizationUuid;
-       private String arModelUuid;
-       private Timestamp created;
-       private String modelInstanceName;
-       private String providingServiceModelInvariantUuid;
-       private String targetNetworkRole;
-       private String nfFunction;
-       private String nfType;
-       private String nfRole;
-       private String nfNamingCode;
+       private String modelCustomizationUuid = null;
+       private String arModelUuid = null;
+       private Timestamp created = null;
+       private String modelInstanceName = null;
+       private String providingServiceModelInvariantUuid = null;
+       private String targetNetworkRole = null;
+       private String nfFunction = null;
+       private String nfType = null;
+       private String nfRole = null;
+       private String nfNamingCode = null;
        private Integer minInstances;
        private Integer maxInstances;
-       private AllottedResource ar = null;
-       private String providingServiceModelUuid;
-       private String providingServiceModelName;
+       private AllottedResource allottedResource = null;
+       private String providingServiceModelUuid = null;
+       private String providingServiceModelName = null;
 
        public AllottedResourceCustomization() {
                super();
@@ -77,10 +77,10 @@ public class AllottedResourceCustomization extends MavenLikeVersioning implement
                this.modelInstanceName = modelInstanceName;
        }
        public AllottedResource getAllottedResource() {
-               return this.ar;
+               return this.allottedResource;
        }
        public void setAllottedResource(AllottedResource ar) {
-               this.ar = ar;
+               this.allottedResource = ar;
        }
        public String getProvidingServiceModelInvariantUuid() {
                return this.providingServiceModelInvariantUuid;
@@ -149,7 +149,7 @@ public class AllottedResourceCustomization extends MavenLikeVersioning implement
                        ",modelInstanceName=" + this.modelInstanceName +
                        ",modelInstanceName=" + this.modelInstanceName +
                        ",created=" + this.created +
-                       ",ar=" + this.ar;
+                       ",ar=" + this.allottedResource;
        }
 
 }
index e22d1eb..d353288 100644 (file)
@@ -25,7 +25,7 @@ import java.io.Serializable;
 
 public class ArRecipe extends Recipe implements Serializable {
        private static final long serialVersionUID = 768026109321305392L;
-       private String modelName;
+       private String modelName = null;
        public ArRecipe() {}
 
        public String getModelName() {
index fcd9211..899127c 100644 (file)
@@ -30,13 +30,13 @@ public class HeatEnvironment extends MavenLikeVersioning implements Serializable
        
        private static final long serialVersionUID = 768026109321305392L;
 
-       private String artifactUuid;
+       private String artifactUuid = null;
        private String name = null;
        private String description = null;
        private String environment = null;
-       private String artifactChecksum;
+       private String artifactChecksum = null;
 
-       private Timestamp created;
+       private Timestamp created = null;
 
        public HeatEnvironment() {}
 
index ec429c8..8d7da22 100644 (file)
@@ -30,13 +30,13 @@ public class HeatFiles extends MavenLikeVersioning implements Serializable {
        
        private static final long serialVersionUID = 768026109321305392L;
 
-       private String artifactUuid;
+       private String artifactUuid = null;
        private String description = null;
-       private String fileName;
-       private String fileBody;
-       private Timestamp created;
-       private String version;
-       private String artifactChecksum;
+       private String fileName = null;
+       private String fileBody = null;
+       private Timestamp created = null;
+       private String version = null;
+       private String artifactChecksum = null;
 
        public HeatFiles() {}
 
index df06744..1fff176 100644 (file)
@@ -23,11 +23,15 @@ package org.openecomp.mso.db.catalog.beans;
 
 import java.io.Serializable;
 
+import com.openpojo.business.annotation.BusinessKey;
+
 public class HeatNestedTemplate implements Serializable {
 
-    private String parentTemplateId;
-    private String childTemplateId;
-    private String providerResourceFile;
+       @BusinessKey
+    private String parentTemplateId = null;
+       @BusinessKey
+    private String childTemplateId = null;
+    private String providerResourceFile = null;
     public static final long serialVersionUID = -1322322139926390329L;
 
     public HeatNestedTemplate () {
@@ -91,7 +95,15 @@ public class HeatNestedTemplate implements Serializable {
         // hash code does not have to be a unique result - only that two objects that should be treated as equal
         // return the same value. so this should work.
         int result;
-        result = this.parentTemplateId.hashCode() + this.childTemplateId.hashCode();
+        int parentTemplateIdHash = 0;
+        int childTemplateIdHash = 0;
+        if (this.parentTemplateId != null) {
+               parentTemplateIdHash = this.parentTemplateId.hashCode();
+        }
+        if (this.childTemplateId != null) {
+               childTemplateIdHash = this.childTemplateId.hashCode();
+        }
+        result = parentTemplateIdHash + childTemplateIdHash;
         return result;
     }
 }
index 03813a7..c6386ef 100644 (file)
@@ -31,17 +31,17 @@ public class HeatTemplate extends MavenLikeVersioning implements Serializable {
        
        private static final long serialVersionUID = 768026109321305392L;
 
-    private String artifactUuid;
-    private String templateName;
+    private String artifactUuid = null;
+    private String templateName = null;
     private String templateBody = null;
     private int timeoutMinutes;
     private Set <HeatTemplateParam> parameters;
     private Set <HeatNestedTemplate> files;
-    private String description;
-    private String asdcUuid;
-    private String artifactChecksum;
+    private String description = null;
+    private String asdcUuid = null;
+    private String artifactChecksum = null;
 
-    private Timestamp created;
+    private Timestamp created = null;
 
     public enum TemplateStatus {
                                 PARENT, CHILD, PARENT_COMPLETE
index f6202b7..9bfc41b 100644 (file)
@@ -1,76 +1,80 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-\r
-// an embeddable class to represent the Composite key for NetworkResource in the 1707 db refactoring\r
-public class HeatTemplateArtifactUuidModelUuid implements Serializable {\r
-       \r
-       private String heatTemplateArtifactUuid;\r
-       private String modelUuid;\r
-       public static final long serialVersionUID = -1322322139926390329L;\r
-\r
-       public HeatTemplateArtifactUuidModelUuid() {\r
-       }\r
-       \r
-       public String getHeatTemplateArtifactUuid() {\r
-               return this.heatTemplateArtifactUuid;\r
-       }\r
-       public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {\r
-               this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;\r
-       }\r
-       public String getModelUuid() {\r
-               return this.modelUuid;\r
-       }\r
-       public void setModelUuid(String modelUuid) {\r
-               this.modelUuid = modelUuid;\r
-       }\r
-\r
-       @Override\r
-       public String toString() {\r
-               return "heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid + " modelUuid=" + this.modelUuid;\r
-       }\r
-\r
-    @Override\r
-    public boolean equals (Object o) {\r
-        if (!(o instanceof HeatTemplateArtifactUuidModelUuid)) {\r
-            return false;\r
-        }\r
-        if (this == o) {\r
-            return true;\r
-        }\r
-        HeatTemplateArtifactUuidModelUuid htaumu = (HeatTemplateArtifactUuidModelUuid) o;\r
-        if (htaumu.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) \r
-                       && htaumu.getModelUuid().equals(this.getModelUuid())) {\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode () {\r
-        // hash code does not have to be a unique result - only that two objects that should be treated as equal\r
-        // return the same value. so this should work.\r
-        return this.heatTemplateArtifactUuid.hashCode() + this.modelUuid.hashCode();\r
-    }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+// an embeddable class to represent the Composite key for NetworkResource in the 1707 db refactoring
+public class HeatTemplateArtifactUuidModelUuid implements Serializable {
+       
+       @BusinessKey
+       private String heatTemplateArtifactUuid = null;
+       @BusinessKey
+       private String modelUuid = null;
+       public static final long serialVersionUID = -1322322139926390329L;
+
+       public HeatTemplateArtifactUuidModelUuid() {
+       }
+       
+       public String getHeatTemplateArtifactUuid() {
+               return this.heatTemplateArtifactUuid;
+       }
+       public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {
+               this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;
+       }
+       public String getModelUuid() {
+               return this.modelUuid;
+       }
+       public void setModelUuid(String modelUuid) {
+               this.modelUuid = modelUuid;
+       }
+
+       @Override
+       public String toString() {
+               return "heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid + " modelUuid=" + this.modelUuid;
+       }
+
+    @Override
+    public boolean equals (Object o) {
+        if (!(o instanceof HeatTemplateArtifactUuidModelUuid)) {
+            return false;
+        }
+        if (this == o) {
+            return true;
+        }
+        HeatTemplateArtifactUuidModelUuid htaumu = (HeatTemplateArtifactUuidModelUuid) o;
+        if (htaumu.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) 
+                       && htaumu.getModelUuid().equals(this.getModelUuid())) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode () {
+        // hash code does not have to be a unique result - only that two objects that should be treated as equal
+        // return the same value. so this should work.
+        return this.heatTemplateArtifactUuid.hashCode() + this.modelUuid.hashCode();
+    }
+
+}
index 7ceb19c..7f7dd2b 100644 (file)
@@ -22,13 +22,19 @@ package org.openecomp.mso.db.catalog.beans;
 
 import java.io.Serializable;
 
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+import com.openpojo.business.annotation.BusinessKey;
+
 public class HeatTemplateParam implements Serializable {
 
-       private String heatTemplateArtifactUuid;
-       private String paramName;
+       @BusinessKey
+       private String heatTemplateArtifactUuid = null;
+       @BusinessKey
+       private String paramName = null;
        private boolean required;
-       private String paramType;
-       private String paramAlias;
+       private String paramType = null;
+       private String paramAlias = null;
     public static final long serialVersionUID = -1322322139926390329L;
        
        public HeatTemplateParam() {}
@@ -71,21 +77,16 @@ public class HeatTemplateParam implements Serializable {
        public String toString () {
                return "Param=" + paramName + ",type=" + paramType + ",required=" + required + ",paramAlias=" + paramAlias + ", heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid;
        }
-       
-    @Override
-    public boolean equals (Object o) {
-        if (!(o instanceof HeatTemplateParam)) {
-            return false;
-        }
-        if (this == o) {
-            return true;
-        }
-        HeatTemplateParam htp = (HeatTemplateParam) o;
-        if (htp.getHeatTemplateArtifactUuid().equals(this.heatTemplateArtifactUuid) && htp.getParamName().equalsIgnoreCase(this.paramName)) {
-            return true;
-        }
-        return false;
-    }
+
+       @Override
+       public boolean equals(final Object other) {
+               if (!(other instanceof HeatTemplateParam)) {
+                       return false;
+               }
+               HeatTemplateParam castOther = (HeatTemplateParam) other;
+               return new EqualsBuilder().append(heatTemplateArtifactUuid, castOther.heatTemplateArtifactUuid)
+                               .append(paramName, castOther.paramName).isEquals();
+       }
 
     @Override
     public int hashCode () {
index 96e6c61..5cd6b58 100644 (file)
@@ -31,14 +31,14 @@ public class Model extends MavenLikeVersioning implements Serializable {
        private static final long serialVersionUID = 768026109321305392L;
 
        private int id;
-       private String modelCustomizationId;
-       private String modelCustomizationName;
-       private String modelInvariantId;
-       private String modelName;
-       private String modelType;
-       private String modelVersion;
-       private String modelVersionId;
-       private Timestamp created;
+       private String modelCustomizationId = null;
+       private String modelCustomizationName = null;
+       private String modelInvariantId = null;
+       private String modelName = null;
+       private String modelType = null;
+       private String modelVersion = null;
+       private String modelVersionId = null;
+       private Timestamp created = null;
        private Map<String,ServiceRecipe> recipes;
 
        /**
index 7ef5a4a..4ba35f7 100644 (file)
@@ -31,13 +31,13 @@ public class ModelRecipe extends MavenLikeVersioning implements Serializable {
        
        private int id;
        private Integer modelId;
-       private String action;
-       private String schemaVersion;
-       private String description;
-       private String orchestrationUri;
-       private String modelParamXSD;
+       private String action = null;
+       private String schemaVersion = null;
+       private String description = null;
+       private String orchestrationUri = null;
+       private String modelParamXSD = null;
        private Integer recipeTimeout;
-       private Timestamp created;
+       private Timestamp created = null;
 
        /**
         * @return the id
@@ -169,12 +169,12 @@ public class ModelRecipe extends MavenLikeVersioning implements Serializable {
        public String toString() {
                StringBuilder sb = new StringBuilder();
                sb.append("ModelRecipe: ");
-               sb.append("modelId=").append(modelId.toString());
+               sb.append("modelId=").append(modelId);
                sb.append(",action=").append(action);
                sb.append(",schemaVersion=").append(schemaVersion);
                sb.append(",orchestrationUri=").append(orchestrationUri);
                sb.append(",modelParamXSD=").append(modelParamXSD);
-               sb.append(",recipeTimeout=").append(recipeTimeout.toString());
+               sb.append(",recipeTimeout=").append(recipeTimeout);
         if (created != null) {
                sb.append (",created=");
                sb.append (DateFormat.getInstance().format(created));
index eeaa363..d10b633 100644 (file)
@@ -25,7 +25,7 @@ import java.io.Serializable;
 
 public class NetworkRecipe extends Recipe implements Serializable {
        private static final long serialVersionUID = 768026109321305392L;
-       private String modelName;
+       private String modelName = null;
        public NetworkRecipe() {}
 
        public String getModelName() {
index 025b13b..d4e1ec5 100644 (file)
@@ -35,15 +35,15 @@ public class NetworkResource extends MavenLikeVersioning implements Serializable
        private String neutronNetworkType = null;
        private String aicVersionMin = null;
        private String aicVersionMax = null;
-       private String modelName;
-       private String modelInvariantUUID;
-       private String modelVersion;
-       private String toscaNodeType;
-       private Timestamp created;
-       private String modelUUID;
-    private String category;
-    private String subCategory;
-       private String heatTemplateArtifactUUID;
+       private String modelName = null;
+       private String modelInvariantUUID = null;
+       private String modelVersion = null;
+       private String toscaNodeType = null;
+       private Timestamp created = null;
+       private String modelUUID = null;
+    private String category = null;
+    private String subCategory = null;
+       private String heatTemplateArtifactUUID = null;
        
        public NetworkResource() {}
        
index b581545..f1d5d4f 100644 (file)
 package org.openecomp.mso.db.catalog.beans;
 
 import java.sql.Timestamp;
+
+import com.openpojo.business.annotation.BusinessKey;
+
 import java.io.Serializable;
 
 public class NetworkResourceCustomization implements Serializable{
 
        // modelCustomizationUuid and networkResourceModelUuid form a composite primary key
+       @BusinessKey
        private String modelCustomizationUuid = null;
+       @BusinessKey
        private String networkResourceModelUuid = null;
        public static final long serialVersionUID = -1322322139926390329L;
-       private String modelInstanceName;
-       private Timestamp created;
-       private String networkTechnology;
+       private String modelInstanceName = null;
+       private Timestamp created = null;
+       private String networkTechnology = null;
        private String networkType = null;
-       private String networkScope;
-       private String networkRole;
+       private String networkScope = null;
+       private String networkRole = null;
 
        // These fields are not in the table directly - but I'm adding them here for storage in the objects we're dealing with
        private NetworkResource networkResource = null;
index 58c2441..3f2093b 100644 (file)
@@ -32,13 +32,13 @@ public class Recipe extends MavenLikeVersioning implements Serializable {
        private static final long serialVersionUID = 768026109321305392L;
 
     private int id;
-    protected String action;
-    private String description;
-    protected String orchestrationUri;
+    protected String action = null;
+    private String description = null;
+    protected String orchestrationUri = null;
     private int recipeTimeout;
-    private String serviceType;
-    private String paramXSD;
-       private Timestamp created;
+    private String serviceType = null;
+    private String paramXSD = null;
+       private Timestamp created = null;
     
     public Recipe () {
         super ();
index 37cad25..620c6bb 100644 (file)
 
 package org.openecomp.mso.db.catalog.beans;
 
-import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
-
 import java.io.Serializable;
 import java.sql.Timestamp;
 import java.text.DateFormat;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
+
 public class Service extends MavenLikeVersioning implements Serializable {
        
        private static final long serialVersionUID = 768026109321305392L;
 
-       private String modelName;
-       private String description;
-       private String modelUUID;
-       private String modelInvariantUUID;
-       private Timestamp created;
-       private String toscaCsarArtifactUUID;
-       private String modelVersion;
-       private String category;
-       private String serviceType;
-       private String serviceRole;
-       private String environmentContext;
-       private String workloadContext;
-       private Map<String,ServiceRecipe> recipes;
-       private Set<ServiceToResourceCustomization> serviceResourceCustomizations;
+       private String modelName = null;
+       private String description = null;
+       private String modelUUID = null;
+       private String modelInvariantUUID = null;
+       private Timestamp created = null;
+       private String toscaCsarArtifactUUID = null;
+       private String modelVersion = null;
+       private String category = null;
+       private String serviceType = null;
+       private String serviceRole = null;
+       private String environmentContext = null;
+       private String workloadContext = null;
+       private Map<String,ServiceRecipe> recipes = new HashMap<>();
+       private Set<ServiceToResourceCustomization> serviceResourceCustomizations = new HashSet<>();
        
        public Service() {}
        
index 78f94e4..d199671 100644 (file)
  */
 package org.openecomp.mso.db.catalog.beans;
 
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.db.catalog.beans.VfModule;
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.List;
 
 /*
  * A simple holder for Service and its associated elements:
@@ -35,17 +33,17 @@ public class ServiceMacroHolder implements Serializable {
        private static final long serialVersionUID = 768026109321305392L;
 
        private Service service;
-       private ArrayList<VnfResource> vnfResources;
-       private ArrayList<NetworkResourceCustomization> networkResourceCustomizations;
-       private ArrayList<AllottedResourceCustomization> allottedResourceCustomizations;
-       private ArrayList<VnfResourceCustomization> vnfResourceCustomizations;
+       private List<VnfResource> vnfResources;
+       private List<NetworkResourceCustomization> networkResourceCustomization;
+       private List<AllottedResourceCustomization> allottedResourceCustomization;
+       private List<VnfResourceCustomization> vnfResourceCustomizations;
 
        public ServiceMacroHolder() {
                super();
                this.service = null;
                this.vnfResources = new ArrayList<>();
-               this.networkResourceCustomizations = new ArrayList<>();
-               this.allottedResourceCustomizations = new ArrayList<>();
+               this.networkResourceCustomization = new ArrayList<>();
+               this.allottedResourceCustomization = new ArrayList<>();
                this.vnfResourceCustomizations = new ArrayList<>();
        }
        public ServiceMacroHolder(Service service) {
@@ -60,10 +58,10 @@ public class ServiceMacroHolder implements Serializable {
                this.service = service;
        }
 
-       public void setVnfResources(ArrayList<VnfResource> vnfResources) {
+       public void setVnfResources(List<VnfResource> vnfResources) {
                this.vnfResources = vnfResources;
        }
-       public ArrayList<VnfResource> getVnfResources() {
+       public List<VnfResource> getVnfResources() {
                return this.vnfResources;
        }
        public void addVnfResource(VnfResource vr) {
@@ -77,10 +75,10 @@ public class ServiceMacroHolder implements Serializable {
                }
        }
 
-       public void setVnfResourceCustomizations(ArrayList<VnfResourceCustomization> vnfResourceCustomizations) {
+       public void setVnfResourceCustomizations(List<VnfResourceCustomization> vnfResourceCustomizations) {
                this.vnfResourceCustomizations = vnfResourceCustomizations;
        }
-       public ArrayList<VnfResourceCustomization> getVnfResourceCustomizations() {
+       public List<VnfResourceCustomization> getVnfResourceCustomizations() {
                return this.vnfResourceCustomizations;
        }
        public void addVnfResourceCustomizations(VnfResourceCustomization vrc) {
@@ -94,33 +92,33 @@ public class ServiceMacroHolder implements Serializable {
                }
        }
        
-       public void setNetworkResourceCustomization(ArrayList<NetworkResourceCustomization> networkResourceCustomizations) {
-               this.networkResourceCustomizations = networkResourceCustomizations;
+       public void setNetworkResourceCustomization(List<NetworkResourceCustomization> networkResourceCustomizations) {
+               this.networkResourceCustomization = networkResourceCustomizations;
        }
-       public ArrayList<NetworkResourceCustomization> getNetworkResourceCustomization() {
-               return this.networkResourceCustomizations;
+       public List<NetworkResourceCustomization> getNetworkResourceCustomization() {
+               return this.networkResourceCustomization;
        }
-       public void addNetworkResourceCustomization(NetworkResourceCustomization nrc) {
-               if (this.networkResourceCustomizations != null) {
-                       this.networkResourceCustomizations.add(nrc);
+       public void addNetworkResourceCustomizations(NetworkResourceCustomization nrc) {
+               if (this.networkResourceCustomization != null) {
+                       this.networkResourceCustomization.add(nrc);
                } else {
-                       this.networkResourceCustomizations = new ArrayList<>();
-                       this.networkResourceCustomizations.add(nrc);
+                       this.networkResourceCustomization = new ArrayList<>();
+                       this.networkResourceCustomization.add(nrc);
                }
        }
 
-       public void setAllottedResourceCustomization(ArrayList<AllottedResourceCustomization> allottedResourceCustomizations) {
-               this.allottedResourceCustomizations = allottedResourceCustomizations;
+       public void setAllottedResourceCustomization(List<AllottedResourceCustomization> allottedResourceCustomizations) {
+               this.allottedResourceCustomization = allottedResourceCustomizations;
        }
-       public ArrayList<AllottedResourceCustomization> getAllottedResourceCustomization() {
-               return this.allottedResourceCustomizations;
+       public List<AllottedResourceCustomization> getAllottedResourceCustomization() {
+               return this.allottedResourceCustomization;
        }
        public void addAllottedResourceCustomization(AllottedResourceCustomization arc) {
-               if (this.allottedResourceCustomizations != null) {
-                       this.allottedResourceCustomizations.add(arc);
+               if (this.allottedResourceCustomization != null) {
+                       this.allottedResourceCustomization.add(arc);
                } else {
-                       this.allottedResourceCustomizations = new ArrayList<>();
-                       this.allottedResourceCustomizations.add(arc);
+                       this.allottedResourceCustomization = new ArrayList<>();
+                       this.allottedResourceCustomization.add(arc);
                }
        }
 
@@ -151,17 +149,17 @@ public class ServiceMacroHolder implements Serializable {
                } else {
                        sb.append("none");
                }
-               if (this.networkResourceCustomizations != null && this.networkResourceCustomizations.size() > 0) {
+               if (this.networkResourceCustomization != null && this.networkResourceCustomization.size() > 0) {
                        int i=0;
                        sb.append("NetworkResourceCustomizations:");
-                       for (NetworkResourceCustomization nrc : this.networkResourceCustomizations) {
+                       for (NetworkResourceCustomization nrc : this.networkResourceCustomization) {
                                sb.append("NRC[").append(i++).append("]: ").append(nrc.toString());
                        }
                }
-               if (this.allottedResourceCustomizations != null && this.allottedResourceCustomizations.size() > 0) {
+               if (this.allottedResourceCustomization != null && this.allottedResourceCustomization.size() > 0) {
                        int i=0;
                        sb.append("AllottedResourceCustomizations:");
-                       for (AllottedResourceCustomization arc : this.allottedResourceCustomizations) {
+                       for (AllottedResourceCustomization arc : this.allottedResourceCustomization) {
                                sb.append("ARC[").append(i++).append("]: ").append(arc.toString());
                        }
                }
index 303570a..d0bc9b3 100644 (file)
@@ -33,14 +33,14 @@ public class ServiceRecipe extends MavenLikeVersioning implements Serializable {
        private static final long serialVersionUID = 768026109321305392L;
        
        private int id;
-       private String serviceModelUUID;
-       private String action;
-       private String description;
-       private String orchestrationUri;
-       private String serviceParamXSD;
+       private String serviceModelUUID = null;
+       private String action = null;
+       private String description = null;
+       private String orchestrationUri = null;
+       private String serviceParamXSD = null;
        private int recipeTimeout;
        private Integer serviceTimeoutInterim;
-       private Timestamp created;
+       private Timestamp created = null;
 
        private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
        
index 6515a12..2ac71f4 100644 (file)
@@ -22,11 +22,15 @@ package org.openecomp.mso.db.catalog.beans;
 import java.io.Serializable;
 import java.sql.Timestamp;
 
+import com.openpojo.business.annotation.BusinessKey;
+
 public class ServiceToAllottedResources implements Serializable {
 
-       private String serviceModelUuid;
-       private String arModelCustomizationUuid;
-       private Timestamp created;
+       @BusinessKey
+       private String serviceModelUuid = null;
+       @BusinessKey
+       private String arModelCustomizationUuid = null;
+       private Timestamp created = null;
 
        public static final long serialVersionUID = -1322322139926390329L;
 
index 69dc327..3894b4f 100644 (file)
@@ -22,13 +22,17 @@ package org.openecomp.mso.db.catalog.beans;
 import java.io.Serializable;
 import java.sql.Timestamp;
 
+import com.openpojo.business.annotation.BusinessKey;
+
 public class ServiceToNetworks implements Serializable {
 
        // This maps to SERVICE.SERVICE_NAME_VERSION_ID / Service.serviceNameVersionId in SERVICE/Service table
-       private String serviceModelUuid;
+       @BusinessKey
+       private String serviceModelUuid = null;
        // This maps to NETWORK_RESOURCE_CUSTOMIZATION.MODEL_CUSTOMIZATION_UUID / NetworkResourceCustomization.ModelCustomizationUuid
-       private String networkModelCustomizationUuid;
-       private Timestamp created;
+       @BusinessKey
+       private String networkModelCustomizationUuid = null;
+       private Timestamp created = null;
        public static final long serialVersionUID = -1322322139926390329L;
 
        public ServiceToNetworks() {
index 6d74ab3..3babe4a 100644 (file)
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-import java.text.DateFormat;\r
-\r
-public class ServiceToResourceCustomization implements Serializable {\r
-\r
-       private static final long serialVersionUID = 768026109321305392L;\r
-       \r
-       private String modelType;\r
-       private String serviceModelUUID;\r
-       private Timestamp created;\r
-       private String resourceModelCustomizationUUID;\r
-       \r
-       public ServiceToResourceCustomization() {}\r
-       \r
-       public String getServiceModelUUID() {\r
-               return serviceModelUUID;\r
-       }\r
-       \r
-       public void setServiceModelUUID(String serviceModelUUID) {\r
-               this.serviceModelUUID = serviceModelUUID;\r
-       }\r
-       \r
-       public String getModelType() {\r
-               return modelType;\r
-       }\r
-       \r
-       public void setModelType(String modelType) {\r
-               this.modelType = modelType;\r
-       }\r
-       \r
-       public Timestamp getCreated() {\r
-               return created;\r
-       }\r
-       \r
-       public void setCreated(Timestamp created) {\r
-               this.created = created;\r
-       }\r
-       \r
-       public String getResourceModelCustomizationUUID() {\r
-               return resourceModelCustomizationUUID;\r
-       }\r
-\r
-       public void setResourceModelCustomizationUUID(String resourceModelCustomizationUUID) {\r
-               this.resourceModelCustomizationUUID = resourceModelCustomizationUUID;\r
-       }\r
-       \r
-       @Override\r
-       public boolean equals(Object o) {\r
-        if (!(o instanceof ServiceToResourceCustomization)) {\r
-            return false;\r
-        }\r
-        if (this == o) {\r
-            return true;\r
-        }\r
-        ServiceToResourceCustomization strc = (ServiceToResourceCustomization) o;\r
-        if (strc.getServiceModelUUID().equals(this.getServiceModelUUID()) \r
-                       && strc.getResourceModelCustomizationUUID().equals(this.getResourceModelCustomizationUUID())\r
-                       && strc.getModelType().equals(this.getModelType())) {\r
-            return true;\r
-        }\r
-        return false;\r
-               \r
-       }\r
-       \r
-       @Override \r
-       public int hashCode() {\r
-               \r
-               int code = this.modelType == null ? 0 : this.modelType.hashCode();\r
-               code += this.serviceModelUUID == null ? 0 : this.serviceModelUUID.hashCode();\r
-               code += this.resourceModelCustomizationUUID == null ? 0 : this.resourceModelCustomizationUUID.hashCode();\r
-               \r
-               return code;\r
-               \r
-       }\r
-\r
-       @Override\r
-       public String toString() {\r
-               StringBuilder sb = new StringBuilder();\r
-               sb.append("ServiceToResourceCustomization: modelType=").append(modelType).append(",serviceModelUUID=")\r
-            .append(serviceModelUUID).append(",resourceModelCustomizationUUID=").append(resourceModelCustomizationUUID);\r
-               if (created != null) {\r
-                       sb.append (",created=");\r
-                       sb.append (DateFormat.getInstance().format(created));\r
-               }\r
-               return sb.toString();\r
-       }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+public class ServiceToResourceCustomization implements Serializable {
+
+       private static final long serialVersionUID = 768026109321305392L;
+       
+       @BusinessKey
+       private String modelType = null;
+       @BusinessKey
+       private String serviceModelUUID = null;
+       private Timestamp created = null;
+       @BusinessKey
+       private String resourceModelCustomizationUUID = null;
+       
+       public ServiceToResourceCustomization() {}
+       
+       public String getServiceModelUUID() {
+               return serviceModelUUID;
+       }
+       
+       public void setServiceModelUUID(String serviceModelUUID) {
+               this.serviceModelUUID = serviceModelUUID;
+       }
+       
+       public String getModelType() {
+               return modelType;
+       }
+       
+       public void setModelType(String modelType) {
+               this.modelType = modelType;
+       }
+       
+       public Timestamp getCreated() {
+               return created;
+       }
+       
+       public void setCreated(Timestamp created) {
+               this.created = created;
+       }
+       
+       public String getResourceModelCustomizationUUID() {
+               return resourceModelCustomizationUUID;
+       }
+
+       public void setResourceModelCustomizationUUID(String resourceModelCustomizationUUID) {
+               this.resourceModelCustomizationUUID = resourceModelCustomizationUUID;
+       }
+       
+
+       @Override
+       public boolean equals (final Object other) {
+               if (!(other instanceof ServiceToResourceCustomization)) {
+                       return false;
+               }
+               ServiceToResourceCustomization castOther = (ServiceToResourceCustomization) other;
+               return new EqualsBuilder().append(modelType, castOther.modelType)
+                               .append(serviceModelUUID, castOther.serviceModelUUID)
+                               .append(resourceModelCustomizationUUID, castOther.resourceModelCustomizationUUID).isEquals();
+       }
+       
+       @Override 
+       public int hashCode() {
+               
+               int code = this.modelType == null ? 0 : this.modelType.hashCode();
+               code += this.serviceModelUUID == null ? 0 : this.serviceModelUUID.hashCode();
+               code += this.resourceModelCustomizationUUID == null ? 0 : this.resourceModelCustomizationUUID.hashCode();
+               
+               return code;
+               
+       }@Override
+       public String toString() {
+               StringBuilder sb = new StringBuilder();
+               sb.append("ServiceToResourceCustomization: modelType=").append(modelType).append(",serviceModelUUID=")
+            .append(serviceModelUUID).append(",resourceModelCustomizationUUID=").append(resourceModelCustomizationUUID);
+               if (created != null) {
+                       sb.append (",created=");
+                       sb.append (DateFormat.getInstance().format(created));
+               }
+               return sb.toString();
+       }
+
+}
index 3ef7e6e..6fd6e3e 100644 (file)
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-\r
-public class TempNetworkHeatTemplateLookup implements Serializable {\r
-\r
-       private String networkResourceModelName;\r
-       private String heatTemplateArtifactUuid;\r
-       private String aicVersionMin;\r
-       private String aicVersionMax;\r
-    public static final long serialVersionUID = -1322322139926390329L;\r
-\r
-       public TempNetworkHeatTemplateLookup() {\r
-               super();\r
-       }\r
-\r
-       public String getNetworkResourceModelName() {\r
-               return this.networkResourceModelName;\r
-       }\r
-       public void setNetworkResourceModelName(String networkResourceModelName) {\r
-               this.networkResourceModelName = networkResourceModelName;\r
-       }\r
-\r
-       public String getHeatTemplateArtifactUuid() {\r
-               return this.heatTemplateArtifactUuid;\r
-       }\r
-       public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {\r
-               this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;\r
-       }\r
-       public String getAicVersionMin() {\r
-               return this.aicVersionMin;\r
-       }\r
-\r
-       public void setAicVersionMin(String aicVersionMin) {\r
-               this.aicVersionMin = aicVersionMin;\r
-       }\r
-\r
-       public String getAicVersionMax() {\r
-               return this.aicVersionMax;\r
-       }\r
-\r
-       public void setAicVersionMax(String aicVersionMax) {\r
-               this.aicVersionMax = aicVersionMax;\r
-       }\r
-\r
-       @Override\r
-       public String toString() {\r
-               return "NetworkResourceModelName=" + this.networkResourceModelName + "HeatTemplateArtifactUuid=" +\r
-                       this.heatTemplateArtifactUuid + "aicVersionMin=" + this.aicVersionMin + "aicVersionMax=" + this.aicVersionMax;\r
-       }\r
-\r
-       @Override\r
-    public boolean equals (Object o) {\r
-        if (!(o instanceof TempNetworkHeatTemplateLookup)) {\r
-            return false;\r
-        }\r
-        if (this == o) {\r
-            return true;\r
-        }\r
-        TempNetworkHeatTemplateLookup tnhtl = (TempNetworkHeatTemplateLookup) o;\r
-        if (tnhtl.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) && tnhtl.getNetworkResourceModelName().equals(this.getNetworkResourceModelName())) {\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode () {\r
-        // hash code does not have to be a unique result - only that two objects that should be treated as equal\r
-        // return the same value. so this should work.\r
-        int result;\r
-        result = (this.networkResourceModelName != null ? this.networkResourceModelName.hashCode() : 0) + (this.heatTemplateArtifactUuid != null ? this.heatTemplateArtifactUuid.hashCode() : 0);\r
-        return result;\r
-    }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+public class TempNetworkHeatTemplateLookup implements Serializable {
+
+       @BusinessKey
+       private String networkResourceModelName = null;
+       @BusinessKey
+       private String heatTemplateArtifactUuid = null;
+       private String aicVersionMin = null;
+       private String aicVersionMax = null;
+    public static final long serialVersionUID = -1322322139926390329L;
+
+       public TempNetworkHeatTemplateLookup() {
+               super();
+       }
+
+       public String getNetworkResourceModelName() {
+               return this.networkResourceModelName;
+       }
+       public void setNetworkResourceModelName(String networkResourceModelName) {
+               this.networkResourceModelName = networkResourceModelName;
+       }
+
+       public String getHeatTemplateArtifactUuid() {
+               return this.heatTemplateArtifactUuid;
+       }
+       public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {
+               this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;
+       }
+       public String getAicVersionMin() {
+               return this.aicVersionMin;
+       }
+
+       public void setAicVersionMin(String aicVersionMin) {
+               this.aicVersionMin = aicVersionMin;
+       }
+
+       public String getAicVersionMax() {
+               return this.aicVersionMax;
+       }
+
+       public void setAicVersionMax(String aicVersionMax) {
+               this.aicVersionMax = aicVersionMax;
+       }
+
+       @Override
+       public String toString() {
+               return "NetworkResourceModelName=" + this.networkResourceModelName + "HeatTemplateArtifactUuid=" +
+                       this.heatTemplateArtifactUuid + "aicVersionMin=" + this.aicVersionMin + "aicVersionMax=" + this.aicVersionMax;
+       }
+
+       @Override
+    public boolean equals (Object o) {
+        if (!(o instanceof TempNetworkHeatTemplateLookup)) {
+            return false;
+        }
+        if (this == o) {
+            return true;
+        }
+        TempNetworkHeatTemplateLookup tnhtl = (TempNetworkHeatTemplateLookup) o;
+        if (tnhtl.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) && tnhtl.getNetworkResourceModelName().equals(this.getNetworkResourceModelName())) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode () {
+        // hash code does not have to be a unique result - only that two objects that should be treated as equal
+        // return the same value. so this should work.
+        int result;
+        result = (this.networkResourceModelName != null ? this.networkResourceModelName.hashCode() : 0) + (this.heatTemplateArtifactUuid != null ? this.heatTemplateArtifactUuid.hashCode() : 0);
+        return result;
+    }
+
+}
index 591e648..92d02d8 100644 (file)
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-import java.text.DateFormat;\r
-import java.util.Set;\r
-\r
-import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;\r
-\r
-public class ToscaCsar extends MavenLikeVersioning implements Serializable {\r
-       \r
-       private static final long serialVersionUID = 768026109321305392L;\r
-\r
-       private String artifactUUID;\r
-       private String name;\r
-       private String artifactChecksum;\r
-       private String url;\r
-       private String description;\r
-       private Timestamp created;\r
-       private Set<Service> services;\r
-       \r
-       public ToscaCsar() { }\r
-       \r
-       public String getArtifactUUID() {\r
-               return artifactUUID;\r
-       }\r
-       \r
-       public void setArtifactUUID(String artifactUUID) {\r
-               this.artifactUUID = artifactUUID;\r
-       }\r
-       \r
-       public String getName() {\r
-               return name;\r
-       }\r
-       \r
-       public void setName(String name) {\r
-               this.name = name;\r
-       }\r
-       \r
-       public String getArtifactChecksum() {\r
-               return artifactChecksum;\r
-       }\r
-       \r
-       public void setArtifactChecksum(String artifactChecksum) {\r
-               this.artifactChecksum = artifactChecksum;\r
-       }\r
-       \r
-       public String getUrl() {\r
-               return url;\r
-       }\r
-       \r
-       public void setUrl(String url) {\r
-               this.url = url;\r
-       }\r
-       \r
-       public String getDescription() {\r
-               return description;\r
-       }\r
-       \r
-       public void setDescription(String description) {\r
-               this.description = description;\r
-       }\r
-       \r
-       public Timestamp getCreated() {\r
-               return created;\r
-       }\r
-       \r
-       public void setCreated(Timestamp created) {\r
-               this.created = created;\r
-       }\r
-       \r
-       public Set<Service> getServices() {\r
-               return services;\r
-       }\r
-       \r
-       public void setServices(Set<Service> services) {\r
-               this.services = services;\r
-       }\r
-       \r
-       @Override\r
-       public String toString() {\r
-               StringBuilder sb = new StringBuilder();\r
-               sb.append("TOSCACSAR: artifactUUID=").append(artifactUUID).append(",name=").append(name).append(",version=")\r
-            .append(version).append(",description=").append(description).append(",artifactChecksum=")\r
-            .append(artifactChecksum).append(",url=").append(url);\r
-               for (Service service : services) {\r
-                       sb.append("\n").append(service.toString());\r
-               }\r
-               if (created != null) {\r
-                       sb.append (",created=");\r
-                       sb.append (DateFormat.getInstance().format(created));\r
-               }\r
-               return sb.toString();\r
-       }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
+
+public class ToscaCsar extends MavenLikeVersioning implements Serializable {
+       
+       private static final long serialVersionUID = 768026109321305392L;
+
+       private String artifactUUID = null;
+       private String name = null;
+       private String artifactChecksum = null;
+       private String url = null;
+       private String description = null;
+       private Timestamp created = null;
+       private Set<Service> services = new HashSet<>();
+       
+       public ToscaCsar() { }
+       
+       public String getArtifactUUID() {
+               return artifactUUID;
+       }
+       
+       public void setArtifactUUID(String artifactUUID) {
+               this.artifactUUID = artifactUUID;
+       }
+       
+       public String getName() {
+               return name;
+       }
+       
+       public void setName(String name) {
+               this.name = name;
+       }
+       
+       public String getArtifactChecksum() {
+               return artifactChecksum;
+       }
+       
+       public void setArtifactChecksum(String artifactChecksum) {
+               this.artifactChecksum = artifactChecksum;
+       }
+       
+       public String getUrl() {
+               return url;
+       }
+       
+       public void setUrl(String url) {
+               this.url = url;
+       }
+       
+       public String getDescription() {
+               return description;
+       }
+       
+       public void setDescription(String description) {
+               this.description = description;
+       }
+       
+       public Timestamp getCreated() {
+               return created;
+       }
+       
+       public void setCreated(Timestamp created) {
+               this.created = created;
+       }
+       
+       public Set<Service> getServices() {
+               return services;
+       }
+       
+       public void setServices(Set<Service> services) {
+               this.services = services;
+       }
+       
+       @Override
+       public String toString() {
+               StringBuilder sb = new StringBuilder();
+               sb.append("TOSCACSAR: artifactUUID=").append(artifactUUID).append(",name=").append(name).append(",version=")
+            .append(version).append(",description=").append(description).append(",artifactChecksum=")
+            .append(artifactChecksum).append(",url=").append(url);
+               for (Service service : services) {
+                       sb.append("\n").append(service.toString());
+               }
+               if (created != null) {
+                       sb.append (",created=");
+                       sb.append (DateFormat.getInstance().format(created));
+               }
+               return sb.toString();
+       }
+}
index cd2821a..ec3bc7f 100644 (file)
@@ -32,16 +32,16 @@ public class VfModule extends MavenLikeVersioning implements Serializable {
        
        private static final long serialVersionUID = 768026109321305392L;
 
-       private String modelInvariantUUID;
-       private String modelName;
-       private String modelVersion;
-       private String description;
+       private String modelInvariantUUID = null;
+       private String modelName = null;
+       private String modelVersion = null;
+       private String description = null;
        private int isBase;
-       private String heatTemplateArtifactUUId;
-       private String volHeatTemplateArtifactUUId;
-    private Timestamp created;
-       private String modelUUID;
-       private String vnfResourceModelUUId;
+       private String heatTemplateArtifactUUId = null;
+       private String volHeatTemplateArtifactUUId = null;
+    private Timestamp created = null;
+       private String modelUUID = null;
+       private String vnfResourceModelUUId = null;
 
     public VfModule() {
                super();
index db3a266..5b3dec4 100644 (file)
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-\r
-public class VfModuleCustomization implements Serializable {\r
-       \r
-       private String modelCustomizationUuid;\r
-       private String vfModuleModelUuid;\r
-       private String label;\r
-    private Integer minInstances;\r
-    private Integer maxInstances;\r
-    private Integer initialCount;\r
-    private Integer availabilityZoneCount;\r
-    private String heatEnvironmentArtifactUuid;\r
-    private String volEnvironmentArtifactUuid;\r
-    private Timestamp created;\r
-    private VfModule vfModule;\r
-    public static final long serialVersionUID = -1322322139926390329L;\r
-\r
-       public VfModuleCustomization() {\r
-               super();\r
-       }\r
-       \r
-       public String getModelCustomizationUuid() {\r
-               return this.modelCustomizationUuid;\r
-       }\r
-       public void setModelCustomizationUuid(String modelCustomizationUuid) {\r
-               this.modelCustomizationUuid = modelCustomizationUuid;\r
-       }\r
-       public String getVfModuleModelUuid() {\r
-               return this.vfModuleModelUuid;\r
-       }\r
-       public void setVfModuleModelUuid(String vfModuleModelUuid) {\r
-               this.vfModuleModelUuid = vfModuleModelUuid;\r
-       }\r
-       public String getHeatEnvironmentArtifactUuid() {\r
-               return this.heatEnvironmentArtifactUuid;\r
-       }\r
-       public void setHeatEnvironmentArtifactUuid(String heatEnvironmentArtifactUuid) {\r
-               this.heatEnvironmentArtifactUuid = heatEnvironmentArtifactUuid;\r
-       }\r
-       public String getVolEnvironmentArtifactUuid() {\r
-               return this.volEnvironmentArtifactUuid;\r
-       }\r
-       public void setVolEnvironmentArtifactUuid(String volEnvironmentArtifactUuid) {\r
-               this.volEnvironmentArtifactUuid = volEnvironmentArtifactUuid;\r
-       }\r
-       \r
-       public Integer getMinInstances() {\r
-               return this.minInstances;\r
-       }\r
-       public void setMinInstances(Integer minInstances) {\r
-               this.minInstances = minInstances;\r
-       }\r
-       public Integer getMaxInstances() {\r
-               return this.maxInstances;\r
-       }\r
-       public void setMaxInstances(Integer maxInstances) {\r
-               this.maxInstances = maxInstances;\r
-       }\r
-       public Integer getInitialCount() {\r
-               return this.initialCount;\r
-       }\r
-       public void setInitialCount(Integer initialCount) {\r
-               this.initialCount = initialCount;\r
-       }\r
-       public Integer getAvailabilityZoneCount() {\r
-               return this.availabilityZoneCount;\r
-       }\r
-       public void setAvailabilityZoneCount(Integer availabilityZoneCount) {\r
-               this.availabilityZoneCount = availabilityZoneCount;\r
-       }\r
-       public Timestamp getCreated() {\r
-               return created;\r
-       }\r
-       public void setCreated(Timestamp created) {\r
-               this.created = created;\r
-       }\r
-       public String getLabel() {\r
-               return this.label;\r
-       }\r
-       public void setLabel(String label) {\r
-               this.label = label;\r
-       }\r
-       public VfModule getVfModule() {\r
-               return this.vfModule;\r
-       }\r
-       public void setVfModule(VfModule vfModule) {\r
-               this.vfModule = vfModule;\r
-       }\r
-\r
-       @Override\r
-       public String toString() {\r
-               return "modelCustomizationUuid=" + this.modelCustomizationUuid +\r
-                       "vfModuleModelUuid=" + this.vfModuleModelUuid +\r
-                       "label=" + this.label +\r
-                       "initalCount=" + this.initialCount +\r
-                       "minInstances=" + this.minInstances +\r
-                       "maxInstances=" + this.maxInstances +\r
-                       "availabilityZoneCount=" + this.availabilityZoneCount +\r
-                       "heatEnvironmentArtifactUuid=" + this.heatEnvironmentArtifactUuid +\r
-                       "volEnvironmentArtifactUuid=" + this.volEnvironmentArtifactUuid +\r
-                       "created=" + this.created;\r
-       }\r
-\r
-       @Override\r
-    public boolean equals (Object o) {\r
-        if (!(o instanceof VfModuleCustomization)) {\r
-            return false;\r
-        }\r
-        if (this == o) {\r
-            return true;\r
-        }\r
-        VfModuleCustomization vfmc = (VfModuleCustomization) o;\r
-        if (vfmc.getModelCustomizationUuid().equals(this.getModelCustomizationUuid()) && vfmc.getVfModuleModelUuid().equals(this.getVfModuleModelUuid())) {\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode () {\r
-        // hash code does not have to be a unique result - only that two objects that should be treated as equal\r
-        // return the same value. so this should work.\r
-        int result = 0;\r
-        result = (this.modelCustomizationUuid != null ? this.modelCustomizationUuid.hashCode() : 0) + (this.vfModuleModelUuid != null ? this.vfModuleModelUuid.hashCode() : 0);\r
-        return result;\r
-    }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+public class VfModuleCustomization implements Serializable {
+       
+       @BusinessKey
+       private String modelCustomizationUuid = null;
+       @BusinessKey
+       private String vfModuleModelUuid = null;
+       private String label = null;
+    private Integer minInstances;
+    private Integer maxInstances;
+    private Integer initialCount;
+    private Integer availabilityZoneCount;
+    private String heatEnvironmentArtifactUuid = null;
+    private String volEnvironmentArtifactUuid = null;
+    private Timestamp created = null;
+    private VfModule vfModule;
+    public static final long serialVersionUID = -1322322139926390329L;
+
+       public VfModuleCustomization() {
+               super();
+       }
+       
+       public String getModelCustomizationUuid() {
+               return this.modelCustomizationUuid;
+       }
+       public void setModelCustomizationUuid(String modelCustomizationUuid) {
+               this.modelCustomizationUuid = modelCustomizationUuid;
+       }
+       public String getVfModuleModelUuid() {
+               return this.vfModuleModelUuid;
+       }
+       public void setVfModuleModelUuid(String vfModuleModelUuid) {
+               this.vfModuleModelUuid = vfModuleModelUuid;
+       }
+       public String getHeatEnvironmentArtifactUuid() {
+               return this.heatEnvironmentArtifactUuid;
+       }
+       public void setHeatEnvironmentArtifactUuid(String heatEnvironmentArtifactUuid) {
+               this.heatEnvironmentArtifactUuid = heatEnvironmentArtifactUuid;
+       }
+       public String getVolEnvironmentArtifactUuid() {
+               return this.volEnvironmentArtifactUuid;
+       }
+       public void setVolEnvironmentArtifactUuid(String volEnvironmentArtifactUuid) {
+               this.volEnvironmentArtifactUuid = volEnvironmentArtifactUuid;
+       }
+       
+       public Integer getMinInstances() {
+               return this.minInstances;
+       }
+       public void setMinInstances(Integer minInstances) {
+               this.minInstances = minInstances;
+       }
+       public Integer getMaxInstances() {
+               return this.maxInstances;
+       }
+       public void setMaxInstances(Integer maxInstances) {
+               this.maxInstances = maxInstances;
+       }
+       public Integer getInitialCount() {
+               return this.initialCount;
+       }
+       public void setInitialCount(Integer initialCount) {
+               this.initialCount = initialCount;
+       }
+       public Integer getAvailabilityZoneCount() {
+               return this.availabilityZoneCount;
+       }
+       public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
+               this.availabilityZoneCount = availabilityZoneCount;
+       }
+       public Timestamp getCreated() {
+               return created;
+       }
+       public void setCreated(Timestamp created) {
+               this.created = created;
+       }
+       public String getLabel() {
+               return this.label;
+       }
+       public void setLabel(String label) {
+               this.label = label;
+       }
+       public VfModule getVfModule() {
+               return this.vfModule;
+       }
+       public void setVfModule(VfModule vfModule) {
+               this.vfModule = vfModule;
+       }
+
+       @Override
+       public String toString() {
+               return "modelCustomizationUuid=" + this.modelCustomizationUuid +
+                       "vfModuleModelUuid=" + this.vfModuleModelUuid +
+                       "label=" + this.label +
+                       "initalCount=" + this.initialCount +
+                       "minInstances=" + this.minInstances +
+                       "maxInstances=" + this.maxInstances +
+                       "availabilityZoneCount=" + this.availabilityZoneCount +
+                       "heatEnvironmentArtifactUuid=" + this.heatEnvironmentArtifactUuid +
+                       "volEnvironmentArtifactUuid=" + this.volEnvironmentArtifactUuid +
+                       "created=" + this.created;
+       }
+
+       @Override
+    public boolean equals (Object o) {
+        if (!(o instanceof VfModuleCustomization)) {
+            return false;
+        }
+        if (this == o) {
+            return true;
+        }
+        VfModuleCustomization vfmc = (VfModuleCustomization) o;
+        if (vfmc.getModelCustomizationUuid().equals(this.getModelCustomizationUuid()) && vfmc.getVfModuleModelUuid().equals(this.getVfModuleModelUuid())) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode () {
+        // hash code does not have to be a unique result - only that two objects that should be treated as equal
+        // return the same value. so this should work.
+        int result = 0;
+        result = (this.modelCustomizationUuid != null ? this.modelCustomizationUuid.hashCode() : 0) + (this.vfModuleModelUuid != null ? this.vfModuleModelUuid.hashCode() : 0);
+        return result;
+    }
+
+}
index 611604e..3796650 100644 (file)
@@ -26,8 +26,8 @@ import java.io.Serializable;
 
 public class VfModuleToHeatFiles implements Serializable {
        
-    private String vfModuleModelUuid;
-    private String heatFilesArtifactUuid;
+    private String vfModuleModelUuid = null;
+    private String heatFilesArtifactUuid = null;
     public static final long serialVersionUID = -1322322139926390329L;
 
        public VfModuleToHeatFiles() {
index e1795e1..9b701df 100644 (file)
@@ -25,16 +25,20 @@ package org.openecomp.mso.db.catalog.beans;
 import java.sql.Timestamp;
 import java.text.DateFormat;
 
+import com.openpojo.business.annotation.BusinessKey;
+
 import java.io.Serializable;
 
 public class VnfComponent implements Serializable {
-    private int vnfId;
+       @BusinessKey
+       private int vnfId;
+       @BusinessKey
     private String componentType = null;
     private Integer heatTemplateId;
     private Integer heatEnvironmentId;
     public static final long serialVersionUID = -1322322139926390329L;
 
-       private Timestamp created;
+       private Timestamp created = null;
     
     public VnfComponent() {}
 
index 30a5133..2240191 100644 (file)
@@ -26,9 +26,9 @@ public class VnfComponentsRecipe extends Recipe implements Serializable {
        
        private static final long serialVersionUID = 768026109321305392L;
 
-       private String vnfType;
-       private String vnfComponentType;
-       private String vfModuleModelUUId; 
+       private String vnfType = null;
+       private String vnfComponentType = null;
+       private String vfModuleModelUUId = null
 
        public VnfComponentsRecipe() {}
 
index 0dd38cb..d94334c 100644 (file)
@@ -26,8 +26,8 @@ public class VnfRecipe extends Recipe implements Serializable {
        
        private static final long serialVersionUID = 768026109321305392L;
 
-       private String vnfType;
-       private String vfModuleId; 
+       private String vnfType = null;
+       private String vfModuleId = null
 
        public VnfRecipe() {}
 
index fd1e6b6..6b1cb0a 100644 (file)
@@ -1,88 +1,92 @@
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-\r
-public class VnfResCustomToVfModuleCustom implements Serializable {\r
-       \r
-       private String vnfResourceCustModelCustomizationUuid;\r
-       private String vfModuleCustModelCustomizationUuid;\r
-       private Timestamp created;\r
-       \r
-    public static final long serialVersionUID = -1322322139926390329L;\r
-\r
-\r
-       public VnfResCustomToVfModuleCustom() {\r
-               super();\r
-       }\r
-       public String getVnfResourceCustModelCustomizationUuid() {\r
-               return this.vnfResourceCustModelCustomizationUuid;\r
-       }\r
-       public void setVnfResourceCustModelCustomizationUuid(String vnfResourceCustModelCustomizationUuid) {\r
-               this.vnfResourceCustModelCustomizationUuid = vnfResourceCustModelCustomizationUuid;\r
-       }\r
-       public String getVfModuleCustModelCustomizationUuid() {\r
-               return this.vfModuleCustModelCustomizationUuid;\r
-       }\r
-       public void setVfModuleCustModelCustomizationUuid(String vfModuleCustModelCustomizationUuid) {\r
-               this.vfModuleCustModelCustomizationUuid = vfModuleCustModelCustomizationUuid;\r
-       }\r
-       public Timestamp getCreated() {\r
-               return created;\r
-       }\r
-       public void setCreated(Timestamp created) {\r
-               this.created = created;\r
-       }\r
-\r
-       @Override\r
-       public String toString() {\r
-               return "vnfResourceCustModelCustomizationUuid=" + this.vnfResourceCustModelCustomizationUuid +\r
-                       "vfModuleCustModelCustomizationUuid=" + this.vfModuleCustModelCustomizationUuid + "created=" + this.created;\r
-       }\r
-\r
-       @Override\r
-    public boolean equals (Object o) {\r
-        if (!(o instanceof VnfResCustomToVfModuleCustom)) {\r
-            return false;\r
-        }\r
-        if (this == o) {\r
-            return true;\r
-        }\r
-        VnfResCustomToVfModuleCustom vrctvmc = (VnfResCustomToVfModuleCustom) o;\r
-        if (vrctvmc.getVnfResourceCustModelCustomizationUuid().equals(this.getVnfResourceCustModelCustomizationUuid()) && vrctvmc.getVfModuleCustModelCustomizationUuid().equals(this.getVfModuleCustModelCustomizationUuid())) {\r
-            return true;\r
-        }\r
-        return false;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode () {\r
-        // hash code does not have to be a unique result - only that two objects that should be treated as equal\r
-        // return the same value. so this should work.\r
-        int result = 0;\r
-        result = (this.vnfResourceCustModelCustomizationUuid != null ? this.vnfResourceCustModelCustomizationUuid.hashCode() : 0) + (this.vfModuleCustModelCustomizationUuid != null ? this.vfModuleCustModelCustomizationUuid.hashCode() : 0);\r
-        return result;\r
-    }\r
-\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+public class VnfResCustomToVfModuleCustom implements Serializable {
+       
+       @BusinessKey
+       private String vnfResourceCustModelCustomizationUuid = null;
+       @BusinessKey
+       private String vfModuleCustModelCustomizationUuid = null;
+       private Timestamp created = null;
+       
+    public static final long serialVersionUID = -1322322139926390329L;
+
+
+       public VnfResCustomToVfModuleCustom() {
+               super();
+       }
+       public String getVnfResourceCustModelCustomizationUuid() {
+               return this.vnfResourceCustModelCustomizationUuid;
+       }
+       public void setVnfResourceCustModelCustomizationUuid(String vnfResourceCustModelCustomizationUuid) {
+               this.vnfResourceCustModelCustomizationUuid = vnfResourceCustModelCustomizationUuid;
+       }
+       public String getVfModuleCustModelCustomizationUuid() {
+               return this.vfModuleCustModelCustomizationUuid;
+       }
+       public void setVfModuleCustModelCustomizationUuid(String vfModuleCustModelCustomizationUuid) {
+               this.vfModuleCustModelCustomizationUuid = vfModuleCustModelCustomizationUuid;
+       }
+       public Timestamp getCreated() {
+               return created;
+       }
+       public void setCreated(Timestamp created) {
+               this.created = created;
+       }
+
+       @Override
+       public String toString() {
+               return "vnfResourceCustModelCustomizationUuid=" + this.vnfResourceCustModelCustomizationUuid +
+                       "vfModuleCustModelCustomizationUuid=" + this.vfModuleCustModelCustomizationUuid + "created=" + this.created;
+       }
+
+       @Override
+    public boolean equals (Object o) {
+        if (!(o instanceof VnfResCustomToVfModuleCustom)) {
+            return false;
+        }
+        if (this == o) {
+            return true;
+        }
+        VnfResCustomToVfModuleCustom vrctvmc = (VnfResCustomToVfModuleCustom) o;
+        if (vrctvmc.getVnfResourceCustModelCustomizationUuid().equals(this.getVnfResourceCustModelCustomizationUuid()) && vrctvmc.getVfModuleCustModelCustomizationUuid().equals(this.getVfModuleCustModelCustomizationUuid())) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode () {
+        // hash code does not have to be a unique result - only that two objects that should be treated as equal
+        // return the same value. so this should work.
+        int result = 0;
+        result = (this.vnfResourceCustModelCustomizationUuid != null ? this.vnfResourceCustModelCustomizationUuid.hashCode() : 0) + (this.vfModuleCustModelCustomizationUuid != null ? this.vfModuleCustModelCustomizationUuid.hashCode() : 0);
+        return result;
+    }
+
+
+}
index 806cbeb..f8e6024 100644 (file)
@@ -35,23 +35,22 @@ public class VnfResource extends MavenLikeVersioning implements Serializable {
        
        private static final long serialVersionUID = 768026109321305392L;
 
-       private String modelUuid;
-       private String modelInvariantUuid;
-       private String modelName;
-    private String toscaNodeType;
-    private String description;
-    private String orchestrationMode;
-    private String aicVersionMin;
-    private String aicVersionMax;
-    private String category;
-    private String subCategory;
-    private String heatTemplateArtifactUUId;
-    private Timestamp created;
-    private String modelVersion;
-    private Set<VnfResourceCustomization> vnfResourceCustomizations;
-    private Set<VfModule> vfModules;
-    private List<VfModule> vfModuleList;
-    private List<VfModuleCustomization> vfModuleCustomizations;
+       private String modelUuid = null;
+       private String modelInvariantUuid = null;
+       private String modelName = null;
+    private String toscaNodeType = null;
+    private String description = null;
+    private String orchestrationMode = null;
+    private String aicVersionMin = null;
+    private String aicVersionMax = null;
+    private String category = null;
+    private String subCategory = null;
+    private String heatTemplateArtifactUUId = null;
+    private Timestamp created = null;
+    private String modelVersion = null;
+    private Set<VnfResourceCustomization> vnfResourceCustomizations = new HashSet<>();
+    private Set<VfModule> vfModules = new HashSet<>();
+    private List<VfModuleCustomization> vfModuleCustomizations = new ArrayList<>();
 
     public VnfResource () { }
 
@@ -197,7 +196,7 @@ public class VnfResource extends MavenLikeVersioning implements Serializable {
        public List<VfModuleCustomization> getVfModuleCustomizations() {
                return this.vfModuleCustomizations == null ? new ArrayList<>() : this.vfModuleCustomizations;
        }
-       public void setVfModuleCustomizations(ArrayList<VfModuleCustomization> vfModuleCustomizations) {
+       public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
                this.vfModuleCustomizations = vfModuleCustomizations;
        }
        public void addVfModuleCustomization(VfModuleCustomization vfmc) {
index 64c0313..e510ee8 100644 (file)
@@ -32,19 +32,19 @@ public class VnfResourceCustomization extends MavenLikeVersioning implements Ser
        private static final long serialVersionUID = 768026109321305392L;
        
        private String modelCustomizationUuid = null;
-       private String modelInstanceName;
-       private Timestamp created;
+       private String modelInstanceName = null;
+       private Timestamp created = null;
        private String vnfResourceModelUuid = null;
-       private String vnfResourceModelUUID;
+       private String vnfResourceModelUUID = null;
        private Integer minInstances;
        private Integer maxInstances;
        private Integer availabilityZoneMaxCount;
        private VnfResource vnfResource;
-       private String nfFunction;
-       private String nfType;
-       private String nfRole;
-       private String nfNamingCode;
-       private String multiStageDesign;
+       private String nfFunction = null;
+       private String nfType = null;
+       private String nfRole = null;
+       private String nfNamingCode = null;
+       private String multiStageDesign = null;
     private List<VfModuleCustomization> vfModuleCustomizations;
     private Set<ServiceToResourceCustomization> serviceResourceCustomizations;
 
@@ -154,7 +154,7 @@ public class VnfResourceCustomization extends MavenLikeVersioning implements Ser
        public List<VfModuleCustomization> getVfModuleCustomizations() {
                return this.vfModuleCustomizations;
        }
-       public void setVfModuleCustomizations(ArrayList<VfModuleCustomization> vfModuleCustomizations) {
+       public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
                this.vfModuleCustomizations = vfModuleCustomizations;
        }
        public void addVfModuleCustomization(VfModuleCustomization vfmc) {
diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java
new file mode 100644 (file)
index 0000000..57bf292
--- /dev/null
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+import static org.hamcrest.CoreMatchers.isA;
+import static org.mockito.Matchers.eq;
+
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.Matcher;
+import org.junit.Test;
+import org.openecomp.mso.openpojo.rules.EqualsAndHashCodeTester;
+import org.openecomp.mso.openpojo.rules.HasToStringRule;
+import org.openecomp.mso.openpojo.rules.ToStringTester;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.PojoClassFilter;
+import com.openpojo.reflection.filters.FilterEnum;
+import com.openpojo.reflection.filters.FilterNonConcrete;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.SetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+
+public class BeansTest {
+
+       private PojoClassFilter filterTestClasses = new FilterTestClasses();
+       
+       private PojoClassFilter  enumFilter = new FilterEnum();
+       
+       
+
+       @Test
+       public void pojoStructure() {   
+               test("org.openecomp.mso.db.catalog.beans");             
+       }
+
+       private void test(String pojoPackage) {
+               Validator validator = ValidatorBuilder.create()
+                               .with(new GetterMustExistRule())
+                               .with(new SetterMustExistRule())
+                               .with(new HasToStringRule())
+                               
+                               
+                               .with(new SetterTester())
+                               .with(new GetterTester())
+                               .with(new ToStringTester())
+                               .with(new EqualsAndHashCodeTester().onlyDeclaredMethods())
+                               .build();
+               
+       
+               validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete());
+       }
+       private static class FilterTestClasses implements PojoClassFilter {
+               public boolean include(PojoClass pojoClass) {
+                       return !pojoClass.getSourcePath().contains("/test-classes/");
+               }
+       }
+}
index 0e34921..c819079 100644 (file)
@@ -40,7 +40,7 @@ public class ServiceMacroHolderTest {
                assertTrue(serviceMacroHolder.getService() == null);
                serviceMacroHolder.addVnfResource(new VnfResource());
                serviceMacroHolder.addVnfResourceCustomizations(new VnfResourceCustomization());
-               serviceMacroHolder.addNetworkResourceCustomization(new NetworkResourceCustomization());
+               serviceMacroHolder.addNetworkResourceCustomizations(new NetworkResourceCustomization());
                serviceMacroHolder.addAllottedResourceCustomization(new AllottedResourceCustomization());
                assertTrue(serviceMacroHolder != null);
        }
index 05e857f..162073c 100644 (file)
@@ -113,7 +113,7 @@ public class ToStringTest {
                smh.setNetworkResourceCustomization(networkResourceCustomizations);
                
                NetworkResourceCustomization nrc = new NetworkResourceCustomization();
-               smh.addNetworkResourceCustomization(nrc);
+               smh.addNetworkResourceCustomizations(nrc);
                
                ArrayList<AllottedResourceCustomization> allottedResourceCustomizations = new ArrayList<>();
                smh.setAllottedResourceCustomization(allottedResourceCustomizations);