2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
7 * Modifications Copyright (C) 2019 IBM.
8 * ===========================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END====================================================
23 package org.onap.aaf.auth.batch.approvalsets;
25 import java.text.ParseException;
26 import java.util.Date;
27 import java.util.List;
29 import org.onap.aaf.cadi.util.CSV.Writer;
30 import org.onap.aaf.misc.env.util.Chrono;
32 public class Pending {
33 public static final String REMIND = "remind";
40 * Use this constructor to indicate when last Notified
43 public Pending(Date lastNotified) {
45 hasNew = lastNotified==null;
46 earliest = lastNotified;
52 * @throws ParseException
54 public Pending(List<String> row) throws ParseException {
55 hasNew = Boolean.parseBoolean(row.get(2));
56 String d = row.get(3);
57 if(d==null || d.isEmpty()) {
60 earliest = Chrono.dateOnlyFmt.parse(d);
62 qty = Integer.parseInt(row.get(4));
70 public void row(Writer approveCW, String key) {
71 approveCW.row(REMIND,key,hasNew,Chrono.dateOnlyStamp(earliest),qty);
78 public void inc(Pending value) {
81 earliest = value.earliest;
82 } else if(value.earliest!=null && value.earliest.before(earliest)) {
83 earliest = value.earliest;
87 public void earliest(Date lastnotified) {
88 if(lastnotified==null) {
90 } else if (earliest==null || lastnotified.before(earliest)) {
91 earliest = lastnotified;
99 public Date earliest() {
103 public boolean newApprovals() {
107 public static Pending create() {
108 return new Pending((Date)null);