aboutsummaryrefslogtreecommitdiffstats
path: root/resource-assignment/provider/src
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-01-30 14:58:12 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-30 14:58:12 +0000
commitb3e99f4bc65191819c066e20d6d1682a43085d95 (patch)
treebb145d50a5976bf9e82335f343f0b5f70dabdb01 /resource-assignment/provider/src
parent2ac502c781af688fa7f73d1d28388268f57a6ee3 (diff)
parent12ec55610e03492410f9501ad750a702a63db5f8 (diff)
Merge "Sonar fix: ResourceJdbcDaoImpl.java"
Diffstat (limited to 'resource-assignment/provider/src')
-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 c94a5d8a..f9de4280 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"