* ===========================================================================
* 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.
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) {
*
* @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<String, Date> lastNotified, MarkDelete md) {
}
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 (");