From f24981f52226241603ded942f6a774d3e411a157 Mon Sep 17 00:00:00 2001 From: Pawel Date: Wed, 21 Nov 2018 04:56:26 -0500 Subject: fixes in CassDAOImpl.java Change-Id: I46a1f89a5c6fb735bc42df90da9065e3910f6379 Issue-ID: AAF-639 Signed-off-by: Pawel --- .../java/org/onap/aaf/auth/dao/CassDAOImpl.java | 37 ++++++++++++---------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java index 58c4386b..72444c99 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java @@ -48,10 +48,14 @@ import com.datastax.driver.core.ResultSetFuture; */ public class CassDAOImpl extends AbsCassDAO implements DAO { public static final String USER_NAME = "__USER_NAME__"; + public static final String CASS_READ_CONSISTENCY="cassandra.readConsistency"; + public static final String CASS_WRITE_CONSISTENCY="cassandra.writeConsistency"; protected static final String CREATE_SP = "CREATE "; protected static final String UPDATE_SP = "UPDATE "; protected static final String DELETE_SP = "DELETE "; protected static final String SELECT_SP = "SELECT "; + private static final String WHERE = " WHERE "; + private static final String READ_IS_DISABLED = "Read is disabled for %s"; protected final String C_TEXT = getClass().getSimpleName() + " CREATE"; protected final String R_TEXT = getClass().getSimpleName() + " READ"; @@ -59,7 +63,14 @@ public class CassDAOImpl extends AbsCassDAO cache; @@ -95,12 +106,6 @@ public class CassDAOImpl extends AbsCassDAO extends AbsCassDAO dc,Loader loader, int max) { Field[] fields = dc.getDeclaredFields(); - int end = max>=0 & max=0 && max extends AbsCassDAO extends AbsCassDAO> read(TRANS trans, DATA data) { if (readPS==null) { - return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName()); + return Result.err(Result.ERR_NotImplemented,READ_IS_DISABLED,getClass().getSimpleName()); } return readPS.read(trans, R_TEXT, data); } public Result> read(TRANS trans, Object ... key) { if (readPS==null) { - return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName()); + return Result.err(Result.ERR_NotImplemented,READ_IS_DISABLED,getClass().getSimpleName()); } return readPS.read(trans, R_TEXT, key); } public Result readPrimKey(TRANS trans, Object ... key) { if (readPS==null) { - return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName()); + return Result.err(Result.ERR_NotImplemented,READ_IS_DISABLED,getClass().getSimpleName()); } Result> rld = readPS.read(trans, R_TEXT, key); if (rld.isOK()) { @@ -312,9 +317,7 @@ public class CassDAOImpl extends AbsCassDAO