diff options
Diffstat (limited to 'mso-catalog-db/src/main')
13 files changed, 958 insertions, 2 deletions
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 index 173480172d..7c6fb04079 100644 --- 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 @@ -79,6 +79,9 @@ public class ConfigurationResource implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "configurationResource") private Set<ConfigurationResourceCustomization> configurationResourceCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "configurationResource") + private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization; @PrePersist protected void onCreate() { @@ -147,6 +150,16 @@ public class ConfigurationResource implements Serializable { this.configurationResourceCustomization = configurationResourceCustomization; } + @LinkedResource + public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() { + return vnfVfmoduleCvnfcConfigurationCustomization; + } + + public void setVnfVfmoduleCvnfcConfigurationCustomization( + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) { + this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization; + } + @Override public String toString() { return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID) 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 new file mode 100644 index 0000000000..c02b1e3030 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java @@ -0,0 +1,275 @@ +/*- + * ============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.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +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.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "cvnfc_customization") +public class CvnfcCustomization implements Serializable { + + private static final long serialVersionUID = -3772469944364616486L; + + @Id + @Column(name = "ID") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @BusinessKey + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @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 = "NFC_FUNCTION") + private String nfcFunction; + + @Column(name = "NFC_NAMING_CODE") + private String nfcNamingCode; + + @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, fetch = FetchType.LAZY) + @JoinColumn(name = "VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") + private VfModuleCustomization vfModuleCustomization; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VNFC_CUST_MODEL_CUSTOMIZATION_UUID") + private VnfcCustomization vnfcCustomization; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") + private VnfResourceCustomization vnfResourceCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CvnfcCustomization)) { + return false; + } + CvnfcCustomization castOther = (CvnfcCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("modelUUID", modelUUID) + .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion) + .append("modelName", modelName).append("toscaNodeType", toscaNodeType) + .append("description", description).append("nfcFunction", nfcFunction) + .append("nfcNamingCode", nfcNamingCode).append("created", created) + .append("vfModuleCustomization", vfModuleCustomization).append("vnfcCustomization", vnfcCustomization) + .append("vnfResourceCustomization", vnfResourceCustomization) + .append("vnfVfmoduleCvnfcConfigurationCustomization", vnfVfmoduleCvnfcConfigurationCustomization) + .toString(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @LinkedResource + public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() { + return vnfVfmoduleCvnfcConfigurationCustomization; + } + + public void setVnfVfmoduleCvnfcConfigurationCustomization( + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) { + this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + 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 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 String getNfcFunction() { + return nfcFunction; + } + + public void setNfcFunction(String nfcFunction) { + this.nfcFunction = nfcFunction; + } + + public String getNfcNamingCode() { + return nfcNamingCode; + } + + public void setNfcNamingCode(String nfcNamingCode) { + this.nfcNamingCode = nfcNamingCode; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public VfModuleCustomization getVfModuleCustomization() { + return vfModuleCustomization; + } + + public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) { + this.vfModuleCustomization = vfModuleCustomization; + } + + public VnfcCustomization getVnfcCustomization() { + return vnfcCustomization; + } + + public void setVnfcCustomization(VnfcCustomization vnfcCustomization) { + this.vnfcCustomization = vnfcCustomization; + } + + public VnfResourceCustomization getVnfResourceCustomization() { + return vnfResourceCustomization; + } + + public void setVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) { + this.vnfResourceCustomization = vnfResourceCustomization; + } +} 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 index 47d82bff06..7d53a0b843 100644 --- 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 @@ -28,6 +28,7 @@ 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; @@ -94,7 +95,7 @@ public class VfModule implements Serializable { @OneToMany(mappedBy = "vfModule") private List<VfModuleCustomization> vfModuleCustomization; - @ManyToOne + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID") private VnfResource vnfResources; 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 4a9b3bbbb5..5a7d0d5425 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 @@ -22,6 +22,9 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -29,6 +32,7 @@ import javax.persistence.Entity; 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; @@ -37,6 +41,7 @@ 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; @@ -85,7 +90,16 @@ public class VfModuleCustomization implements Serializable { @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "VF_MODULE_MODEL_UUID") private VfModule vfModule; - + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<VnfcCustomization> vnfcCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<CvnfcCustomization> cvnfcCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization; + @PrePersist protected void onCreate() { this.created = new Date(); @@ -196,4 +210,37 @@ public class VfModuleCustomization implements Serializable { public void setVfModule(VfModule vfModule) { this.vfModule = vfModule; } + + @LinkedResource + public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() { + if (vnfVfmoduleCvnfcConfigurationCustomization == null) + vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>(); + return vnfVfmoduleCvnfcConfigurationCustomization; + } + + public void setVnfVfmoduleCvnfcConfigurationCustomization( + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) { + this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization; + } + + @LinkedResource + public Set<VnfcCustomization> getVnfcCustomization() { + return vnfcCustomization; + } + + public void setVnfcCustomization( + Set<VnfcCustomization> vnfcCustomization) { + this.vnfcCustomization = vnfcCustomization; + } + + @LinkedResource + public Set<CvnfcCustomization> getCvnfcCustomization() { + if (cvnfcCustomization == null) + cvnfcCustomization = new HashSet<>(); + return cvnfcCustomization; + } + + public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) { + this.cvnfcCustomization = cvnfcCustomization; + } } 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 index fa0fe5636e..d286bc0727 100644 --- 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 @@ -23,7 +23,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; @@ -67,6 +69,10 @@ public class VnfResourceCustomization implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date created; + public void setCreated(Date created) { + this.created = created; + } + @Column(name = "MIN_INSTANCES") private Integer minInstances; @@ -101,6 +107,12 @@ public class VnfResourceCustomization implements Serializable { @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust") private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private List<CvnfcCustomization> cvnfcCustomization; @Override public String toString() { @@ -250,4 +262,25 @@ public class VnfResourceCustomization implements Serializable { List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) { this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations; } + + @LinkedResource + public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() { + if (vnfVfmoduleCvnfcConfigurationCustomization == null) + vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>(); + return vnfVfmoduleCvnfcConfigurationCustomization; + } + + public void setVnfVfmoduleCvnfcConfigurationCustomization( + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) { + this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization; + } + + @LinkedResource + public List<CvnfcCustomization> getCvnfcCustomization() { + return cvnfcCustomization; + } + + public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) { + this.cvnfcCustomization = cvnfcCustomization; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java new file mode 100644 index 0000000000..8ef797f8fa --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java @@ -0,0 +1,236 @@ +/*- + * ============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.GeneratedValue; +import javax.persistence.GenerationType; +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; + +@Entity +@Table(name = "vnf_vfmodule_cvnfc_configuration_customization") +public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable { + + private static final long serialVersionUID = -3153216266280581103L; + + @Id + @Column(name = "ID") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @BusinessKey + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "CONFIGURATION_TYPE") + private String configurationType; + + @Column(name = "CONFIGURATION_ROLE") + private String configurationRole; + + @Column(name = "CONFIGURATION_FUNCTION") + private String configurationFunction; + + @Column(name = "POLICY_NAME") + private String policyName; + + @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, fetch = FetchType.LAZY) + @JoinColumn(name = "CONFIGURATION_MODEL_UUID") + private ConfigurationResource configurationResource; + + @BusinessKey + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "CVNFC_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID") + private CvnfcCustomization cvnfcCustomization; + + @BusinessKey + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VF_MODULE_MODEL_CUSTOMIZATION_UUID") + private VfModuleCustomization vfModuleCustomization; + + @BusinessKey + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") + private VnfResourceCustomization vnfResourceCustomization; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfVfmoduleCvnfcConfigurationCustomization)) { + return false; + } + VnfVfmoduleCvnfcConfigurationCustomization castOther = (VnfVfmoduleCvnfcConfigurationCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID) + .append(cvnfcCustomization, castOther.cvnfcCustomization) + .append(vfModuleCustomization, castOther.vfModuleCustomization) + .append(vnfResourceCustomization, castOther.vnfResourceCustomization).isEquals(); + } + + + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).append(cvnfcCustomization) + .append(vfModuleCustomization).append(vnfResourceCustomization).toHashCode(); + } + + + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("configurationType", configurationType) + .append("configurationRole", configurationRole).append("configurationFunction", configurationFunction) + .append("policyName", policyName).append("created", created) + .append("configurationResource", configurationResource).append("cvnfcCustomization", cvnfcCustomization) + .append("vfModuleCustomization", vfModuleCustomization) + .append("vnfResourceCustomization", vnfResourceCustomization).toString(); + } + + + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + 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 getConfigurationType() { + return configurationType; + } + + public void setConfigurationType(String configurationType) { + this.configurationType = configurationType; + } + + public String getConfigurationRole() { + return configurationRole; + } + + public void setConfigurationRole(String configurationRole) { + this.configurationRole = configurationRole; + } + + public String getConfigurationFunction() { + return configurationFunction; + } + + public void setConfigurationFunction(String configurationFunction) { + this.configurationFunction = configurationFunction; + } + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public ConfigurationResource getConfigurationResource() { + return configurationResource; + } + + public void setConfigurationResource(ConfigurationResource configurationResource) { + this.configurationResource = configurationResource; + } + + public CvnfcCustomization getCvnfcCustomization() { + return cvnfcCustomization; + } + + public void setCvnfcCustomization(CvnfcCustomization cvnfcCustomization) { + this.cvnfcCustomization = cvnfcCustomization; + } + + public VfModuleCustomization getVfModuleCustomization() { + return vfModuleCustomization; + } + + public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) { + this.vfModuleCustomization = vfModuleCustomization; + } + + public VnfResourceCustomization getVnfResourceCustomization() { + return vnfResourceCustomization; + } + + public void setVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) { + this.vnfResourceCustomization = vnfResourceCustomization; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java new file mode 100644 index 0000000000..8534242a58 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java @@ -0,0 +1,191 @@ +/*- + * ============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 com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +@Entity +@Table(name = "vnfc_customization") +public class VnfcCustomization implements Serializable { + + private static final long serialVersionUID = -3772469944364616486L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @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) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "vnfcCustomization") + private List<CvnfcCustomization> cvnfcCustomization; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfcCustomization)) { + return false; + } + VnfcCustomization castOther = (VnfcCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("modelUUID", modelUUID) + .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion) + .append("modelName", modelName).append("toscaNodeType", toscaNodeType) + .append("description", description).append("created", created) + .append("cvnfcCustomization", cvnfcCustomization).toString(); + } + + @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 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; + } + + public void setCreated(Date created) { + this.created = created; + } + + public List<CvnfcCustomization> getCvnfcCustomization() { + return 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 8da24c928d..e29d88cb89 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 @@ -26,6 +26,7 @@ import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkRecipe; @@ -195,6 +196,8 @@ public class CatalogDbClient { private final Client<CloudSite> cloudSiteClient; private final Client<CloudifyManager> cloudifyManagerClient; + + private Client<CvnfcCustomization> cvnfcCustomizationClient; private final Client<ControllerSelectionReference> controllerSelectionReferenceClient; @@ -240,6 +243,7 @@ public class CatalogDbClient { instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR; cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR; cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR; + } public CatalogDbClient() { @@ -278,6 +282,7 @@ public class CatalogDbClient { cloudSiteClient = clientFactory.create(CloudSite.class); cloudifyManagerClient = clientFactory.create(CloudifyManager.class); serviceRecipeClient = clientFactory.create(ServiceRecipe.class); + cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); } @@ -537,5 +542,20 @@ public class CatalogDbClient { it.forEachRemaining(list::add); return list; } + + public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){ + return this.getMultipleVnfcCustomizations( + UriBuilder.fromUri(endpoint + "/vnfcCustomization/search/findByVnfCustomizationUUIDAndVfModuleCustomizationUUID") + .queryParam("VNF_CUSTOMIZATION_UUID", vnfCustomizationUUID) + .queryParam("VFMODULE_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build()); + } + + private List<CvnfcCustomization> getMultipleVnfcCustomizations(URI uri) { + Iterable<CvnfcCustomization> vnfcIterator = cvnfcCustomizationClient.getAll(uri); + List<CvnfcCustomization> vnfcList = new ArrayList<>(); + Iterator<CvnfcCustomization> it = vnfcIterator.iterator(); + it.forEachRemaining(vnfcList::add); + return vnfcList; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java index ba40a9c506..fc5a95769d 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java @@ -1,3 +1,23 @@ +/*- + * ============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.CloudSite; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java index dfa677b402..3d2ecea2d6 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java @@ -1,3 +1,23 @@ +/*- + * ============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.CloudifyManager; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java new file mode 100644 index 0000000000..3eeef07c97 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java @@ -0,0 +1,37 @@ +/*- + * ============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.CvnfcCustomization; +import org.onap.so.db.catalog.data.projections.InlineVnf; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "cvnfcCustomization", path = "cvnfcCustomization", excerptProjection = InlineVnf.class) +public interface CvnfcCustomizationRepository extends JpaRepository<CvnfcCustomization, String> { + CvnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid); + List<CvnfcCustomization> findByModelCustomizationUUID(String modelCustomizationUUID); + List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization, + @Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization); +}
\ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java new file mode 100644 index 0000000000..f936933485 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.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 java.util.List; + +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vnfVfmoduleCvnfcConfigurationCustomization", path = "vnfVfmoduleCvnfcConfigurationCustomization") +public interface VnfVfmoduleCvnfcConfigurationCustomizationRepository extends JpaRepository<VnfVfmoduleCvnfcConfigurationCustomization, Integer> { + List<VnfVfmoduleCvnfcConfigurationCustomization> 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/VnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java new file mode 100644 index 0000000000..4ccbf5831f --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.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.VnfcCustomization; +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 = "vnfcCustomization", path = "vnfcCustomization") +public interface VnfcCustomizationRepository extends JpaRepository<VnfcCustomization, String> { + VnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid); +}
\ No newline at end of file |