X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-batch%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fbatch%2Fhelpers%2FLastNotified.java;h=e6942f09bbc43f7f363d2f1795cca26c99553f7a;hb=66424b306877435b7e71e119a8d1498b4b263719;hp=d05f38c5ee5e436be55639f267925688e03ac556;hpb=1cbfaa9d856d5d5dae37f7b8cf412cc6839f84ee;p=aaf%2Fauthz.git diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java index d05f38c5..e6942f09 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/LastNotified.java @@ -4,7 +4,7 @@ * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. * =========================================================================== - * Modifications Copyright (C) 2018 IBM. + * 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. @@ -47,7 +47,7 @@ import com.datastax.driver.core.Statement; public class LastNotified { private Map 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) { @@ -84,21 +84,17 @@ public class LastNotified { * * @param user * @param target - * @param target_key + * @param targetkey * @return */ - public Date lastNotified(String user, String target, String target_key) { - String key = user + '|' + target + '|' + target_key; + public Date lastNotified(String user, String target, String targetkey) { + String key = user + '|' + target + '|' + (targetkey==null?"":targetkey); return lastNotified(key); } public Date lastNotified(String key) { - Date rv = lastNotified.get(key); - if(rv==null) { - rv = never; - lastNotified.put(key, rv); - } - return rv; + Date d = lastNotified.get(key); + return d==null?NEVER:d; } private Date add(ResultSet result, Map lastNotified, MarkDelete md) { @@ -124,8 +120,8 @@ public class LastNotified { } private interface MarkDelete { - public boolean process(String fullKey, Date last); - }; + boolean process(String fullKey, Date last); + } private void startQuery(StringBuilder query) { query.append(SELECT + " WHERE user in (");