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 listed will expire on the dates shown. If "
42 + "allowed to expire, the ID will no longer authorized in that role.<br><br>"
43 + "If the ID is for a current <b><i>Application</i></b>, this <b><i>WILL</i></b> cause an outage.";
47 public boolean body(AuthzTrans trans, StringBuilder sb, int indent, Notify n, String id) {
48 String fullname = "n/a";
51 Identity identity = trans.org().getIdentity(trans, id);
53 trans.warn().printf("Cannot find %s in Organization",id);
55 fullname = identity.fullName();
56 if(!identity.isPerson()) {
57 if((identity = identity.responsibleTo())!=null) {
58 kind = "AppID Sponsor";
59 fullname = identity.fullName();
63 } catch (OrganizationException e) {
67 println(sb,indent,explanation);
68 println(sb,indent,"<br><br>");
69 println(sb,indent,"<table>");
71 println(sb,indent,"<tr>");
73 println(sb,indent,"<th>"+kind+"</th>");
74 println(sb,indent,"<th>Fully Qualified ID</th>");
75 println(sb,indent,"<th>Role</th>");
76 println(sb,indent,"<th>Expires</th>");
78 println(sb,indent,"</tr>");
82 for(List<String> row : rows.get(id)) {
83 println(sb,indent,"<tr>");
85 name = printCell(sb,indent,fullname,name);
86 fqi = printCell(sb,indent,row.get(1),fqi);
87 printCell(sb,indent,row.get(2)+'.'+row.get(3));
88 Date expires = new Date(Long.parseLong(row.get(6)));
89 printCell(sb,indent,Chrono.niceUTCStamp(expires));
91 println(sb,indent,"</tr>");
94 println(sb,indent,"</table>");
100 public String user(List<String> row) {
101 if( (row != null) && row.size()>1) {