From 8a4224bffad3139e151722dcc9ddd52731d3d5e6 Mon Sep 17 00:00:00 2001 From: Sooriyaa Date: Mon, 10 Sep 2018 12:40:03 +0530 Subject: Adding a constant to remove duplicate string Adding a constant to remove duplicate string Issue-ID: MUSIC-133 Change-Id: I1c9e82cf210c2dd0f00bec53c95fa5281f368568 Signed-off-by: Sooriyaa --- .../org/onap/music/conductor/conditionals/MusicConditional.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java b/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java index 994d31bc..0e8cc14a 100644 --- a/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java +++ b/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java @@ -47,6 +47,7 @@ import com.datastax.driver.core.TableMetadata; public class MusicConditional { private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestMusicDataAPI.class); + private static final String CRITICAL = "critical"; public static ReturnType conditionalInsert(String keyspace, String tablename, String casscadeColumnName, Map casscadeColumnData, String primaryKey, Map valuesMap, @@ -130,10 +131,10 @@ public class MusicConditional { return new ReturnType(ResultType.FAILURE, e.getMessage()); } if (results.all().isEmpty()) { - MusicCore.getDSHandle().executePut(queryBank.get(MusicUtil.INSERT), "critical"); + MusicCore.getDSHandle().executePut(queryBank.get(MusicUtil.INSERT), CRITICAL); return new ReturnType(ResultType.SUCCESS, "insert"); } else { - MusicCore.getDSHandle().executePut(queryBank.get(MusicUtil.UPDATE), "critical"); + MusicCore.getDSHandle().executePut(queryBank.get(MusicUtil.UPDATE), CRITICAL); return new ReturnType(ResultType.SUCCESS, "update"); } } else { @@ -198,14 +199,14 @@ public class MusicConditional { update.addValue(MusicUtil.convertToActualDataType(DataType.text(), vector_ts)); update.addValue(MusicUtil.convertToActualDataType(DataType.text(), primaryKeyValue)); try { - MusicCore.getDSHandle().executePut(update, "critical"); + MusicCore.getDSHandle().executePut(update, CRITICAL); } catch (Exception ex) { return new ReturnType(ResultType.FAILURE, ex.getMessage()); } }else { return new ReturnType(ResultType.FAILURE,"Cannot find data related to key: "+primaryKey); } - MusicCore.getDSHandle().executePut(queryBank.get(MusicUtil.UPSERT), "critical"); + MusicCore.getDSHandle().executePut(queryBank.get(MusicUtil.UPSERT), CRITICAL); return new ReturnType(ResultType.SUCCESS, "update success"); } else { -- cgit 1.2.3-korg