diff options
Diffstat (limited to 'src/main/java')
7 files changed, 15 insertions, 11 deletions
diff --git a/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java b/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java index 2aa281f..dcc67b4 100644 --- a/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java +++ b/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java @@ -159,11 +159,11 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService { query.bind("serviceLocation", serviceLocation); } - if (asdcServiceId != null && !"NONE".equals(asdcServiceId.toUpperCase(Locale.ENGLISH))) { + if (asdcServiceId != null && !"NONE".equalsIgnoreCase(asdcServiceId)) { query.bind("asdcServiceId", asdcServiceId); } - if (asdcResourceId != null && !"NONE".equals(asdcResourceId.toUpperCase(Locale.ENGLISH))) { + if (asdcResourceId != null && !"NONE".equalsIgnoreCase(asdcResourceId)) { query.bind("asdcResourceId", asdcResourceId); } diff --git a/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java b/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java index bc1888f..65c9d4f 100644 --- a/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java +++ b/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java @@ -76,7 +76,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService { service.setVnfLocation(serviceObject.getVnfLocation()); service.setDeploymentRef(serviceObject.getDeploymentRef()); - List<DCAEServiceComponent> serviceComponents = new ArrayList<DCAEServiceComponent>(); + List<DCAEServiceComponent> serviceComponents = new ArrayList<>(); for (DCAEServiceComponentObject sco : componentObjects) { DCAEServiceComponent component = new DCAEServiceComponent(); @@ -90,7 +90,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService { // TODO: When putting together the components fail. Should this be a 500 case? // For now, this is just logged as a warning. - if (COMPONENT_SOURCE_DCAE_CONTROLLER.equals(sco.getComponentSource().toUpperCase(Locale.ENGLISH))) { + if (COMPONENT_SOURCE_DCAE_CONTROLLER.equalsIgnoreCase(sco.getComponentSource())) { if (this.dcaeControllerClient != null) { try { DCAEControllerClient.ServiceInstance serviceInstance @@ -105,7 +105,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService { LOG.warn(String.format("%s, %s", e.getMessage(), sco.toString()), e); } } - } else if (COMPONENT_SOURCE_DATA_BUS_CONTROLLER.equals(sco.getComponentSource().toUpperCase(Locale.ENGLISH))) { + } else if (COMPONENT_SOURCE_DATA_BUS_CONTROLLER.equalsIgnoreCase(sco.getComponentSource())) { if (this.databusControllerClient != null) { try { if (this.databusControllerClient.isExists(sco.getComponentId())) { @@ -136,7 +136,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService { String componentType, Boolean shareable, DateTime created, Integer offset, UriInfo uriInfo, SecurityContext securityContext) { List<DCAEServiceObject> serviceObjects = new ArrayList<>(); - DateTime createdCutoff = (created == null ? DateTime.now(DateTimeZone.UTC) : created); + DateTime createdCutoff = created == null ? DateTime.now(DateTimeZone.UTC) : created; LOG.info(String.format("Create time upper bound cutoff: %s", createdCutoff.toString())); @@ -150,7 +150,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService { sb.append(" join dcae_services_components_maps m on ds.service_id = m.service_id "); sb.append(" join dcae_service_components dsc on m.component_id = dsc.component_id"); - List<String> whereClauses = new ArrayList<String>(); + List<String> whereClauses = new ArrayList<>(); if (typeId != null) { whereClauses.add("ds.type_id = :typeId"); @@ -211,7 +211,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService { if (shareable != null) { // NOTE: That the shareable field in the database is actually an integer. - query.bind("shareable", (shareable ? 1 : 0)); + query.bind("shareable", shareable ? 1 : 0); } query.bind("createdCutoff", createdCutoff); @@ -229,7 +229,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService { List<DCAEServiceObject> serviceObjectsSliced = serviceObjects.subList(offset, endpoint); DCAEServiceComponentsDAO componentsDAO = InventoryDAOManager.getInstance().getDCAEServiceComponentsDAO(); - List<DCAEService> services = new ArrayList<DCAEService>(); + List<DCAEService> services = new ArrayList<>(); for (DCAEServiceObject so : serviceObjectsSliced) { List<DCAEServiceComponentObject> components = componentsDAO.getByServiceId(so.getServiceId()); diff --git a/src/main/java/org/onap/dcae/inventory/clients/DatabusControllerClient.java b/src/main/java/org/onap/dcae/inventory/clients/DatabusControllerClient.java index 29330b0..b2429d9 100644 --- a/src/main/java/org/onap/dcae/inventory/clients/DatabusControllerClient.java +++ b/src/main/java/org/onap/dcae/inventory/clients/DatabusControllerClient.java @@ -48,7 +48,7 @@ public class DatabusControllerClient { resourcePath = (new StringBuilder("/")).append(resourcePath).toString(); } - return UriBuilder.fromPath(resourcePath.toString()).scheme("https").host(this.connectionConfiguration.getHost()) + return UriBuilder.fromPath(resourcePath).scheme("https").host(this.connectionConfiguration.getHost()) .port(this.connectionConfiguration.getPort()).build(); } 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 bdb6298..aa242a4 100644 --- a/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java +++ b/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java @@ -40,6 +40,7 @@ import org.skife.jdbi.v2.sqlobject.customizers.Mapper; public interface DCAEServiceTypesDAO extends InventoryDAO { @SqlQuery("select exists (select * from information_schema.tables where table_name = \'dcae_service_types\')") + @Override Boolean checkIfTableExists(); /** @@ -51,6 +52,7 @@ public interface DCAEServiceTypesDAO extends InventoryDAO { "vnf_types varchar[] not null, service_ids varchar[], service_locations varchar[], " + "asdc_service_id varchar, asdc_resource_id varchar, " + "created timestamp not null, deactivated timestamp, constraint pk_type_created primary key (type_id))") + @Override void createTable(); // REVIEW: asdcServiceId and asdcResourceId is implicitly part of the unique key and thus shouldn't be updated. diff --git a/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java b/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java index 68ed59c..c9eaa99 100644 --- a/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java +++ b/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java @@ -36,6 +36,7 @@ public interface DCAEServicesComponentsMapsDAO extends InventoryDAO { @SqlQuery("select exists (select * from information_schema.tables where table_name = \'dcae_services_components_maps\')") Boolean checkIfTableExists(); + @Override @SqlUpdate("create table dcae_services_components_maps (service_id varchar not null references dcae_services (service_id), " + "component_id varchar not null references dcae_service_components (component_id), " + "created timestamp not null, primary key (service_id, component_id))") diff --git a/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesDAO.java b/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesDAO.java index 1398a26..c1ca46e 100644 --- a/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesDAO.java +++ b/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesDAO.java @@ -36,6 +36,7 @@ import org.skife.jdbi.v2.util.IntegerMapper; */ public interface DCAEServicesDAO extends InventoryDAO { + @Override @SqlQuery("select exists (select * from information_schema.tables where table_name = \'dcae_services\')") Boolean checkIfTableExists(); diff --git a/src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceObject.java b/src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceObject.java index 83e2bfe..232c18a 100644 --- a/src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceObject.java +++ b/src/main/java/org/onap/dcae/inventory/dbthings/models/DCAEServiceObject.java @@ -29,7 +29,7 @@ import org.joda.time.DateTimeZone; */ public class DCAEServiceObject { - public static enum DCAEServiceStatus { + public enum DCAEServiceStatus { RUNNING, REMOVED } |