diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-02 22:54:57 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-02 22:54:57 -0400 |
commit | 86f04e1d55b54a1a23bb274d211c6fca85980fef (patch) | |
tree | e8fb0a8c1d5e64761068df56faa8a8e509fa2f48 /adapters/mso-catalog-db-adapter/src/main/java | |
parent | d59fc0ad5db7b7cacf5996f86db34f41090061fa (diff) |
fix catalogdb cvfnc customization
Hibernate entities were all wrong and needed
a complete rewrite.
The scope kept growing and ended up touching a
lot more of the code than originally planned.
These changes make the db interactions much easier
and more straightforward from java.
The flyway script order had to change to make this
migration possible.
Change-Id: I6ce363a385661300eddb11923ac6a80538edaddc
Issue-ID: SO-1710
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main/java')
2 files changed, 12 insertions, 46 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java index 93e396bb94..374e597116 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java @@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client","org.onap.so.logging.jaxrs.filter","org.onap.so.logging.spring.interceptor"}) +@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client","org.onap.so.logging.jaxrs.filter","org.onap.so.logging.spring.interceptor","org.onap.so.client","org.onap.so.configuration"}) @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") @EntityScan("org.onap.so.db.catalog.beans") public class CatalogDBApplication { diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java index dbb168bd15..5009dce020 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java @@ -22,36 +22,20 @@ package org.onap.so.adapters.catalogdb.rest; -/* -Create an initial query to retrieve a VNF Resource definition (including a list of possible module types) -within the context of a given service. Input is a vnf resource model customization ID (new field for 1702), -or a composite key (from 1610) of service name, service version, vnf instance name -Returns a structure (JSON?) containing VNF RESOURCE attributes, plus a list of VF Module structures. -Query a NETWORK_RESOURCE from the MSO Catalog, based on a networkModelCustomizationUUID (new for 1702), -a network type (unique type identifier in 1610), or based on network role within a service. - -Create Adapter framework for access to Catalog DB, including connection management, -login/password access, transaction logic, etc. This can be modeled after the Request DB Adapter - -Update the MSO Catalog DB schema to include the new fields defined in this user story. - -Note that the resourceModelCustomizationUUID (or vfModuleModelCustomizationUUID) will be unique keys (indexes) -on the VNF_RESOURCE and VF_MODULE tables respectively. -The previously constructed "vnf-type" and "vf-module-type" field may continue to be populated, -but should no longer be needed and can deprecate in future release. - -For migration, a new randomly generated UUID field may be generated for the *ModelCustomizationUUID" fields -until such time that the model is redistributed from ASDC. - -All other fields Check with Mike Z for appropriate value for the vfModuleLabel. -We might be able to derive it's value from the current vnf-type (using the "middle" piece that identifies the module type). - -min and initial counts can be 0. max can be null to indicate no maximum. +import java.util.ArrayList; +import java.util.List; -Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table. - */ +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.GenericEntity; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.onap.so.adapters.catalogdb.catalogrest.CatalogQuery; @@ -73,7 +57,6 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; -import org.onap.so.db.catalog.beans.VnfRecipe; import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; @@ -95,23 +78,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.GenericEntity; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.List; -/** - * This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1) - * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. - * Requests respond synchronously only - */ @Path("/{version: v[0-9]+}") @Component public class CatalogDbAdapterRest { @@ -160,7 +127,6 @@ public class CatalogDbAdapterRest { public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) { return Response .status(respStatus) - //.entity(new GenericEntity<QueryServiceVnfs>(qryResp) {}) .entity(qryResp.toJsonString(version, isArray)) .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .build(); |