summaryrefslogtreecommitdiffstats
path: root/auth/auth-cass
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-03-07 12:58:39 -0600
committerInstrumental <jonathan.gathman@att.com>2019-03-07 12:58:54 -0600
commita174f8ddbc5eb78a648fb68b33ef18cb64d81fda (patch)
treed27c01bcd63fd6a7bff00687c6f33423a3a40e8c /auth/auth-cass
parent9dc1cd2632d1dda9c8f072e99616e73e0517f1aa (diff)
Improve Batches
Issue-ID: AAF-740 Change-Id: Ib3e8a3f977964eed2e992dc02154dd3bc90492df Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-cass')
-rw-r--r--auth/auth-cass/cass_init/init.cql2
-rw-r--r--auth/auth-cass/cass_init/init2_10.cql2
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java12
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java7
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java28
5 files changed, 33 insertions, 18 deletions
diff --git a/auth/auth-cass/cass_init/init.cql b/auth/auth-cass/cass_init/init.cql
index 04540799..75b02c53 100644
--- a/auth/auth-cass/cass_init/init.cql
+++ b/auth/auth-cass/cass_init/init.cql
@@ -168,6 +168,8 @@ CREATE TABLE future (
memo varchar, // Description
start timestamp, // When it should take effect
expires timestamp, // When not longer valid
+ target_key varchar, // Item Key (or 2nd key, assuming user is first)
+ target_date timestamp, // Item's relevant date/stamp
construct blob, // How to construct this object (like History)
PRIMARY KEY(id)
);
diff --git a/auth/auth-cass/cass_init/init2_10.cql b/auth/auth-cass/cass_init/init2_10.cql
index 839acf60..b7195076 100644
--- a/auth/auth-cass/cass_init/init2_10.cql
+++ b/auth/auth-cass/cass_init/init2_10.cql
@@ -1,2 +1,4 @@
use authz;
alter TABLE cred ADD tag varchar;
+alter TABLE future ADD target_key varchar;
+alter TABLE future ADD target_date timestamp;
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<AuthzTrans,ApprovalDAO.Data> {
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<AuthzTrans,ApprovalDAO.Data> {
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<AuthzTrans,ApprovalDAO.Data> {
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<AuthzTrans,CredDAO.Data> {
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<AuthzTrans,CredDAO.Data> {
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<AuthzTrans,CredDAO.Data> {
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<AuthzTrans,CredDAO.Data> {
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<AuthzTrans,CredDAO.Data> {
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<AuthzTrans,FutureDAO.Data> {
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<Data> {
@@ -83,12 +85,14 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
@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<AuthzTrans,FutureDAO.Data> {
obj[++idx] = data.start;
obj[++idx] = data.expires;
obj[++idx] = data.construct;
+ obj[++idx] = data.target_key;
+ obj[++idx] = data.target_date;
}
}