From 12ec55610e03492410f9501ad750a702a63db5f8 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Tue, 8 Jan 2019 21:20:14 +0530 Subject: Sonar fix: ResourceJdbcDaoImpl.java Fixed sonar issues/code-smells across this file Issue-ID: CCSDK-919 Change-Id: I2f23c4fd39b55393590fd97d6a95a0c5acbb2a6d Signed-off-by: Arundathi Patil --- .../ccsdk/sli/adaptors/rm/dao/jdbc/ResourceJdbcDaoImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'resource-assignment/provider/src/main') 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" -- cgit 1.2.3-korg