From 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 30 Jul 2018 15:56:09 -0400 Subject: Containerization feature of SO Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) --- .../onap/so/db/catalog/beans/AllottedResource.java | 179 +++++++++++ .../beans/AllottedResourceCustomization.java | 242 +++++++++++++++ .../org/onap/so/db/catalog/beans/ArRecipe.java | 184 +++++++++++ .../so/db/catalog/beans/BuildingBlockDetail.java | 117 +++++++ .../CollectionNetworkResourceCustomization.java | 208 +++++++++++++ .../so/db/catalog/beans/CollectionResource.java | 181 +++++++++++ .../beans/CollectionResourceCustomization.java | 180 +++++++++++ ...llectionResourceInstanceGroupCustomization.java | 180 +++++++++++ ...ectionResourceInstanceGroupCustomizationId.java | 78 +++++ .../so/db/catalog/beans/ConfigurationResource.java | 171 +++++++++++ .../beans/ConfigurationResourceCustomization.java | 190 ++++++++++++ .../beans/ExternalServiceToInternalService.java | 132 ++++++++ .../onap/so/db/catalog/beans/HeatEnvironment.java | 163 ++++++++++ .../org/onap/so/db/catalog/beans/HeatFiles.java | 157 ++++++++++ .../org/onap/so/db/catalog/beans/HeatTemplate.java | 211 +++++++++++++ .../so/db/catalog/beans/HeatTemplateParam.java | 124 ++++++++ .../so/db/catalog/beans/HeatTemplateParamId.java | 75 +++++ .../onap/so/db/catalog/beans/InstanceGroup.java | 232 ++++++++++++++ .../so/db/catalog/beans/InstanceGroupType.java | 25 ++ .../java/org/onap/so/db/catalog/beans/Model.java | 229 ++++++++++++++ .../org/onap/so/db/catalog/beans/ModelRecipe.java | 206 +++++++++++++ .../NetworkCollectionResourceCustomization.java | 53 ++++ .../so/db/catalog/beans/NetworkInstanceGroup.java | 34 +++ .../onap/so/db/catalog/beans/NetworkRecipe.java | 174 +++++++++++ .../onap/so/db/catalog/beans/NetworkResource.java | 305 +++++++++++++++++++ .../beans/NetworkResourceCustomization.java | 171 +++++++++++ .../so/db/catalog/beans/OrchestrationAction.java | 45 +++ .../so/db/catalog/beans/OrchestrationStatus.java | 58 ++++ ...rchestrationStatusStateTransitionDirective.java | 133 ++++++++ .../OrchestrationStatusValidationDirective.java | 37 +++ .../java/org/onap/so/db/catalog/beans/Recipe.java | 35 +++ .../org/onap/so/db/catalog/beans/ResourceType.java | 43 +++ .../java/org/onap/so/db/catalog/beans/Service.java | 335 +++++++++++++++++++++ .../so/db/catalog/beans/ServiceProxyResource.java | 158 ++++++++++ .../beans/ServiceProxyResourceCustomization.java | 164 ++++++++++ .../onap/so/db/catalog/beans/ServiceRecipe.java | 184 +++++++++++ .../java/org/onap/so/db/catalog/beans/SubType.java | 25 ++ .../beans/TempNetworkHeatTemplateLookup.java | 119 ++++++++ .../beans/TempNetworkHeatTemplateLookupId.java | 78 +++++ .../org/onap/so/db/catalog/beans/ToscaCsar.java | 171 +++++++++++ .../onap/so/db/catalog/beans/VFCInstanceGroup.java | 34 +++ .../org/onap/so/db/catalog/beans/VfModule.java | 231 ++++++++++++++ .../so/db/catalog/beans/VfModuleCustomization.java | 199 ++++++++++++ .../so/db/catalog/beans/VnfComponentsRecipe.java | 171 +++++++++++ .../org/onap/so/db/catalog/beans/VnfRecipe.java | 187 ++++++++++++ .../org/onap/so/db/catalog/beans/VnfResource.java | 259 ++++++++++++++++ .../db/catalog/beans/VnfResourceCustomization.java | 253 ++++++++++++++++ .../beans/VnfcInstanceGroupCustomization.java | 169 +++++++++++ .../beans/VnfcInstanceGroupCustomizationId.java | 79 +++++ .../db/catalog/beans/macro/NorthBoundRequest.java | 185 ++++++++++++ .../db/catalog/beans/macro/OrchestrationFlow.java | 146 +++++++++ .../catalog/beans/macro/RainyDayHandlerStatus.java | 154 ++++++++++ .../onap/so/db/catalog/client/CatalogDbClient.java | 307 +++++++++++++++++++ .../data/projections/InlineAllottedResources.java | 64 ++++ .../catalog/data/projections/InlineNetworks.java | 72 +++++ .../db/catalog/data/projections/InlineService.java | 52 ++++ .../catalog/data/projections/InlineVfModules.java | 59 ++++ .../so/db/catalog/data/projections/InlineVnf.java | 76 +++++ .../AllottedResourceCustomizationRepository.java | 38 +++ .../repository/AllottedResourceRepository.java | 30 ++ .../data/repository/ArRecipeRepository.java | 31 ++ .../repository/BuildingBlockDetailRepository.java | 31 ++ ...tionNetworkResourceCustomizationRepository.java | 29 ++ .../CollectionResourceCustomizationRepository.java | 29 ++ ...sourceInstanceGroupCustomizationRepository.java | 34 +++ .../repository/CollectionResourceRepository.java | 29 ++ ...nfigurationResourceCustomizationRepository.java | 30 ++ .../ConfigurationResourceRepository.java | 29 ++ ...ExternalServiceToInternalServiceRepository.java | 32 ++ .../data/repository/HeatEnvironmentRepository.java | 30 ++ .../data/repository/HeatTemplateRepository.java | 30 ++ .../data/repository/InstanceGroupRepository.java | 29 ++ .../data/repository/ModelRecipeRepository.java | 33 ++ .../catalog/data/repository/ModelRepository.java | 33 ++ ...kCollectionResourceCustomizationRepository.java | 29 ++ .../repository/NetworkInstanceGroupRepository.java | 30 ++ .../data/repository/NetworkRecipeRepository.java | 30 ++ .../NetworkResourceCustomizationRepository.java | 39 +++ .../data/repository/NetworkResourceRepository.java | 43 +++ .../repository/NorthBoundRequestRepository.java | 32 ++ .../repository/OrchestrationFlowRepository.java | 35 +++ ...onStatusStateTransitionDirectiveRepository.java | 34 +++ .../RainyDayHandlerStatusRepository.java | 34 +++ ...erviceProxyResourceCustomizationRepository.java | 29 ++ .../repository/ServiceProxyResourceRepository.java | 29 ++ .../data/repository/ServiceRecipeRepository.java | 34 +++ .../catalog/data/repository/ServiceRepository.java | 98 ++++++ .../TempNetworkHeatTemplateRepository.java | 31 ++ .../data/repository/ToscaCsarRepository.java | 30 ++ .../repository/VFCInstanceGroupRepository.java | 30 ++ .../VFModuleCustomizationRepository.java | 32 ++ .../data/repository/VFModuleRepository.java | 58 ++++ .../repository/VnfComponentRecipeRepository.java | 39 +++ .../repository/VnfCustomizationRepository.java | 39 +++ .../data/repository/VnfRecipeRepository.java | 32 ++ .../data/repository/VnfResourceRepository.java | 41 +++ .../VnfcInstanceGroupCustomizationRepository.java | 33 ++ .../db/catalog/rest/beans/ServiceMacroHolder.java | 194 ++++++++++++ .../so/db/catalog/utils/MavenLikeVersioning.java | 112 +++++++ .../utils/MavenLikeVersioningComparator.java | 49 +++ .../db/catalog/utils/RecordNotFoundException.java | 50 +++ .../org/onap/so/db/catalog/utils/package-info.java | 26 ++ 102 files changed, 10272 insertions(+) create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ArRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionNetworkResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResource.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceInstanceGroupCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceInstanceGroupCustomizationId.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ExternalServiceToInternalService.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatEnvironment.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatFiles.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplate.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplateParam.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplateParamId.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/InstanceGroup.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/InstanceGroupType.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Model.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ModelRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkCollectionResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkInstanceGroup.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusStateTransitionDirective.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Recipe.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResource.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/TempNetworkHeatTemplateLookup.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/TempNetworkHeatTemplateLookupId.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ToscaCsar.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VFCInstanceGroup.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfComponentsRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomizationId.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineAllottedResources.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineNetworks.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineService.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineVfModules.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineVnf.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/AllottedResourceCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/AllottedResourceRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceInstanceGroupCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ExternalServiceToInternalServiceRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HeatEnvironmentRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HeatTemplateRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/InstanceGroupRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkCollectionResourceCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkInstanceGroupRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/TempNetworkHeatTemplateRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ToscaCsarRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFCInstanceGroupRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcInstanceGroupCustomizationRepository.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioningComparator.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/RecordNotFoundException.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/package-info.java (limited to 'mso-catalog-db/src/main/java/org/onap') diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java new file mode 100644 index 0000000000..75461c6cde --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java @@ -0,0 +1,179 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "allotted_resource") +public class AllottedResource implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + @BusinessKey + @Id + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Column(name = "SUBCATEGORY") + private String subcategory; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "allottedResource") + private Set allotedResourceCustomization; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID) + .append("modelVersion", modelVersion).append("modelName", modelName) + .append("toscaNodeType", toscaNodeType).append("subcategory", subcategory) + .append("description", description).append("created", created) + .append("allotedResourceCustomization", allotedResourceCustomization).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof AllottedResource)) { + return false; + } + AllottedResource castOther = (AllottedResource) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @LinkedResource + public Set getAllotedResourceCustomization() { + if (allotedResourceCustomization == null) + allotedResourceCustomization = new HashSet<>(); + return allotedResourceCustomization; + } + + public void setAllotedResourceCustomization(Set allotedResourceCustomization) { + this.allotedResourceCustomization = allotedResourceCustomization; + } + + 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 Date getCreated() { + return created; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java new file mode 100644 index 0000000000..f68c6d2502 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java @@ -0,0 +1,242 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "allotted_resource_customization") +public class AllottedResourceCustomization implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "PROVIDING_SERVICE_MODEL_INVARIANT_UUID") + private String providingServiceModelInvariantUUID; + + @Column(name = "PROVIDING_SERVICE_MODEL_UUID") + private String providingServiceModelUUID; + + @Column(name = "PROVIDING_SERVICE_MODEL_NAME") + private String providingServiceModelName; + + @Column(name = "TARGET_NETWORK_ROLE") + private String targetNetworkRole; + + @Column(name = "NF_FUNCTION") + private String nfFunction; + + @Column(name = "NF_TYPE") + private String nfType; + + @Column(name = "NF_ROLE") + private String nfRole; + + @Column(name = "NF_NAMING_CODE") + private String nfNamingCode; + + @Column(name = "MIN_INSTANCES") + private Integer minInstances; + + @Column(name = "MAX_INSTANCES") + private Integer maxInstances; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "AR_MODEL_UUID") + private AllottedResource allottedResource; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("created", created).append("modelInstanceName", modelInstanceName) + .append("providingServiceModelInvariantUUID", providingServiceModelInvariantUUID) + .append("providingServiceModelUUID", providingServiceModelUUID) + .append("providingServiceModelName", providingServiceModelName) + .append("targetNetworkRole", targetNetworkRole).append("nfFunction", nfFunction) + .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode) + .append("minInstances", minInstances).append("maxInstances", maxInstances) + .append("allottedResource", allottedResource).toString(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof AllottedResourceCustomization)) { + return false; + } + AllottedResourceCustomization castOther = (AllottedResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + public String getProvidingServiceModelUUID() { + return providingServiceModelUUID; + } + + public void setProvidingServiceModelUUID(String providingServiceModelUUID) { + this.providingServiceModelUUID = providingServiceModelUUID; + } + + public String getProvidingServiceModelName() { + return providingServiceModelName; + } + + public void setProvidingServiceModelName(String providingServiceModelName) { + this.providingServiceModelName = providingServiceModelName; + } + + public AllottedResourceCustomization() { + super(); + } + + public String getModelCustomizationUUID() { + return this.modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public Date getCreated() { + return this.created; + } + + public String getModelInstanceName() { + return this.modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + @LinkedResource + public AllottedResource getAllottedResource() { + return this.allottedResource; + } + + public void setAllottedResource(AllottedResource allottedResource) { + this.allottedResource = allottedResource; + } + + public String getProvidingServiceModelInvariantUUID() { + return this.providingServiceModelInvariantUUID; + } + + public void setProvidingServiceModelInvariantUUID(String providingServiceModelInvariantUUID) { + this.providingServiceModelInvariantUUID = providingServiceModelInvariantUUID; + } + + public String getTargetNetworkRole() { + return this.targetNetworkRole; + } + + public void setTargetNetworkRole(String targetNetworkRole) { + this.targetNetworkRole = targetNetworkRole; + } + + public String getNfFunction() { + return this.nfFunction; + } + + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + + public String getNfType() { + return this.nfType; + } + + public void setNfType(String nfType) { + this.nfType = nfType; + } + + public String getNfRole() { + return this.nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + + public String getNfNamingCode() { + return this.nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + 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; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ArRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ArRecipe.java new file mode 100644 index 0000000000..86ff743475 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ArRecipe.java @@ -0,0 +1,184 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "ar_recipe") +public class ArRecipe implements Recipe, Serializable { + private static final long serialVersionUID = 768026109321305392L; + + @Id + @Column(name = "ID", nullable = false) + private Integer id; + @BusinessKey + @Column(name = "MODEL_NAME", nullable = false) + private String modelName; + @BusinessKey + @Column(name = "ACTION", nullable = false) + private String action; + + @Column(name = "VERSION_STR", nullable = false) + private String version; + @BusinessKey + @Column(name = "SERVICE_TYPE") + private String serviceType; + + @Column(name = "DESCRIPTION") + private String description; + @BusinessKey + @Column(name = "ORCHESTRATION_URI", nullable = false) + private String orchestrationUri; + + @Column(name = "AR_PARAM_XSD") + private String paramXsd; + + @Column(name = "RECIPE_TIMEOUT") + private Integer recipeTimeout; + + @Column(name = "CREATION_TIMESTAMP", nullable = false, updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOrchestrationUri() { + return orchestrationUri; + } + + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + public String getParamXsd() { + return paramXsd; + } + + public void setParamXsd(String paramXsd) { + this.paramXsd = paramXsd; + } + + public Integer getRecipeTimeout() { + return recipeTimeout; + } + + public void setRecipeTimeout(Integer recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelName", getModelName()).append("action", getAction()) + .append("version", getVersion()).append("serviceType", getServiceType()) + .append("description", getDescription()).append("orchestrationUri", getOrchestrationUri()) + .append("paramXSD", getParamXsd()).append("recipeTimeout", getRecipeTimeout()) + .append("created", getCreated()).toString(); + } + + @Override + public boolean equals(final Object other) { + if (this == other) { + return true; + } + if (!(other instanceof ArRecipe)) { + return false; + } + ArRecipe castOther = (ArRecipe) other; + return new EqualsBuilder().append(getId(), castOther.getId()).append(getModelName(), castOther.getModelName()) + .append(getAction(), castOther.getAction()).append(getServiceType(), castOther.getServiceType()) + .append(getOrchestrationUri(), castOther.getOrchestrationUri()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(getId()).append(getModelName()).append(getAction()).append(getServiceType()) + .append(getOrchestrationUri()).toHashCode(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java new file mode 100644 index 0000000000..36a9db77ed --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "building_block_detail") +public class BuildingBlockDetail implements Serializable { + private static final long serialVersionUID = -2375223199178059155L; + + @Id + @Column(name = "id") + @GeneratedValue + private Integer id; + + @BusinessKey + @Column(name = "BUILDING_BLOCK_NAME") + private String buildingBlockName; + + @Enumerated(EnumType.STRING) + @Column(name = "RESOURCE_TYPE") + private ResourceType resourceType; + + @Enumerated(EnumType.STRING) + @Column(name = "TARGET_ACTION") + private OrchestrationAction targetAction; + + @Override + public String toString() { + return new ToStringBuilder(this).append("buildingBlockName", buildingBlockName) + .append("resourceType", resourceType).append("targetAction", targetAction).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof BuildingBlockDetail)) { + return false; + } + BuildingBlockDetail castOther = (BuildingBlockDetail) other; + return new EqualsBuilder().append(buildingBlockName, castOther.buildingBlockName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(buildingBlockName).toHashCode(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getBuildingBlockName() { + return buildingBlockName; + } + + public void setBuildingBlockName(String buildingBlockName) { + this.buildingBlockName = buildingBlockName; + } + + public ResourceType getResourceType() { + return resourceType; + } + + public void setResourceType(ResourceType resourceType) { + this.resourceType = resourceType; + } + + public OrchestrationAction getTargetAction() { + return targetAction; + } + + public void setTargetAction(OrchestrationAction targetAction) { + this.targetAction = targetAction; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionNetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionNetworkResourceCustomization.java new file mode 100644 index 0000000000..d4de5cbcdf --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionNetworkResourceCustomization.java @@ -0,0 +1,208 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "collection_network_resource_customization") +public class CollectionNetworkResourceCustomization implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 11115611315801079L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID = null; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @BusinessKey + @Column(name = "NETWORK_TECHNOLOGY") + private String networkTechnology; + + @BusinessKey + @Column(name = "NETWORK_TYPE") + private String networkType = null; + + @BusinessKey + @Column(name = "NETWORK_SCOPE") + private String networkScope; + + @BusinessKey + @Column(name = "NETWORK_ROLE") + private String networkRole; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID") + private NetworkResource networkResource = null; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID") + private InstanceGroup instanceGroup = null; + + @BusinessKey + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "CRC_MODEL_CUSTOMIZATION_UUID") + private NetworkCollectionResourceCustomization networkResourceCustomization = null; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CollectionNetworkResourceCustomization)) { + return false; + } + CollectionNetworkResourceCustomization castOther = (CollectionNetworkResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID) + .append(networkTechnology, castOther.networkTechnology).append(networkType, castOther.networkType) + .append(networkScope, castOther.networkScope).append(networkRole, castOther.networkRole) + .append(networkResourceCustomization, castOther.networkResourceCustomization).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).append(networkTechnology).append(networkType) + .append(networkScope).append(networkRole).append(networkResourceCustomization).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("created", created) + .append("networkTechnology", networkTechnology).append("networkType", networkType) + .append("networkScope", networkScope).append("networkRole", networkRole) + .append("networkResource", networkResource).append("collectionResource", networkResourceCustomization) + .toString(); + } + + public String getModelCustomizationUUID() { + return this.modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + @LinkedResource + public NetworkCollectionResourceCustomization getNetworkResourceCustomization() { + return networkResourceCustomization; + } + + public void setNetworkResourceCustomization(NetworkCollectionResourceCustomization networkResourceCustomization) { + this.networkResourceCustomization = networkResourceCustomization; + } + + public String getModelInstanceName() { + return this.modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + @LinkedResource + public NetworkResource getNetworkResource() { + return this.networkResource; + } + + public void setNetworkResource(NetworkResource networkResource) { + this.networkResource = networkResource; + } + + public String getNetworkType() { + return this.networkType; + } + + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public Date getCreated() { + return this.created; + } + + public String getNetworkTechnology() { + return this.networkTechnology; + } + + public void setNetworkTechnology(String networkTechnology) { + this.networkTechnology = networkTechnology; + } + + public String getNetworkScope() { + return this.networkScope; + } + + public void setNetworkScope(String networkScope) { + this.networkScope = networkScope; + } + + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + + public String getNetworkRole() { + return this.networkRole; + } + + @LinkedResource + public InstanceGroup getInstanceGroup() { + return instanceGroup; + } + + public void setInstanceGroup(InstanceGroup instanceGroup) { + this.instanceGroup = instanceGroup; + } + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResource.java new file mode 100644 index 0000000000..f8148aa781 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResource.java @@ -0,0 +1,181 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "collection_resource") +public class CollectionResource implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -8612818857960992110L; + + @BusinessKey + @Id + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "collectionResource") + private Set collectionResourceCustomization; + + @OneToOne(cascade = CascadeType.ALL, mappedBy = "collectionResource") + private InstanceGroup instanceGroup; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CollectionResource)) { + return false; + } + CollectionResource castOther = (CollectionResource) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } + + public Set getCollectionResourceCustomization() { + return collectionResourceCustomization; + } + + public void setCollectionResourceCustomization( + Set collectionResourceCustomization) { + this.collectionResourceCustomization = collectionResourceCustomization; + } + + public String getModelUUID() { + return modelUUID; + } + + public Date getCreated() { + return this.created; + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @LinkedResource + public InstanceGroup getInstanceGroup() { + return instanceGroup; + } + + public void setInstanceGroup(InstanceGroup instanceGroup) { + this.instanceGroup = instanceGroup; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelName", modelName) + .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion) + .append("toscaNodeType", toscaNodeType).append("description", description).append("created", created) + .toString(); + } +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceCustomization.java new file mode 100644 index 0000000000..34389de22f --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceCustomization.java @@ -0,0 +1,180 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.DiscriminatorColumn; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@DiscriminatorColumn(name = "OBJECT_TYPE") +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +@Table(name = "collection_resource_customization") +public class CollectionResourceCustomization implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -8328823396870652841L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "COLLECTION_RESOURCE_TYPE") + private String type; + + @Column(name = "ROLE") + private String role; + + @Column(name = "FUNCTION") + private String function; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "CR_MODEL_UUID") + private CollectionResource collectionResource; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "collectionResourceCust") + private List collectionInstanceGroupCustomizations; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("type", type).append("role", role) + .append("function", function).append("created", created) + .append("collectionResource", collectionResource) + .append("collectionInstanceGroupCustomizations", collectionInstanceGroupCustomizations).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CollectionResourceCustomization)) { + return false; + } + CollectionResourceCustomization castOther = (CollectionResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + public Date getCreated() { + return this.created; + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getFunction() { + return function; + } + + public void setFunction(String function) { + this.function = function; + } + + @LinkedResource + public CollectionResource getCollectionResource() { + return collectionResource; + } + + public void setCollectionResource(CollectionResource collectionResource) { + this.collectionResource = collectionResource; + } + + @LinkedResource + public List getCollectionInstanceGroupCustomizations() { + return collectionInstanceGroupCustomizations; + } + + public void setCollectionInstanceGroupCustomizations( + List collectionInstanceGroupCustomizations) { + this.collectionInstanceGroupCustomizations = collectionInstanceGroupCustomizations; + } +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceInstanceGroupCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceInstanceGroupCustomization.java new file mode 100644 index 0000000000..7379225a34 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceInstanceGroupCustomization.java @@ -0,0 +1,180 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@IdClass(CollectionResourceInstanceGroupCustomizationId.class) +@Table(name = "collection_resource_instance_group_customization") +public class CollectionResourceInstanceGroupCustomization implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 5169990063225044265L; + + @BusinessKey + @Id + @Column(name = "COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID") + private String modelCustomizationUUID; + + @BusinessKey + @Id + @Column(name = "INSTANCE_GROUP_MODEL_UUID") + private String modelUUID; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID", updatable = false, insertable = false) + private CollectionResourceCustomization collectionResourceCust; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID", updatable = false, insertable = false) + private InstanceGroup instanceGroup; + + @Column(name = "FUNCTION") + private String function; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "SUBINTERFACE_NETWORK_QUANTITY") + private Integer subInterfaceNetworkQuantity; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelUUID", modelUUID).append("collectionResourceCust", collectionResourceCust) + .append("instanceGroup", instanceGroup).append("function", function).append("description", description) + .append("created", created).append("subInterfaceNetworkQuantity", subInterfaceNetworkQuantity) + .toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CollectionResourceInstanceGroupCustomization)) { + return false; + } + CollectionResourceInstanceGroupCustomization castOther = (CollectionResourceInstanceGroupCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID) + .append(modelUUID, castOther.modelUUID).append(collectionResourceCust, castOther.collectionResourceCust) + .append(instanceGroup, castOther.instanceGroup).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).append(modelUUID).append(collectionResourceCust) + .append(instanceGroup).toHashCode(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getFunction() { + return function; + } + + public void setFunction(String function) { + this.function = function; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreated() { + return created; + } + + public Integer getSubInterfaceNetworkQuantity() { + return subInterfaceNetworkQuantity; + } + + public void setSubInterfaceNetworkQuantity(Integer subInterfaceNetworkQuantity) { + this.subInterfaceNetworkQuantity = subInterfaceNetworkQuantity; + } + + @LinkedResource + public CollectionResourceCustomization getCollectionResourceCust() { + return collectionResourceCust; + } + + public void setCollectionResourceCust(CollectionResourceCustomization collectionResourceCust) { + this.collectionResourceCust = collectionResourceCust; + } + + @LinkedResource + public InstanceGroup getInstanceGroup() { + return instanceGroup; + } + + public void setInstanceGroup(InstanceGroup instanceGroup) { + this.instanceGroup = instanceGroup; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceInstanceGroupCustomizationId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceInstanceGroupCustomizationId.java new file mode 100644 index 0000000000..ff35bdb390 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CollectionResourceInstanceGroupCustomizationId.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +public class CollectionResourceInstanceGroupCustomizationId implements Serializable { + /** + * + */ + private static final long serialVersionUID = 7118300524797895317L; + + @BusinessKey + private String modelCustomizationUUID; + @BusinessKey + private String modelUUID; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelUUID", modelUUID).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CollectionResourceInstanceGroupCustomizationId)) { + return false; + } + CollectionResourceInstanceGroupCustomizationId castOther = (CollectionResourceInstanceGroupCustomizationId) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID) + .append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).append(modelUUID).toHashCode(); + } + + public String getModelCustomizationUUID() { + return this.modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelUUID() { + return this.modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java new file mode 100644 index 0000000000..173480172d --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java @@ -0,0 +1,171 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" }) +@Entity +@Table(name = "configuration") +public class ConfigurationResource implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 6675926401792679171L; + + @BusinessKey + @Id + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "configurationResource") + private Set configurationResourceCustomization; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreated() { + return created; + } + + @LinkedResource + public Set getConfigurationResourceCustomization() { + return configurationResourceCustomization; + } + + public void setConfigurationResourceCustomization( + Set configurationResourceCustomization) { + this.configurationResourceCustomization = configurationResourceCustomization; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID) + .append("modelVersion", modelVersion).append("modelName", modelName) + .append("toscaNodeType", toscaNodeType).append("description", description).append("created", created) + .append("configurationResourceCustomization", configurationResourceCustomization).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ConfigurationResource)) { + return false; + } + ConfigurationResource castOther = (ConfigurationResource) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java new file mode 100644 index 0000000000..4f21580b9c --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java @@ -0,0 +1,190 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "configuration_customization") +public class ConfigurationResourceCustomization implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1230671937560638856L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "CONFIGURATION_FUNCTION") + private String nfFunction; + + @Column(name = "CONFIGURATION_TYPE") + private String nfType; + + @Column(name = "CONFIGURATION_ROLE") + private String nfRole; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID") + private ServiceProxyResourceCustomization serviceProxyResourceCustomization; + + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID") + private ConfigurationResourceCustomization configResourceCustomization; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "CONFIGURATION_MODEL_UUID") + private ConfigurationResource configurationResource; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getNfFunction() { + return nfFunction; + } + + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + + public String getNfType() { + return nfType; + } + + public void setNfType(String nfType) { + this.nfType = nfType; + } + + public String getNfRole() { + return nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + + public Date getCreated() { + return created; + } + + @LinkedResource + public ServiceProxyResourceCustomization getServiceProxyResourceCustomization() { + return serviceProxyResourceCustomization; + } + + public void setServiceProxyResourceCustomization( + ServiceProxyResourceCustomization serviceProxyResourceCustomization) { + this.serviceProxyResourceCustomization = serviceProxyResourceCustomization; + } + + @LinkedResource + public ConfigurationResourceCustomization getConfigResourceCustomization() { + return configResourceCustomization; + } + + public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) { + this.configResourceCustomization = configResourceCustomization; + } + + @LinkedResource + public ConfigurationResource getConfigurationResource() { + return configurationResource; + } + + public void setConfigurationResource(ConfigurationResource configurationResource) { + this.configurationResource = configurationResource; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction) + .append("nfType", nfType).append("nfRole", nfRole).append("created", created) + .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization) + .append("configResourceCustomization", configResourceCustomization) + .append("configurationResource", configurationResource).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ConfigurationResourceCustomization)) { + return false; + } + ConfigurationResourceCustomization castOther = (ConfigurationResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ExternalServiceToInternalService.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ExternalServiceToInternalService.java new file mode 100644 index 0000000000..d076aebf86 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ExternalServiceToInternalService.java @@ -0,0 +1,132 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "external_service_to_internal_model_mapping") +public class ExternalServiceToInternalService implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 3825246668050173010L; + + @Id + @Column(name = "Id") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @BusinessKey + @Column(name = "SERVICE_NAME") + private String serviceName; + + @BusinessKey + @Column(name = "PRODUCT_FLAVOR") + private String productFlavor; + + @BusinessKey + @Column(name = "SUBSCRIPTION_SERVICE_TYPE") + private String subscriptionServiceType; + + @BusinessKey + @Column(name = "SERVICE_MODEL_UUID") + private String serviceModelUUID; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ExternalServiceToInternalService)) { + return false; + } + ExternalServiceToInternalService castOther = (ExternalServiceToInternalService) other; + return new EqualsBuilder().append(serviceName, castOther.serviceName) + .append(productFlavor, castOther.productFlavor) + .append(subscriptionServiceType, castOther.subscriptionServiceType) + .append(serviceModelUUID, castOther.serviceModelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(serviceName).append(productFlavor).append(subscriptionServiceType) + .append(serviceModelUUID).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("serviceName", serviceName) + .append("productFlavor", productFlavor).append("subscriptionServiceType", subscriptionServiceType) + .append("serviceModelUUID", serviceModelUUID).toString(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getProductFlavor() { + return productFlavor; + } + + public void setProductFlavor(String productFlavor) { + this.productFlavor = productFlavor; + } + + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + public String getServiceModelUUID() { + return serviceModelUUID; + } + + public void setServiceModelUUID(String serviceModelUUID) { + this.serviceModelUUID = serviceModelUUID; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatEnvironment.java new file mode 100644 index 0000000000..6abe8d5110 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatEnvironment.java @@ -0,0 +1,163 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.text.DateFormat; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "heat_environment") +public class HeatEnvironment implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "ARTIFACT_UUID") + private String artifactUuid; + + @Column(name = "NAME") + private String name = null; + + @Column(name = "DESCRIPTION") + private String description = null; + + @Lob + @Column(name = "BODY", columnDefinition = "LONGTEXT") + private String environment = null; + + @Column(name = "ARTIFACT_CHECKSUM") + private String artifactChecksum; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @BusinessKey + @Column(name = "VERSION") + private String version; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof HeatEnvironment)) { + return false; + } + HeatEnvironment castOther = (HeatEnvironment) other; + return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).append(version, castOther.version) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(artifactUuid).append(version).toHashCode(); + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getArtifactUuid() { + return this.artifactUuid; + } + + public void setArtifactUuid(String artifactUuid) { + this.artifactUuid = artifactUuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getEnvironment() { + return this.environment; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public Date getCreated() { + return created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Artifact UUID=" + this.artifactUuid); + sb.append(", name="); + sb.append(name); + sb.append(", version="); + sb.append(version); + sb.append(", description="); + sb.append(this.description == null ? "null" : this.description); + sb.append(", body="); + sb.append(this.environment == null ? "null" : this.environment); + if (this.created != null) { + sb.append(",creationTimestamp="); + sb.append(DateFormat.getInstance().format(this.created)); + } + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatFiles.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatFiles.java new file mode 100644 index 0000000000..6fe1e08f0d --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatFiles.java @@ -0,0 +1,157 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "heat_files") +public class HeatFiles implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "ARTIFACT_UUID") + private String artifactUuid; + + @Column(name = "DESCRIPTION") + private String description = null; + + @Column(name = "NAME") + private String fileName; + + @Lob + @Column(name = "BODY", columnDefinition = "LONGTEXT") + private String fileBody; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "ARTIFACT_CHECKSUM") + private String artifactChecksum; + + @Column(name = "VERSION") + private String version; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("description", description) + .append("fileName", fileName).append("fileBody", fileBody).append("created", created) + .append("artifactChecksum", artifactChecksum).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof HeatFiles)) { + return false; + } + HeatFiles castOther = (HeatFiles) other; + return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(artifactUuid).toHashCode(); + } + + public String getArtifactUuid() { + return this.artifactUuid; + } + + public void setArtifactUuid(String artifactUuid) { + this.artifactUuid = artifactUuid; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getFileName() { + return this.fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileBody() { + return this.fileBody; + } + + public void setFileBody(String fileBody) { + this.fileBody = fileBody; + } + + public Date getCreated() { + return created; + } + + public String getAsdcUuid() { + return this.artifactUuid; + } + + public void setAsdcUuid(String artifactUuid) { + this.artifactUuid = artifactUuid; + } + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplate.java new file mode 100644 index 0000000000..2389793f33 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplate.java @@ -0,0 +1,211 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.Lob; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "heat_template") +public class HeatTemplate implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "ARTIFACT_UUID", length = 200) + private String artifactUuid; + + @Column(name = "NAME", length = 200) + private String templateName; + + @Lob + @Column(name = "BODY", columnDefinition = "LONGTEXT") + private String templateBody = null; + + @Column(name = "TIMEOUT_MINUTES", length = 20) + private Integer timeoutMinutes; + + @BusinessKey + @Column(name = "VERSION") + private String version; + + @Column(name = "DESCRIPTION", length = 1200) + private String description; + + @Column(name = "ARTIFACT_CHECKSUM", length = 200) + private String artifactChecksum; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "heatTemplateArtifactUuid") + private Set parameters; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "heat_nested_template", joinColumns = @JoinColumn(name = "PARENT_HEAT_TEMPLATE_UUID"), inverseJoinColumns = @JoinColumn(name = "CHILD_HEAT_TEMPLATE_UUID")) + private List childTemplates; + + public enum TemplateStatus { + PARENT, CHILD, PARENT_COMPLETE + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("templateName", templateName) + .append("templateBody", templateBody).append("timeoutMinutes", timeoutMinutes) + .append("version", version).append("description", description) + .append("artifactChecksum", artifactChecksum).append("created", created) + .append("parameters", parameters).append("childTemplates", childTemplates).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof HeatTemplate)) { + return false; + } + HeatTemplate castOther = (HeatTemplate) other; + return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).append(version, castOther.version) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(artifactUuid).append(version).toHashCode(); + } + + @LinkedResource + public List getChildTemplates() { + if (childTemplates == null) + childTemplates = new ArrayList<>(); + return childTemplates; + } + + public void setChildTemplates(List childTemplates) { + this.childTemplates = childTemplates; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getArtifactUuid() { + return this.artifactUuid; + } + + public void setArtifactUuid(String artifactUuid) { + this.artifactUuid = artifactUuid; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getTemplateBody() { + return templateBody; + } + + public void setTemplateBody(String templateBody) { + this.templateBody = templateBody; + } + + public Integer getTimeoutMinutes() { + return timeoutMinutes; + } + + public void setTimeoutMinutes(Integer timeout) { + this.timeoutMinutes = timeout; + } + + @LinkedResource + public Set getParameters() { + if (parameters == null) + parameters = new HashSet<>(); + return parameters; + } + + public void setParameters(Set parameters) { + this.parameters = parameters; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getHeatTemplate() { + return this.templateBody; + } + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public Date getCreated() { + return created; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplateParam.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplateParam.java new file mode 100644 index 0000000000..cdbe7aee7a --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplateParam.java @@ -0,0 +1,124 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@IdClass(HeatTemplateParamId.class) +@Entity +@Table(name = "heat_template_params") +public class HeatTemplateParam implements Serializable { + + @BusinessKey + @Id + @Column(name = "HEAT_TEMPLATE_ARTIFACT_UUID") + private String heatTemplateArtifactUuid; + + @BusinessKey + @Id + @Column(name = "PARAM_NAME") + private String paramName; + + @Column(name = "IS_REQUIRED") + private Boolean required; + + @Column(name = "PARAM_TYPE") + private String paramType; + + @Column(name = "PARAM_ALIAS") + private String paramAlias; + + public static final long serialVersionUID = -1322322139926390329L; + + @Override + public String toString() { + return new ToStringBuilder(this).append("heatTemplateArtifactUuid", heatTemplateArtifactUuid) + .append("paramName", paramName).append("required", required).append("paramType", paramType) + .append("paramAlias", paramAlias).toString(); + } + + @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() { + return new HashCodeBuilder().append(heatTemplateArtifactUuid).append(paramName).toHashCode(); + } + + public String getHeatTemplateArtifactUuid() { + return this.heatTemplateArtifactUuid; + } + + public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) { + this.heatTemplateArtifactUuid = heatTemplateArtifactUuid; + } + + public String getParamName() { + return paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + public Boolean isRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public String getParamAlias() { + return paramAlias; + } + + public void setParamAlias(String paramAlias) { + this.paramAlias = paramAlias; + } + + public String getParamType() { + return paramType; + } + + public void setParamType(String paramType) { + this.paramType = paramType; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplateParamId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplateParamId.java new file mode 100644 index 0000000000..61c199c43f --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/HeatTemplateParamId.java @@ -0,0 +1,75 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +public class HeatTemplateParamId implements Serializable { + @BusinessKey + private String heatTemplateArtifactUuid; + @BusinessKey + private String paramName; + + public static final long serialVersionUID = -1322322139926390329L; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof HeatTemplateParamId)) { + return false; + } + HeatTemplateParamId castOther = (HeatTemplateParamId) other; + return new EqualsBuilder().append(heatTemplateArtifactUuid, castOther.heatTemplateArtifactUuid) + .append(paramName, castOther.paramName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(heatTemplateArtifactUuid).append(paramName).toHashCode(); + } + + public String getHeatTemplateArtifactUuid() { + return this.heatTemplateArtifactUuid; + } + + public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) { + this.heatTemplateArtifactUuid = heatTemplateArtifactUuid; + } + + public String getParamName() { + return this.paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("heatTemplateArtifactUuid", heatTemplateArtifactUuid) + .append("paramName", paramName).toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/InstanceGroup.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/InstanceGroup.java new file mode 100644 index 0000000000..fdd250089a --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/InstanceGroup.java @@ -0,0 +1,232 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.DiscriminatorColumn; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@DiscriminatorColumn(name = "OBJECT_TYPE") +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +@Table(name = "instance_group") +public class InstanceGroup implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -263859017727376578L; + + @BusinessKey + @Id + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "ROLE") + private String role; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Enumerated(EnumType.STRING) + @Column(name = "INSTANCE_GROUP_TYPE") + private InstanceGroupType type; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "CR_MODEL_UUID") + private CollectionResource collectionResource; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "instanceGroup") + private List collectionInstanceGroupCustomizations; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "instanceGroup") + private List vnfcInstanceGroupCustomizations; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "instanceGroup") + private List collectionNetworkResourceCustomizations; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelName", modelName) + .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion) + .append("role", role).append("toscaNodeType", toscaNodeType).append("type", type) + .append("created", created).append("collectionResource", collectionResource) + .append("collectionInstanceGroupCustomizations", collectionInstanceGroupCustomizations) + .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof InstanceGroup)) { + return false; + } + InstanceGroup castOther = (InstanceGroup) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelUUID() { + return modelUUID; + } + + public Date getCreated() { + return created; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelName() { + return modelName; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public InstanceGroupType getType() { + return type; + } + + public void setType(InstanceGroupType type) { + this.type = type; + } + + @LinkedResource + public CollectionResource getCollectionResource() { + return collectionResource; + } + + public void setCollectionResource(CollectionResource collectionResource) { + this.collectionResource = collectionResource; + } + + @LinkedResource + public List getCollectionInstanceGroupCustomizations() { + return collectionInstanceGroupCustomizations; + } + + public void setCollectionInstanceGroupCustomizations( + List collectionInstanceGroupCustomizations) { + this.collectionInstanceGroupCustomizations = collectionInstanceGroupCustomizations; + } + + @LinkedResource + public List getVnfcInstanceGroupCustomizations() { + return vnfcInstanceGroupCustomizations; + } + + public void setVnfcInstanceGroupCustomizations( + List vnfcInstanceGroupCustomizations) { + this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations; + } + + @LinkedResource + public List getCollectionNetworkResourceCustomizations() { + return collectionNetworkResourceCustomizations; + } + + public void setCollectionNetworkResourceCustomizations( + List collectionNetworkResourceCustomizations) { + this.collectionNetworkResourceCustomizations = collectionNetworkResourceCustomizations; + } +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/InstanceGroupType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/InstanceGroupType.java new file mode 100644 index 0000000000..e67078b104 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/InstanceGroupType.java @@ -0,0 +1,25 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +public enum InstanceGroupType { + L3_NETWORK, VNFC; +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Model.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Model.java new file mode 100644 index 0000000000..9c5c23ef0e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Model.java @@ -0,0 +1,229 @@ +/*- + * ============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.onap.so.db.catalog.beans; + + +import java.io.Serializable; +import java.util.Date; +import java.util.Map; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.MapKey; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; +@Entity +@Table(name = "model") +public class Model implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @Id + @Column(name = "ID", nullable = false, updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + @Column(name = "MODEL_CUSTOMIZATION_ID", length = 40) + private String modelCustomizationId = null; + @Column(name = "MODEL_CUSTOMIZATION_NAME", length = 40) + private String modelCustomizationName = null; + @Column(name = "MODEL_INVARIANT_ID", length = 40) + private String modelInvariantId = null; + @Column(name = "MODEL_NAME", length = 40) + private String modelName = null; + @BusinessKey + @Column(name = "MODEL_TYPE", length = 20) + private String modelType = null; + @Column(name = "MODEL_VERSION", length = 20) + private String modelVersion = null; + @BusinessKey + @Column(name = "MODEL_VERSION_ID", length = 40) + private String modelVersionId = null; + @Column(name = "CREATION_TIMESTAMP", nullable = false, updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created = null; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy="modelId") + @MapKey(name = "action") + private Map recipes; + + /** + * @return the id + */ + public Integer getId() { + return id; + } + + /** + * @return the modelCustomizationId + */ + public String getModelCustomizationId() { + return modelCustomizationId; + } + + /** + * @param modelCustomizationId the modelCustomizationId to set + */ + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + /** + * @return the modelCustomizationName + */ + public String getModelCustomizationName() { + return modelCustomizationName; + } + + /** + * @param modelCustomizationName the modelCustomizationName to set + */ + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + /** + * @return the modelInvariantId + */ + public String getModelInvariantId() { + return modelInvariantId; + } + + /** + * @param modelInvariantId the modelInvariantId to set + */ + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + /** + * @return the modelName + */ + public String getModelName() { + return modelName; + } + + /** + * @param modelName the modelName to set + */ + public void setModelName(String modelName) { + this.modelName = modelName; + } + + /** + * @return the modelType + */ + public String getModelType() { + return modelType; + } + + /** + * @param modelType the modelType to set + */ + public void setModelType(String modelType) { + this.modelType = modelType; + } + + /** + * @return the modelVersion + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * @param modelVersion the modelVersion to set + */ + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + /** + * @return the modelVersionId + */ + public String getModelVersionId() { + return modelVersionId; + } + + /** + * @param modelVersionId the modelVersionId to set + */ + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + /** + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * @return the recipes + */ + public Map getRecipes() { + return recipes; + } + + /** + * @param recipes the recipes to set + */ + public void setRecipes(Map recipes) { + this.recipes = recipes; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Model)) { + return false; + } + Model castOther = (Model) other; + return new EqualsBuilder().append(getModelType(), castOther.getModelType()) + .append(getModelVersionId(), castOther.getModelVersionId()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(getModelType()).append(getModelVersionId()).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", getId()).append("modelCustomizationId", getModelCustomizationId()) + .append("modelCustomizationName", getModelCustomizationName()) + .append("modelInvariantId", getModelInvariantId()).append("modelName", getModelName()) + .append("modelType", getModelType()).append("modelVersion", getModelVersion()) + .append("modelVersionId", getModelVersionId()).append("created", getCreated()) + .append("recipes", getRecipes()).toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ModelRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ModelRecipe.java new file mode 100644 index 0000000000..3d7cb68172 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ModelRecipe.java @@ -0,0 +1,206 @@ +/*- + * ============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.onap.so.db.catalog.beans; + + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "model_recipe") +public class ModelRecipe implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @Id + @Column(name = "ID", nullable = false, updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + @BusinessKey + @Column(name = "MODEL_ID", nullable = false) + private Integer modelId; + @BusinessKey + @Column(name = "ACTION", length = 50) + private String action = null; + @Column(name = "SCHEMA_VERSION", length = 20) + private String schemaVersion = null; + @Column(name = "DESCRIPTION", length = 1200) + private String description = null; + @Column(name = "ORCHESTRATION_URI", length = 256) + private String orchestrationUri = null; + @Column(name = "MODEL_PARAM_XSD", length = 2048) + private String modelParamXSD = null; + @Column(name = "RECIPE_TIMEOUT") + private Integer recipeTimeout; + @Column(name = "CREATION_TIMESTAMP", nullable = false, updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created = null; + + /** + * @return the id + */ + public Integer getId() { + return id; + } + + /** + * @return the modelId + */ + public Integer getModelId() { + return modelId; + } + + /** + * @param modelId the modelId to set + */ + public void setModelId(Integer modelId) { + this.modelId = modelId; + } + + /** + * @return the action + */ + public String getAction() { + return action; + } + + /** + * @param action the action to set + */ + public void setAction(String action) { + this.action = action; + } + + /** + * @return the versionStr + */ + public String getSchemaVersion() { + return schemaVersion; + } + + /** + * @param schemaVersion the versionStr to set + */ + public void setSchemaVersion(String schemaVersion) { + this.schemaVersion = schemaVersion; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the orchestrationUri + */ + public String getOrchestrationUri() { + return orchestrationUri; + } + + /** + * @param orchestrationUri the orchestrationUri to set + */ + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + /** + * @return the modelParamXSD + */ + public String getModelParamXSD() { + return modelParamXSD; + } + + /** + * @param modelParamXSD the modelParamXSD to set + */ + public void setModelParamXSD(String modelParamXSD) { + this.modelParamXSD = modelParamXSD; + } + + /** + * @return the recipeTimeout + */ + public Integer getRecipeTimeout() { + return recipeTimeout; + } + + /** + * @param recipeTimeout the recipeTimeout to set + */ + public void setRecipeTimeout(Integer recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + /** + * @return the created + */ + public Date getCreated() { + return created; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ModelRecipe)) { + return false; + } + ModelRecipe castOther = (ModelRecipe) other; + return new EqualsBuilder().append(getModelId(), castOther.getModelId()) + .append(getAction(), castOther.getAction()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(getModelId()).append(getAction()).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", getId()).append("modelId", getModelId()) + .append("action", getAction()).append("schemaVersion", getSchemaVersion()) + .append("description", getDescription()).append("orchestrationUri", getOrchestrationUri()) + .append("modelParamXSD", getModelParamXSD()).append("recipeTimeout", getRecipeTimeout()) + .append("created", getCreated()).toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkCollectionResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkCollectionResourceCustomization.java new file mode 100644 index 0000000000..a1b51f9a6b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkCollectionResourceCustomization.java @@ -0,0 +1,53 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; +import javax.persistence.OneToMany; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@DiscriminatorValue(value = "NetworkCollection") +public class NetworkCollectionResourceCustomization extends CollectionResourceCustomization { + + /** + * + */ + private static final long serialVersionUID = -4571173204548832466L; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "networkResourceCustomization") + private Set networkResourceCustomization; + + @LinkedResource + public Set getNetworkResourceCustomization() { + return networkResourceCustomization; + } + + public void setNetworkResourceCustomization( + Set networkResourceCustomization) { + this.networkResourceCustomization = networkResourceCustomization; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkInstanceGroup.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkInstanceGroup.java new file mode 100644 index 0000000000..edda4b8122 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkInstanceGroup.java @@ -0,0 +1,34 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; + +@Entity +@DiscriminatorValue(value = "L3_NETWORK") +public class NetworkInstanceGroup extends InstanceGroup { + + /** + * + */ + private static final long serialVersionUID = 1934855643166769237L; +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkRecipe.java new file mode 100644 index 0000000000..73056e2f8c --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkRecipe.java @@ -0,0 +1,174 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "network_recipe") +public class NetworkRecipe implements Serializable, Recipe { + private static final long serialVersionUID = 768026109321305392L; + + @Id + @Column(name = "id") + private Integer id; + + @BusinessKey + @Column(name = "ACTION") + protected String action; + + @Column(name = "DESCRIPTION") + private String description; + + @BusinessKey + @Column(name = "ORCHESTRATION_URI") + protected String orchestrationUri; + + @Column(name = "RECIPE_TIMEOUT") + private Integer recipeTimeout; + + @BusinessKey + @Column(name = "SERVICE_TYPE") + private String serviceType; + + @BusinessKey + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "NETWORK_PARAM_XSD") + private String paramXsd; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkRecipe)) { + return false; + } + NetworkRecipe castOther = (NetworkRecipe) other; + return new EqualsBuilder().append(action, castOther.action).append(orchestrationUri, castOther.orchestrationUri) + .append(serviceType, castOther.serviceType).append(modelName, castOther.modelName).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(action).append(orchestrationUri).append(serviceType).append(modelName) + .toHashCode(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOrchestrationUri() { + return orchestrationUri; + } + + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + public Integer getRecipeTimeout() { + return recipeTimeout; + } + + public void setRecipeTimeout(Integer recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public Date getCreated() { + return created; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getParamXsd() { + return paramXsd; + } + + public void setParamXsd(String paramXsd) { + this.paramXsd = paramXsd; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(super.toString()); + sb.append(",modelName=" + modelName); + sb.append(",networkParamXSD=" + paramXsd); + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java new file mode 100644 index 0000000000..c31cd61ce0 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResource.java @@ -0,0 +1,305 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "network_resource") +public class NetworkResource implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "ORCHESTRATION_MODE") + private String orchestrationMode = null; + + @Column(name = "DESCRIPTION") + private String description = null; + + @Column(name = "NEUTRON_NETWORK_TYPE") + private String neutronNetworkType = null; + + @Column(name = "AIC_VERSION_MIN") + private String aicVersionMin = null; + + @Column(name = "AIC_VERSION_MAX") + private String aicVersionMax = null; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Column(name = "RESOURCE_CATEGORY") + private String category; + + @Column(name = "RESOURCE_SUB_CATEGORY") + private String subCategory; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "networkResource") + private List networkResourceCustomization; + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "networkResource") + private List collectionNetworkResourceCustomization; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "HEAT_TEMPLATE_ARTIFACT_UUID") + private HeatTemplate heatTemplate; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkResource)) { + return false; + } + NetworkResource castOther = (NetworkResource) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } + + @LinkedResource + public List getNetworkResourceCustomization() { + return networkResourceCustomization; + } + + public void addNetworkResourceCustomization(NetworkResourceCustomization networkResourceCustomization) { + if (this.networkResourceCustomization == null) + this.networkResourceCustomization = new ArrayList<>(); + + this.networkResourceCustomization.add(networkResourceCustomization); + } + + public void setNetworkResourceCustomization(List networkResourceCustomization) { + this.networkResourceCustomization = networkResourceCustomization; + } + + @LinkedResource + public List getCollectionNetworkResourceCustomization() { + return collectionNetworkResourceCustomization; + } + + public void setCollectionNetworkResourceCustomization( + List collectionNetworkResourceCustomization) { + this.collectionNetworkResourceCustomization = collectionNetworkResourceCustomization; + } + + public String getOrchestrationMode() { + return orchestrationMode; + } + + public void setOrchestrationMode(String orchestrationMode) { + this.orchestrationMode = orchestrationMode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getNeutronNetworkType() { + return neutronNetworkType; + } + + public void setNeutronNetworkType(String neutronNetworkType) { + this.neutronNetworkType = neutronNetworkType; + } + + public Date getCreated() { + return created; + } + + public String getAicVersionMin() { + return aicVersionMin; + } + + public void setAicVersionMin(String aicVersionMin) { + this.aicVersionMin = aicVersionMin; + } + + public String getAicVersionMax() { + return aicVersionMax; + } + + public void setAicVersionMax(String aicVersionMax) { + this.aicVersionMax = aicVersionMax; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + /** + * @return Returns the category. + */ + public String getCategory() { + return category; + } + + /** + * @param category + * The category to set. + */ + public void setCategory(String category) { + this.category = category; + } + + /** + * @return Returns the subCategory. + */ + public String getSubCategory() { + return subCategory; + } + + /** + * @param subCategory + * The subCategory to set. + */ + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + @LinkedResource + public HeatTemplate getHeatTemplate() { + return heatTemplate; + } + + public void setHeatTemplate(HeatTemplate heatTemplate) { + this.heatTemplate = heatTemplate; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("NETWORK Resource:"); + sb.append("modelVersion="); + sb.append(modelVersion); + sb.append(",mode="); + sb.append(orchestrationMode); + sb.append(",neutronType="); + sb.append(neutronNetworkType); + sb.append(",aicVersionMin="); + sb.append(aicVersionMin); + sb.append(",aicVersionMax="); + sb.append(aicVersionMax); + sb.append(",modelName="); + sb.append(modelName); + sb.append(",modelInvariantUUID="); + sb.append(modelInvariantUUID); + sb.append(",toscaNodeType="); + sb.append(toscaNodeType); + sb.append(",modelUUID="); + sb.append(modelUUID); + + 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/onap/so/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java new file mode 100644 index 0000000000..7afeac7710 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java @@ -0,0 +1,171 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "network_resource_customization") +public class NetworkResourceCustomization implements Serializable { + public static final long serialVersionUID = -1322322139926390329L; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("created", created) + .append("networkTechnology", networkTechnology).append("networkType", networkType) + .append("networkScope", networkScope).append("networkRole", networkRole) + .append("networkResource", networkResource).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkResourceCustomization)) { + return false; + } + NetworkResourceCustomization castOther = (NetworkResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + public NetworkResourceCustomization() { + super(); + } + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID = null; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "NETWORK_TECHNOLOGY") + private String networkTechnology; + + @Column(name = "NETWORK_TYPE") + private String networkType = null; + + @Column(name = "NETWORK_SCOPE") + private String networkScope; + + @Column(name = "NETWORK_ROLE") + private String networkRole; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID") + private NetworkResource networkResource = null; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelCustomizationUUID() { + return this.modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return this.modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + @LinkedResource + public NetworkResource getNetworkResource() { + return this.networkResource; + } + + public void setNetworkResource(NetworkResource networkResource) { + this.networkResource = networkResource; + } + + public String getNetworkType() { + return this.networkType; + } + + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public Date getCreated() { + return this.created; + } + + public String getNetworkTechnology() { + return this.networkTechnology; + } + + public void setNetworkTechnology(String networkTechnology) { + this.networkTechnology = networkTechnology; + } + + public String getNetworkScope() { + return this.networkScope; + } + + public void setNetworkScope(String networkScope) { + this.networkScope = networkScope; + } + + public void setNetworkRole(String networkRole) { + this.networkRole = networkRole; + } + + public String getNetworkRole() { + return this.networkRole; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java new file mode 100644 index 0000000000..d831d1ebd2 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +//TODO find this file a new location? +public enum OrchestrationAction { + ASSIGN("Assign"), + UNASSIGN("Unassign"), + ACTIVATE("Activate"), + DEACTIVATE("Deactivate"), + CHANGE_MODEL("ChangeModel"), + CREATE("Create"), + DELETE("Delete"), + UPDATE("Update"), + CUSTOM("Custom"); + + private final String name; + + private OrchestrationAction(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java new file mode 100644 index 0000000000..b893cec0f2 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java @@ -0,0 +1,58 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +public enum OrchestrationStatus { + ACTIVE("Active", "active"), + ASSIGNED("Assigned", "assigned"), + CREATED("Created", "created"), + INVENTORIED("Inventoried", "inventoried"), + PENDING("Pending", "pending"), + PENDING_ACTIVATION("PendingActivation", "pending.?activation"), + PENDING_CREATE("PendingCreate", "pending.?create"), + PENDING_DELETE("PendingDelete", "pending.?delete"), + PRECREATED("PreCreated", "pre.?created"); + + private final String name; + private final String fuzzyMatcher; + private OrchestrationStatus(String name, String fuzzyMatcher) { + this.name = name; + this.fuzzyMatcher = fuzzyMatcher; + } + + @Override + public String toString() { + return name; + } + /** + * case insensitive regular expression match to enum value + * + * @param status + * @return + */ + public boolean fuzzyMap(String status) { + if (status != null) { + return status.matches("(?i)" + this.fuzzyMatcher); + } else { + return false; + } + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusStateTransitionDirective.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusStateTransitionDirective.java new file mode 100644 index 0000000000..517b17af91 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusStateTransitionDirective.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "orchestration_status_state_transition_directive") +public class OrchestrationStatusStateTransitionDirective implements Serializable { + private static final long serialVersionUID = -4626396955833442376L; + + @Id + @Column(name = "id") + @GeneratedValue + private Integer id; + + @Enumerated(EnumType.STRING) + @Column(name = "RESOURCE_TYPE") + @BusinessKey + private ResourceType resourceType; + + @Enumerated(EnumType.STRING) + @Column(name = "ORCHESTRATION_STATUS") + @BusinessKey + private OrchestrationStatus orchestrationStatus; + + @Enumerated(EnumType.STRING) + @Column(name = "TARGET_ACTION") + @BusinessKey + private OrchestrationAction targetAction; + + @Enumerated(EnumType.STRING) + @Column(name = "FLOW_DIRECTIVE") + @BusinessKey + private OrchestrationStatusValidationDirective flowDirective; + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("resourceType", resourceType) + .append("orchestrationStatus", orchestrationStatus).append("targetAction", targetAction) + .append("flowDirective", flowDirective).toString(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public ResourceType getResourceType() { + return resourceType; + } + + public void setResourceType(ResourceType resourceType) { + this.resourceType = resourceType; + } + + public OrchestrationStatus getOrchestrationStatus() { + return orchestrationStatus; + } + + public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + + public OrchestrationAction getTargetAction() { + return targetAction; + } + + public void setTargetAction(OrchestrationAction targetAction) { + this.targetAction = targetAction; + } + + public OrchestrationStatusValidationDirective getFlowDirective() { + return flowDirective; + } + + public void setFlowDirective(OrchestrationStatusValidationDirective flowDirective) { + this.flowDirective = flowDirective; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof OrchestrationStatusStateTransitionDirective)) { + return false; + } + OrchestrationStatusStateTransitionDirective castOther = (OrchestrationStatusStateTransitionDirective) other; + return new EqualsBuilder().append(getResourceType(), castOther.getResourceType()) + .append(getOrchestrationStatus(), castOther.getOrchestrationStatus()) + .append(getTargetAction(), castOther.getTargetAction()) + .append(getFlowDirective(), castOther.getFlowDirective()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(getResourceType()).append(getOrchestrationStatus()) + .append(getTargetAction()).append(getFlowDirective()).toHashCode(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java new file mode 100644 index 0000000000..544e1cbf08 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatusValidationDirective.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +//TODO find this file a new location? +public enum OrchestrationStatusValidationDirective { + SILENT_SUCCESS("SilentSuccess"), CONTINUE("Continue"), FAIL("Fail"); + + private final String name; + + private OrchestrationStatusValidationDirective(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Recipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Recipe.java new file mode 100644 index 0000000000..ff6b713e6b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Recipe.java @@ -0,0 +1,35 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +public interface Recipe { + public Integer getId(); + + public String getAction(); + + public String getDescription(); + + public String getParamXsd(); + + public String getOrchestrationUri(); + + public Integer getRecipeTimeout(); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java new file mode 100644 index 0000000000..8e1d498e42 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +public enum ResourceType { + SERVICE("Service"), + VNF("Vnf"), + VOLUME_GROUP("VolumeGroup"), + VF_MODULE("VfModule"), + NETWORK("Network"), + NETWORK_COLLECTION("NetworkCollection"), + CONFIGURATION("Configuration"), + CUSTOM("Custom"); + + private final String name; + + private ResourceType(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java new file mode 100644 index 0000000000..6eb453805b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java @@ -0,0 +1,335 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToOne; +import javax.persistence.MapKey; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "service") +public class Service implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "DESCRIPTION", length = 1200) + private String description; + + @BusinessKey + @Id + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "SERVICE_TYPE") + private String serviceType; + + @Column(name = "SERVICE_ROLE") + private String serviceRole; + + @Column(name = "ENVIRONMENT_CONTEXT") + private String environmentContext; + + @Column(name = "WORKLOAD_CONTEXT") + private String workloadContext; + + @Column(name = "SERVICE_CATEGORY") + private String category; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "network_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID")) + private List networkCustomizations; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "vnf_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID")) + private List vnfCustomizations; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "allotted_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID")) + private List allottedCustomizations; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "collection_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID")) + private List collectionResourceCustomizations; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "service_proxy_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID")) + private List serviceProxyCustomizations; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "configuration_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID")) + private List configurationCustomizations; + + @OneToMany(cascade = CascadeType.ALL) + @MapKey(name = "action") + @JoinColumn(name = "SERVICE_MODEL_UUID") + private Map recipes; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID") + private ToscaCsar csar; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelName", modelName).append("description", description) + .append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID) + .append("created", created).append("modelVersion", modelVersion).append("serviceType", serviceType) + .append("serviceRole", serviceRole).append("environmentContext", environmentContext) + .append("workloadContext", workloadContext).append("category", category) + .append("networkCustomizations", networkCustomizations).append("vnfCustomizations", vnfCustomizations) + .append("allottedCustomizations", allottedCustomizations) + .append("collectionResourceCustomizations", collectionResourceCustomizations) + .append("serviceProxyCustomizations", serviceProxyCustomizations) + .append("configurationCustomizations", configurationCustomizations).append("recipes", recipes) + .append("csar", csar).toString(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof Service)) { + return false; + } + Service castOther = (Service) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } + + @LinkedResource + public List getServiceProxyCustomizations() { + return serviceProxyCustomizations; + } + + public void setServiceProxyCustomizations(List serviceProxyCustomizations) { + this.serviceProxyCustomizations = serviceProxyCustomizations; + } + + @LinkedResource + public List getNetworkCustomizations() { + if (networkCustomizations == null) + networkCustomizations = new ArrayList<>(); + return networkCustomizations; + } + + public void setNetworkCustomizations(List networkCustomizations) { + this.networkCustomizations = networkCustomizations; + } + + @LinkedResource + public List getVnfCustomizations() { + if (vnfCustomizations == null) + vnfCustomizations = new ArrayList<>(); + return vnfCustomizations; + } + + public void setVnfCustomizations(List vnfCustomizations) { + this.vnfCustomizations = vnfCustomizations; + } + + @LinkedResource + public List getAllottedCustomizations() { + if (allottedCustomizations == null) + allottedCustomizations = new ArrayList<>(); + return allottedCustomizations; + } + + public void setAllottedCustomizations(List allotedCustomizations) { + this.allottedCustomizations = allotedCustomizations; + } + + @LinkedResource + public List getCollectionResourceCustomizations() { + if (collectionResourceCustomizations == null) + collectionResourceCustomizations = new ArrayList<>(); + return collectionResourceCustomizations; + } + + public void setCollectionResourceCustomizations( + List collectionResourceCustomizations) { + this.collectionResourceCustomizations = collectionResourceCustomizations; + } + + @LinkedResource + public List getConfigurationCustomizations() { + if(configurationCustomizations == null) + configurationCustomizations = new ArrayList<>(); + return configurationCustomizations; + } + + public void setConfigurationCustomizations(List configurationCustomizations) { + this.configurationCustomizations = configurationCustomizations; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @LinkedResource + public Map getRecipes() { + return recipes; + } + + public void setRecipes(Map recipes) { + this.recipes = recipes; + } + + public Date getCreated() { + return created; + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + /** + * @return Returns the category. + */ + public String getCategory() { + return category; + } + + /** + * @param category + * The category to set. + */ + public void setCategory(String category) { + this.category = category; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceRole() { + return serviceRole; + } + + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + + public String getEnvironmentContext() { + return this.environmentContext; + } + + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + + @LinkedResource + public ToscaCsar getCsar() { + return csar; + } + + public void setCsar(ToscaCsar csar) { + this.csar = csar; + } + + public String getWorkloadContext() { + return this.workloadContext; + } + + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResource.java new file mode 100644 index 0000000000..a3f12edef4 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResource.java @@ -0,0 +1,158 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" }) +@Entity +@Table(name = "service_proxy") +public class ServiceProxyResource implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 8113564204017394906L; + + @BusinessKey + @Id + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "serviceProxyResource") + private Set serviceProxyCustomization; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreated() { + return created; + } + + @LinkedResource + public Set getServiceProxyCustomization() { + return serviceProxyCustomization; + } + + public void setServiceProxyCustomization(Set serviceProxyCustomization) { + this.serviceProxyCustomization = serviceProxyCustomization; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID) + .append("modelVersion", modelVersion).append("modelName", modelName).append("description", description) + .append("created", created).append("serviceProxyCustomization", serviceProxyCustomization).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceProxyResource)) { + return false; + } + ServiceProxyResource castOther = (ServiceProxyResource) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java new file mode 100644 index 0000000000..3df22bc716 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java @@ -0,0 +1,164 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "service_proxy_customization") +public class ServiceProxyResourceCustomization implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -2822457299134903084L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "SOURCE_SERVICE_MODEL_UUID") + private Service sourceService; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "SERVICE_PROXY_MODEL_UUID") + private ServiceProxyResource serviceProxyResource; + + @OneToOne(mappedBy = "serviceProxyResourceCustomization") + private ConfigurationResourceCustomization configResourceCustomization; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + public Date getCreated() { + return created; + } + + @LinkedResource + public Service getSourceService() { + return sourceService; + } + + public void setSourceService(Service sourceService) { + this.sourceService = sourceService; + } + + @LinkedResource + public ServiceProxyResource getServiceProxyResource() { + return serviceProxyResource; + } + + public void setServiceProxyResource(ServiceProxyResource serviceProxyResource) { + this.serviceProxyResource = serviceProxyResource; + } + + @LinkedResource + public ConfigurationResourceCustomization getConfigResourceCustomization() { + return configResourceCustomization; + } + + public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) { + this.configResourceCustomization = configResourceCustomization; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("toscaNodeType", toscaNodeType) + .append("created", created).append("sourceService", sourceService) + .append("serviceProxyResource", serviceProxyResource) + .append("configResourceCustomization", configResourceCustomization).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceProxyResourceCustomization)) { + return false; + } + ServiceProxyResourceCustomization castOther = (ServiceProxyResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java new file mode 100644 index 0000000000..d063ea4809 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java @@ -0,0 +1,184 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "service_recipe") +public class ServiceRecipe implements Serializable, Recipe { + + private static final long serialVersionUID = 768026109321305392L; + + @Id + @Column(name = "id") + private Integer id; + + @BusinessKey + @Column(name = "SERVICE_MODEL_UUID") + private String serviceModelUUID; + + @BusinessKey + @Column(name = "ACTION") + private String action; + + @Column(name = "description") + private String description; + + @BusinessKey + @Column(name = "ORCHESTRATION_URI") + private String orchestrationUri; + + @Column(name = "SERVICE_PARAM_XSD") + private String paramXsd; + + @Column(name = "RECIPE_TIMEOUT") + private Integer recipeTimeout; + + @Column(name = "SERVICE_TIMEOUT_INTERIM") + private Integer serviceTimeoutInterim; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("serviceModelUUID", serviceModelUUID) + .append("action", action).append("description", description) + .append("orchestrationUri", orchestrationUri).append("serviceParamXSD", paramXsd) + .append("recipeTimeout", recipeTimeout).append("serviceTimeoutInterim", serviceTimeoutInterim) + .append("created", created).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ServiceRecipe)) { + return false; + } + ServiceRecipe castOther = (ServiceRecipe) other; + return new EqualsBuilder().append(serviceModelUUID, castOther.serviceModelUUID).append(action, castOther.action) + .append(orchestrationUri, castOther.orchestrationUri).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(serviceModelUUID).append(action).append(orchestrationUri).toHashCode(); + } + + // This 'default' CTR is now needed for backward compatibility since a new + // CTR was added below + public ServiceRecipe() { + super(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public void setCreated(Date created) { + this.created = created; + } + + public String getServiceModelUUID() { + return serviceModelUUID; + } + + public void setServiceModelUUID(String serviceModelUUID) { + this.serviceModelUUID = serviceModelUUID; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOrchestrationUri() { + return orchestrationUri; + } + + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + public String getParamXsd() { + return paramXsd; + } + + public void setParamXsd(String paramXsd) { + this.paramXsd = paramXsd; + } + + public Integer getRecipeTimeout() { + return recipeTimeout; + } + + public void setRecipeTimeout(Integer recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + public Integer getServiceTimeoutInterim() { + return serviceTimeoutInterim; + } + + public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) { + this.serviceTimeoutInterim = serviceTimeoutInterim; + } + + public Date getCreated() { + return created; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java new file mode 100644 index 0000000000..bc4f07b54b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/SubType.java @@ -0,0 +1,25 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +public enum SubType { + SUB_INTERFACE +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/TempNetworkHeatTemplateLookup.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/TempNetworkHeatTemplateLookup.java new file mode 100644 index 0000000000..484a5a9e97 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/TempNetworkHeatTemplateLookup.java @@ -0,0 +1,119 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "temp_network_heat_template_lookup") +@IdClass(TempNetworkHeatTemplateLookupId.class) +public class TempNetworkHeatTemplateLookup implements Serializable { + + public static final long serialVersionUID = -1322322139926390329L; + + @BusinessKey + @Id + @Column(name = "NETWORK_RESOURCE_MODEL_NAME") + private String networkResourceModelName; + + @BusinessKey + @Id + @Column(name = "HEAT_TEMPLATE_ARTIFACT_UUID") + private String heatTemplateArtifactUuid; + + @Column(name = "AIC_VERSION_MIN") + private String aicVersionMin; + + @Column(name = "AIC_VERSION_MAX") + private String aicVersionMax; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof TempNetworkHeatTemplateLookup)) { + return false; + } + TempNetworkHeatTemplateLookup castOther = (TempNetworkHeatTemplateLookup) other; + return new EqualsBuilder().append(networkResourceModelName, castOther.networkResourceModelName) + .append(heatTemplateArtifactUuid, castOther.heatTemplateArtifactUuid).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(networkResourceModelName).append(heatTemplateArtifactUuid).toHashCode(); + } + + 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() { + StringBuilder sb = new StringBuilder(); + sb.append("NetworkResourceModelName=" + this.networkResourceModelName); + sb.append("HeatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid); + sb.append("aicVersionMin=" + this.aicVersionMin); + sb.append("aicVersionMax=" + this.aicVersionMax); + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/TempNetworkHeatTemplateLookupId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/TempNetworkHeatTemplateLookupId.java new file mode 100644 index 0000000000..2be6fe4e12 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/TempNetworkHeatTemplateLookupId.java @@ -0,0 +1,78 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +public class TempNetworkHeatTemplateLookupId implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3660507980620002091L; + @BusinessKey + private String networkResourceModelName; + @BusinessKey + private String heatTemplateArtifactUuid; + + @Override + public String toString() { + return new ToStringBuilder(this).append("networkResourceModelName", networkResourceModelName) + .append("heatTemplateArtifactUuid", heatTemplateArtifactUuid).toString(); + } + + public String getNetworkResourceModelName() { + return networkResourceModelName; + } + + public void setNetworkResourceModelName(String networkResourceModelName) { + this.networkResourceModelName = networkResourceModelName; + } + + public String getHeatTemplateArtifactUuid() { + return heatTemplateArtifactUuid; + } + + public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) { + this.heatTemplateArtifactUuid = heatTemplateArtifactUuid; + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof TempNetworkHeatTemplateLookupId)) { + return false; + } + TempNetworkHeatTemplateLookupId castOther = (TempNetworkHeatTemplateLookupId) other; + return new EqualsBuilder().append(networkResourceModelName, castOther.networkResourceModelName) + .append(heatTemplateArtifactUuid, castOther.heatTemplateArtifactUuid).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(networkResourceModelName).append(heatTemplateArtifactUuid).toHashCode(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ToscaCsar.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ToscaCsar.java new file mode 100644 index 0000000000..567675044e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ToscaCsar.java @@ -0,0 +1,171 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "tosca_csar") +public class ToscaCsar implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "ARTIFACT_UUID") + private String artifactUUID; + + @Column(name = "NAME") + private String name; + + @Column(name = "ARTIFACT_CHECKSUM") + private String artifactChecksum; + + @Column(name = "URL") + private String url; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @BusinessKey + @Column(name = "Version") + private String version; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "csar") + @JsonIgnore + private List services; + + @Override + public String toString() { + return new ToStringBuilder(this).append("artifactUUID", artifactUUID).append("name", name) + .append("artifactChecksum", artifactChecksum).append("url", url).append("description", description) + .append("created", created).append("version", version).append("services", services).toString(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof ToscaCsar)) { + return false; + } + ToscaCsar castOther = (ToscaCsar) other; + return new EqualsBuilder().append(artifactUUID, castOther.artifactUUID).append(version, castOther.version) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(artifactUUID).append(version).toHashCode(); + } + + 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 getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + 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 Date getCreated() { + return created; + } + + @LinkedResource + public List getServices() { + return services; + } + + public void setServices(List services) { + this.services = services; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VFCInstanceGroup.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VFCInstanceGroup.java new file mode 100644 index 0000000000..e44309e258 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VFCInstanceGroup.java @@ -0,0 +1,34 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; + +@Entity +@DiscriminatorValue(value = "VNFC") +public class VFCInstanceGroup extends InstanceGroup { + + /** + * + */ + private static final long serialVersionUID = -6254325954630189563L; +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java new file mode 100644 index 0000000000..47d82bff06 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java @@ -0,0 +1,231 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "vf_module") +public class VfModule implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @Id + @BusinessKey + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "IS_BASE") + private Boolean isBase; + + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "VOL_HEAT_TEMPLATE_ARTIFACT_UUID") + private HeatTemplate volumeHeatTemplate; + + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "HEAT_TEMPLATE_ARTIFACT_UUID") + private HeatTemplate moduleHeatTemplate; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "vf_module_to_heat_files", joinColumns = @JoinColumn(name = "VF_MODULE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "HEAT_FILES_ARTIFACT_UUID")) + private List heatFiles; + + @OneToMany(mappedBy = "vfModule") + private List vfModuleCustomization; + + @ManyToOne + @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID") + private VnfResource vnfResources; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID) + .append("modelName", modelName).append("modelVersion", modelVersion).append("description", description) + .append("isBase", isBase).append("volumeHeatTemplate", volumeHeatTemplate) + .append("moduleHeatTemplate", moduleHeatTemplate).append("created", created) + .append("heatFiles", heatFiles).append("vfModuleCustomization", vfModuleCustomization) + .append("vnfResources", vnfResources).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VfModule)) { + return false; + } + VfModule castOther = (VfModule) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + @LinkedResource + public List getVfModuleCustomization() { + if (vfModuleCustomization == null) + vfModuleCustomization = new ArrayList<>(); + + return vfModuleCustomization; + } + + public void setVfModuleCustomization(List vfModuleCustomization) { + this.vfModuleCustomization = vfModuleCustomization; + } + + public String getModelName() { + return this.modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public Boolean getIsBase() { + return isBase; + } + + public void setIsBase(Boolean isBase) { + this.isBase = isBase; + } + + @LinkedResource + public List getHeatFiles() { + if (heatFiles == null) + heatFiles = new ArrayList<>(); + return heatFiles; + } + + public void setHeatFiles(List heatFiles) { + this.heatFiles = heatFiles; + } + + @LinkedResource + public VnfResource getVnfResources() { + return vnfResources; + } + + public void setVnfResources(VnfResource vnfResources) { + this.vnfResources = vnfResources; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreated() { + return created; + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + @LinkedResource + public HeatTemplate getVolumeHeatTemplate() { + return volumeHeatTemplate; + } + + public void setVolumeHeatTemplate(HeatTemplate volumeHeatTemplate) { + this.volumeHeatTemplate = volumeHeatTemplate; + } + + @LinkedResource + public HeatTemplate getModuleHeatTemplate() { + return moduleHeatTemplate; + } + + public void setModuleHeatTemplate(HeatTemplate moduleHeatTemplate) { + this.moduleHeatTemplate = moduleHeatTemplate; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java new file mode 100644 index 0000000000..4a9b3bbbb5 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java @@ -0,0 +1,199 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "vf_module_customization") +public class VfModuleCustomization implements Serializable { + + public static final long serialVersionUID = -1322322139926390329L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "LABEL") + private String label; + + @Column(name = "MIN_INSTANCES") + private Integer minInstances; + + @Column(name = "MAX_INSTANCES") + private Integer maxInstances; + + @Column(name = "INITIAL_COUNT") + private Integer initialCount; + + @Column(name = "AVAILABILITY_ZONE_COUNT") + private Integer availabilityZoneCount; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "VOL_ENVIRONMENT_ARTIFACT_UUID") + HeatEnvironment volumeHeatEnv; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "HEAT_ENVIRONMENT_ARTIFACT_UUID") + HeatEnvironment heatEnvironment; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "VF_MODULE_MODEL_UUID") + private VfModule vfModule; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID).append("label", label) + .append("minInstances", minInstances).append("maxInstances", maxInstances) + .append("initialCount", initialCount).append("availabilityZoneCount", availabilityZoneCount) + .append("created", created).append("volumeHeatEnv", volumeHeatEnv) + .append("heatEnvironment", heatEnvironment).append("vfModule", vfModule).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VfModuleCustomization)) { + return false; + } + VfModuleCustomization castOther = (VfModuleCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + public VfModuleCustomization() { + super(); + } + + public String getModelCustomizationUUID() { + return this.modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + @LinkedResource + public HeatEnvironment getVolumeHeatEnv() { + return volumeHeatEnv; + } + + public void setVolumeHeatEnv(HeatEnvironment volumeHeatEnv) { + this.volumeHeatEnv = volumeHeatEnv; + } + + @LinkedResource + public HeatEnvironment getHeatEnvironment() { + return heatEnvironment; + } + + public void setHeatEnvironment(HeatEnvironment heatEnvironment) { + this.heatEnvironment = heatEnvironment; + } + + 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 Date getCreated() { + return created; + } + + public String getLabel() { + return this.label; + } + + public void setLabel(String label) { + this.label = label; + } + + @LinkedResource + public VfModule getVfModule() { + return this.vfModule; + } + + public void setVfModule(VfModule vfModule) { + this.vfModule = vfModule; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfComponentsRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfComponentsRecipe.java new file mode 100644 index 0000000000..e4ac0d5816 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfComponentsRecipe.java @@ -0,0 +1,171 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "vnf_components_recipe") +public class VnfComponentsRecipe implements Serializable, Recipe { + + private static final long serialVersionUID = 768026109321305392L; + + @Id + @Column(name = "id") + private Integer id; + + @BusinessKey + @Column(name = "ACTION") + private String action; + + @Column(name = "DESCRIPTION") + private String description; + + @BusinessKey + @Column(name = "ORCHESTRATION_URI") + private String orchestrationUri; + + @Column(name = "RECIPE_TIMEOUT") + private Integer recipeTimeout; + + @BusinessKey + @Column(name = "VNF_TYPE") + private String vnfType; + + @Column(name = "VNF_COMPONENT_PARAM_XSD") + private String paramXsd; + + @Column(name = "VNF_COMPONENT_TYPE") + private String vnfComponentType; + + @BusinessKey + @Column(name = "VF_MODULE_MODEL_UUID") + private String vfModuleModelUUID; + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("action", action).append("description", description) + .append("orchestrationUri", orchestrationUri).append("recipeTimeout", recipeTimeout) + .append("vnfType", vnfType).append("paramXsd", paramXsd).append("vnfComponentType", vnfComponentType) + .append("vfModuleModelUUID", vfModuleModelUUID).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfComponentsRecipe)) { + return false; + } + VnfComponentsRecipe castOther = (VnfComponentsRecipe) other; + return new EqualsBuilder().append(action, castOther.action).append(orchestrationUri, castOther.orchestrationUri) + .append(vnfType, castOther.vnfType).append(vfModuleModelUUID, castOther.vfModuleModelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(action).append(orchestrationUri).append(vnfType).append(vfModuleModelUUID) + .toHashCode(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + public void setRecipeTimeout(Integer recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getParamXsd() { + return paramXsd; + } + + public void setParamXsd(String paramXsd) { + this.paramXsd = paramXsd; + } + + public String getVnfComponentType() { + return vnfComponentType; + } + + public void setVnfComponentType(String vnfComponentType) { + this.vnfComponentType = vnfComponentType; + } + + public String getVfModuleModelUUID() { + return vfModuleModelUUID; + } + + public void setVfModuleModelUUID(String vfModuleModelUUID) { + this.vfModuleModelUUID = vfModuleModelUUID; + } + + @Override + public String getOrchestrationUri() { + return orchestrationUri; + } + + @Override + public Integer getRecipeTimeout() { + return recipeTimeout; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java new file mode 100644 index 0000000000..aef2ac5e74 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfRecipe.java @@ -0,0 +1,187 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "vnf_recipe") +public class VnfRecipe implements Serializable, Recipe { + + private static final long serialVersionUID = 768026109321305392L; + + @Id + @Column(name = "id") + private Integer id; + + @BusinessKey + @Column(name = "NF_ROLE") + private String nfRole; + + @Column(name = "VNF_PARAM_XSD") + private String paramXsd; + + @Column(name = "VF_MODULE_ID") + private String vfModuleId; + + @BusinessKey + @Column(name = "ACTION") + protected String action; + + @Column(name = "description") + private String description; + + @BusinessKey + @Column(name = "ORCHESTRATION_URI") + protected String orchestrationUri; + + @Column(name = "RECIPE_TIMEOUT") + private Integer recipeTimeout; + + @BusinessKey + @Column(name = "SERVICE_TYPE") + private String serviceType; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("vnfType", nfRole).append("paramXsd", paramXsd) + .append("vfModuleId", vfModuleId).append("action", action).append("description", description) + .append("orchestrationUri", orchestrationUri).append("recipeTimeout", recipeTimeout) + .append("serviceType", serviceType).append("created", created).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfRecipe)) { + return false; + } + VnfRecipe castOther = (VnfRecipe) other; + return new EqualsBuilder().append(nfRole, castOther.nfRole).append(action, castOther.action) + .append(orchestrationUri, castOther.orchestrationUri).append(serviceType, castOther.serviceType) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(nfRole).append(action).append(orchestrationUri).append(serviceType) + .toHashCode(); + } + + public String getNfRole() { + return nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + + public String getParamXsd() { + return paramXsd; + } + + public void setParamXsd(String paramXsd) { + this.paramXsd = paramXsd; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getOrchestrationUri() { + return orchestrationUri; + } + + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + public Integer getRecipeTimeout() { + return recipeTimeout; + } + + public void setRecipeTimeout(Integer recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public Date getCreated() { + return created; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java new file mode 100644 index 0000000000..764d2b7c39 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java @@ -0,0 +1,259 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "vnf_resource") +public class VnfResource implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "ORCHESTRATION_MODE") + private String orchestrationMode; + + @Column(name = "AIC_VERSION_MIN") + private String aicVersionMin; + + @Column(name = "AIC_VERSION_MAX") + private String aicVersionMax; + + @Column(name = "RESOURCE_CATEGORY") + private String category; + + @Column(name = "RESOURCE_SUB_CATEGORY") + private String subCategory; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "HEAT_TEMPLATE_ARTIFACT_UUID") + private HeatTemplate heatTemplates; + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResources") + private List vnfResourceCustomizations; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID) + .append("modelName", modelName).append("modelVersion", modelVersion) + .append("toscaNodeType", toscaNodeType).append("description", description) + .append("orchestrationMode", orchestrationMode).append("aicVersionMin", aicVersionMin) + .append("aicVersionMax", aicVersionMax).append("created", created) + .append("heatTemplates", heatTemplates).append("vnfResourceCustomizations", vnfResourceCustomizations) + .toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfResource)) { + return false; + } + VnfResource castOther = (VnfResource) other; + return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelUUID).toHashCode(); + } + + public String getOrchestrationMode() { + return orchestrationMode; + } + + public void setOrchestrationMode(String orchestrationMode) { + this.orchestrationMode = orchestrationMode; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreated() { + return created; + } + + 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; + } + + /** + * @return Returns the category. + */ + public String getCategory() { + return category; + } + + /** + * @param category + * The category to set. + */ + public void setCategory(String category) { + this.category = category; + } + + /** + * @return Returns the subCategory. + */ + public String getSubCategory() { + return subCategory; + } + + /** + * @param subCategory + * The subCategory to set. + */ + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + public String getModelInvariantUUID() { + return this.modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelInvariantId() { + return this.modelInvariantUUID; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + @LinkedResource + public List getVnfResourceCustomizations() { + if (vnfResourceCustomizations == null) + vnfResourceCustomizations = new ArrayList<>(); + return vnfResourceCustomizations; + } + + public void setVnfResourceCustomizations(List vnfResourceCustomizations) { + this.vnfResourceCustomizations = vnfResourceCustomizations; + } + + @LinkedResource + public HeatTemplate getHeatTemplates() { + return heatTemplates; + } + + public void setHeatTemplates(HeatTemplate heatTemplates) { + this.heatTemplates = heatTemplates; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java new file mode 100644 index 0000000000..fa0fe5636e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java @@ -0,0 +1,253 @@ +/*- + * ============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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "vnf_resource_customization") +public class VnfResourceCustomization implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @Column(name = "MIN_INSTANCES") + private Integer minInstances; + + @Column(name = "MAX_INSTANCES") + private Integer maxInstances; + + @Column(name = "AVAILABILITY_ZONE_MAX_COUNT") + private Integer availabilityZoneMaxCount; + + @Column(name = "NF_FUNCTION") + private String nfFunction; + + @Column(name = "NF_TYPE") + private String nfType; + + @Column(name = "NF_ROLE") + private String nfRole; + + @Column(name = "NF_NAMING_CODE") + private String nfNamingCode; + + @Column(name = "MULTI_STAGE_DESIGN") + private String multiStageDesign; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID") + private VnfResource vnfResources; + + @OneToMany(cascade = CascadeType.ALL) + @JoinTable(name = "vnf_res_custom_to_vf_module_custom", joinColumns = @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"), inverseJoinColumns = @JoinColumn(name = "VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID")) + private List vfModuleCustomizations; + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust") + private List vnfcInstanceGroupCustomizations; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("created", created) + .append("minInstances", minInstances).append("maxInstances", maxInstances) + .append("availabilityZoneMaxCount", availabilityZoneMaxCount).append("nfFunction", nfFunction) + .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode) + .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources) + .append("vfModuleCustomizations", vfModuleCustomizations) + .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfResourceCustomization)) { + return false; + } + VnfResourceCustomization castOther = (VnfResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return this.modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public Date getCreationTimestamp() { + return this.created; + } + + 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 getAvailabilityZoneMaxCount() { + return this.availabilityZoneMaxCount; + } + + public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) { + this.availabilityZoneMaxCount = availabilityZoneMaxCount; + } + + public String getNfFunction() { + return nfFunction; + } + + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + + public String getNfType() { + return nfType; + } + + public void setNfType(String nfType) { + this.nfType = nfType; + } + + public String getNfRole() { + return nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + + public String getNfNamingCode() { + return nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + public String getMultiStageDesign() { + return this.multiStageDesign; + } + + public void setMultiStageDesign(String multiStageDesign) { + this.multiStageDesign = multiStageDesign; + } + + @LinkedResource + public List getVfModuleCustomizations() { + if (vfModuleCustomizations == null) + vfModuleCustomizations = new ArrayList<>(); + return vfModuleCustomizations; + } + + public void setVfModuleCustomizations(List vfModuleCustomizations) { + this.vfModuleCustomizations = vfModuleCustomizations; + } + + @LinkedResource + public VnfResource getVnfResources() { + return vnfResources; + } + + public void setVnfResources(VnfResource vnfResources) { + this.vnfResources = vnfResources; + } + + public Date getCreated() { + return created; + } + + @LinkedResource + public List getVnfcInstanceGroupCustomizations() { + return vnfcInstanceGroupCustomizations; + } + + public void setVnfcInstanceGroupCustomizations( + List vnfcInstanceGroupCustomizations) { + this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java new file mode 100644 index 0000000000..1d4cef158f --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java @@ -0,0 +1,169 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.IdClass; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@IdClass(VnfcInstanceGroupCustomizationId.class) +@Table(name = "vnfc_instance_group_customization") +public class VnfcInstanceGroupCustomization implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -8288218040186901676L; + + @BusinessKey + @Id + @Column(name = "VNF_RESOURCE_CUSTOMIZATION_MODEL_UUID") + private String modelCustomizationUUID; + + @BusinessKey + @Id + @Column(name = "INSTANCE_GROUP_MODEL_UUID") + private String modelUUID; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VNF_RESOURCE_CUSTOMIZATION_MODEL_UUID", updatable = false, insertable = false) + private VnfResourceCustomization vnfResourceCust; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID", updatable = false, insertable = false) + private InstanceGroup instanceGroup; + + @Column(name = "FUNCTION") + private String function; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfcInstanceGroupCustomization)) { + return false; + } + VnfcInstanceGroupCustomization castOther = (VnfcInstanceGroupCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID) + .append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).append(modelUUID).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelUUID", modelUUID).append("function", function).append("description", description) + .append("created", created).toString(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public Date getCreated() { + return created; + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getFunction() { + return function; + } + + public void setFunction(String function) { + this.function = function; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setCreated(Date created) { + this.created = created; + } + + @LinkedResource + public VnfResourceCustomization getVnfResourceCust() { + return vnfResourceCust; + } + + public void setVnfResourceCust(VnfResourceCustomization vnfResourceCust) { + this.vnfResourceCust = vnfResourceCust; + } + + @LinkedResource + public InstanceGroup getInstanceGroup() { + return instanceGroup; + } + + public void setInstanceGroup(InstanceGroup instanceGroup) { + this.instanceGroup = instanceGroup; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomizationId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomizationId.java new file mode 100644 index 0000000000..f22d4fe213 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomizationId.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +public class VnfcInstanceGroupCustomizationId implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1628277798979456195L; + + @BusinessKey + private String modelCustomizationUUID; + @BusinessKey + private String modelUUID; + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelUUID", modelUUID).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfcInstanceGroupCustomizationId)) { + return false; + } + VnfcInstanceGroupCustomizationId castOther = (VnfcInstanceGroupCustomizationId) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID) + .append(modelUUID, castOther.modelUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).append(modelUUID).toHashCode(); + } + + public String getModelCustomizationUUID() { + return this.modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelUUID() { + return this.modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java new file mode 100644 index 0000000000..67f23c1e43 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/NorthBoundRequest.java @@ -0,0 +1,185 @@ +/*- + * ============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.onap.so.db.catalog.beans.macro; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "northbound_request_ref_lookup") +public class NorthBoundRequest implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -2238991039015148725L; + + @Id + @Column(name = "id") + @GeneratedValue + private Integer id; + + @BusinessKey + @Column(name = "MACRO_ACTION") + private String macroAction; + + @BusinessKey + @Column(name = "ACTION") + private String action; + + @BusinessKey + @Column(name = "REQUEST_SCOPE") + private String requestScope; + + @BusinessKey + @Column(name = "IS_ALACARTE") + private Boolean isAlacarte; + + @BusinessKey + @Column(name = "IS_TOPLEVELFLOW") + private Boolean isToplevelflow; + + @BusinessKey + @Column(name = "MIN_API_VERSION") + private Double minApiVersion; + + @BusinessKey + @Column(name = "MAX_API_VERSION") + private Double maxApiVersion; + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "northBoundRequest") + private List orchestrationFlowList; + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("action", action).append("requestScope", requestScope) + .append("isAlacarte", isAlacarte).append("isToplevelflow", isToplevelflow) + .append("minApiVersion", minApiVersion).append("maxApiVersion", maxApiVersion).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NorthBoundRequest)) { + return false; + } + NorthBoundRequest castOther = (NorthBoundRequest) other; + return new EqualsBuilder().append(action, castOther.action).append(requestScope, castOther.requestScope) + .append(isAlacarte, castOther.isAlacarte).append(isToplevelflow, castOther.isToplevelflow) + .append(minApiVersion, castOther.minApiVersion).append(maxApiVersion, castOther.maxApiVersion) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(action).append(requestScope).append(isAlacarte).append(isToplevelflow) + .append(minApiVersion).append(maxApiVersion).toHashCode(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getMacroAction() { + return macroAction; + } + + public void setMacroAction(String macroAction) { + this.macroAction = macroAction; + } + + public String getRequestScope() { + return requestScope; + } + + public void setRequestScope(String requestScope) { + this.requestScope = requestScope; + } + + public Boolean getIsAlacarte() { + return isAlacarte; + } + + public void setIsAlacarte(Boolean isAlacarte) { + this.isAlacarte = isAlacarte; + } + + public Boolean getIsToplevelflow() { + return isToplevelflow; + } + + public void setIsToplevelflow(Boolean isToplevelflow) { + this.isToplevelflow = isToplevelflow; + } + + public Double getMinApiVersion() { + return minApiVersion; + } + + public void setMinApiVersion(Double minApiVersion) { + this.minApiVersion = minApiVersion; + } + + public Double getMaxApiVersion() { + return maxApiVersion; + } + + public void setMaxApiVersion(Double maxApiVersion) { + this.maxApiVersion = maxApiVersion; + } + + @LinkedResource + public List getOrchestrationFlowList() { + return orchestrationFlowList; + } + + public void setOrchestrationFlowList(List orchestrationFlowList) { + this.orchestrationFlowList = orchestrationFlowList; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java new file mode 100644 index 0000000000..058947e6b1 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/OrchestrationFlow.java @@ -0,0 +1,146 @@ +/*- + * ============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.onap.so.db.catalog.beans.macro; + +import java.io.Serializable; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.onap.so.db.catalog.beans.BuildingBlockDetail; + +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "orchestration_flow_reference") +public class OrchestrationFlow implements Serializable { + + private static final long serialVersionUID = 2457818854397870011L; + + @Id + @Column(name = "ID") + @GeneratedValue + private Integer id; + + @BusinessKey + @Column(name = "COMPOSITE_ACTION") + private String action; + + @BusinessKey + @Column(name = "SEQ_NO") + private Integer sequenceNumber; + + @BusinessKey + @Column(name = "FLOW_NAME") + private String flowName; + + @BusinessKey + @Column(name = "FLOW_VERSION") + private Double flowVersion; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "NB_REQ_REF_LOOKUP_ID") + private NorthBoundRequest northBoundRequest; + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("action", action) + .append("sequenceNumber", sequenceNumber).append("flowName", flowName) + .append("flowVersion", flowVersion).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof OrchestrationFlow)) { + return false; + } + OrchestrationFlow castOther = (OrchestrationFlow) other; + return new EqualsBuilder().append(action, castOther.action).append(sequenceNumber, castOther.sequenceNumber) + .append(flowName, castOther.flowName).append(flowVersion, castOther.flowVersion).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(action).append(sequenceNumber).append(flowName).append(flowVersion) + .toHashCode(); + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public Integer getSequenceNumber() { + return sequenceNumber; + } + + public void setSequenceNumber(Integer sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } + + public String getFlowName() { + return flowName; + } + + public void setFlowName(String flowName) { + this.flowName = flowName; + } + + public Double getFlowVersion() { + return flowVersion; + } + + public void setFlowVersion(Double flowVersion) { + this.flowVersion = flowVersion; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + @LinkedResource + public NorthBoundRequest getNorthBoundRequest() { + return northBoundRequest; + } + + public void setNorthBoundRequest(NorthBoundRequest northBoundRequest) { + this.northBoundRequest = northBoundRequest; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java new file mode 100644 index 0000000000..f341c4cb5c --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java @@ -0,0 +1,154 @@ +/*- + * ============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.onap.so.db.catalog.beans.macro; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "rainy_day_handler_macro") +public class RainyDayHandlerStatus implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "id") + @GeneratedValue + private Integer id; + + @BusinessKey + @Column(name = "FLOW_NAME") + private String flowName; + + @BusinessKey + @Column(name = "SERVICE_TYPE") + private String serviceType; + + @BusinessKey + @Column(name = "VNF_TYPE") + private String vnfType; + + @BusinessKey + @Column(name = "ERROR_CODE") + private String errorCode; + + @BusinessKey + @Column(name = "WORK_STEP") + private String workStep; + + @BusinessKey + @Column(name = "POLICY") + private String policy; + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("flowName", flowName) + .append("serviceType", serviceType).append("vnfType", vnfType).append("errorCode", errorCode) + .append("workStep", workStep).append("policy", policy).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof RainyDayHandlerStatus)) { + return false; + } + RainyDayHandlerStatus castOther = (RainyDayHandlerStatus) other; + return new EqualsBuilder().append(flowName, castOther.flowName).append(serviceType, castOther.serviceType) + .append(vnfType, castOther.vnfType).append(errorCode, castOther.errorCode) + .append(workStep, castOther.workStep).append(policy, castOther.policy).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(flowName).append(serviceType).append(vnfType).append(errorCode) + .append(workStep).append(policy).toHashCode(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getFlowName() { + return flowName; + } + + public void setFlowName(String flowName) { + this.flowName = flowName; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getWorkStep() { + return workStep; + } + + public void setWorkStep(String workStep) { + this.workStep = workStep; + } + + public String getPolicy() { + return policy; + } + + public void setPolicy(String policy) { + this.policy = policy; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java new file mode 100644 index 0000000000..d3a1c5d8d6 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -0,0 +1,307 @@ +/*- + * ============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.onap.so.db.catalog.client; + +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.OrchestrationAction; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; +import org.onap.so.db.catalog.beans.ResourceType; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; +import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.BufferingClientHttpRequestFactory; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import uk.co.blackpepper.bowman.Client; +import uk.co.blackpepper.bowman.ClientFactory; +import uk.co.blackpepper.bowman.Configuration; +import uk.co.blackpepper.bowman.RestTemplateConfigurer; + +@Component("CatalogDbClient") +public class CatalogDbClient { + + protected Client serviceClient; + + protected Client vfModuleCustomizationClient; + + protected Client orchestrationClient; + + protected Client northBoundRequestClient; + + protected Client rainyDayHandlerStatusClient; + + protected Client buildingBlockDetailClient; + + protected Client orchestrationStatusStateTransitionDirectiveClient; + + protected Client vnfcInstanceGroupCustomizationClient; + + protected Client collectionResourceInstanceGroupCustomizationClient; + + protected Client instanceGroupClient; + + protected Client networkCollectionResourceCustomizationClient; + + protected Client collectionNetworkResourceCustomizationClient; + + @Value("${mso.catalog.db.spring.endpoint}") + protected String endpoint; + + @Value("${mso.db.auth}") + private String msoAdaptersAuth; + + public CatalogDbClient() { + ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()); + + ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(new RestTemplateConfigurer() { + + public void configure(RestTemplate restTemplate) { + restTemplate.getInterceptors().add((new SpringClientFilter())); + + restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { + + public ClientHttpResponse intercept(HttpRequest request, byte[] body, + ClientHttpRequestExecution execution) throws IOException { + + request.getHeaders().add("Authorization", msoAdaptersAuth); + return execution.execute(request, body); + } + }); + } + }).build().buildClientFactory(); + serviceClient = clientFactory.create(Service.class); + orchestrationClient = clientFactory.create(OrchestrationFlow.class); + vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class); + northBoundRequestClient = clientFactory.create(NorthBoundRequest.class); + rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class); + buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class); + orchestrationStatusStateTransitionDirectiveClient = clientFactory + .create(OrchestrationStatusStateTransitionDirective.class); + vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class); + collectionResourceInstanceGroupCustomizationClient = clientFactory + .create(CollectionResourceInstanceGroupCustomization.class); + instanceGroupClient = clientFactory.create(InstanceGroup.class); + networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class); + collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class); + } + + public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) { + NetworkCollectionResourceCustomization networkCollectionResourceCustomization = + this.getSingleNetworkCollectionResourceCustomization(UriBuilder.fromUri(endpoint + "/networkCollectionResourceCustomization/" + modelCustomizationUUID).build()); + if (networkCollectionResourceCustomization != null) { + networkCollectionResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID); + } + return networkCollectionResourceCustomization; + } + + private NetworkCollectionResourceCustomization getSingleNetworkCollectionResourceCustomization(URI uri) { + return networkCollectionResourceCustomizationClient.get(uri); + } + + public Service getServiceByID(String modelUUID) { + Service service = this.getSingleService(UriBuilder.fromUri(endpoint + "/service/" + modelUUID).build()); + if (service != null) { + service.setModelUUID(modelUUID); + } + return service; + } + + public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) { + BuildingBlockDetail buildingBlockDetail = buildingBlockDetailClient + .get(UriBuilder.fromUri(endpoint + "/buildingBlockDetail/search/findOneByBuildingBlockName") + .queryParam("buildingBlockName", buildingBlockName).build()); + if (buildingBlockDetail != null) { + buildingBlockDetail.setBuildingBlockName(buildingBlockName); + } + return buildingBlockDetail; + } + + public CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomizationByID(String modelCustomizationUUID) { + CollectionNetworkResourceCustomization collectionNetworkResourceCustomization = + this.getSingleCollectionNetworkResourceCustomization( + UriBuilder.fromUri(endpoint + "/collectionNetworkResourceCustomization/" + modelCustomizationUUID).build()); + if (collectionNetworkResourceCustomization != null) { + collectionNetworkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID); + } + return collectionNetworkResourceCustomization; + } + + public InstanceGroup getInstanceGroupByModelUUID(String modelUUID) { + InstanceGroup instanceGroup = this + .getSingleInstanceGroup(UriBuilder.fromUri(endpoint + "/instanceGroup/" + modelUUID).build()); + if (instanceGroup != null) { + instanceGroup.setModelUUID(modelUUID); + } + return instanceGroup; + } + + public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective( + ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) { + return orchestrationStatusStateTransitionDirectiveClient.get(UriBuilder + .fromUri( + endpoint + "/orchestrationStatusStateTransitionDirective/search/findOneByResourceTypeAndOrchestrationStatusAndTargetAction") + .queryParam("resourceType", resourceType.name()) + .queryParam("orchestrationStatus", orchestrationStatus.name()) + .queryParam("targetAction", targetAction.name()).build()); + } + + public List getOrchestrationFlowByAction(String action) { + return this + .getMultipleOrchestrationFlows(UriBuilder.fromUri(endpoint + "/orchestrationFlow/search/findByAction") + .queryParam("COMPOSITE_ACTION", action).build()); + } + + public List getAllOrchestrationFlows() { + return this.getMultipleOrchestrationFlows(UriBuilder.fromUri(endpoint + "/orchestrationFlow/").build()); + } + + protected List getMultipleOrchestrationFlows(URI uri) { + Iterable orchIterator = orchestrationClient.getAll(uri); + List orchList = new ArrayList<>(); + Iterator it = orchIterator.iterator(); + it.forEachRemaining(orchList::add); + return orchList; + } + + public List getVnfcInstanceGroupsByVnfResourceCust(String modelCustomizationUUID) { + return this.getMultipleVnfcInstanceGroupCustomizations( + UriBuilder.fromUri(endpoint + "/vnfcInstanceGroupCustomization/search/findByModelCustomizationUUID") + .queryParam("MODEL_CUSTOMIZATION_UUID", modelCustomizationUUID).build()); + } + + public List getCollectionResourceInstanceGroupCustomizationByModelCustUUID( + String modelCustomizationUUID) { + return this.getMultipleCollectionResourceInstanceGroupCustomizations(UriBuilder + .fromUri(endpoint + "/collectionResourceInstanceGroupCustomization/search/findByModelCustomizationUUID") + .queryParam("MODEL_CUSTOMIZATION_UUID", modelCustomizationUUID).build()); + } + + private List getMultipleCollectionResourceInstanceGroupCustomizations( + URI uri) { + Iterable collectionInstanceGroupCustIter = collectionResourceInstanceGroupCustomizationClient + .getAll(uri); + List collectionInstanceGroupCustList = new ArrayList<>(); + Iterator it = collectionInstanceGroupCustIter.iterator(); + it.forEachRemaining(collectionInstanceGroupCustList::add); + return collectionInstanceGroupCustList; + } + + protected List getMultipleVnfcInstanceGroupCustomizations(URI uri) { + Iterable vnfcIterator = vnfcInstanceGroupCustomizationClient.getAll(uri); + List vnfcList = new ArrayList<>(); + Iterator it = vnfcIterator.iterator(); + it.forEachRemaining(vnfcList::add); + return vnfcList; + } + + public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) { + VfModuleCustomization vfModuleCust = this.getSingleVfModuleCustomization( + UriBuilder.fromUri(endpoint + "/vfModuleCustomization/" + modelCustomizationUUID).build()); + if (vfModuleCust != null) { + vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID); + } + return vfModuleCust; + } + + public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(String requestAction, + String resourceName, boolean aLaCarte) { + return this.getSingleNorthBoundRequest(UriBuilder + .fromUri(endpoint + "/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarte") + .queryParam("ACTION", requestAction).queryParam("REQUEST_SCOPE", resourceName) + .queryParam("IS_ALACARTE", aLaCarte).build()); + } + + public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( + String flowName, String serviceType, String vnfType, String errorCode, String workStep) { + return this.getSingleRainyDayHandlerStatus(UriBuilder + .fromUri( + endpoint + "/rainy_day_handler_macro/search/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep") + .queryParam("FLOW_NAME", flowName).queryParam("SERVICE_TYPE", serviceType) + .queryParam("VNF_TYPE", vnfType).queryParam("ERROR_CODE", errorCode).queryParam("WORK_STEP", workStep) + .build()); + } + + protected CollectionNetworkResourceCustomization getSingleCollectionNetworkResourceCustomization(URI uri) { + return collectionNetworkResourceCustomizationClient.get(uri); + } + + protected InstanceGroup getSingleInstanceGroup(URI uri) { + return instanceGroupClient.get(uri); + } + + protected Service getSingleService(URI uri) { + return serviceClient.get(uri); + } + + protected VfModuleCustomization getSingleVfModuleCustomization(URI uri) { + return vfModuleCustomizationClient.get(uri); + } + + protected NorthBoundRequest getSingleNorthBoundRequest(URI uri) { + return northBoundRequestClient.get(uri); + } + + protected RainyDayHandlerStatus getSingleRainyDayHandlerStatus(URI uri) { + return rainyDayHandlerStatusClient.get(uri); + } + + public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) { + return this.getSingleService( + UriBuilder.fromUri(endpoint + "/service/search/findByModelVersionAndModelInvariantUUID") + .queryParam("MODEL_VERSION", modelVersion) + .queryParam("MODEL_INVARIANT_UUID", modelInvariantUUID).build()); + } + + //USED FOR TEST ONLY + public void setPortToEndpoint(String port) { + endpoint = endpoint + port; + } + + //USED FOR TEST ONLY + public void removePortFromEndpoint() { + endpoint = endpoint.substring(0, endpoint.lastIndexOf(':') + 1); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineAllottedResources.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineAllottedResources.java new file mode 100644 index 0000000000..c03e988e2e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineAllottedResources.java @@ -0,0 +1,64 @@ +/*- + * ============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.onap.so.db.catalog.data.projections; + +import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.rest.core.config.Projection; + +@Projection(name = "InlineAllottedResources", types = { AllottedResourceCustomization.class }) +public interface InlineAllottedResources { + + String getModelCustomizationUUID(); + String getModelInstanceName(); + String getMaxInstances(); + String getMinInstances(); + String getNfNamingCode(); + String getNfRole(); + String getNfType(); + String getNfFunction(); + String getTargetNetworkRole(); + String getProvidingServiceModelInvariantUUID(); + String getProvidingServiceModelName(); + String getProvidingServiceModelUUID(); + + @Value("#{target.getAllottedResource().getDescription()}") + String getDescription(); + + @Value("#{target.getAllottedResource().getCreated()}") + String getCreated(); + + + @Value("#{target.getAllottedResource().getModelInvariantUUID()}") + String getModelInvariantUuid (); + + @Value("#{target.getAllottedResource().getModelName()}") + String getModelName (); + + @Value("#{target.getAllottedResource().getModelUUID()}") + String getModelUuid (); + + @Value("#{target.getAllottedResource().getToscaNodeType()}") + String getToscaNodeType (); + + @Value("#{target.getAllottedResource().getSubcategory()}") + String getSubcategory (); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineNetworks.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineNetworks.java new file mode 100644 index 0000000000..8311df8adf --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineNetworks.java @@ -0,0 +1,72 @@ +/*- + * ============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.onap.so.db.catalog.data.projections; + + +import java.sql.Timestamp; + +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.rest.core.config.Projection; + +@Projection(name = "InlineNetworks", types = { NetworkResourceCustomization.class }) +public interface InlineNetworks { + + String getModelCustomizationUUID(); + String getModelInstanceName(); + String getNetworkTechnology(); + String getNetworkType(); + String getNetworkScope(); + String getNetworkRole(); + + @Value("#{target.getNetworkResource().getDescription()}") + String getDescription(); + + @Value("#{target.getNetworkResource().getCreated()}") + Timestamp getCreated(); + + @Value("#{target.getNetworkResource().getModelVersion()}") + String getModelVersion(); + + @Value("#{target.getNetworkResource().getModelInvariantUUID()}") + String getModelInvariantUUID(); + + @Value("#{target.getNetworkResource().getModelName()}") + String getModelName (); + + @Value("#{target.getNetworkResource().getModelUUID()}") + String getModelUUID (); + + @Value("#{target.getNetworkResource().getNeutronNetworkType()}") + String getNeutronNetworkType (); + + @Value("#{target.getNetworkResource().getAicVersionMin()}") + String getAicVersionMin (); + + @Value("#{target.getNetworkResource().getAicVersionMax()}") + String getAicVersionMax (); + + @Value("#{target.getNetworkResource().getOrchestrationMode()}") + String getOrchestrationMode (); + + @Value("#{target.getNetworkResource().getToscaNodeType()}") + String getToscaNodeType (); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineService.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineService.java new file mode 100644 index 0000000000..c7241acd8b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineService.java @@ -0,0 +1,52 @@ +/*- + * ============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.onap.so.db.catalog.data.projections; + + +import java.util.List; +import java.util.Map; + +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.ServiceRecipe; +import org.springframework.data.rest.core.config.Projection; + +@Projection(name = "InlineService", types = { Service.class }) +public interface InlineService { + + String getModelName(); + String getDescription(); + String getCreated(); + String getModelUUID(); + String getModelInvariantUUID(); + String getModelVersion(); + String getServiceType(); + String getServiceRole(); + String getEnvironmentContext(); + String getWorkloadContext(); + + List getNetworkCustomizations(); + + List getVnfCustomizations(); + + List getAllottedCustomizations(); + + Map getRecipes (); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineVfModules.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineVfModules.java new file mode 100644 index 0000000000..316a02b016 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineVfModules.java @@ -0,0 +1,59 @@ +/*- + * ============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.onap.so.db.catalog.data.projections; + +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.rest.core.config.Projection; + +@Projection(name = "InlineVfModules", types = { VfModuleCustomization.class }) +public interface InlineVfModules { + + String getModelCustomizationUUID(); + + @Value("#{target.getVfModule().getModelName()}") + String getModelName (); + + @Value("#{target.getVfModule().getModelUUID()}") + String getModelUUID (); + + @Value("#{target.getVfModule().getModelInvariantUUID()}") + String getModelInvariantUUID (); + + @Value("#{target.getVfModule().getModelVersion()}") + String getModelVersion (); + + @Value("#{target.getVfModule().getDescription()}") + String getDescription(); + + @Value("#{target.getVfModule().getIsBase()}") + Boolean getIsBase(); + + String getMinInstances(); + String getMaxInstances(); + String getAvailabilityZoneCount(); + String getLabel(); + String getInitialCount(); + + @Value("#{target.getVfModule().getCreated()}") + String getCreated(); + +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineVnf.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineVnf.java new file mode 100644 index 0000000000..17e54f9b45 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/projections/InlineVnf.java @@ -0,0 +1,76 @@ +/*- + * ============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.onap.so.db.catalog.data.projections; + +import java.util.List; + +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.rest.core.config.Projection; + +@Projection(name = "InlineVnf", types = { VnfResourceCustomization.class }) +public interface InlineVnf { + + String getModelInstanceName(); + + String getModelCustomizationUUID(); + + @Value("#{target.getVnfResources().getModelUUID()}") + String getModelUUID(); + + @Value("#{target.getVnfResources().getModelInvariantUUID()}") + String getModelInvariantUUID(); + + @Value("#{target.getVnfResources().getModelName()}") + String getModelName(); + + @Value("#{target.getVnfResources().getModelVersion()}") + String getModelVersion(); + + @Value("#{target.getVnfResources().getToscaNodeType()}") + String getToscaNodeType (); + + @Value("#{target.getVnfResources().getDescription()}") + String getDescription(); + + @Value("#{target.getVnfResources().getOrchestrationMode()}") + String getOrchestrationMode(); + + @Value("#{target.getVnfResources().getAicVersionMin()}") + String getAicVersionMin(); + + @Value("#{target.getVnfResources().getAicVersionMax()}") + String getAicVersionMax(); + + String getMinInstances(); + String getMaxInstances(); + String getAvailabilityZoneMaxCount(); + String getNfFunction(); + String getNfType(); + String getNfRole(); + String getNfNamingCode(); + String getMultiStageDesign(); + + @Value("#{target.getVnfResources().getCreated()}") + String getCreated(); + + List getVfModuleCustomizations(); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/AllottedResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/AllottedResourceCustomizationRepository.java new file mode 100644 index 0000000000..57fe2df182 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/AllottedResourceCustomizationRepository.java @@ -0,0 +1,38 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "allottedResourceCustomization", path = "allottedResourceCustomization") +public interface AllottedResourceCustomizationRepository extends JpaRepository { + + @Query(value = "SELECT * FROM ALLOTTED_RESOURCE_CUSTOMIZATION WHERE PROVIDING_SERVICE_MODEL_UUID =?0", nativeQuery = true) + List queryByProvidingServiceModelUUID(String providingServiceModelUUID); + + List findByModelCustomizationUUID(String modelCustomizationUUID); + AllottedResourceCustomization findOneByModelCustomizationUUID(String modelCustomizationUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/AllottedResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/AllottedResourceRepository.java new file mode 100644 index 0000000000..9d0ac92449 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/AllottedResourceRepository.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.AllottedResource; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "allottedResource", path = "allottedResource") +public interface AllottedResourceRepository extends JpaRepository { + AllottedResource findResourceByModelUUID(String modelUUID); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java new file mode 100644 index 0000000000..58058da380 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ArRecipe; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "arRecipe", path = "arRecipe") +public interface ArRecipeRepository extends JpaRepository { + + public ArRecipe findByModelNameAndAction(String modelName, String action); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java new file mode 100644 index 0000000000..79ad9c77d1 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "buildingBlockDetail", path = "buildingBlockDetail") +public interface BuildingBlockDetailRepository extends JpaRepository { + BuildingBlockDetail findOneByBuildingBlockName(@Param("buildingBlockName") String buildingBlockName); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepository.java new file mode 100644 index 0000000000..79efe644bd --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionNetworkResourceCustomizationRepository.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "collectionNetworkResourceCustomization", path = "collectionNetworkResourceCustomization") +public interface CollectionNetworkResourceCustomizationRepository + extends JpaRepository { +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceCustomizationRepository.java new file mode 100644 index 0000000000..6e33eac556 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceCustomizationRepository.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "collectionResourceCustomization", path = "collectionResourceCustomization") +public interface CollectionResourceCustomizationRepository extends JpaRepository { + CollectionResourceCustomization findByModelCustomizationUUID(String modelCustomizationUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceInstanceGroupCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceInstanceGroupCustomizationRepository.java new file mode 100644 index 0000000000..32e09bf2af --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceInstanceGroupCustomizationRepository.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "collectionResourceInstanceGroupCustomization", path = "collectionResourceInstanceGroupCustomization") +public interface CollectionResourceInstanceGroupCustomizationRepository + extends JpaRepository { + + List findByModelCustomizationUUID(String modelCustomizationlUUID); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceRepository.java new file mode 100644 index 0000000000..5d847b87fb --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CollectionResourceRepository.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.CollectionResource; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "collectionResource", path = "collectionResource") +public interface CollectionResourceRepository extends JpaRepository { + CollectionResource findByModelUUID(String modelUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java new file mode 100644 index 0000000000..cd96f05c3e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceCustomizationRepository.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "configurationResourceCustomization", path = "configurationResourceCustomization") +public interface ConfigurationResourceCustomizationRepository + extends JpaRepository { + +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceRepository.java new file mode 100644 index 0000000000..5a29035cdb --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ConfigurationResourceRepository.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "configurationResource", path = "configurationResource") +public interface ConfigurationResourceRepository extends JpaRepository { + ConfigurationResource findResourceByModelUUID(String modelUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ExternalServiceToInternalServiceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ExternalServiceToInternalServiceRepository.java new file mode 100644 index 0000000000..91a912920e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ExternalServiceToInternalServiceRepository.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "externalServiceToInternalService", path = "externalServiceToInternalService") +public interface ExternalServiceToInternalServiceRepository + extends JpaRepository { + ExternalServiceToInternalService findByServiceName(String serviceName); + ExternalServiceToInternalService findByServiceNameAndSubscriptionServiceType(String serviceName , String subscriptionServiceType); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HeatEnvironmentRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HeatEnvironmentRepository.java new file mode 100644 index 0000000000..85d57e5b85 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HeatEnvironmentRepository.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "heatEnvironment", path = "heatEnvironment") +public interface HeatEnvironmentRepository extends JpaRepository { + HeatEnvironment findByArtifactUuid(String artifactUUID); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HeatTemplateRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HeatTemplateRepository.java new file mode 100644 index 0000000000..cb79506868 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/HeatTemplateRepository.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "heatTemplate", path = "heatTemplate") +public interface HeatTemplateRepository extends JpaRepository { + HeatTemplate findByArtifactUuid(String artifactUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/InstanceGroupRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/InstanceGroupRepository.java new file mode 100644 index 0000000000..5f5d85ae99 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/InstanceGroupRepository.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "instanceGroup", path = "instanceGroup") +public interface InstanceGroupRepository extends JpaRepository { + InstanceGroup findByModelUUID(String modelUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java new file mode 100644 index 0000000000..6ad1c64196 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ModelRecipe; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "modelRecipe", path = "modelRecipe") +public interface ModelRecipeRepository extends JpaRepository { + + + public ModelRecipe findByModelIdAndAction(String modelId, String action); + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java new file mode 100644 index 0000000000..4ace731817 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.Model; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "model", path = "model") +public interface ModelRepository extends JpaRepository { + + + public Model findByModelVersionIdAndModelType(String modelVersionid, String modelType); + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkCollectionResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkCollectionResourceCustomizationRepository.java new file mode 100644 index 0000000000..1d9bf71396 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkCollectionResourceCustomizationRepository.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "networkCollectionResourceCustomization", path = "networkCollectionResourceCustomization") +public interface NetworkCollectionResourceCustomizationRepository extends JpaRepository { + NetworkCollectionResourceCustomization findByModelCustomizationUUID(String modelCustomizationUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkInstanceGroupRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkInstanceGroupRepository.java new file mode 100644 index 0000000000..e2981ce96e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkInstanceGroupRepository.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.NetworkInstanceGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "networkInstanceGroup", path = "networkInstanceGroup") +public interface NetworkInstanceGroupRepository extends JpaRepository { + NetworkInstanceGroup findByModelUUID(String modelUUID); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java new file mode 100644 index 0000000000..3fb7d7aa19 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.NetworkRecipe; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "networkRecipe", path = "networkRecipe") +public interface NetworkRecipeRepository extends JpaRepository { + NetworkRecipe findByModelNameAndAction(String modelName, String action); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceCustomizationRepository.java new file mode 100644 index 0000000000..c169f3661a --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceCustomizationRepository.java @@ -0,0 +1,39 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.data.projections.InlineNetworks; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "networkResourceCustomization", path = "networkResourceCustomization", excerptProjection = InlineNetworks.class) +public interface NetworkResourceCustomizationRepository extends JpaRepository { + List findByModelCustomizationUUID(String modelCustomizationUUID); + + NetworkResourceCustomization findOneByModelCustomizationUUID(String modelCustomizationUUID); + + List findByNetworkType(String networkType); + + NetworkResourceCustomization findOneByNetworkType(String networkType); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java new file mode 100644 index 0000000000..842c888091 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java @@ -0,0 +1,43 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.NetworkResource; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.VnfResource; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +@Repository +public interface NetworkResourceRepository extends JpaRepository { + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelName + * @return + */ + @Query(value = "SELECT * FROM network_resource WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) + NetworkResource findFirstByModelNameOrderByModelVersionDesc(String modelName); + + public NetworkResource findResourceByModelUUID(String modelUUID); + NetworkResource findOneByModelName(String modelName); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java new file mode 100644 index 0000000000..b568d6c09b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "northbound_request_ref_lookup", path = "northbound_request_ref_lookup") +public interface NorthBoundRequestRepository extends JpaRepository { + NorthBoundRequest findOneByActionAndRequestScopeAndIsAlacarte(@Param("ACTION") String action, + @Param("REQUEST_SCOPE") String requestScope, @Param("IS_ALACARTE") Boolean isALaCarte); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java new file mode 100644 index 0000000000..db9cd745db --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java @@ -0,0 +1,35 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "orchestrationFlow", path = "orchestrationFlow") +public interface OrchestrationFlowRepository extends JpaRepository { + List findByAction(@Param("COMPOSITE_ACTION") String action); + + OrchestrationFlow findOneByAction(@Param("COMPOSITE_ACTION") String action); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java new file mode 100644 index 0000000000..ab728f46bf --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.OrchestrationAction; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; +import org.onap.so.db.catalog.beans.ResourceType; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "orchestrationStatusStateTransitionDirective", path = "orchestrationStatusStateTransitionDirective") +public interface OrchestrationStatusStateTransitionDirectiveRepository extends JpaRepository { + OrchestrationStatusStateTransitionDirective findOneByResourceTypeAndOrchestrationStatusAndTargetAction(@Param("resourceType") ResourceType resourceType, @Param("orchestrationStatus") OrchestrationStatus orchestrationStatus, @Param("targetAction") OrchestrationAction targetAction); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java new file mode 100644 index 0000000000..283c9623c8 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "rainy_day_handler_macro", path = "rainy_day_handler_macro") +public interface RainyDayHandlerStatusRepository extends JpaRepository { + RainyDayHandlerStatus findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( + @Param("FLOW_NAME") String flowName, @Param("SERVICE_TYPE") String serviceType, + @Param("VNF_TYPE") String vnfType, @Param("ERROR_CODE") String errorCode, + @Param("WORK_STEP") String workStep); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java new file mode 100644 index 0000000000..c90fd8965a --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "serviceProxyResourceCustomization", path = "serviceProxyResourceCustomization") +public interface ServiceProxyResourceCustomizationRepository + extends JpaRepository { +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceRepository.java new file mode 100644 index 0000000000..e6ec3b04d1 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceRepository.java @@ -0,0 +1,29 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ServiceProxyResource; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "serviceProxyResource", path = "serviceProxyResource") +public interface ServiceProxyResourceRepository extends JpaRepository { + ServiceProxyResource findResourceByModelUUID(String modelUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java new file mode 100644 index 0000000000..57578cfb07 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java @@ -0,0 +1,34 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ServiceRecipe; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "serviceRecipe", path = "serviceRecipe") +public interface ServiceRecipeRepository extends JpaRepository { + public ServiceRecipe findByActionAndServiceModelUUID(String action, String serviceModelUUID); + + public ServiceRecipe findByAction(String action); + + public ServiceRecipe findFirstByServiceModelUUIDAndAction(String serviceModelUUID, String action); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java new file mode 100644 index 0000000000..eac432a4dd --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java @@ -0,0 +1,98 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.data.projections.InlineService; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "service", path = "service", excerptProjection = InlineService.class) +public interface ServiceRepository extends JpaRepository { + List findByModelName(String modelName); + + Service findOneByModelName(String modelName); + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelName + * @return + */ + @Query(value = "SELECT * FROM service WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) + Service findFirstByModelNameOrderByModelVersionDesc(String modelName); + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelName + * @return + */ + @Query(value = "SELECT * FROM service WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) + Service findByModelNameOrderByModelVersionDesc(String modelName); + + Service findOneByModelNameAndModelVersion(String modelName, String modelVersion); + + Service findByModelNameAndModelVersion(String modelName, String modelVersion); + + Service findByServiceType(String serviceType); + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelName + * @return + */ + @Query(value = "SELECT * FROM service WHERE MODEL_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) + Service findFirstOneByModelUUIDOrderByModelVersionDesc(String modelUUID); + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelName + * @return + */ + @Query(value = "SELECT * FROM service WHERE MODEL_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) + Service findOneByModelUUIDOrderByModelVersionDesc(String modelUUID); + + Service findByModelVersionAndModelInvariantUUID(@Param("MODEL_VERSION") String modelVersion, + @Param("MODEL_INVARIANT_UUID") String modelInvariantUUID); + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelName + * @return + */ + @Query(value = "SELECT * FROM service WHERE MODEL_INVARIANT_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) + Service findFirstByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID); + + List findByModelUUID(String modelUUID); + + Service findOneByModelUUID(String modelUUID); + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelInvariantId + * @return + */ + @Query(value = "SELECT * FROM service WHERE MODEL_INVARIANT_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC;", nativeQuery = true) + List findByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantId); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/TempNetworkHeatTemplateRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/TempNetworkHeatTemplateRepository.java new file mode 100644 index 0000000000..d506c5b585 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/TempNetworkHeatTemplateRepository.java @@ -0,0 +1,31 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "tempNetworkHeatTemplateLookup", path = "tempNetworkHeatTemplateLookup") +public interface TempNetworkHeatTemplateRepository extends JpaRepository { + + TempNetworkHeatTemplateLookup findFirstBynetworkResourceModelName(String networkResourceModelName); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ToscaCsarRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ToscaCsarRepository.java new file mode 100644 index 0000000000..b85867776c --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ToscaCsarRepository.java @@ -0,0 +1,30 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.ToscaCsar; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "toscaCsar", path = "toscaCsar") +public interface ToscaCsarRepository extends JpaRepository { + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFCInstanceGroupRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFCInstanceGroupRepository.java new file mode 100644 index 0000000000..da091827b7 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFCInstanceGroupRepository.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.VFCInstanceGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vfcInstanceGroup", path = "vfcInstanceGroup") +public interface VFCInstanceGroupRepository extends JpaRepository { + VFCInstanceGroup findByModelUUID(String modelUUID); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleCustomizationRepository.java new file mode 100644 index 0000000000..ee2d08b6f2 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleCustomizationRepository.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vfModuleCustomization", path = "vfModuleCustomization") +public interface VFModuleCustomizationRepository extends JpaRepository { + VfModuleCustomization findByModelCustomizationUUID(String modelCustomizationUUID); + + VfModuleCustomization findByModelCustomizationUUIDAndVfModuleModelUUID(String modelCustomizationUUID, String vfModuleModelUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java new file mode 100644 index 0000000000..6b403b312e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java @@ -0,0 +1,58 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.VfModule; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vfModule", path = "vfModule") +public interface VFModuleRepository extends JpaRepository { + VfModule findByModelUUID(String modelUUID); + + VfModule findByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion); + + VfModule findByModelName(String modelName); + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelInvariantUUID + * @return + */ + @Query(value = "SELECT * FROM vf_module WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true) + VfModule findFirstByModelNameOrderByModelVersionDesc(String modelName); + + VfModule findByModelInvariantUUIDAndModelUUID(String modelCustomizationUUID, String modelUUID); + + VfModule findByModelInvariantUUID(@Param("ACTION") String modelCustomizationUUID); + + /** + * This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting + * @param modelInvariantUUID + * @return + */ + @Query(value = "SELECT * FROM vf_module WHERE MODEL_INVARIANT_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC;", nativeQuery = true) + List findByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java new file mode 100644 index 0000000000..822ac44be2 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java @@ -0,0 +1,39 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.VnfComponentsRecipe; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vnfComponentsRecipe", path = "vnfComponentsRecipe") +public interface VnfComponentRecipeRepository extends JpaRepository { + + VnfComponentsRecipe findVnfComponentsRecipeByVfModuleModelUUIDAndVnfTypeAndAction(String vfModuleModelUUID, + String vnfType, String action); + + VnfComponentsRecipe findVnfComponentsRecipeByVnfTypeAndAction(String vnfType, String action); + + VnfComponentsRecipe findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String modelUUID, + String vnfComponentType, String action); + + VnfComponentsRecipe findVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java new file mode 100644 index 0000000000..0d9ac2b33d --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java @@ -0,0 +1,39 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.VnfResource; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.data.projections.InlineVnf; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vnfResourceCustomization", path = "vnfResourceCustomization", excerptProjection = InlineVnf.class) +public interface VnfCustomizationRepository extends JpaRepository { + List findByModelCustomizationUUID(String modelCustomizationUUID); + + VnfResourceCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid); + + VnfResourceCustomization findByModelInstanceNameAndVnfResources(String modelInstanceName, VnfResource vnfResource); + +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java new file mode 100644 index 0000000000..97d6669c58 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java @@ -0,0 +1,32 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.VnfRecipe; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vnfRecipe", path = "vnfRecipe") +public interface VnfRecipeRepository extends JpaRepository { + VnfRecipe findVnfRecipeByServiceTypeAndAction(String serviceType, String action); + + VnfRecipe findVnfRecipeByNfRoleAndAction(String nfRole, String action); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java new file mode 100644 index 0000000000..5b0258238e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java @@ -0,0 +1,41 @@ +/*- + * ============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.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.VnfResource; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vnfResource", path = "vnfResource") +public interface VnfResourceRepository extends JpaRepository { + + VnfResource findResourceByModelNameAndModelUUID(String modelName, String modelUUID); + + VnfResource findByModelName(String modelName); + + VnfResource findByModelNameAndModelVersion(String modelName, String modelVersion); + + VnfResource findResourceByModelUUID(String modelUUID); + + VnfResource findResourceByModelInvariantUUID(String modelInvariantId); + + VnfResource findResourceByModelInvariantUUIDAndModelVersion(String relatedInstanceModelInvariantId, String relatedInstanceVersion); +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcInstanceGroupCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcInstanceGroupCustomizationRepository.java new file mode 100644 index 0000000000..f2fbbe6b57 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcInstanceGroupCustomizationRepository.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vnfcInstanceGroupCustomization", path = "vnfcInstanceGroupCustomization") +public interface VnfcInstanceGroupCustomizationRepository + extends JpaRepository { + List findByModelCustomizationUUID(String modelCustomizationlUUID); +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java new file mode 100644 index 0000000000..fc968a4ef9 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java @@ -0,0 +1,194 @@ +/*- + * ============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.onap.so.db.catalog.rest.beans; + +import java.io.Serializable; +import java.util.ArrayList; + +import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VnfResource; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; + +import com.openpojo.business.annotation.BusinessKey; + +/* + * A simple holder for Service and its associated elements: + * VnfResource, 1-n VfModule, Network TBD + */ + +public class ServiceMacroHolder implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + @BusinessKey + private Service service; + private ArrayList vnfResources; + private ArrayList networkResourceCustomizations; + private ArrayList allottedResourceCustomizations; + private ArrayList vnfResourceCustomizations; + + + public ServiceMacroHolder() { + super(); + this.service = null; + this.vnfResources = new ArrayList(); + this.networkResourceCustomizations = new ArrayList<>(); + this.allottedResourceCustomizations = new ArrayList<>(); + this.vnfResourceCustomizations = new ArrayList<>(); + } + public ServiceMacroHolder(Service service) { + this(); + this.service = service; + } + + public Service getService() { + return this.service; + } + public void setService(Service service) { + this.service = service; + } + + public void setVnfResources(ArrayList vnfResources) { + this.vnfResources = vnfResources; + } + public ArrayList getVnfResources() { + return this.vnfResources; + } + public void addVnfResource(VnfResource vr) { + if (vr != null) { + if (this.vnfResources != null) { + this.vnfResources.add(vr); + } else { + this.vnfResources = new ArrayList<>(); + this.vnfResources.add(vr); + } + } + } + + public void setVnfResourceCustomizations(ArrayList vnfResourceCustomizations) { + this.vnfResourceCustomizations = vnfResourceCustomizations; + } + public ArrayList getVnfResourceCustomizations() { + return this.vnfResourceCustomizations; + } + public void addVnfResourceCustomizations(VnfResourceCustomization vrc) { + if (vrc != null) { + if (this.vnfResourceCustomizations != null) { + this.vnfResourceCustomizations.add(vrc); + } else { + this.vnfResourceCustomizations = new ArrayList<>(); + this.vnfResourceCustomizations.add(vrc); + } + } + } + + public void setNetworkResourceCustomization(ArrayList networkResourceCustomizations) { + this.networkResourceCustomizations = networkResourceCustomizations; + } + public ArrayList getNetworkResourceCustomization() { + return this.networkResourceCustomizations; + } + public void addNetworkResourceCustomization(NetworkResourceCustomization nrc) { + if (this.networkResourceCustomizations != null) { + this.networkResourceCustomizations.add(nrc); + } else { + this.networkResourceCustomizations = new ArrayList<>(); + this.networkResourceCustomizations.add(nrc); + } + } + + public void setAllottedResourceCustomization(ArrayList allottedResourceCustomizations) { + this.allottedResourceCustomizations = allottedResourceCustomizations; + } + public ArrayList getAllottedResourceCustomization() { + return this.allottedResourceCustomizations; + } + public void addAllottedResourceCustomization(AllottedResourceCustomization arc) { + if (this.allottedResourceCustomizations != null) { + this.allottedResourceCustomizations.add(arc); + } else { + this.allottedResourceCustomizations = new ArrayList<>(); + this.allottedResourceCustomizations.add(arc); + } + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ServicePlus: "); + if (this.service != null) { + sb.append("service: " + this.service.toString()); + } else { + sb.append("service: null"); + } + if (this.vnfResourceCustomizations != null && this.vnfResourceCustomizations.size() > 0) { + int i=0; + sb.append("VnfResources: "); + for (VnfResourceCustomization vrc : this.vnfResourceCustomizations) { + sb.append(", vnfResourceCustomization[" + i++ + "]:" + vrc.toString()); + } + } else { + sb.append("none"); + } + if (this.vnfResources != null && this.vnfResources.size() > 0) { + int i=0; + sb.append("VnfResources: "); + for (VnfResource vr : this.vnfResources) { + sb.append(", vnfResource[" + i++ + "]:" + vr.toString()); + } + } else { + sb.append("none"); + } + if (this.networkResourceCustomizations != null && this.networkResourceCustomizations.size() > 0) { + int i=0; + sb.append("NetworkResourceCustomizations:"); + for (NetworkResourceCustomization nrc : this.networkResourceCustomizations) { + sb.append("NRC[" + i++ + "]: " + nrc.toString()); + } + } + if (this.allottedResourceCustomizations != null && this.allottedResourceCustomizations.size() > 0) { + int i=0; + sb.append("AllottedResourceCustomizations:"); + for (AllottedResourceCustomization arc : this.allottedResourceCustomizations) { + sb.append("ARC[" + i++ + "]: " + arc.toString()); + } + } + + return sb.toString(); + } + public ArrayList getNetworkResourceCustomizations() { + return networkResourceCustomizations; + } + public void setNetworkResourceCustomizations(ArrayList networkResourceCustomizations) { + this.networkResourceCustomizations = networkResourceCustomizations; + } + public ArrayList getAllottedResourceCustomizations() { + return allottedResourceCustomizations; + } + public void setAllottedResourceCustomizations(ArrayList allottedResourceCustomizations) { + this.allottedResourceCustomizations = allottedResourceCustomizations; + } + + + + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java new file mode 100644 index 0000000000..6951c4412d --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java @@ -0,0 +1,112 @@ +/*- + * ============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.onap.so.db.catalog.utils; + + +import java.io.Serializable; + +/** + * This class is the base class for object that requires a Version in Catalog DB. + * The version is built on a string as ASDC provides a number like 1.2 or 2.0 ... + * This class supports also 1.2.3.4... (Maven like version) + * + * + */ +public class MavenLikeVersioning implements Serializable { + + protected String version; + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** + * This method is used to compare the current object version to a specified one + * It is assumed that the version is like the maven one, eg: 2.0.1.5.6 + * + * @param versionToCompare The version that will be used for comparison + * @return True if the current object is more recent than the specified version, False otherwise + * + */ + public boolean isMoreRecentThan (String versionToCompare) { + if (versionToCompare == null || versionToCompare.trim().isEmpty() || this.version == null || this.version.trim().isEmpty()) { + return false; + } + String[] currentVersionArray = this.version.split("\\."); + String[] specifiedVersionArray = versionToCompare.split("\\."); + + int smalestStringLength = Math.min(currentVersionArray.length, specifiedVersionArray.length); + + for (int currentVersionIndex = 0; currentVersionIndex < smalestStringLength; ++currentVersionIndex) { + + if (Integer.parseInt(currentVersionArray[currentVersionIndex]) < Integer + .parseInt(specifiedVersionArray[currentVersionIndex])) { + return false; + } else if (Integer.parseInt(currentVersionArray[currentVersionIndex]) > Integer + .parseInt(specifiedVersionArray[currentVersionIndex])) { + return true; + } + } + try { + // Even if versionToCompare has more digits, it means versionToCompare is more recent + return Integer.parseInt(currentVersionArray[smalestStringLength - 1]) != Integer + .parseInt(specifiedVersionArray[smalestStringLength - 1]) + || currentVersionArray.length > specifiedVersionArray.length; + } catch (NumberFormatException e) { + return false; + } + } + + /** + * This method is used to compare the current object version to a specified one + * It is assumed that the version is like the maven one, eg: 2.0.1.5.6 + * + * @param versionToCompare The version that will be used for comparison + * @return True if the current object is equal to the specified version, False otherwise + * + */ + public boolean isTheSameVersion (String versionToCompare) { + if (versionToCompare == null && this.version == null) { + return true; + } else if (versionToCompare == null || versionToCompare.trim().equals("") || this.version == null || this.version.trim().equals("")) { + return false; + } + String [] currentVersionArray = this.version.split("\\."); + String [] specifiedVersionArray = versionToCompare.split("\\."); + + if (currentVersionArray.length != specifiedVersionArray.length) { + return false; + } + + for (int currentVersionIndex=0;currentVersionIndex < currentVersionArray.length;++currentVersionIndex) { + + if (Integer.parseInt(currentVersionArray[currentVersionIndex]) != Integer.parseInt(specifiedVersionArray[currentVersionIndex])) { + return false; + } + } + + return true; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioningComparator.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioningComparator.java new file mode 100644 index 0000000000..85fc9b3df2 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioningComparator.java @@ -0,0 +1,49 @@ +/*- + * ============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.onap.so.db.catalog.utils; + + +import java.util.Comparator; + +/** + * This class can be used to sort object from MavenLikeVersioning type. + * + * + * + */ +public class MavenLikeVersioningComparator implements Comparator { + + @Override + public int compare(MavenLikeVersioning o1, MavenLikeVersioning o2) { + final int BEFORE = -1; + final int EQUAL = 0; + final int AFTER = 1; + + if (o1.isTheSameVersion(o2.getVersion())) { + return EQUAL; + } else if (o1.isMoreRecentThan(o2.getVersion())) { + return AFTER; + } else { + return BEFORE; + } + } + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/RecordNotFoundException.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/RecordNotFoundException.java new file mode 100644 index 0000000000..4168492245 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/RecordNotFoundException.java @@ -0,0 +1,50 @@ +/*- + * ============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.onap.so.db.catalog.utils; + +/* +* Exception of the ASDC controller. +*/ +public class RecordNotFoundException extends Exception { + + /** + * serialization id. + */ + private static final long serialVersionUID = 8425657297510362736L; + + /** + * @param message The message to dump + * @param cause The Throwable cause object + */ + public RecordNotFoundException(final String message) { + super (message); + + } + + /** + * @param message The message to dump + * @param cause The Throwable cause object + */ + public RecordNotFoundException(final String message, final Throwable cause) { + super (message, cause); + + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/package-info.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/package-info.java new file mode 100644 index 0000000000..4f43c26b2e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/package-info.java @@ -0,0 +1,26 @@ +/*- + * ============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========================================================= + */ + +/** + * Utility classes for catalog DB. + */ + +package org.onap.so.db.catalog.utils; + -- cgit 1.2.3-korg