X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-batch%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fbatch%2Freports%2Fbodies%2FNotifyBody.java;h=b36cf648b86455935ff81691da04bf94d403ca93;hb=628b7105ce4d9818aac69a082e515f9275fd46fd;hp=429ea6d236780d4e094024fc7df18b59ae129cca;hpb=218728980874ca82b07a10fceb26debd6045d2ea;p=aaf%2Fauthz.git diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java index 429ea6d2..b36cf648 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyBody.java @@ -30,6 +30,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -41,6 +42,7 @@ import org.onap.aaf.cadi.Access; import org.onap.aaf.misc.env.APIException; public abstract class NotifyBody { + private static final String DUPL = "''"; private static final Map bodyMap = new HashMap<>(); protected Map>> rows; @@ -48,6 +50,7 @@ public abstract class NotifyBody { private final String type; private String date; private int escalation; + private int count; public NotifyBody(final String type, final String name) { rows = new TreeMap<>(); @@ -55,6 +58,7 @@ public abstract class NotifyBody { this.type = type; date=""; escalation = 1; + count = 0; } public void store(List row) { @@ -85,6 +89,10 @@ public abstract class NotifyBody { return name; } + public String type() { + return type; + } + public String date() { return date; } @@ -105,7 +113,7 @@ public abstract class NotifyBody { * @param row * @return */ - public abstract String body(AuthzTrans trans, Notify n, String id); + public abstract boolean body(AuthzTrans trans, StringBuilder sb, int indent, Notify n, String id); /** * Return "null" if user not found in row... Code will handle. @@ -127,7 +135,11 @@ public abstract class NotifyBody { * */ public static Collection getAll() { - return bodyMap.values(); + // Note: The same Notify Body is entered several times with different keys. + // Therefore, need a Set of Values, not all the Values. + Set set = new HashSet<>(); + set.addAll(bodyMap.values()); + return set; } /** @@ -140,14 +152,10 @@ public abstract class NotifyBody { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Package pkg = NotifyBody.class.getPackage(); String path = pkg.getName().replace('.', '/'); -// Enumeration urls = cl.getResources(path); -// while(urls.hasMoreElements()) { -// URL url = urls.nextElement(); URL url = cl.getResource(path); if(url == null) { throw new APIException("Cannot load resources from " + path); } - System.out.println(url); File dir; try { dir = new File(url.toURI()); @@ -180,6 +188,36 @@ public abstract class NotifyBody { } } } -// } + } + + protected void println(StringBuilder sb, int indent, Object ... objs) { + for(int i=0;i",current,""); + } + + public synchronized void inc() { + ++count; + } + + public int count() { + return count; } }