From df40ceda123528e27df349a9716a1a0116235e6c Mon Sep 17 00:00:00 2001 From: ezhil Date: Wed, 28 Nov 2018 22:59:35 +0530 Subject: Fixed sonar issues in FutureDAO.java Fixed Sonar issues Issue-ID: AAF-648 Change-Id: I45feb124a17aafd6192c024d63200b20ce3ef768 Signed-off-by: ezhil --- .../main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java index a98f101f..96cbf28a 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java @@ -4,6 +4,8 @@ * =========================================================================== * Copyright (c) 2018 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. * You may obtain a copy of the License at @@ -46,9 +48,9 @@ import com.datastax.driver.core.Row; public class FutureDAO extends CassDAOImpl { private static final String TABLE = "future"; private final HistoryDAO historyDAO; -// private static String createString; private PSInfo psByStartAndTarget; - + public static final int KEYLIMIT = 1; + public FutureDAO(AuthzTrans trans, Cluster cluster, String keyspace) { super(trans, FutureDAO.class.getSimpleName(),cluster, keyspace, Data.class,TABLE, readConsistency(trans,TABLE), writeConsistency(trans,TABLE)); historyDAO = new HistoryDAO(trans, this); @@ -61,7 +63,7 @@ public class FutureDAO extends CassDAOImpl { init(trans); } - public static final int KEYLIMIT = 1; + public static class Data { public UUID id; public String target; @@ -112,13 +114,6 @@ public class FutureDAO extends CassDAOImpl { // Set up sub-DAOs String[] helpers = setCRUD(trans, TABLE, Data.class, new FLoader(KEYLIMIT)); - // Uh, oh. Can't use "now()" in Prepared Statements (at least at this level) -// createString = "INSERT INTO " + TABLE + " ("+helpers[FIELD_COMMAS] +") VALUES (now(),"; -// -// // Need a specialty Creator to handle the "now()" -// replace(CRUD.Create, new PSInfo(trans, "INSERT INTO future (" + helpers[FIELD_COMMAS] + -// ") VALUES(now(),?,?,?,?,?)",new FLoader(0))); - // Other SELECT style statements... match with a local Method psByStartAndTarget = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + " FROM future WHERE start <= ? and target = ? ALLOW FILTERING", new FLoader(2) { @@ -134,7 +129,7 @@ public class FutureDAO extends CassDAOImpl { } - public Result> readByStartAndTarget(AuthzTrans trans, Date start, String target) throws DAOException { + public Result> readByStartAndTarget(AuthzTrans trans, Date start, String target) { return psByStartAndTarget.read(trans, R_TEXT, new Object[]{start, target}); } -- cgit 1.2.3-korg