X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-batch%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fbatch%2Fapprovalsets%2FPending.java;h=04083d9e715ef758c465dd706776f49b4ddad1d4;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=5d720c2f63bae09b38ffe0d4a89f9e3f27b4d067;hpb=889a9891f6df5bbb26a760cfb106be947e87aa5c;p=aaf%2Fauthz.git diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java index 5d720c2f..04083d9e 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/approvalsets/Pending.java @@ -3,13 +3,15 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * + * Modifications Copyright (C) 2019 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,82 +30,82 @@ import org.onap.aaf.cadi.util.CSV.Writer; import org.onap.aaf.misc.env.util.Chrono; public class Pending { - public static final String REMIND = "remind"; - - int qty; - boolean hasNew; - Date earliest; - - /** - * Use this constructor to indicate when last Notified - * @param last_notified - */ - public Pending(Date last_notified) { - qty = 1; - hasNew = last_notified==null; - earliest = last_notified; - } + public static final String REMIND = "remind"; + + int qty; + boolean hasNew; + Date earliest; + + /** + * Use this constructor to indicate when last Notified + * @param lastNotified + */ + public Pending(Date lastNotified) { + qty = 1; + hasNew = lastNotified==null; + earliest = lastNotified; + } + + /** + * Create from CSV Row + * @param row + * @throws ParseException + */ + public Pending(List row) throws ParseException { + hasNew = Boolean.parseBoolean(row.get(2)); + String d = row.get(3); + if(d==null || d.isEmpty()) { + earliest = null; + } else { + earliest = Chrono.dateOnlyFmt.parse(d); + } + qty = Integer.parseInt(row.get(4)); + } + + /** + * Write CSV Row + * @param approveCW + * @param key + */ + public void row(Writer approveCW, String key) { + approveCW.row(REMIND,key,hasNew,Chrono.dateOnlyStamp(earliest),qty); + } + + public void inc() { + ++qty; + } + + public void inc(Pending value) { + qty += value.qty; + if(earliest == null) { + earliest = value.earliest; + } else if(value.earliest != null && value.earliest.before(earliest)) { + earliest = value.earliest; + } + } - /** - * Create from CSV Row - * @param row - * @throws ParseException - */ - public Pending(List row) throws ParseException { - hasNew = Boolean.parseBoolean(row.get(2)); - String d = row.get(3); - if(d==null || d.isEmpty()) { - earliest = null; - } else { - earliest = Chrono.dateOnlyFmt.parse(d); - } - qty = Integer.parseInt(row.get(4)); - } + public void earliest(Date lastnotified) { + if(lastnotified == null) { + hasNew=true; + } else if (earliest == null || lastnotified.before(earliest)) { + earliest = lastnotified; + } + } - /** - * Write CSV Row - * @param approveCW - * @param key - */ - public void row(Writer approveCW, String key) { - approveCW.row(REMIND,key,hasNew,Chrono.dateOnlyStamp(earliest),qty); - } + public int qty() { + return qty; + } - public void inc() { - ++qty; - } - - public void inc(Pending value) { - qty+=value.qty; - if(earliest==null) { - earliest = value.earliest; - } else if(value.earliest!=null && value.earliest.before(earliest)) { - earliest = value.earliest; - } - } + public Date earliest() { + return earliest; + } - public void earliest(Date lastnotified) { - if(lastnotified==null) { - hasNew=true; - } else if (earliest==null || lastnotified.before(earliest)) { - earliest = lastnotified; - } - } - - public int qty() { - return qty; - } - - public Date earliest() { - return earliest; - } - - public boolean newApprovals() { - return hasNew; - } + public boolean newApprovals() { + return hasNew; + } - public static Pending create() { - return new Pending((Date)null); - } + public static Pending create() { + return new Pending((Date)null); + } } \ No newline at end of file