summaryrefslogtreecommitdiffstats
path: root/auth/auth-batch/src
diff options
context:
space:
mode:
authorJonathan Gathman <jonathan.gathman@att.com>2019-04-11 18:12:01 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-11 18:12:01 +0000
commitd087d3ddd2829ced1d2ffccc5147c377cbcc92cb (patch)
treea89a5aaaf49c4cc2aa2f33f133f2f406bdfe1fec /auth/auth-batch/src
parent133592f4d210a3e509c1c53a736e87ec2f1533ce (diff)
parent489a6290823086a928474bbe4979ccd2dc405187 (diff)
Merge "Future.java - sonar fixes"
Diffstat (limited to 'auth/auth-batch/src')
-rw-r--r--auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java45
1 files changed, 18 insertions, 27 deletions
diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
index 4f87e330..74c3411f 100644
--- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
+++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/helpers/Future.java
@@ -93,18 +93,16 @@ public class Future implements CacheChange.Data, Comparable<Future> {
fdd.expires = expires;
fdd.construct = construct;
String role = null;
- switch(target) {
- case "user_role":
- UserRoleDAO.Data urdd = new UserRoleDAO.Data();
- try {
- urdd.reconstitute(construct);
- fdd.target_key = urdd.user + '|' + urdd.role;
- fdd.target_date=urdd.expires;
- role=urdd.role;
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- break;
+ if ("user_role".equals(target)) {
+ UserRoleDAO.Data urdd = new UserRoleDAO.Data();
+ try {
+ urdd.reconstitute(construct);
+ fdd.target_key = urdd.user + '|' + urdd.role;
+ fdd.target_date = urdd.expires;
+ role = urdd.role;
+ } catch (IOException e) {
+ e.printStackTrace(System.err);
+ }
}
this.role = role;
}
@@ -130,21 +128,14 @@ public class Future implements CacheChange.Data, Comparable<Future> {
}
public static void load(Trans trans, Session session, Creator<Future> creator) {
- load(trans,session,creator, new Visitor<Future>() {
- @Override
- public void visit(Future f) {
- data.put(f.fdd.id,f);
- if (f.role==null) {
- return;
- }
- List<Future> lf = byRole.get(f.role);
- if (lf==null) {
- lf = new ArrayList<>();
- byRole.put(f.role,lf);
- }
- lf.add(f);
- }
- });
+ load(trans,session,creator, f -> {
+ data.put(f.fdd.id,f);
+ if (f.role==null) {
+ return;
+ }
+ List<Future> lf = byRole.computeIfAbsent(f.role, k -> new ArrayList<>());
+ lf.add(f);
+ });
}