DataMigration, other Batch
[aaf/authz.git] / auth / auth-batch / src / main / java / org / onap / aaf / auth / batch / reports / bodies / NotifyBody.java
index 453c2f2..034286c 100644 (file)
@@ -39,6 +39,7 @@ import java.util.TreeMap;
 import org.onap.aaf.auth.batch.reports.Notify;
 import org.onap.aaf.auth.env.AuthzTrans;
 import org.onap.aaf.cadi.Access;
+import org.onap.aaf.cadi.config.Config;
 import org.onap.aaf.misc.env.APIException;
 
 public abstract class NotifyBody {
@@ -48,15 +49,19 @@ public abstract class NotifyBody {
        protected Map<String,List<List<String>>> rows;
        private final String name;
        private final String type;
+       protected final String env;
        private String date;
        private int escalation;
+       private int count;
        
-       public NotifyBody(final String type, final String name) {
+       public NotifyBody(Access access, final String type, final String name) {
                rows = new TreeMap<>();
                this.name = name;
                this.type = type;
                date="";
                escalation = 1;
+               count = 0;
+               env = access.getProperty(Config.AAF_ENV,"DEVL");
        }
        
        public void store(List<String> row) {
@@ -87,6 +92,10 @@ public abstract class NotifyBody {
                return name;
        }
        
+       public String type() {
+               return type;
+       }
+       
        public String date() {
                return date;
        }
@@ -116,6 +125,8 @@ public abstract class NotifyBody {
         */
        protected abstract String user(List<String> row);
        
+       public abstract String subject();
+
        /**
         * Get Notify Body based on key of
         * type|name
@@ -183,7 +194,6 @@ public abstract class NotifyBody {
                        }
                }
        }
-       
 
        protected void println(StringBuilder sb, int indent, Object ... objs) {
                for(int i=0;i<indent;++i) {
@@ -195,12 +205,24 @@ public abstract class NotifyBody {
                sb.append('\n');
        }
        
-       protected void printCell(StringBuilder sb, int indent, String current, String prev) {
+       protected String printCell(StringBuilder sb, int indent, String current, String prev) {
                if(current.equals(prev)) {
                        println(sb,indent,DUPL);
                } else {
-                       println(sb,indent,"<td>",current,"</td>");
+                       printCell(sb,indent,current);
                }
+               return current; // use to set prev...
+       }
+       
+       protected void printCell(StringBuilder sb, int indent, String current) {
+               println(sb,indent,"<td>",current,"</td>");
+       }
+       
+       public synchronized void inc() {
+               ++count;
+       }
+       
+       public int count() {
+               return count;
        }
-
 }