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%2FNotifyPendingApprBody.java;h=8019e4465667ccdbccb552845fe9f8d159a72b4b;hb=d86e3224e6a5af2bd2b713f93bea5e6677d3ebc2;hp=502464e90dda20bee3219f7fe9ae77e1d1ea9e78;hpb=9dc1cd2632d1dda9c8f072e99616e73e0517f1aa;p=aaf%2Fauthz.git diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java index 502464e9..8019e446 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/reports/bodies/NotifyPendingApprBody.java @@ -22,69 +22,33 @@ package org.onap.aaf.auth.batch.reports.bodies; import java.util.List; +import org.onap.aaf.auth.batch.helpers.LastNotified; import org.onap.aaf.auth.batch.reports.Notify; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.cadi.Access; public class NotifyPendingApprBody extends NotifyBody { - private final String explanation; public NotifyPendingApprBody(Access access) { super(access,"appr","PendingApproval"); - explanation = "The following Approvals are awaiting your action. "; } @Override public boolean body(AuthzTrans trans, StringBuilder sb, int indent, Notify n, String id) { - println(sb,indent,explanation); -/* println(sb,indent,""); - indent+=2; - println(sb,indent,""); - indent+=2; - println(sb,indent,""); - println(sb,indent,""); - println(sb,indent,""); - println(sb,indent,""); - println(sb,indent,""); - indent-=2; - println(sb,indent,""); - String theid, type, info, expires, warnings; - GregorianCalendar gc = new GregorianCalendar(); + boolean rv = false; for(List row : rows.get(id)) { - theid=row.get(1); - switch(row.get(3)) { - case "1": - case "2": - type = "Password"; - break; - case "200": - type = "x509 (Certificate)"; - break; - default: - type = "Unknown, see AAF GUI"; - break; + String qty = row.get(2); + if("1".equals(qty)) { + printf(sb,indent,"You have an Approval in the AAF %s Environment awaiting your decision.\n",row.get(3)); + } else { + printf(sb,indent,"You have %s Approvals in the AAF %s Environment awaiting your decision.\n",qty,row.get(3)); } - theid = ""+theid+""; - gc.setTimeInMillis(Long.parseLong(row.get(5))); - expires = Chrono.niceUTCStamp(gc); - info = row.get(6); - //TODO get Warnings - warnings = ""; - - println(sb,indent,""); - indent+=2; - printCell(sb,indent,theid); - printCell(sb,indent,info); - printCell(sb,indent,type); - printCell(sb,indent,expires); - printCell(sb,indent,warnings); - indent-=2; - println(sb,indent,""); + printf(sb,indent,"

ACTION:Click onAAF Approval Page",n.guiURL); + rv = true; + break; // only one } - indent-=2; - println(sb,indent,"
Fully Qualified IDUnique IDTypeExpiresWarnings
"); - */ - return true; + + return rv; } @Override @@ -100,4 +64,23 @@ public class NotifyPendingApprBody extends NotifyBody { return String.format("AAF Pending Approval Notification (ENV: %s)",env); } + + @Override + public void record(AuthzTrans trans, StringBuilder query, String id, List notified, LastNotified lastN) { + for(String n : notified) { + // No special key for Pending Requests. + lastN.update(query,n,"pending",""); + } + } + + /* (non-Javadoc) + * @see org.onap.aaf.auth.batch.reports.bodies.NotifyBody#store(java.util.List) + */ + @Override + public void store(List row) { + // Notify Pending is setup for 1 Notification at a time + super.rows.clear(); + super.store(row); + } + }