diff options
Diffstat (limited to 'mso-catalog-db/src/main/java')
10 files changed, 164 insertions, 44 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java index deaa2a3221..0d7fe7d38f 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java @@ -93,6 +93,11 @@ public class CloudSite { @Column(name = "CLOUDIFY_ID") private String cloudifyId; + @JsonProperty("cloud_owner") + @BusinessKey + @Column(name = "CLOUD_OWNER") + private String cloudOwner; + // Derived property (set by CloudConfig loader based on identityServiceId) @BusinessKey @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @@ -266,12 +271,20 @@ public class CloudSite { this.identityServiceId = identityServiceId; } + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId()) .append("identityServiceId", getIdentityServiceId()).append("cloudVersion", getCloudVersion()) .append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform()) - .append("orchestrator", getOrchestrator()).toString(); + .append("orchestrator", getOrchestrator()).append("cloud-owner", getCloudOwner()).toString(); } @Override diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java index 05d43d093c..33994bae8b 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcConfigurationCustomization.java @@ -78,11 +78,11 @@ public class CvnfcConfigurationCustomization implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date created; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "CONFIGURATION_MODEL_UUID") private ConfigurationResource configurationResource; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "CVNFC_CUSTOMIZATION_ID") private CvnfcCustomization cvnfcCustomization; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java index 7fb328fdb5..9bf0cdd6a7 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java @@ -92,11 +92,11 @@ public class CvnfcCustomization implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date created; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "VF_MODULE_CUSTOMIZATION_ID") private VfModuleCustomization vfModuleCustomization; - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "VNFC_CUST_MODEL_CUSTOMIZATION_UUID") private VnfcCustomization vnfcCustomization; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java new file mode 100644 index 0000000000..1f19dcc1dd --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Tech Mahindra + * ================================================================================ + * 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 = "network_technology_reference") +public class NetworkTechnologyReference implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "ID", nullable = false, updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @BusinessKey + @Column(name = "cloud_owner") + private String cloudOwner; + + @BusinessKey + @Column(name = "network_technology") + private String networkTechnology; + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("cloudOwner", cloudOwner) + .append("networkTechnology", networkTechnology).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkTechnologyReference)) { + return false; + } + NetworkTechnologyReference castOther = (NetworkTechnologyReference) other; + return new EqualsBuilder().append(cloudOwner, castOther.cloudOwner) + .append(networkTechnology, castOther.networkTechnology).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(cloudOwner).append(networkTechnology).toHashCode(); + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public Integer getId() { + return id; + } + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getNetworkTechnology() { + return networkTechnology; + } + + public void setNetworkTechnology(String networkTechnology) { + this.networkTechnology = networkTechnology; + } + + + +} 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 index 0d7a6dbd1f..8222b72d8f 100644 --- 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 @@ -79,6 +79,9 @@ public class Service implements Serializable { @Column(name = "SERVICE_ROLE") private String serviceRole; + @Column(name = "SERVICE_FUNCTION") + private String serviceFunction; + @Column(name = "ENVIRONMENT_CONTEXT") private String environmentContext; @@ -139,6 +142,9 @@ public class Service implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "service") private List<ServiceArtifact> serviceArtifactList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "service") + private List<ServiceInfo> serviceInfos; + @Column(name = "NAMING_POLICY") private String namingPolicy; @@ -385,6 +391,17 @@ public class Service implements Serializable { this.serviceArtifactList = serviceArtifactList; } + public List<ServiceInfo> getServiceInfos() { + if (serviceInfos == null) { + serviceInfos = new ArrayList<>(); + } + return serviceInfos; + } + + public void setServiceInfos(List<ServiceInfo> serviceInfos) { + this.serviceInfos = serviceInfos; + } + public String getWorkloadContext() { return this.workloadContext; } @@ -456,4 +473,13 @@ public class Service implements Serializable { public void setControllerActor(String controllerActor) { this.controllerActor = controllerActor; } + + public String getServiceFunction() { + return serviceFunction; + } + + public void setServiceFunction(String serviceFunction) { + this.serviceFunction = serviceFunction; + } + } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java index f9c95767f6..d11a112c80 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java @@ -45,9 +45,8 @@ public class ServiceInfo implements Serializable { @Column(name = "SERVICE_PROPERTIES") private String serviceProperties; - @OneToOne(cascade = CascadeType.ALL) - @JoinTable(name = "service_to_service_info", joinColumns = @JoinColumn(name = "SERVICE_INFO_ID"), - inverseJoinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID")) + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "SERVICE_MODEL_UUID") private Service service; public Integer getId() { 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 index 3420682900..83de95874c 100644 --- 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 @@ -21,10 +21,9 @@ 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; @@ -41,7 +40,6 @@ 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 org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import com.fasterxml.jackson.annotation.JsonFormat; import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; @@ -98,7 +96,7 @@ public class VfModuleCustomization implements Serializable { private VnfResourceCustomization vnfCustomization; @OneToMany(cascade = CascadeType.ALL, mappedBy = "vfModuleCustomization") - private Set<CvnfcCustomization> cvnfcCustomization; + private List<CvnfcCustomization> cvnfcCustomization; @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION") private Boolean skipPostInstConf; @@ -233,13 +231,13 @@ public class VfModuleCustomization implements Serializable { } @LinkedResource - public Set<CvnfcCustomization> getCvnfcCustomization() { + public List<CvnfcCustomization> getCvnfcCustomization() { if (cvnfcCustomization == null) - cvnfcCustomization = new HashSet<>(); + cvnfcCustomization = new ArrayList<>(); return cvnfcCustomization; } - public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) { + public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) { this.cvnfcCustomization = cvnfcCustomization; } 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 index cd7edb007d..4c5bbaf7ec 100644 --- 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 @@ -915,7 +915,7 @@ public class CatalogDbClient { findVnfResourceCustomizationInList(vnfCustomizationUUID, service.getVnfCustomizations()); VfModuleCustomization vfModuleCust = findVfModuleCustomizationInList(vfModuleCustomizationUUID, vnfResourceCust.getVfModuleCustomizations()); - return vfModuleCust.getCvnfcCustomization().stream().collect(Collectors.toList()); + return vfModuleCust.getCvnfcCustomization(); } public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID, @@ -971,10 +971,9 @@ public class CatalogDbClient { List<CvnfcCustomization> cvnfcCustomization = getCvnfcCustomization(serviceModelUUID, vnfCustomizationUuid, vfModuleCustomizationUuid); CvnfcCustomization cvnfc = findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcCustomization); - List<CvnfcConfigurationCustomization> fabricConfigs = cvnfc - .getCvnfcConfigurationCustomization().stream().filter(cvnfcCustom -> cvnfcCustom - .getConfigurationResource().getToscaNodeType().contains("FabricConfiguration")) - .collect(Collectors.toList()); + List<CvnfcConfigurationCustomization> fabricConfigs = cvnfc.getCvnfcConfigurationCustomization(); + fabricConfigs.stream().filter(cvnfcCustom -> cvnfcCustom.getConfigurationResource().getToscaNodeType() + .contains("FabricConfiguration")).collect(Collectors.toList()); if (fabricConfigs != null && !fabricConfigs.isEmpty() && fabricConfigs.size() == 1) { logger.debug("Found Fabric Configuration: {}", fabricConfigs.get(0)); return fabricConfigs.get(0); diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java index e3a4ca264e..0b7065490b 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (c) 2019, CMCC Technologies Co., Ltd. + * Copyright (C) 2019 Tech Mahindra * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,14 +20,13 @@ package org.onap.so.db.catalog.data.repository; -import org.onap.so.db.catalog.beans.Service; -import org.onap.so.db.catalog.beans.ServiceInfo; + +import java.util.List; +import org.onap.so.db.catalog.beans.NetworkTechnologyReference; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; -@RepositoryRestResource(collectionResourceRel = "serviceInfo", path = "serviceInfo") -public interface ServiceInfoRepository extends JpaRepository<ServiceInfo, Integer> { - ServiceInfo findByService(Service service); +public interface NetworkTechnologyReferenceRepository extends JpaRepository<NetworkTechnologyReference, Integer> { + List<NetworkTechnologyReference> findAllByCloudOwner(String cloudOwner); } 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 index ec4e922c8f..65cbb5253e 100644 --- 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 @@ -39,7 +39,6 @@ public class ServiceMacroHolder implements Serializable { private ArrayList<AllottedResourceCustomization> allottedResourceCustomizations; private ArrayList<VnfResourceCustomization> vnfResourceCustomizations; private ArrayList<ServiceProxyResourceCustomization> serviceProxyResourceCustomizations; - private ServiceInfo serviceInfo; public ServiceMacroHolder() { @@ -50,7 +49,6 @@ public class ServiceMacroHolder implements Serializable { this.allottedResourceCustomizations = new ArrayList<>(); this.vnfResourceCustomizations = new ArrayList<>(); this.serviceProxyResourceCustomizations = new ArrayList<>(); - this.serviceInfo = null; } public ServiceMacroHolder(Service service) { @@ -66,14 +64,6 @@ public class ServiceMacroHolder implements Serializable { this.service = service; } - public ServiceInfo getServiceInfo() { - return serviceInfo; - } - - public void setServiceInfo(ServiceInfo serviceInfo) { - this.serviceInfo = serviceInfo; - } - public void setVnfResources(ArrayList<VnfResource> vnfResources) { this.vnfResources = vnfResources; } @@ -165,11 +155,6 @@ public class ServiceMacroHolder implements Serializable { } else { sb.append("service: null"); } - if (this.serviceInfo != null) { - sb.append("serviceInfo: " + this.serviceInfo.toString()); - } else { - sb.append("serviceInfo: null"); - } if (this.vnfResourceCustomizations != null && this.vnfResourceCustomizations.size() > 0) { int i = 0; sb.append("VnfResources: "); |