From a174f8ddbc5eb78a648fb68b33ef18cb64d81fda Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 7 Mar 2019 12:58:39 -0600 Subject: Improve Batches Issue-ID: AAF-740 Change-Id: Ib3e8a3f977964eed2e992dc02154dd3bc90492df Signed-off-by: Instrumental --- .../org/onap/aaf/auth/dao/cass/ApprovalDAO.java | 12 +++++----- .../java/org/onap/aaf/auth/dao/cass/CredDAO.java | 7 +++++- .../java/org/onap/aaf/auth/dao/cass/FutureDAO.java | 28 +++++++++++++--------- 3 files changed, 29 insertions(+), 18 deletions(-) (limited to 'auth/auth-cass/src') diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java index cc4135ee..4c66c964 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java @@ -76,7 +76,7 @@ public class ApprovalDAO extends CassDAOImpl { public String status; public String memo; public String operation; - public Date last_notified; +// public Date last_notified; public Date updated; } @@ -97,11 +97,11 @@ public class ApprovalDAO extends CassDAOImpl { data.status = row.getString(5); data.memo = row.getString(6); data.operation = row.getString(7); - data.last_notified = row.getTimestamp(8); +// data.last_notified = row.getTimestamp(8); // This is used to get "WRITETIME(STATUS)" from Approval, which gives us an "updated" - if (row.getColumnDefinitions().size()>9) { + if (row.getColumnDefinitions().size()>8) { // Rows reported in MicroSeconds - data.updated = new Date(row.getLong(9)/1000); + data.updated = new Date(row.getLong(8)/1000); } return data; } @@ -121,12 +121,12 @@ public class ApprovalDAO extends CassDAOImpl { obj[++idx]=data.status; obj[++idx]=data.memo; obj[++idx]=data.operation; - obj[++idx]=data.last_notified; +// obj[++idx]=data.last_notified; } } private void init(AuthzTrans trans) { - String[] helpers = setCRUD(trans, TABLE, Data.class, ApprovalLoader.deflt,9); + String[] helpers = setCRUD(trans, TABLE, Data.class, ApprovalLoader.deflt,8); psByUser = new PSInfo(trans, SELECT_SP + helpers[FIELD_COMMAS] + ", WRITETIME(status) FROM " + TABLE + " WHERE user = ?", new ApprovalLoader(1) { @Override diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java index 9a47e576..01cc9237 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java @@ -84,6 +84,7 @@ public class CredDAO extends CassDAOImpl { public Integer other; public String ns; public String tag; + public String notes; public ByteBuffer cred; // this is a blob in cassandra @@ -129,7 +130,8 @@ public class CredDAO extends CassDAOImpl { data.other = row.getInt(3); data.ns = row.getString(4); data.tag = row.getString(5); - data.cred = row.getBytesUnsafe(6); + data.notes = row.getString(6); + data.cred = row.getBytesUnsafe(7); return data; } @@ -148,6 +150,7 @@ public class CredDAO extends CassDAOImpl { obj[i=idx] = data.other; obj[++i] = data.ns; obj[++i] = data.tag; + obj[++i] = data.notes; obj[++i] = data.cred; } @@ -160,6 +163,7 @@ public class CredDAO extends CassDAOImpl { os.writeInt(data.other==null?0:data.other); writeString(os, data.ns); writeString(os, data.tag); + writeString(os, data.notes); if (data.cred==null) { os.writeInt(-1); } else { @@ -182,6 +186,7 @@ public class CredDAO extends CassDAOImpl { data.other = is.readInt(); data.ns = readString(is,buff); data.tag = readString(is,buff); + data.notes = readString(is,buff); int i = is.readInt(); data.cred=null; 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 10c0ec97..7831815f 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 @@ -65,11 +65,13 @@ public class FutureDAO extends CassDAOImpl { public static class Data { public UUID id; - public String target; - public String memo; - public Date start; - public Date expires; - public ByteBuffer construct; // this is a blob in cassandra + public String target; + public String memo; + public Date start; + public Date expires; + public String target_key; + public Date target_date; + public ByteBuffer construct; // this is a blob in cassandra } private static class FLoader extends Loader { @@ -83,12 +85,14 @@ public class FutureDAO extends CassDAOImpl { @Override public Data load(Data data, Row row) { - data.id = row.getUUID(0); - data.target = row.getString(1); - data.memo = row.getString(2); - data.start = row.getTimestamp(3); - data.expires = row.getTimestamp(4); - data.construct = row.getBytes(5); + data.id = row.getUUID(0); + data.target = row.getString(1); + data.memo = row.getString(2); + data.start = row.getTimestamp(3); + data.expires = row.getTimestamp(4); + data.construct = row.getBytes(5); + data.target_key = row.getString(6); + data.target_date = row.getTimestamp(7); return data; } @@ -106,6 +110,8 @@ public class FutureDAO extends CassDAOImpl { obj[++idx] = data.start; obj[++idx] = data.expires; obj[++idx] = data.construct; + obj[++idx] = data.target_key; + obj[++idx] = data.target_date; } } -- cgit 1.2.3-korg