aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSooriyaa <soponraj@in.ibm.com>2018-09-10 12:40:03 +0530
committerSooriyaa <soponraj@in.ibm.com>2018-09-10 12:40:45 +0530
commit8a4224bffad3139e151722dcc9ddd52731d3d5e6 (patch)
treef92695ac0a1db8d272cb640f68bbf82545051275
parent021bc07b7ee7faddb7c94f3d12044d6e81276142 (diff)
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 <soponraj@in.ibm.com>
-rw-r--r--src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java9
1 files 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<String, Object> casscadeColumnData, String primaryKey, Map<String, Object> 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 {