2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 * ===========================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END====================================================
21 package org.onap.aaf.auth.batch.reports.bodies;
23 import java.io.IOException;
24 import java.util.Date;
25 import java.util.List;
27 import org.onap.aaf.auth.batch.reports.Notify;
28 import org.onap.aaf.auth.env.AuthzTrans;
29 import org.onap.aaf.auth.org.Organization.Identity;
30 import org.onap.aaf.auth.org.OrganizationException;
31 import org.onap.aaf.cadi.Access;
32 import org.onap.aaf.misc.env.util.Chrono;
34 public abstract class NotifyURBody extends NotifyBody {
36 private final String explanation;
37 public NotifyURBody(Access access, String name) throws IOException {
38 super(access,"ur",name);
41 explanation = "The Roles for the IDs associated with you will expire on the dates shown. If "
42 + "allowed to expire, the ID will no longer authorized in that role on that date.<br><br>"
43 + "It is the responsibility of the Designated Approvers to approve, but you can monitor "
44 + "their progress by clicking the ID Link.";
48 public boolean body(AuthzTrans trans, StringBuilder sb, int indent, Notify n, String id) {
49 String fullname = "n/a";
52 Identity identity = trans.org().getIdentity(trans, id);
54 trans.warn().printf("Cannot find %s in Organization",id);
56 fullname = identity.fullName();
57 if(!identity.isPerson()) {
58 if((identity = identity.responsibleTo())!=null) {
59 kind = "AppID Sponsor";
60 fullname = identity.fullName();
64 } catch (OrganizationException e) {
68 println(sb,indent,explanation);
69 println(sb,indent,"<br><br>");
70 println(sb,indent,"<table>");
72 println(sb,indent,"<tr>");
74 println(sb,indent,"<th>"+kind+"</th>");
75 println(sb,indent,"<th>Fully Qualified ID</th>");
76 println(sb,indent,"<th>Role</th>");
77 println(sb,indent,"<th>Expires</th>");
79 println(sb,indent,"</tr>");
83 for(List<String> row : rows.get(id)) {
84 println(sb,indent,"<tr>");
86 name = printCell(sb,indent,fullname,name);
87 String rid = row.get(1);
88 String fqiCell = "<a href=\"" + gui_url + "/myrequests\">" + rid + "</a>";
89 fqi = printCell(sb,indent,fqiCell,fqi);
90 printCell(sb,indent,row.get(2));
91 Date expires = new Date(Long.parseLong(row.get(6)));
92 printCell(sb,indent,Chrono.niceUTCStamp(expires));
94 println(sb,indent,"</tr>");
97 println(sb,indent,"</table>");
103 public String user(List<String> row) {
104 if( (row != null) && row.size()>1) {