diff options
author | Shadi Haidar <sh1986@att.com> | 2018-10-21 14:51:22 -0400 |
---|---|---|
committer | Haidar, Shadi (sh1986) <sh1986@att.com> | 2018-11-07 09:25:50 -0500 |
commit | edb7b340c2f055af88e1ff9a4c7dfc0d51ac9b77 (patch) | |
tree | d13dc8e4dad93eee71fab752b299497acfbeca1f | |
parent | e09d200eaf5a3b36652433f3b8581192d7e0b52b (diff) |
xAdd application/component.
Change-Id: Ib60ef8f3e64aa03dfa49b7c542ac7bae1e25175f
Issue-ID: DCAEGEN2-879
Signed-off-by: Shadi Haidar <sh1986@att.com>
Signed-off-by: Haidar, Shadi (sh1986) <sh1986@att.com>
-rw-r--r-- | docs/API.md | 7 | ||||
-rw-r--r-- | docs/DatabaseTables.md | 2 | ||||
-rw-r--r-- | pom.xml | 22 | ||||
-rw-r--r-- | src/gen/java/io/swagger/api/DcaeServiceTypesApi.java | 21 | ||||
-rw-r--r-- | src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java | 3 | ||||
-rw-r--r-- | src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java | 28 | ||||
-rw-r--r-- | src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java | 42 | ||||
-rw-r--r-- | src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java | 24 | ||||
-rw-r--r-- | src/main/java/org/onap/dcae/inventory/daos/InventoryDAO.java | 4 | ||||
-rw-r--r-- | src/main/java/org/onap/dcae/inventory/daos/InventoryDAOManager.java | 30 | ||||
-rw-r--r-- | src/main/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java | 2 | ||||
-rw-r--r-- | src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java | 18 | ||||
-rw-r--r-- | swagger_inventory.yaml | 25 | ||||
-rw-r--r-- | version.properties | 4 |
14 files changed, 201 insertions, 31 deletions
diff --git a/docs/API.md b/docs/API.md index ec0ff89..c99eb1e 100644 --- a/docs/API.md +++ b/docs/API.md @@ -75,6 +75,9 @@ Get a list of `DCAEServiceType` objects. |**Query**|**serviceLocation** <br>*optional*|Filter by associated service location. Instances with service location null or empty is always returned.|string|| |**Query**|**typeName** <br>*optional*|Filter by service type name|string|| |**Query**|**vnfType** <br>*optional*|Filter by associated vnf type. No wildcards, matches are explicit. This field is treated case insensitive.|string|| +|**Query**|**owner** <br>*optional*|Filter by owner name|string|| +|**Query**|**application** <br>*optional*|Filter by application name|string|| +|**Query**|**component** <br>*optional*|Filter by component name|string|| #### Responses @@ -443,6 +446,8 @@ Remove an existing `DCAEService` object. |**created** <br>*required*|Created timestamp for this DCAE service type in epoch time|string(date-time)| |**deactivated** <br>*optional*|Deactivated timestamp for this DCAE service type in epoch time|string(date-time)| |**owner** <br>*required*||string| +|**application** <br>*optional*||string| +|**component** <br>*optional*||string| |**selfLink** <br>*required*|Link to self where the Link.title is typeName|[Link](#link)| |**serviceIds** <br>*optional*|List of service ids that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service id.|< string > array| |**serviceLocations** <br>*optional*|List of service locations that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service location.|< string > array| @@ -462,6 +467,8 @@ Remove an existing `DCAEService` object. |**asdcServiceURL** <br>*optional*|URL to the ASDC service model|string| |**blueprintTemplate** <br>*required*|String representation of a Cloudify blueprint with unbound variables|string| |**owner** <br>*required*||string| +|**application** <br>*optional*||string| +|**component** <br>*optional*||string| |**serviceIds** <br>*optional*|List of service ids that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service id.|< string > array| |**serviceLocations** <br>*optional*|List of service locations that are used to associate with DCAE service type. DCAE service types with this propery as null or empty means them apply for every service location.|< string > array| |**typeName** <br>*required*|Descriptive name for this DCAE service type|string| diff --git a/docs/DatabaseTables.md b/docs/DatabaseTables.md index 30f4f7b..48b2ba7 100644 --- a/docs/DatabaseTables.md +++ b/docs/DatabaseTables.md @@ -26,6 +26,8 @@ As of version 0.12.0. asdc_resource_id | character varying | not null created | timestamp without time zone | not null is_active | boolean | not null + application | character varying | + component | character varying | Indexes: "pk_type_created" PRIMARY KEY, btree (type_id, created) ``` @@ -29,7 +29,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <groupId>org.onap.dcaegen2.platform</groupId> <artifactId>inventory-api</artifactId> - <version>3.0.4</version> + <version>3.1.0</version> <name>dcaegen2-platform-inventory-api</name> <!--internal <version>3.0.0</version>--> @@ -88,16 +88,16 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-server</artifactId> - <version>9.4.12.v20180830</version> - </dependency> - <dependency> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-http</artifactId> - <version>9.4.12.v20180830</version> - </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + <version>9.4.12.v20180830</version> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-http</artifactId> + <version>9.4.12.v20180830</version> + </dependency> <dependency> <groupId>io.dropwizard</groupId> <artifactId>dropwizard-jdbi</artifactId> diff --git a/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java b/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java index 72f1f63..5ff9eb3 100644 --- a/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java +++ b/src/gen/java/io/swagger/api/DcaeServiceTypesApi.java @@ -45,7 +45,7 @@ public class DcaeServiceTypesApi { public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeName, Boolean onlyLatest, Boolean onlyActive, String vnfType, String serviceId, String serviceLocation, String asdcServiceId, - String asdcResourceId, Integer offset) { + String asdcResourceId, Integer offset, String application, String component, String owner) { UriBuilder ub = uriInfo.getBaseUriBuilder().path(DcaeServiceTypesApi.class) .path(DcaeServiceTypesApi.class, "dcaeServiceTypesGet"); @@ -76,6 +76,15 @@ public class DcaeServiceTypesApi { if (offset != null) { ub.queryParam("offset", offset); } + if (application != null) { + ub.queryParam("application", application); + } + if (component != null) { + ub.queryParam("component", component); + } + if (owner != null) { + ub.queryParam("owner", owner); + } Link.Builder lb = Link.fromUri(ub.build()); lb.rel(rel); @@ -90,7 +99,7 @@ public class DcaeServiceTypesApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "List of `DCAEServiceType` objects", response = InlineResponse200.class)}) public Response dcaeServiceTypesGet( - @ApiParam(value = "Filter by service type name") @QueryParam("typeName") String typeName, + @ApiParam(value = "Filter by service type name. Wildcards matches with asterick(s) allowed.") @QueryParam("typeName") String typeName, @ApiParam(value = "If set to true, query returns just the latest versions of DCAE service types. If set to false, then all versions are returned. Default is true") @DefaultValue("true") @QueryParam("onlyLatest") Boolean onlyLatest, @ApiParam(value = "If set to true, query returns only *active* DCAE service types. If set to false, then all DCAE service types are returned. Default is true") @@ -106,10 +115,14 @@ public class DcaeServiceTypesApi { @ApiParam(value = "Filter by associated asdc design resource id. Setting this to `NONE` will return instances that have asdc resource id set to null") @QueryParam("asdcResourceId") String asdcResourceId, @ApiParam(value = "Query resultset offset used for pagination (zero-based)") @QueryParam("offset") Integer offset, - @Context SecurityContext securityContext) + @Context SecurityContext securityContext, + @ApiParam(value = "Filter by associated application.") @QueryParam("application") String application, + @ApiParam(value = "Filter by associated component or sub-application module.") @QueryParam("component") String component, + @ApiParam(value = "Filter by associated owner.") @QueryParam("owner") String owner + ) throws NotFoundException { return delegate.dcaeServiceTypesGet(typeName, onlyLatest, onlyActive, vnfType, serviceId, serviceLocation, - asdcServiceId, asdcResourceId, offset, uriInfo, securityContext); + asdcServiceId, asdcResourceId, offset, uriInfo, securityContext, application, component, owner); } public static Link buildLinkForGet(UriInfo uriInfo, String rel, String typeId) { diff --git a/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java b/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java index afc7476..ab2bc64 100644 --- a/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java +++ b/src/gen/java/io/swagger/api/DcaeServiceTypesApiService.java @@ -31,7 +31,8 @@ public abstract class DcaeServiceTypesApiService { public abstract Response dcaeServiceTypesGet(String typeName, Boolean onlyLatest, Boolean onlyActive, String vnfType, String serviceId, String serviceLocation, String asdcServiceId, String asdcResourceId, - Integer offset, UriInfo uriInfo, SecurityContext securityContext) + Integer offset, UriInfo uriInfo, SecurityContext securityContext, + String application, String component, String owner) throws NotFoundException; public abstract Response dcaeServiceTypesTypeIdGet(String typeId, UriInfo uriInfo, SecurityContext securityContext) throws NotFoundException; diff --git a/src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java b/src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java index 7cd3577..83b7949 100644 --- a/src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java +++ b/src/gen/java/io/swagger/model/DCAEServiceTypeRequest.java @@ -53,6 +53,8 @@ public class DCAEServiceTypeRequest { private String asdcServiceId = null; private String asdcResourceId = null; private String asdcServiceURL = null; + private String application = null; + private String component = null; /** @@ -72,6 +74,26 @@ public class DCAEServiceTypeRequest { public void setOwner(String owner) { this.owner = owner; } + + @ApiModelProperty(required = false, value = "Application associated or that added this DCAE service type.") + @JsonProperty("application") + public String getApplication() { + return application; + } + + public void setApplication(String application) { + this.application = application; + } + + @ApiModelProperty(required = false, value = "Component or sub-application module associated or that added this DCAE service type.") + @JsonProperty("component") + public String getComponent() { + return component; + } + + public void setComponent(String component) { + this.component = component; + } @ApiModelProperty(required = true, value = "Descriptive name for this DCAE service type") @@ -192,13 +214,15 @@ public class DCAEServiceTypeRequest { } DCAEServiceTypeRequest dCAEServiceTypeRequest = (DCAEServiceTypeRequest) o; return Objects.equals(owner, dCAEServiceTypeRequest.owner) && + Objects.equals(application, dCAEServiceTypeRequest.application) && + Objects.equals(component, dCAEServiceTypeRequest.component) && Objects.equals(vnfTypes, dCAEServiceTypeRequest.vnfTypes) && Objects.equals(blueprintTemplate, dCAEServiceTypeRequest.blueprintTemplate); } @Override public int hashCode() { - return Objects.hash(owner, vnfTypes, blueprintTemplate); + return Objects.hash(owner, application, component, vnfTypes, blueprintTemplate); } @Override @@ -207,6 +231,8 @@ public class DCAEServiceTypeRequest { sb.append("class DCAEServiceTypeRequest {\n"); sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" application: ").append(toIndentedString(application)).append("\n"); + sb.append(" component: ").append(toIndentedString(component)).append("\n"); sb.append(" vnfTypes: ").append(toIndentedString(vnfTypes)).append("\n"); sb.append(" blueprintTemplate: ").append(toIndentedString(blueprintTemplate)).append("\n"); sb.append("}"); diff --git a/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java b/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java index feafd20..13f1540 100644 --- a/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java +++ b/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java @@ -58,6 +58,8 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { serviceType.setTypeName(serviceTypeObject.getTypeName()); serviceType.setTypeVersion(serviceTypeObject.getTypeVersion()); serviceType.setOwner(serviceTypeObject.getOwner()); + serviceType.setApplication(serviceTypeObject.getApplication()); + serviceType.setComponent(serviceTypeObject.getComponent()); serviceType.setVnfTypes(serviceTypeObject.getVnfTypes()); serviceType.setServiceIds(serviceTypeObject.getServiceIds()); serviceType.setServiceLocations(serviceTypeObject.getServiceLocations()); @@ -76,7 +78,9 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { @Override public Response dcaeServiceTypesGet(String typeName, Boolean onlyLatest, Boolean onlyActive, String vnfType, String serviceId, String serviceLocation, String asdcServiceId, - String asdcResourceId, Integer offset, UriInfo uriInfo, SecurityContext securityContext) + String asdcResourceId, Integer offset, + UriInfo uriInfo, SecurityContext securityContext, + String application, String component, String owner) throws NotFoundException { List<DCAEServiceTypeObject> serviceTypeObjects = new ArrayList<>(); @@ -100,7 +104,7 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { whereClauses.add(":typeName = type_name"); } else { - typeName = typeName.replaceAll("\\*", "%"); + typeName = typeName.replaceAll("\\*", "%"); whereClauses.add("type_name LIKE :typeName"); } } @@ -116,14 +120,14 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { if (serviceLocation != null) { whereClauses.add("(:serviceLocation = any(service_locations) or service_locations = \'{}\' or service_locations is null)"); } - + if (asdcServiceId != null) { if (asdcServiceId.equalsIgnoreCase("NONE")) { whereClauses.add("asdc_service_id is null"); } else { whereClauses.add(":asdcServiceId = asdc_service_id"); } - } + } if (asdcResourceId != null) { if (asdcResourceId.equalsIgnoreCase("NONE")) { @@ -132,6 +136,18 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { whereClauses.add(":asdcResourceId = asdc_resource_id"); } } + + if (owner != null) { + whereClauses.add(":owner = owner"); + } + + if (application != null) { + whereClauses.add(":application = application"); + } + + if (component != null) { + whereClauses.add(":component = component"); + } whereClauses.add("created < :createdCutoff"); @@ -174,6 +190,18 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { if (asdcResourceId != null && !"NONE".equalsIgnoreCase(asdcResourceId)) { query.bind("asdcResourceId", asdcResourceId); } + + if (application != null) { + query.bind("application", application); + } + + if (component != null) { + query.bind("component", component); + } + + if (owner != null) { + query.bind("owner", owner); + } query.bind("createdCutoff", createdCutoff); @@ -205,14 +233,14 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { if (offsetPrev >= 0) { navigationLinks.setPreviousLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "prev", typeName, onlyLatest, - onlyActive, vnfType, serviceId, serviceLocation, asdcServiceId, asdcResourceId, offsetPrev)); + onlyActive, vnfType, serviceId, serviceLocation, asdcServiceId, asdcResourceId, offsetPrev, application, component, owner)); } Integer offsetNext = offset + PAGINATION_PAGE_SIZE; if (offsetNext < totalCount) { navigationLinks.setNextLink(DcaeServiceTypesApi.buildLinkForGet(uriInfo, "next", typeName, onlyLatest, - onlyActive, vnfType, serviceId, serviceLocation, asdcServiceId, asdcResourceId, offsetNext)); + onlyActive, vnfType, serviceId, serviceLocation, asdcServiceId, asdcResourceId, offsetNext, application, component, owner)); } response.setLinks(navigationLinks); @@ -251,6 +279,8 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { serviceTypeObject.setTypeName(request.getTypeName()); serviceTypeObject.setTypeVersion(request.getTypeVersion()); serviceTypeObject.setOwner(request.getOwner()); + serviceTypeObject.setApplication(request.getApplication()); + serviceTypeObject.setComponent(request.getComponent()); serviceTypeObject.setBlueprintTemplate(request.getBlueprintTemplate()); serviceTypeObject.setVnfTypes(request.getVnfTypes()); serviceTypeObject.setServiceIds(request.getServiceIds()); diff --git a/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java b/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java index aa242a4..770661c 100644 --- a/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java +++ b/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java @@ -42,6 +42,14 @@ public interface DCAEServiceTypesDAO extends InventoryDAO { @SqlQuery("select exists (select * from information_schema.tables where table_name = \'dcae_service_types\')") @Override Boolean checkIfTableExists(); + + @SqlQuery("select exists (select * from information_schema.columns where table_name = \'dcae_service_types\' and column_name=\'application\')") + @Override + Boolean checkIfApplicationColumnExists(); + + @SqlQuery("select exists (select * from information_schema.columns where table_name = \'dcae_service_types\' and column_name=\'component\')") + @Override + Boolean checkIfComponentColumnExists(); /** * Note that service_ids and service_locations are nullable fields. This might not be the right decision but because @@ -50,20 +58,28 @@ public interface DCAEServiceTypesDAO extends InventoryDAO { @SqlUpdate("create table dcae_service_types (type_id varchar not null, type_version integer not null, " + "type_name varchar not null, owner varchar not null, blueprint_template text not null, " + "vnf_types varchar[] not null, service_ids varchar[], service_locations varchar[], " + - "asdc_service_id varchar, asdc_resource_id varchar, " + + "asdc_service_id varchar, asdc_resource_id varchar, application varchar, component varchar, " + "created timestamp not null, deactivated timestamp, constraint pk_type_created primary key (type_id))") @Override void createTable(); + + @SqlUpdate("alter table dcae_service_types add column application varchar") + @Override + void updateTableToAddApplicationCol(); + + @SqlUpdate("alter table dcae_service_types add column component varchar") + @Override + void updateTableToAddComponentCol(); // REVIEW: asdcServiceId and asdcResourceId is implicitly part of the unique key and thus shouldn't be updated. - @SqlUpdate("insert into dcae_service_types(type_id, type_version, type_name, owner, blueprint_template, vnf_types, " + + @SqlUpdate("insert into dcae_service_types(type_id, type_version, type_name, owner, application, component, blueprint_template, vnf_types, " + "service_ids, service_locations, asdc_service_id, asdc_resource_id, created, deactivated) " + - "values (:typeId, :typeVersion, :typeName, :owner, :blueprintTemplate, :vnfTypes, :serviceIds, " + + "values (:typeId, :typeVersion, :typeName, :owner, :application, :component, :blueprintTemplate, :vnfTypes, :serviceIds, " + ":serviceLocations, :asdcServiceId, :asdcResourceId, :created, null)") void insert(@BindBean DCAEServiceTypeObject serviceObject); @SqlUpdate("update dcae_service_types set " + - "owner = :owner, blueprint_template = :blueprintTemplate, vnf_types = :vnfTypes, " + + "owner = :owner, application = :application, component = :component, blueprint_template = :blueprintTemplate, vnf_types = :vnfTypes, " + "service_ids = :serviceIds, service_locations = :serviceLocations, created = :created, " + "deactivated = null where type_id = :typeId") void update(@BindBean DCAEServiceTypeObject serviceObject); diff --git a/src/main/java/org/onap/dcae/inventory/daos/InventoryDAO.java b/src/main/java/org/onap/dcae/inventory/daos/InventoryDAO.java index a369cb1..e678b60 100644 --- a/src/main/java/org/onap/dcae/inventory/daos/InventoryDAO.java +++ b/src/main/java/org/onap/dcae/inventory/daos/InventoryDAO.java @@ -25,5 +25,9 @@ package org.onap.dcae.inventory.daos; */ public interface InventoryDAO { Boolean checkIfTableExists(); + Boolean checkIfApplicationColumnExists(); + Boolean checkIfComponentColumnExists(); void createTable(); + void updateTableToAddApplicationCol(); + void updateTableToAddComponentCol(); } diff --git a/src/main/java/org/onap/dcae/inventory/daos/InventoryDAOManager.java b/src/main/java/org/onap/dcae/inventory/daos/InventoryDAOManager.java index b809d2d..5bdecfe 100644 --- a/src/main/java/org/onap/dcae/inventory/daos/InventoryDAOManager.java +++ b/src/main/java/org/onap/dcae/inventory/daos/InventoryDAOManager.java @@ -101,6 +101,8 @@ public final class InventoryDAOManager { final DBI jdbi_local = factory.build(this.environment, this.configuration.getDataSourceFactory(), "dcae-database"); jdbi_local.registerArgumentFactory(new StringListArgument()); + boolean recreateDcaeServiceTypesView = false; + for (Class<? extends InventoryDAO> daoClass : DAO_CLASSES) { final InventoryDAO dao = jdbi_local.onDemand(daoClass); @@ -110,6 +112,23 @@ public final class InventoryDAOManager { dao.createTable(); debugLogger.info(String.format("Sql table created: %s", daoClass.getSimpleName())); } + // dcae_service_types DB table has been enhanced to include 2 new columns which need to be added if they don't already exist + if ( daoClass.getSimpleName().equals("DCAEServiceTypesDAO") ) { + if (dao.checkIfApplicationColumnExists()) { + debugLogger.info(String.format("ApplicationColumn exists: %s", daoClass.getSimpleName())); + } else { + dao.updateTableToAddApplicationCol(); + debugLogger.info(String.format("ApplicationColumn created: %s", daoClass.getSimpleName()+".updateTableToAddApplicationCol()" )); + recreateDcaeServiceTypesView = true; + } + if (dao.checkIfComponentColumnExists()) { + debugLogger.info(String.format("ComponentColumn exists: %s", daoClass.getSimpleName())); + } else { + dao.updateTableToAddComponentCol();; + debugLogger.info(String.format("ComponentColumn created: %s", daoClass.getSimpleName()+".updateTableToAddComponentCol()")); + recreateDcaeServiceTypesView = true; + } + } } // CREATE VIEWS @@ -119,7 +138,16 @@ public final class InventoryDAOManager { String checkQuery = String.format("select exists (select * from information_schema.tables where table_name = '%s')", viewName); - if (jdbiHandle.createQuery(checkQuery).map(BooleanMapper.FIRST).first()) { + boolean viewExists = jdbiHandle.createQuery(checkQuery).map(BooleanMapper.FIRST).first(); + + // if the view exists and the 2 new dcae_service_types DB table columns: application and component need to be added + // we need to re-create the view by deleting it first + if (viewExists && recreateDcaeServiceTypesView) { + debugLogger.info(String.format("Need to delete existing Sql view: %s", viewName)); + jdbiHandle.execute(String.format("drop view %s ", viewName)); + } + + if (viewExists) { debugLogger.info(String.format("Sql view exists: %s", viewName)); } else { StringBuilder sb = new StringBuilder(String.format("create view %s as ", viewName)); diff --git a/src/main/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java b/src/main/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java index bda4423..a7e2249 100644 --- a/src/main/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java +++ b/src/main/java/org/onap/dcae/inventory/dbthings/mappers/DCAEServiceTypeObjectMapper.java @@ -43,6 +43,8 @@ public class DCAEServiceTypeObjectMapper implements ResultSetMapper<DCAEServiceT object.setTypeName(resultSet.getString("type_name")); object.setTypeVersion(resultSet.getInt("type_version")); object.setOwner(resultSet.getString("owner")); + object.setApplication(resultSet.getString("application")); + object.setComponent(resultSet.getString("component")); String[] vnfTypes = (String[]) resultSet.getArray("vnf_types").getArray(); object.setVnfTypes(Arrays.asList(vnfTypes)); diff --git a/src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java b/src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java index f264c99..3c86138 100644 --- a/src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java +++ b/src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceTypeObject.java @@ -36,6 +36,8 @@ public class DCAEServiceTypeObject { private Integer typeVersion = null; private String blueprintTemplate = null; private String owner = null; + private String application = null; + private String component = null; private List<String> vnfTypes = null; private List<String> serviceIds = null; private List<String> serviceLocations = null; @@ -83,6 +85,22 @@ public class DCAEServiceTypeObject { public void setOwner(String owner) { this.owner = owner; } + + public String getApplication() { + return application; + } + + public void setApplication(String application) { + this.application = application; + } + + public String getComponent() { + return component; + } + + public void setComponent(String component) { + this.component = component; + } public List<String> getVnfTypes() { return vnfTypes; diff --git a/swagger_inventory.yaml b/swagger_inventory.yaml index c18419c..e1ca695 100644 --- a/swagger_inventory.yaml +++ b/swagger_inventory.yaml @@ -17,7 +17,7 @@ # ECOMP is a trademark and service mark of AT&T Intellectual Property. swagger: '2.0' info: - version: "3.0.0" + version: "3.1.0" title: DCAE Inventory API description: | DCAE Inventory is a web service that provides the following: @@ -99,6 +99,21 @@ paths: required: false type: "integer" format: "int32" + - name: "owner" + in: "query" + description: "Filter by owner name" + required: false + type: "string" + - name: "application" + in: "query" + description: "Filter by application name" + required: false + type: "string" + - name: "component" + in: "query" + description: "Filter by component name" + required: false + type: "string" responses: 200: description: "List of `DCAEServiceType` objects" @@ -352,6 +367,10 @@ definitions: properties: owner: type: "string" + application: + type: "string" + component: + type: "string" typeName: type: "string" description: "Descriptive name for this DCAE service type" @@ -625,6 +644,10 @@ definitions: properties: owner: type: "string" + application: + type: "string" + component: + type: "string" typeName: type: "string" description: "Descriptive name for this DCAE service type" diff --git a/version.properties b/version.properties index d096cfd..ed42494 100644 --- a/version.properties +++ b/version.properties @@ -2,8 +2,8 @@ # Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... )
# because they are used in Jenkins, whose plug-in doesn't support
major=3
-minor=0
-patch=4
+minor=1
+patch=0
base_version=${major}.${minor}.${patch}
# Release must be completed with git revision # in Jenkins
|