summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java4
-rw-r--r--src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java12
-rw-r--r--src/main/java/org/onap/dcae/inventory/LinkSerializer.java1
-rw-r--r--src/main/java/org/onap/dcae/inventory/clients/DCAEControllerClient.java2
-rw-r--r--src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTransactionDAO.java7
-rw-r--r--src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java1
-rw-r--r--src/main/java/org/onap/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java1
-rw-r--r--src/main/java/org/onap/dcae/inventory/daos/DCAEServicesDAO.java3
-rw-r--r--src/main/java/org/onap/dcae/inventory/daos/InventoryDAOManager.java4
-rw-r--r--src/main/java/org/onap/dcae/inventory/dbthings/StringListArgument.java4
10 files changed, 21 insertions, 18 deletions
diff --git a/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java b/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java
index 312eaf1..fc6509a 100644
--- a/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java
+++ b/src/main/java/io/swagger/api/impl/DcaeServiceTypesApiServiceImpl.java
@@ -112,7 +112,7 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
}
if (asdcServiceId != null) {
- if ("NONE".equals(asdcServiceId.toUpperCase(Locale.ENGLISH))) {
+ if (asdcServiceId.equalsIgnoreCase("NONE")) {
whereClauses.add("asdc_service_id is null");
} else {
whereClauses.add(":asdcServiceId = asdc_service_id");
@@ -163,7 +163,7 @@ public class DcaeServiceTypesApiServiceImpl extends DcaeServiceTypesApiService {
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 fe938f1..f1219ac 100644
--- a/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java
+++ b/src/main/java/io/swagger/api/impl/DcaeServicesApiServiceImpl.java
@@ -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())) {
@@ -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");
@@ -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());
@@ -302,7 +302,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
// Watch! We have to query for services regardless of status because we need to account for "removed" instances
// that get resurrected.
final DCAEServiceObject serviceObjectFromStore = servicesDAO.getByServiceId(serviceId);
- final Map<String, DCAEServiceComponentObject> componentObjectsFromStore = new HashMap<String, DCAEServiceComponentObject>();
+ final Map<String, DCAEServiceComponentObject> componentObjectsFromStore = new HashMap<>();
for (DCAEServiceComponentObject componentObject : componentsDAO.getByServiceId(serviceId)) {
componentObjectsFromStore.put(componentObject.getComponentId(), componentObject);
@@ -333,7 +333,7 @@ public class DcaeServicesApiServiceImpl extends DcaeServicesApiService {
// 2) Insert/update DCAEServiceComponentObjects. Components exist independent of the associated DCAE service.
- Map<String, DCAEServiceComponentObject> componentObjectsToSendBack = new HashMap<String, DCAEServiceComponentObject>();
+ Map<String, DCAEServiceComponentObject> componentObjectsToSendBack = new HashMap<>();
for (DCAEServiceComponentRequest requestComponent : request.getComponents()) {
// Have to query the database rather than checking the result of getting by service id because of the
diff --git a/src/main/java/org/onap/dcae/inventory/LinkSerializer.java b/src/main/java/org/onap/dcae/inventory/LinkSerializer.java
index ad5c6f3..c7abc99 100644
--- a/src/main/java/org/onap/dcae/inventory/LinkSerializer.java
+++ b/src/main/java/org/onap/dcae/inventory/LinkSerializer.java
@@ -21,7 +21,6 @@
package org.onap.dcae.inventory;
import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
diff --git a/src/main/java/org/onap/dcae/inventory/clients/DCAEControllerClient.java b/src/main/java/org/onap/dcae/inventory/clients/DCAEControllerClient.java
index 87cd7b5..b309cfd 100644
--- a/src/main/java/org/onap/dcae/inventory/clients/DCAEControllerClient.java
+++ b/src/main/java/org/onap/dcae/inventory/clients/DCAEControllerClient.java
@@ -134,7 +134,7 @@ public class DCAEControllerClient {
}
- private final static Logger LOG = LoggerFactory.getLogger(DCAEControllerClient.class);
+ private static final Logger LOG = LoggerFactory.getLogger(DCAEControllerClient.class);
private final Client client;
private final InventoryConfiguration.DCAEControllerConnectionConfiguration connectionConfiguration;
diff --git a/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTransactionDAO.java b/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTransactionDAO.java
index cc7c88b..a4571cd 100644
--- a/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTransactionDAO.java
+++ b/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTransactionDAO.java
@@ -1,4 +1,5 @@
/*-
+
* ============LICENSE_START=======================================================
* dcae-inventory
* ================================================================================
@@ -120,13 +121,13 @@ public abstract class DCAEServiceTransactionDAO {
}
@CreateSqlObject
- abstract public DCAEServicesDAO getServicesDAO();
+ public abstract DCAEServicesDAO getServicesDAO();
@CreateSqlObject
- abstract public DCAEServicesComponentsMapsDAO getServicesComponentsMappingDAO();
+ public abstract DCAEServicesComponentsMapsDAO getServicesComponentsMappingDAO();
@CreateSqlObject
- abstract public DCAEServiceComponentsDAO getComponentsDAO();
+ public abstract DCAEServiceComponentsDAO getComponentsDAO();
@Transaction
public void insert(DCAEServiceTransactionContext context) {
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 cc53276..aa242a4 100644
--- a/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java
+++ b/src/main/java/org/onap/dcae/inventory/daos/DCAEServiceTypesDAO.java
@@ -52,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 c9eaa99..270d638 100644
--- a/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java
+++ b/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesComponentsMapsDAO.java
@@ -34,6 +34,7 @@ import org.skife.jdbi.v2.sqlobject.SqlUpdate;
public interface DCAEServicesComponentsMapsDAO extends InventoryDAO {
@SqlQuery("select exists (select * from information_schema.tables where table_name = \'dcae_services_components_maps\')")
+ @Override
Boolean checkIfTableExists();
@Override
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 c1ca46e..0595a9a 100644
--- a/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesDAO.java
+++ b/src/main/java/org/onap/dcae/inventory/daos/DCAEServicesDAO.java
@@ -42,7 +42,8 @@ public interface DCAEServicesDAO extends InventoryDAO {
@SqlUpdate("create table dcae_services (service_id varchar not null primary key, type_id varchar not null, " +
"vnf_id varchar not null, vnf_type varchar not null, vnf_location varchar not null, deployment_ref varchar, " +
- "created timestamp not null, modified timestamp not null, status varchar not null)")
+ "created timestamp not null, modified timestamp not null, status varchar not null)")
+ @Override
void createTable();
@SqlUpdate("insert into dcae_services(service_id, type_id, vnf_id, vnf_type, vnf_location, deployment_ref, " +
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 c2527e2..2bd17bf 100644
--- a/src/main/java/org/onap/dcae/inventory/daos/InventoryDAOManager.java
+++ b/src/main/java/org/onap/dcae/inventory/daos/InventoryDAOManager.java
@@ -60,9 +60,9 @@ public final class InventoryDAOManager {
}
- private final static Logger LOG = LoggerFactory.getLogger(InventoryDAOManager.class);
+ private static final Logger LOG = LoggerFactory.getLogger(InventoryDAOManager.class);
// WATCH! Table creation order matters where mapping tables refer to other tables for foreign keys.
- private final static List<Class> DAO_CLASSES = Arrays.asList(DCAEServiceTypesDAO.class, DCAEServicesDAO.class,
+ private static final List<Class> DAO_CLASSES = Arrays.asList(DCAEServiceTypesDAO.class, DCAEServicesDAO.class,
DCAEServiceComponentsDAO.class, DCAEServicesComponentsMapsDAO.class);
private DBI jdbi;
diff --git a/src/main/java/org/onap/dcae/inventory/dbthings/StringListArgument.java b/src/main/java/org/onap/dcae/inventory/dbthings/StringListArgument.java
index 2e70550..aa41ac6 100644
--- a/src/main/java/org/onap/dcae/inventory/dbthings/StringListArgument.java
+++ b/src/main/java/org/onap/dcae/inventory/dbthings/StringListArgument.java
@@ -45,11 +45,11 @@ public class StringListArgument implements ArgumentFactory<List<String>> {
@Override
public Argument build(Class<?> expectedType, List<String> value, StatementContext statementContext) {
- Argument argument = (int position, PreparedStatement statement, StatementContext ctx) -> {
+ return (int position, PreparedStatement statement, StatementContext ctx) -> {
Array values = statement.getConnection().createArrayOf("varchar", value.toArray());
statement.setArray(position, values);
};
- return argument;
+
}
}