diff options
author | Arundathi Patil <arundpil@in.ibm.com> | 2019-01-03 13:36:49 +0530 |
---|---|---|
committer | IBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com> | 2019-01-03 13:37:00 +0530 |
commit | 15975e0cae27c868ae9d94fdd1d3627dc39cfe36 (patch) | |
tree | 6fc41a99df0e0a061a47ac1c633a7b142b287c83 /auth/auth-batch/src/main/java | |
parent | da120047d0da2b940947312b55da8098724e6a75 (diff) |
Sonar fix: Future.java
Fixed sonar issues/code-smells across this file
Issue-ID: AAF-688
Change-Id: I376add4207dd40655f60cf433e44ba9ed4405ec8
Signed-off-by: Arundathi Patil <arundpil@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.java | 81 |
1 files changed, 41 insertions, 40 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 ac4a1323..d9ee272d 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 @@ -3,6 +3,8 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * + * Modifications Copyright (C) 2018 IBM. * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +52,45 @@ public class Future implements CacheChange.Data, Comparable<Future> { public final FutureDAO.Data fdd; public final String role; // derived private static final CacheChange<Future> cache = new CacheChange<>(); - + + public static Creator<Future> v2_0_17 = new Creator<Future>() { + @Override + public Future create(Row row) { + return new Future(row.getUUID(0),row.getString(1),row.getString(2), + row.getTimestamp(3),row.getTimestamp(4), null); + } + + @Override + public String select() { + return "select id,memo,target,start,expires from authz.future"; + } + }; + + public static Creator<Future> withConstruct = new Creator<Future>() { + @Override + public String select() { + return "select id,memo,target,start,expires,construct from authz.future"; + } + + @Override + public Future create(Row row) { + return new Future(row.getUUID(0),row.getString(1),row.getString(2), + row.getTimestamp(3),row.getTimestamp(4), row.getBytes(5)); + } + + }; + + + public Future(UUID id, String memo, String target, Date start, Date expires, ByteBuffer construct) { + fdd = new FutureDAO.Data(); + fdd.id = id; + fdd.memo = memo; + fdd.target = target; + fdd.start = start; + fdd.expires = expires; + fdd.construct = construct; + role = Approval.roleFromMemo(memo); + } public final UUID id() { return fdd.id; @@ -72,18 +112,6 @@ public class Future implements CacheChange.Data, Comparable<Future> { return fdd.expires; } - - public Future(UUID id, String memo, String target, Date start, Date expires, ByteBuffer construct) { - fdd = new FutureDAO.Data(); - fdd.id = id; - fdd.memo = memo; - fdd.target = target; - fdd.start = start; - fdd.expires = expires; - fdd.construct = construct; - role = Approval.roleFromMemo(memo); - } - public static void load(Trans trans, Session session, Creator<Future> creator) { trans.info().log( "query: " + creator.select() ); ResultSet results; @@ -118,33 +146,6 @@ public class Future implements CacheChange.Data, Comparable<Future> { trans.info().log("Found",count,"Futures"); } } - - public static Creator<Future> v2_0_17 = new Creator<Future>() { - @Override - public Future create(Row row) { - return new Future(row.getUUID(0),row.getString(1),row.getString(2), - row.getTimestamp(3),row.getTimestamp(4), null); - } - - @Override - public String select() { - return "select id,memo,target,start,expires from authz.future"; - } - }; - - public static Creator<Future> withConstruct = new Creator<Future>() { - @Override - public String select() { - return "select id,memo,target,start,expires,construct from authz.future"; - } - - @Override - public Future create(Row row) { - return new Future(row.getUUID(0),row.getString(1),row.getString(2), - row.getTimestamp(3),row.getTimestamp(4), row.getBytes(5)); - } - - }; public Result<Void> delayedDelete(AuthzTrans trans, FutureDAO fd, boolean dryRun, String text) { Result<Void> rv; |