diff options
author | dinesha <dineshgs@in.ibm.com> | 2019-08-06 17:17:56 +0530 |
---|---|---|
committer | dinesha <dineshgs@in.ibm.com> | 2019-08-06 17:18:18 +0530 |
commit | 06d5164d29793c5e82f3596b2845ac84b39f44a8 (patch) | |
tree | 4a5249f92cf865eb423869a30f518a865b4100c8 /vid-app-common | |
parent | 3ba3f77b2daa129fb2379e932cf35277e827a51b (diff) |
Sonar Fix- RoleGenaratorServiceImpl.java- Define a constant instead of duplicating this literal
Fixed Sonar issues accross the file
Issue-ID: VID-547
Change-Id: I91dc81916fc1c7843e0f5b723cdf47153e682592
Signed-off-by: dinesha <dineshgs@in.ibm.com>
Diffstat (limited to 'vid-app-common')
-rw-r--r-- | vid-app-common/src/main/java/org/onap/vid/services/RoleGenaratorServiceImpl.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/RoleGenaratorServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/RoleGenaratorServiceImpl.java index a24a72e46..815c85d6f 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/RoleGenaratorServiceImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/RoleGenaratorServiceImpl.java @@ -47,10 +47,11 @@ public class RoleGenaratorServiceImpl implements RoleGeneratorService { public static final String TBL_NAME = "fn_role"; public static final String TEMP_DELIMITER ="***"; public static final String OLD_DELIMITER = "_"; + public static final String CrLf = ";\r\n"; @Override public String generateRoleScript(Boolean firstRun) { - String query = "USE " + DB_NAME + ";\r\n" + + String query = "USE " + DB_NAME + CrLf + "SET SQL_SAFE_UPDATES = 0;\r\n"; try { HttpResponse<SubscriberList> allSubscribers = aaiOverTLSClient.getAllSubscribers(); @@ -100,7 +101,7 @@ public class RoleGenaratorServiceImpl implements RoleGeneratorService { query = query + "('" + subscriber.globalCustomerId + "','" + subscriberName + "') ,"; } if(query.length() > 0) - query = query.substring(0, query.length()-1) + ";\r\n"; + query = query.substring(0, query.length()-1) + CrLf; return query; } @@ -112,7 +113,7 @@ public class RoleGenaratorServiceImpl implements RoleGeneratorService { } }); if(query[0].length() > 0) - query[0] = query[0].substring(0, query[0].length()-1) + ";\r\n"; + query[0] = query[0].substring(0, query[0].length()-1) + CrLf; return query[0]; } @@ -153,7 +154,7 @@ public class RoleGenaratorServiceImpl implements RoleGeneratorService { private String createTemporaryTableAvailableRoles(String availableRoles) { String query = "CREATE TEMPORARY TABLE IF NOT EXISTS available_roles(rname VARCHAR(255));\r\n"; - query += "INSERT INTO available_roles VALUES "+availableRoles+";\r\n"; + query += "INSERT INTO available_roles VALUES "+availableRoles+CrLf; return query; } @@ -185,6 +186,6 @@ public class RoleGenaratorServiceImpl implements RoleGeneratorService { } private String dropTemporaryTable(String table) { - return "DROP TEMPORARY TABLE IF EXISTS " + table + ";\r\n"; + return "DROP TEMPORARY TABLE IF EXISTS " + table + CrLf; } } |