summaryrefslogtreecommitdiffstats
path: root/resource-assignment/provider
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2019-01-08 21:20:14 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2019-01-08 21:20:29 +0530
commit12ec55610e03492410f9501ad750a702a63db5f8 (patch)
tree913a0ed5f7517624ad1407f35b56e332eff28cc1 /resource-assignment/provider
parent26f865938e18be289d51956663956ec315200910 (diff)
Sonar fix: ResourceJdbcDaoImpl.java
Fixed sonar issues/code-smells across this file Issue-ID: CCSDK-919 Change-Id: I2f23c4fd39b55393590fd97d6a95a0c5acbb2a6d Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'resource-assignment/provider')
-rw-r--r--resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java
index c94a5d8a0..f9de42802 100644
--- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java
+++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
* reserved.
+ * Modifications Copyright (C) 2018 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +37,8 @@ import org.springframework.jdbc.support.KeyHolder;
public class ResourceJdbcDaoImpl implements ResourceJdbcDao {
+ private static final String baseSelectResourceQuery = "SELECT * FROM RESOURCE WHERE resource_id IN (\n";
+
@SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(ResourceJdbcDaoImpl.class);
@@ -44,16 +47,16 @@ public class ResourceJdbcDaoImpl implements ResourceJdbcDao {
private static final String RESOURCE_QUERY_1_SQL =
"SELECT * FROM RESOURCE WHERE asset_id LIKE ? AND resource_name = ?";
- private static final String RESOURCE_SET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n"
+ private static final String RESOURCE_SET_SQL = baseSelectResourceQuery
+ "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_set_id = ?)";
- private static final String RESOURCE_UNION_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n"
+ private static final String RESOURCE_UNION_SQL = baseSelectResourceQuery
+ "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_union_id = ?)";
- private static final String RESOURCE_SET_FOR_ASSET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n"
+ private static final String RESOURCE_SET_FOR_ASSET_SQL = baseSelectResourceQuery
+ "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_set_id = ?) AND asset_id = ?";
- private static final String RESOURCE_UNION_FOR_ASSET_SQL = "SELECT * FROM RESOURCE WHERE resource_id IN (\n"
+ private static final String RESOURCE_UNION_FOR_ASSET_SQL = baseSelectResourceQuery
+ "SELECT DISTINCT resource_id FROM ALLOCATION_ITEM WHERE resource_union_id = ?) AND asset_id = ?";
private static final String INSERT_SQL = "INSERT INTO RESOURCE (\n"