Merge "AAFcli.java -Declare "value" on a separate line"
[aaf/authz.git] / auth / auth-cass / src / main / java / org / onap / aaf / auth / dao / cass / FutureDAO.java
index 10c0ec9..15c2b55 100644 (file)
@@ -9,9 +9,9 @@
  * 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
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,9 +38,9 @@ import com.datastax.driver.core.ResultSet;
 import com.datastax.driver.core.Row;
 
 /**
- * FutureDAO stores Construction information to create 
+ * FutureDAO stores Construction information to create
  * elements at another time.
- * 
+ *
  * @author Jonathan
  * 8/20/2013
  */
@@ -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.target_key   = row.getString(5);
+            data.target_date  = row.getTimestamp(6);
+            data.construct    = row.getBytes(7);
             return data;
         }
 
@@ -105,6 +109,8 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
             obj[++idx] = data.memo;
             obj[++idx] = data.start;
             obj[++idx] = data.expires;
+            obj[++idx] = data.target_key;
+            obj[++idx] = data.target_date;
             obj[++idx] = data.construct;
         }
     }
@@ -146,7 +152,7 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
             return Result.err(rs);
         }
         wasModified(trans, CRUD.create, data, null, id);
-        return Result.ok(data);    
+        return Result.ok(data);
     }
 
     /**
@@ -166,10 +172,10 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
         hd.target = TABLE;
         hd.subject = subject?override[1]:"";
         hd.memo = memo?String.format("%s by %s", override[0], hd.user):data.memo;
-    
+
         if (historyDAO.create(trans, hd).status!=Status.OK) {
             trans.error().log("Cannot log to History");
         }
     }
-    
+
 }