From 1f8f50733aaaa103cdb7e34099179cba436f754c Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 28 Mar 2018 10:12:15 -0400 Subject: improved coverage for catalog db beans Change-Id: Ibf1fd21dc81f0a3e16447b05dfce1761efa69237 Issue-ID: SO-541 Signed-off-by: Benjamin, Max (mb388a) --- .../mso/db/catalog/beans/AllottedResource.java | 186 ++++++------- .../beans/AllottedResourceCustomization.java | 32 +-- .../openecomp/mso/db/catalog/beans/ArRecipe.java | 2 +- .../mso/db/catalog/beans/HeatEnvironment.java | 6 +- .../openecomp/mso/db/catalog/beans/HeatFiles.java | 12 +- .../mso/db/catalog/beans/HeatNestedTemplate.java | 20 +- .../mso/db/catalog/beans/HeatTemplate.java | 12 +- .../beans/HeatTemplateArtifactUuidModelUuid.java | 156 ++++++----- .../mso/db/catalog/beans/HeatTemplateParam.java | 39 +-- .../org/openecomp/mso/db/catalog/beans/Model.java | 16 +- .../mso/db/catalog/beans/ModelRecipe.java | 16 +- .../mso/db/catalog/beans/NetworkRecipe.java | 2 +- .../mso/db/catalog/beans/NetworkResource.java | 18 +- .../beans/NetworkResourceCustomization.java | 15 +- .../org/openecomp/mso/db/catalog/beans/Recipe.java | 12 +- .../openecomp/mso/db/catalog/beans/Service.java | 34 +-- .../mso/db/catalog/beans/ServiceMacroHolder.java | 66 +++-- .../mso/db/catalog/beans/ServiceRecipe.java | 12 +- .../catalog/beans/ServiceToAllottedResources.java | 10 +- .../mso/db/catalog/beans/ServiceToNetworks.java | 10 +- .../beans/ServiceToResourceCustomization.java | 221 ++++++++------- .../beans/TempNetworkHeatTemplateLookup.java | 196 ++++++------- .../openecomp/mso/db/catalog/beans/ToscaCsar.java | 231 ++++++++-------- .../openecomp/mso/db/catalog/beans/VfModule.java | 18 +- .../db/catalog/beans/VfModuleCustomization.java | 306 +++++++++++---------- .../mso/db/catalog/beans/VfModuleToHeatFiles.java | 4 +- .../mso/db/catalog/beans/VnfComponent.java | 8 +- .../mso/db/catalog/beans/VnfComponentsRecipe.java | 6 +- .../openecomp/mso/db/catalog/beans/VnfRecipe.java | 4 +- .../beans/VnfResCustomToVfModuleCustom.java | 180 ++++++------ .../mso/db/catalog/beans/VnfResource.java | 35 ++- .../db/catalog/beans/VnfResourceCustomization.java | 18 +- .../openecomp/mso/db/catalog/beans/BeansTest.java | 80 ++++++ .../db/catalog/test/ServiceMacroHolderTest.java | 2 +- .../mso/db/catalog/test/ToStringTest.java | 2 +- 35 files changed, 1056 insertions(+), 931 deletions(-) create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java (limited to 'mso-catalog-db') diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java index 0cd9487527..a0af4b2300 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResource.java @@ -1,93 +1,93 @@ -/*- - * ============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; - private String modelInvariantUuid; - private String modelVersion; - private String modelName; - private String toscaNodeType; - private String subcategory; - private String description; - private Timestamp created; - - 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; - } - -} +/*- + * ============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; + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java index 2dcc2e8e6e..e5a653760b 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java @@ -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; } } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java index e22d1eb036..d3532886d5 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ArRecipe.java @@ -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() { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java index fcd9211ec6..899127c048 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java @@ -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() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java index ec429c896e..8d7da22673 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java @@ -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() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java index df067445f6..1fff17612e 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatNestedTemplate.java @@ -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; } } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java index 03813a7299..c6386efdd6 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java @@ -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 parameters; private Set 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 diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java index f6202b7365..9bfc41b675 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateArtifactUuidModelUuid.java @@ -1,76 +1,80 @@ -/*- - * ============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; - -// an embeddable class to represent the Composite key for NetworkResource in the 1707 db refactoring -public class HeatTemplateArtifactUuidModelUuid implements Serializable { - - private String heatTemplateArtifactUuid; - private String modelUuid; - 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(); - } - -} +/*- + * ============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(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java index 7ceb19c5a0..7f7dd2b4c6 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplateParam.java @@ -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 () { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java index 96e6c616bf..5cd6b58aee 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java @@ -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 recipes; /** diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java index 7ef5a4a7b9..4ba35f7f42 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java @@ -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)); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java index eeaa363aa6..d10b633557 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkRecipe.java @@ -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() { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java index 025b13b708..d4e1ec536a 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResource.java @@ -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() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java index b581545182..f1d5d4f003 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java @@ -20,20 +20,25 @@ 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; diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java index 58c24412dc..3f2093b7e2 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Recipe.java @@ -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 (); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java index 37cad254ba..620c6bb17c 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Service.java @@ -20,32 +20,34 @@ 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 recipes; - private Set 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 recipes = new HashMap<>(); + private Set serviceResourceCustomizations = new HashSet<>(); public Service() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java index 78f94e40c1..d199671621 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java @@ -19,11 +19,9 @@ */ 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 vnfResources; - private ArrayList networkResourceCustomizations; - private ArrayList allottedResourceCustomizations; - private ArrayList vnfResourceCustomizations; + private List vnfResources; + private List networkResourceCustomization; + private List allottedResourceCustomization; + private List 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 vnfResources) { + public void setVnfResources(List vnfResources) { this.vnfResources = vnfResources; } - public ArrayList getVnfResources() { + public List getVnfResources() { return this.vnfResources; } public void addVnfResource(VnfResource vr) { @@ -77,10 +75,10 @@ public class ServiceMacroHolder implements Serializable { } } - public void setVnfResourceCustomizations(ArrayList vnfResourceCustomizations) { + public void setVnfResourceCustomizations(List vnfResourceCustomizations) { this.vnfResourceCustomizations = vnfResourceCustomizations; } - public ArrayList getVnfResourceCustomizations() { + public List getVnfResourceCustomizations() { return this.vnfResourceCustomizations; } public void addVnfResourceCustomizations(VnfResourceCustomization vrc) { @@ -94,33 +92,33 @@ public class ServiceMacroHolder implements Serializable { } } - public void setNetworkResourceCustomization(ArrayList networkResourceCustomizations) { - this.networkResourceCustomizations = networkResourceCustomizations; + public void setNetworkResourceCustomization(List networkResourceCustomizations) { + this.networkResourceCustomization = networkResourceCustomizations; } - public ArrayList getNetworkResourceCustomization() { - return this.networkResourceCustomizations; + public List 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 allottedResourceCustomizations) { - this.allottedResourceCustomizations = allottedResourceCustomizations; + public void setAllottedResourceCustomization(List allottedResourceCustomizations) { + this.allottedResourceCustomization = allottedResourceCustomizations; } - public ArrayList getAllottedResourceCustomization() { - return this.allottedResourceCustomizations; + public List 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()); } } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java index 303570a8d0..d0bc9b33f7 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java @@ -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); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java index 6515a12bc0..2ac71f4ddf 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java @@ -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; diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java index 69dc32796f..3894b4f7b5 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java @@ -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() { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java index 6d74ab38aa..3babe4ad23 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToResourceCustomization.java @@ -1,111 +1,110 @@ -/*- - * ============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; - -public class ServiceToResourceCustomization implements Serializable { - - private static final long serialVersionUID = 768026109321305392L; - - private String modelType; - private String serviceModelUUID; - private Timestamp created; - private String resourceModelCustomizationUUID; - - 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(Object o) { - if (!(o instanceof ServiceToResourceCustomization)) { - return false; - } - if (this == o) { - return true; - } - ServiceToResourceCustomization strc = (ServiceToResourceCustomization) o; - if (strc.getServiceModelUUID().equals(this.getServiceModelUUID()) - && strc.getResourceModelCustomizationUUID().equals(this.getResourceModelCustomizationUUID()) - && strc.getModelType().equals(this.getModelType())) { - return true; - } - return false; - - } - - @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(); - } - -} +/*- + * ============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(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java index 3ef7e6e237..6fd6e3e6ae 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/TempNetworkHeatTemplateLookup.java @@ -1,96 +1,100 @@ -/*- - * ============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; - -public class TempNetworkHeatTemplateLookup implements Serializable { - - private String networkResourceModelName; - private String heatTemplateArtifactUuid; - private String aicVersionMin; - private String aicVersionMax; - 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; - } - -} +/*- + * ============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; + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java index 591e648a33..92d02d8a11 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ToscaCsar.java @@ -1,115 +1,116 @@ -/*- - * ============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.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; - private String name; - private String artifactChecksum; - private String url; - private String description; - private Timestamp created; - private Set services; - - 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 getServices() { - return services; - } - - public void setServices(Set 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(); - } -} +/*- + * ============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 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 getServices() { + return services; + } + + public void setServices(Set 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(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java index cd2821a7b0..ec3bc7fefb 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java @@ -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(); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java index db3a2664a8..5b3dec4700 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleCustomization.java @@ -1,151 +1,155 @@ -/*- - * ============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; - -public class VfModuleCustomization implements Serializable { - - private String modelCustomizationUuid; - private String vfModuleModelUuid; - private String label; - private Integer minInstances; - private Integer maxInstances; - private Integer initialCount; - private Integer availabilityZoneCount; - private String heatEnvironmentArtifactUuid; - private String volEnvironmentArtifactUuid; - private Timestamp created; - 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; - } - -} +/*- + * ============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; + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java index 611604e830..3796650364 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModuleToHeatFiles.java @@ -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() { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java index e1795e1b04..9b701df1d2 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponent.java @@ -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() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java index 30a5133bd5..2240191d45 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java @@ -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() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java index 0dd38cbbc1..d94334c98d 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java @@ -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() {} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java index fd1e6b67b8..6b1cb0a19c 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResCustomToVfModuleCustom.java @@ -1,88 +1,92 @@ -/*- - * ============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; - -public class VnfResCustomToVfModuleCustom implements Serializable { - - private String vnfResourceCustModelCustomizationUuid; - private String vfModuleCustModelCustomizationUuid; - private Timestamp created; - - 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; - } - - -} +/*- + * ============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; + } + + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java index 806cbeb076..f8e6024e69 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java @@ -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 vnfResourceCustomizations; - private Set vfModules; - private List vfModuleList; - private List 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 vnfResourceCustomizations = new HashSet<>(); + private Set vfModules = new HashSet<>(); + private List vfModuleCustomizations = new ArrayList<>(); public VnfResource () { } @@ -197,7 +196,7 @@ public class VnfResource extends MavenLikeVersioning implements Serializable { public List getVfModuleCustomizations() { return this.vfModuleCustomizations == null ? new ArrayList<>() : this.vfModuleCustomizations; } - public void setVfModuleCustomizations(ArrayList vfModuleCustomizations) { + public void setVfModuleCustomizations(List vfModuleCustomizations) { this.vfModuleCustomizations = vfModuleCustomizations; } public void addVfModuleCustomization(VfModuleCustomization vfmc) { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java index 64c031397f..e510ee867d 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResourceCustomization.java @@ -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 vfModuleCustomizations; private Set serviceResourceCustomizations; @@ -154,7 +154,7 @@ public class VnfResourceCustomization extends MavenLikeVersioning implements Ser public List getVfModuleCustomizations() { return this.vfModuleCustomizations; } - public void setVfModuleCustomizations(ArrayList vfModuleCustomizations) { + public void setVfModuleCustomizations(List 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 index 0000000000..57bf292dd8 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/BeansTest.java @@ -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/"); + } + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java index 0e3492170e..c819079a40 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ServiceMacroHolderTest.java @@ -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); } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java index 05e857f178..162073cc76 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/ToStringTest.java @@ -113,7 +113,7 @@ public class ToStringTest { smh.setNetworkResourceCustomization(networkResourceCustomizations); NetworkResourceCustomization nrc = new NetworkResourceCustomization(); - smh.addNetworkResourceCustomization(nrc); + smh.addNetworkResourceCustomizations(nrc); ArrayList allottedResourceCustomizations = new ArrayList<>(); smh.setAllottedResourceCustomization(allottedResourceCustomizations); -- cgit 1.2.3-korg