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.approvalsets;
23 import java.text.ParseException;
24 import java.util.Date;
25 import java.util.List;
27 import org.onap.aaf.cadi.util.CSV.Writer;
28 import org.onap.aaf.misc.env.util.Chrono;
30 public class Pending {
31 public static final String REMIND = "remind";
38 * Use this constructor to indicate when last Notified
39 * @param last_notified
41 public Pending(Date last_notified) {
43 hasNew = last_notified==null;
44 earliest = last_notified;
50 * @throws ParseException
52 public Pending(List<String> row) throws ParseException {
53 hasNew = Boolean.parseBoolean(row.get(2));
54 String d = row.get(3);
55 if(d==null || d.isEmpty()) {
58 earliest = Chrono.dateOnlyFmt.parse(d);
60 qty = Integer.parseInt(row.get(4));
68 public void row(Writer approveCW, String key) {
69 approveCW.row(REMIND,key,hasNew,Chrono.dateOnlyStamp(earliest),qty);
76 public void inc(Pending value) {
79 earliest = value.earliest;
80 } else if(value.earliest!=null && value.earliest.before(earliest)) {
81 earliest = value.earliest;
85 public void earliest(Date lastnotified) {
86 if(lastnotified==null) {
88 } else if (earliest==null || lastnotified.before(earliest)) {
89 earliest = lastnotified;
97 public Date earliest() {
101 public boolean newApprovals() {
105 public static Pending create() {
106 return new Pending((Date)null);