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.util.List;
25 import org.onap.aaf.auth.batch.helpers.LastNotified;
26 import org.onap.aaf.auth.batch.reports.Notify;
27 import org.onap.aaf.auth.env.AuthzTrans;
28 import org.onap.aaf.cadi.Access;
30 public class NotifyPendingApprBody extends NotifyBody {
32 public NotifyPendingApprBody(Access access) {
33 super(access,"appr","PendingApproval");
37 public boolean body(AuthzTrans trans, StringBuilder sb, int indent, Notify n, String id) {
39 for(List<String> row : rows.get(id)) {
40 String qty = row.get(2);
42 printf(sb,indent,"You have an Approval in the AAF %s Environment awaiting your decision.\n",row.get(3));
44 printf(sb,indent,"You have %s Approvals in the AAF %s Environment awaiting your decision.\n",qty,row.get(3));
46 printf(sb,indent,"<br><br><b>ACTION:</b> <i>Click on</i> <a href=\"%s/approve\">AAF Approval Page</a>",n.guiURL);
55 public String user(List<String> row) {
56 if( (row != null) && row.size()>1) {
63 public String subject() {
64 return String.format("AAF Pending Approval Notification (ENV: %s)",env);
69 public void record(AuthzTrans trans, StringBuilder query, String id, List<String> notified, LastNotified lastN) {
70 for(String n : notified) {
71 // No special key for Pending Requests.
72 lastN.update(query,n,"pending","");
77 * @see org.onap.aaf.auth.batch.reports.bodies.NotifyBody#store(java.util.List)
80 public void store(List<String> row) {
81 // Notify Pending is setup for 1 Notification at a time