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.List;
26 import org.onap.aaf.auth.batch.reports.Notify;
27 import org.onap.aaf.auth.env.AuthzTrans;
28 import org.onap.aaf.auth.org.Organization.Identity;
29 import org.onap.aaf.auth.org.OrganizationException;
30 import org.onap.aaf.cadi.Access;
32 public abstract class NotifyURBody extends NotifyBody {
34 private final String explanation;
35 public NotifyURBody(Access access, String name) throws IOException {
39 explanation = "The Roles for the IDs listed will expire on the dates shown. If "
40 + "allowed to expire, the ID will no longer have access to the Permissions "
41 + "associated with that Role.";
45 public boolean body(AuthzTrans trans, StringBuilder sb, int indent, Notify n, String id) {
46 String fullname = "n/a";
49 Identity identity = trans.org().getIdentity(trans, id);
51 trans.warn().printf("Cannot find %s in Organization",id);
53 fullname = identity.fullName();
54 if(!identity.isPerson()) {
55 if((identity = identity.responsibleTo())!=null) {
56 kind = "AppID Sponsor";
57 fullname = identity.fullName();
61 } catch (OrganizationException e) {
65 println(sb,indent,explanation);
66 println(sb,indent,"<table>");
68 println(sb,indent,"<tr>");
70 println(sb,indent,"<th>"+kind+"</th>");
71 println(sb,indent,"<th>Fully Qualified ID</th>");
72 println(sb,indent,"<th>Role</th>");
73 println(sb,indent,"<th>Expires</th>");
75 println(sb,indent,"</tr>");
79 for(List<String> row : rows.get(id)) {
80 println(sb,indent,"<tr>");
82 name = printCell(sb,indent,fullname,name);
83 fqi = printCell(sb,indent,row.get(1),fqi);
84 printCell(sb,indent,row.get(2)+'.'+row.get(3));
85 printCell(sb,indent,row.get(4));
87 println(sb,indent,"</tr>");
90 println(sb,indent,"</table>");
96 public String user(List<String> row) {
97 if( (row != null) && row.size()>1) {