From 9797ba0f3aa46ee9267f6e8de1d7f871464f4b99 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Sat, 20 Apr 2019 15:41:18 +0530 Subject: Enhancement for query Enhancemenv for query to include group and vnfccustomization. { "serviceResources": { "modelInfo": { "modelName": "NSService", "modelUuid": "0bad8c92-7d22-49f0-b092-b64e6ca564a7", "modelInvariantUuid": "69161960-515b-4bf3-91f1-313b813f5e1d", "modelVersion": "1.0" }, "serviceType": "", "serviceRole": "", "environmentContext": "General_Revenue-Bearing", "resourceOrder": "NF", "workloadContext": "Production", "serviceVnfs": [ { "modelInfo": { "modelName": "", "modelUuid": "123", "modelInvariantUuid": "", "modelVersion": "", "modelCustomizationUuid": "1234", "modelInstanceName": "test" }, "toscaNodeType": "", "nfFunction": "", "nfType": "", "nfRole": "", "nfNamingCode": "", "multiStageDesign": "", "resourceInput": "", "vfModules": [], "groups": [ { "modelInfo": { "modelName": "test", "modelUuid": "11", "modelInvariantUuid": "11", "modelVersion": "2" }, "vnfcs": [ { "modelInfo": { "modelName": "xfs", "modelUuid": "22", "modelInvariantUuid": "2222", "modelVersion": "22222", "modelCustomizationUuid": "2222" } } ] } ] } ], "serviceNetworks": [], "serviceAllottedResources": [] } } Issue-ID: SO-1393 Change-Id: Iee7f79337f73276f857d6d42b5b2416e4e8f4536 Signed-off-by: subhash kumar singh --- .../so/db/catalog/beans/VnfcCustomization.java | 31 ++++++++++++++++------ .../beans/VnfcInstanceGroupCustomization.java | 14 ++++++++++ mso-catalog-db/src/test/resources/schema.sql | 1 + 3 files changed, 38 insertions(+), 8 deletions(-) (limited to 'mso-catalog-db') 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 index a7a31dcf89..413efaf12c 100644 --- 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 @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 Huawei 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. @@ -20,23 +21,25 @@ package org.onap.so.db.catalog.beans; -import java.io.Serializable; -import java.util.Date; -import java.util.List; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; 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.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; +import java.io.Serializable; +import java.util.Date; +import java.util.List; @Entity @Table(name = "vnfc_customization") @@ -81,6 +84,10 @@ public class VnfcCustomization implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "vnfcCustomization") private List cvnfcCustomization; + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID") + private VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization; + @Override public boolean equals(final Object other) { if (!(other instanceof VnfcCustomization)) { @@ -190,6 +197,14 @@ public class VnfcCustomization implements Serializable { this.cvnfcCustomization = cvnfcCustomization; } + public VnfcInstanceGroupCustomization getVnfcInstanceGroupCustomization() { + return vnfcInstanceGroupCustomization; + } + + public void setVnfcInstanceGroupCustomization(VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization) { + this.vnfcInstanceGroupCustomization = vnfcInstanceGroupCustomization; + } + public String getResourceInput() { return resourceInput; } 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 index 695e5bbbb9..8a00ccd261 100644 --- 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 @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 Huawei 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. @@ -22,6 +23,7 @@ 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; @@ -32,6 +34,7 @@ import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; @@ -66,6 +69,9 @@ public class VnfcInstanceGroupCustomization implements Serializable { @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID") private InstanceGroup instanceGroup; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "vnfcInstanceGroupCustomization") + private List vnfcCustomizations; + @Column(name = "FUNCTION") private String function; @@ -150,4 +156,12 @@ public class VnfcInstanceGroupCustomization implements Serializable { public void setInstanceGroup(InstanceGroup instanceGroup) { this.instanceGroup = instanceGroup; } + + public List getVnfcCustomizations() { + return vnfcCustomizations; + } + + public void setVnfcCustomizations(List vnfcCustomizations) { + this.vnfcCustomizations = vnfcCustomizations; + } } diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index 97afcc04be..34340f1357 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -1134,6 +1134,7 @@ CREATE TABLE `vnfc_customization` ( `TOSCA_NODE_TYPE` varchar(200) NOT NULL, `DESCRIPTION` varchar(1200) DEFAULT NULL, `RESOURCE_INPUT` varchar(20000) DEFAULT NULL, + `VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID` integer DEFAULT NULL, `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- cgit 1.2.3-korg