summaryrefslogtreecommitdiffstats
path: root/auth/auth-batch/src/main/java
diff options
context:
space:
mode:
authorDriptaroop Das <driptaroop.das@in.ibm.com>2019-04-09 01:01:39 +0530
committerDriptaroop Das <driptaroop.das@in.ibm.com>2019-04-09 01:01:54 +0530
commit489a6290823086a928474bbe4979ccd2dc405187 (patch)
tree0024402f1c0c99b53aece023a5ef7382f72cb00c /auth/auth-batch/src/main/java
parentdcd0cb51ce490f0d790713a2c1e9dc5fda36e70d (diff)
Future.java - sonar fixes
Future.java - sonar fixes Issue-ID: AAF-807 Change-Id: I1d94cf7db94f3e5a15fe61be72d23e0ea6084bdb Signed-off-by: Driptaroop Das <driptaroop.das@in.ibm.com>
Diffstat (limited to 'auth/auth-batch/src/main/java')
-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);
+ });
}