Improve Upload Batch
[aaf/authz.git] / auth / auth-batch / src / main / java / org / onap / aaf / auth / batch / helpers / LastNotified.java
index 0120ba4..e6942f0 100644 (file)
@@ -47,7 +47,7 @@ import com.datastax.driver.core.Statement;
 public class LastNotified {
        private Map<String,Date> lastNotified = new TreeMap<>();
        private Session session;
-       private static final Date never = new Date(0);
+       public static final Date NEVER = new Date(0);
        private static final String SELECT = "SELECT user,target,key,last FROM authz.notified";
        
        public LastNotified(Session session) {
@@ -88,12 +88,13 @@ public class LastNotified {
         * @return
         */
        public Date lastNotified(String user, String target, String targetkey) {
-               String key = user + '|' + target + '|' + targetkey;
+               String key = user + '|' + target + '|' + (targetkey==null?"":targetkey);
                return lastNotified(key);
        }
        
        public Date lastNotified(String key) {
-               return lastNotified.computeIfAbsent(key, k -> never);
+               Date d = lastNotified.get(key);
+               return d==null?NEVER:d;
        }
        
        private Date add(ResultSet result, Map<String, Date> lastNotified, MarkDelete md) {