Merge "Adjust Agent for none K8s"
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
index 45617f8..661e40f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/ApprovalSet.java
@@ -39,7 +39,7 @@
 	protected FutureDAO.Data fdd;
 	protected List<ApprovalDAO.Data> ladd;
 	
-	public ApprovalSet(final GregorianCalendar start, final String target, final DataView dv) throws CadiException {
+	public ApprovalSet(final GregorianCalendar start, final String target, final DataView dv) {
 		dataview = dv;
 		fdd = new FutureDAO.Data();
 		fdd.id = Chrono.dateToUUID(System.currentTimeMillis());
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
index bf77b77..91006c4 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/URApprovalSet.java
@@ -123,7 +123,7 @@
 		fdd.target_key = key;
 	}
 
-	private ApprovalDAO.Data newApproval(UserRoleDAO.Data urdd) throws CadiException {
+	private ApprovalDAO.Data newApproval(UserRoleDAO.Data urdd) {
 		ApprovalDAO.Data add = new ApprovalDAO.Data();
 		add.id = Chrono.dateToUUID(System.currentTimeMillis());
 		add.ticket = fdd.id;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
index ce19865..c32db2e 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Approval.java
@@ -4,6 +4,8 @@
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
  * ===========================================================================
+ *  Modifications Copyright (C) 2019 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
@@ -52,10 +54,61 @@
     public static TreeMap<String,List<Approval>> byUser = new TreeMap<>();
     public static TreeMap<UUID,List<Approval>> byTicket = new TreeMap<>();
     public static List<Approval> list = new LinkedList<>();
-    private final static CacheChange<Approval> cache = new CacheChange<>(); 
+    private static final CacheChange<Approval> cache = new CacheChange<>();
     
     public final ApprovalDAO.Data add;
     private String role;
+
+    public static Creator<Approval> v2_0_17 = new Creator<Approval>() {
+        @Override
+        public Approval create(Row row) {
+            return new Approval(row.getUUID(0), row.getUUID(1), row.getString(2),
+                    row.getString(3),row.getString(4),row.getString(5),row.getString(6),row.getString(7),
+                    row.getLong(8)/1000);
+        }
+
+        @Override
+        public String select() {
+            return "select id,ticket,approver,user,memo,operation,status,type,WRITETIME(status) from authz.approval";
+        }
+    };
+
+    public static Visitor<Approval> FullLoad = new Visitor<Approval>() {
+        @Override
+        public void visit(Approval app) {
+            List<Approval> ln;
+            list.add(app);
+
+            String person = app.getApprover();
+            if (person!=null) {
+                ln = byApprover.get(person);
+                if (ln==null) {
+                    ln = new ArrayList<>();
+                    byApprover.put(app.getApprover(), ln);
+                }
+                ln.add(app);
+            }
+
+            person = app.getUser();
+            if (person!=null) {
+                ln = byUser.get(person);
+                if (ln==null) {
+                    ln = new ArrayList<>();
+                    byUser.put(app.getUser(), ln);
+                }
+                ln.add(app);
+            }
+            UUID ticket = app.getTicket();
+            if (ticket!=null) {
+                ln = byTicket.get(ticket);
+                if (ln==null) {
+                    ln = new ArrayList<>();
+                    byTicket.put(app.getTicket(), ln);
+                }
+                ln.add(app);
+            }
+        }
+    };
     
     public Approval(UUID id, UUID ticket, String approver,// Date last_notified, 
             String user, String memo, String operation, String status, String type, long updated) {
@@ -63,7 +116,6 @@
         add.id = id;
         add.ticket = ticket;
         add.approver = approver;
-//        add.last_notified = last_notified;
         add.user = user;
         add.memo = memo;
         add.operation = operation;
@@ -90,11 +142,9 @@
                 	first = memo.indexOf('[',second);
                 	if(first>=0) {
                 		second = memo.indexOf(']', ++first);
-                		if(second>=0) {
-                			if(memo.startsWith(RE_APPROVAL_IN_ROLE) ||
-                			   memo.startsWith(ADD_USER_TO_ROLE)) {
+                		if(second>=0 && (memo.startsWith(RE_APPROVAL_IN_ROLE) ||
+                                memo.startsWith(ADD_USER_TO_ROLE))) {
                 				return  memo.substring(first, second);
-                			}
                 		}
                 	}
                 }
@@ -180,57 +230,6 @@
     	cache.resetLocalData();
     }
 
-    public static Creator<Approval> v2_0_17 = new Creator<Approval>() {
-        @Override
-        public Approval create(Row row) {
-            return new Approval(row.getUUID(0), row.getUUID(1), row.getString(2),
-                    row.getString(3),row.getString(4),row.getString(5),row.getString(6),row.getString(7),
-                    row.getLong(8)/1000);
-        }
-
-        @Override
-        public String select() {
-            return "select id,ticket,approver,user,memo,operation,status,type,WRITETIME(status) from authz.approval";
-        }
-    };
-    
-    public static Visitor<Approval> FullLoad = new Visitor<Approval>() {
-		@Override
-		public void visit(Approval app) {
-	        List<Approval> ln;
-	        list.add(app);
-	        
-	        String person = app.getApprover();
-	        if (person!=null) {
-	        ln = byApprover.get(person);
-	            if (ln==null) {
-	                ln = new ArrayList<>();
-	                byApprover.put(app.getApprover(), ln);
-	            }
-	            ln.add(app);
-	        }
-	        
-	        person = app.getUser();
-	        if (person!=null) {
-	            ln = byUser.get(person);
-	            if (ln==null) {
-	                ln = new ArrayList<>();
-	                byUser.put(app.getUser(), ln);
-	            }
-	            ln.add(app);
-	        }
-	        UUID ticket = app.getTicket();
-	        if (ticket!=null) {
-	            ln = byTicket.get(ticket);
-	            if (ln==null) {
-	                ln = new ArrayList<>();
-	                byTicket.put(app.getTicket(), ln);
-	            }
-	            ln.add(app);
-	        }
-		}
-    };
-
     /**
      * @return the status
      */
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
index dbafdc0..ad1ab37 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NS.java
@@ -32,7 +32,6 @@
 import org.onap.aaf.misc.env.Env;
 import org.onap.aaf.misc.env.TimeTaken;
 import org.onap.aaf.misc.env.Trans;
-import org.onap.aaf.misc.env.util.Chrono;
 
 import com.datastax.driver.core.ResultSet;
 import com.datastax.driver.core.Row;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
index f5e36fa..a2cba25 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/NsAttrib.java
@@ -38,14 +38,7 @@
     public final String ns;
     public final String key;
     public final String value;
-    
-    
-    public NsAttrib(String ns, String key, String value) {
-        this.ns = ns;
-        this.key = key;
-        this.value = value;
-    }
-    
+
     public static Creator<NsAttrib> v2_0_11 = new Creator<NsAttrib>() {
         @Override
         public NsAttrib create(Row row) {
@@ -58,6 +51,13 @@
         }
     };
     
+    
+    public NsAttrib(String ns, String key, String value) {
+        this.ns = ns;
+        this.key = key;
+        this.value = value;
+    }
+    
    public static void load(Trans trans, Session session, Creator<NsAttrib> creator, Visitor<NsAttrib> visitor) {
         trans.info().log( "query: " + creator.select() );
         ResultSet results;
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
index 1f8d978..72fed8a 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyCredBody.java
@@ -3,6 +3,8 @@
  * org.onap.aaf
  * ===========================================================================
  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
  * ===========================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -35,7 +37,7 @@
 	private final String explanation;
 	private final String instruction;
 	 
-	public NotifyCredBody(Access access, String name) throws IOException {
+	public NotifyCredBody(Access access, String name) {
 		super(access,"cred",name);
 		
 		// Default
@@ -76,7 +78,11 @@
 		println(sb,indent,"<th>Warnings</th>");
 		indent-=2;
 		println(sb,indent,"</tr>");
-		String theid, type, info, expires, warnings;
+		String theid;
+		String type;
+		String info;
+		String expires;
+		String warnings;
 		GregorianCalendar gc = new GregorianCalendar();
 		for(List<String> row : rows.get(id)) {
 			theid=row.get(1);