Merge "AAF_CM.java -remove the exception"
[aaf/authz.git] / auth / auth-batch / src / main / java / org / onap / aaf / auth / batch / reports / ApprovedRpt.java
index ea196b1..880173b 100644 (file)
@@ -3,7 +3,7 @@
  * org.onap.aaf
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 IBM.
+ * 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.
@@ -52,7 +52,6 @@ public class ApprovedRpt extends Batch {
     
     private static final String APPR_RPT = "ApprovedRpt";
     private static final String CSV = ".csv";
-    private static final String INFO = "info";
     private Date now;
     private Writer approvedW;
     private CSV historyR;
@@ -64,6 +63,13 @@ public class ApprovedRpt extends Batch {
         
         TimeTaken tt0 = trans.start("Cassandra Initialization", Env.SUB);
         try {
+//            TimeTaken tt = trans.start("Connect to Cluster", Env.REMOTE);
+//            try {
+//                session = cluster.connect();
+//            } finally {
+//                tt.done();
+//            }
+            
             now = new Date();
             String sdate = Chrono.dateOnlyStamp(now);
             File file = new File(logDir(),APPR_RPT + sdate +CSV);
@@ -80,17 +86,32 @@ public class ApprovedRpt extends Batch {
 
     @Override
     protected void run(AuthzTrans trans) {
-        try {
-            Map<String,Boolean> checked = new TreeMap<String, Boolean>();
-            
-            final AuthzTrans transNoAvg = trans.env().newTransNoAvg();
-            int totalLoaded = 0;
-            Date d;
+        try {          
+//            ResultSet results;
+//            Statement stmt = new SimpleStatement( "select dateof(id), approver, status, user, type, memo from authz.approved;" );
+//            results = session.execute(stmt);
+//            Iterator<Row> iter = results.iterator();
+//            Row row;
+            /*
+             *             while (iter.hasNext()) {
+                ++totalLoaded;
+                row = iter.next();
+                d = row.getTimestamp(0);
+                if(d.after(begin)) {
+                    approvedW.row("aprvd",
+                            Chrono.dateOnlyStamp(d),
+                            row.getString(1),
+                            row.getString(2),
+                            row.getString(3),
+                            row.getString(4),
+                            row.getString(5)
+                    );
+                }
+            }
+             */
             GregorianCalendar gc = new GregorianCalendar();
             gc.add(GregorianCalendar.MONTH, -2);
-            Date begin = gc.getTime();
             approvedW.comment("date, approver, status, user, role, memo");
-            
             historyR.visit(row -> {
                 String s = row.get(7);
                 if(s.equals(yr_mon)) {