summaryrefslogtreecommitdiffstats
path: root/auth/auth-cass/src/main/java/org
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-09-07 13:43:23 -0500
committerInstrumental <jonathan.gathman@att.com>2018-09-07 13:43:26 -0500
commit7e966914050e66219689001ff4ab601a49eef0ac (patch)
treeb1bf643f2d191207adc7d9f6b41ac20f56083e76 /auth/auth-cass/src/main/java/org
parentead32f193586e39b59bb366bddf70e665173a52d (diff)
Mass whitespace changes (Style Warnings)
Issue-ID: AAF-473 Change-Id: Ia1b3825a527bd56299949b5962bb9354dffbeef8 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-cass/src/main/java/org')
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java60
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java32
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java34
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java54
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java72
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java32
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java2
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java12
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java18
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java70
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java14
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java54
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java10
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java16
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java8
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java4
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java120
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java28
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java122
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java20
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java32
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java6
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java2
-rw-r--r--auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java18
35 files changed, 484 insertions, 484 deletions
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
index f24c7c9f..d0e4eaab 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/AbsCassDAO.java
@@ -128,18 +128,18 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
psinfos.add(this);
cql = theCQL.trim().toUpperCase();
- if(cql.startsWith("INSERT")) {
+ if (cql.startsWith("INSERT")) {
crud = CRUD.create;
- } else if(cql.startsWith("UPDATE")) {
+ } else if (cql.startsWith("UPDATE")) {
crud = CRUD.update;
- } else if(cql.startsWith("DELETE")) {
+ } else if (cql.startsWith("DELETE")) {
crud = CRUD.delete;
} else {
crud = CRUD.read;
}
int idx = 0, count=0;
- while((idx=cql.indexOf('?',idx))>=0) {
+ while ((idx=cql.indexOf('?',idx))>=0) {
++idx;
++count;
}
@@ -155,7 +155,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
You should prepare only once, and cache the PreparedStatement in your application (it is thread-safe).
If you call prepare multiple times with the same query string, the driver will log a warning.
*/
- if(ps==null) {
+ if (ps==null) {
TimeTaken tt = trans.start("Preparing PSInfo " + crud.toString().toUpperCase() + " on " + name,Env.SUB);
try {
ps = getSession(trans).prepare(cql);
@@ -287,7 +287,7 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
rs = getSession(trans).execute(key==null?ps(trans):ps(trans).bind(key));
/// TEST CODE for Exception
// boolean force = true;
-// if(force) {
+// if (force) {
// Map<InetSocketAddress, Throwable> misa = new HashMap<>();
// //misa.put(new InetSocketAddress(444),new Exception("no host was tried"));
// misa.put(new InetSocketAddress(444),new Exception("Connection has been closed"));
@@ -334,19 +334,19 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
@SuppressWarnings("unchecked")
protected final Result<List<DATA>> extract(Loader<DATA> loader, ResultSet rs, List<DATA> indata, Accept<DATA> accept) {
List<Row> rows = rs.all();
- if(rows.isEmpty()) {
+ if (rows.isEmpty()) {
return Result.ok((List<DATA>)EMPTY); // Result sets now .emptyList(true);
} else {
DATA d;
List<DATA> data = indata==null?new ArrayList<>(rows.size()):indata;
- for(Row row : rows) {
+ for (Row row : rows) {
try {
d = loader.load(dataClass.newInstance(),row);
- if(accept.ok(d)) {
+ if (accept.ok(d)) {
data.add(d);
}
- } catch(Exception e) {
+ } catch (Exception e) {
return Result.err(e);
}
}
@@ -372,8 +372,8 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
public static final void primePSIs(TransStore trans) throws APIException, IOException {
- for(AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
- if(psi.ps==null) {
+ for (AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
+ if (psi.ps==null) {
psi.ps(trans);
}
}
@@ -382,28 +382,28 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
public final Session getSession(TransStore trans) throws APIException, IOException {
// SessionFilter unused since 2015
// Try to use Trans' session, if exists
-// if(sessionSlot!=null) { // try to get from Trans
+// if (sessionSlot!=null) { // try to get from Trans
// Session sess = trans.get(sessionSlot, null);
-// if(sess!=null) {
+// if (sess!=null) {
// return sess;
// }
// }
// If there's an owning DAO, use it's session
- if(owningDAO!=null) {
+ if (owningDAO!=null) {
return owningDAO.getSession(trans);
}
// OK, nothing else works... get our own.
- if(session==null || resetTrigger) {
+ if (session==null || resetTrigger) {
Cluster tempCluster = null;
Session tempSession = null;
try {
synchronized(LOCK) {
boolean reset = false;
- for(ResetRequest r : resetDeque) {
- if(r.session == session) {
- if(r.timestamp>nextAvailableReset) {
+ for (ResetRequest r : resetDeque) {
+ if (r.session == session) {
+ if (r.timestamp>nextAvailableReset) {
reset=true;
nextAvailableReset = System.currentTimeMillis() + 60000;
tempCluster = cluster;
@@ -415,22 +415,22 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
}
- if(reset || session == null) {
+ if (reset || session == null) {
TimeTaken tt = trans.start(NEW_CASSANDRA_SESSION, Env.SUB);
try {
// Note: Maitrayee recommended not closing the cluster, just
// overwrite it. Jonathan 9/30/2016 assuming same for Session
// This was a bad idea. Ran out of File Handles as I suspected, Jonathan
- if(reset) {
- for(AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
+ if (reset) {
+ for (AbsCassDAO<? extends TransStore, ?>.PSInfo psi : psinfos) {
psi.reset();
}
}
- if(reset || cluster==null) {
+ if (reset || cluster==null) {
cluster = CassAccess.cluster(trans, keyspace);
trans.warn().log(NEW_CASSANDRA_CLUSTER_OBJECT_CREATED);
}
- if(reset || session==null) {
+ if (reset || session==null) {
session = cluster.connect(keyspace);
trans.warn().log(NEW_CASSANDRA_SESSION_CREATED);
}
@@ -445,10 +445,10 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
try {
resetDeque.clear();
// Not clearing Session/Cluster appears to kill off FileHandles
- if(tempSession!=null && !tempSession.isClosed()) {
+ if (tempSession!=null && !tempSession.isClosed()) {
tempSession.close();
}
- if(tempCluster!=null && !tempCluster.isClosed()) {
+ if (tempCluster!=null && !tempCluster.isClosed()) {
tempCluster.close();
}
} finally {
@@ -460,11 +460,11 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
public final boolean reportPerhapsReset(TransStore trans, Exception e) {
- if(owningDAO!=null) {
+ if (owningDAO!=null) {
return owningDAO.reportPerhapsReset(trans, e);
} else {
boolean rv = false;
- if(CassAccess.isResetException(e)) {
+ if (CassAccess.isResetException(e)) {
trans.warn().printf("Session Reset called for %s by %s ",session==null?"":session,e==null?"Mgmt Command":e.getClass().getName());
resetDeque.addFirst(new ResetRequest(session));
rv = resetTrigger = true;
@@ -475,8 +475,8 @@ public abstract class AbsCassDAO<TRANS extends TransStore,DATA> {
}
public void close(TransStore trans) {
- if(owningDAO==null) {
- if(session!=null) {
+ if (owningDAO==null) {
+ if (session!=null) {
TimeTaken tt = trans.start("Cassandra Session Close", Env.SUB);
try {
session.close();
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
index 3f4bbb20..1bda405c 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java
@@ -56,7 +56,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
for (int i = 0; i < key.length(); i++) {
h = 31*h + key.charAt(i);
}
- if(h<0)h*=-1;
+ if (h<0)h*=-1;
return h%segSize;
}
@@ -67,7 +67,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
this.expireIn = expireIn;
cache = new Object[segSize];
// Create a new Map for each Segment, and store locally
- for(int i=0;i<segSize;++i) {
+ for (int i=0;i<segSize;++i) {
cache[i]=obtain(name+i);
}
}
@@ -83,17 +83,17 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
int cacheIdx = cacheIdx(key);
@SuppressWarnings("unchecked")
Map<String,Dated> map = ((Map<String,Dated>)cache[cacheIdx]);
-// if(map.remove(key)!=null) // Not seeming to remove all the time
- if(map!=null)map.clear();
+// if (map.remove(key)!=null) // Not seeming to remove all the time
+ if (map!=null)map.clear();
// System.err.println("Remove " + name + " " + key);
return cacheIdx;
}
public Result<Void> invalidate(int segment) {
- if(segment<0 || segment>=cache.length) return Result.err(Status.ERR_BadData,"Cache Segment %s is out of range",Integer.toString(segment));
+ if (segment<0 || segment>=cache.length) return Result.err(Status.ERR_BadData,"Cache Segment %s is out of range",Integer.toString(segment));
@SuppressWarnings("unchecked")
Map<String,Dated> map = ((Map<String,Dated>)cache[segment]);
- if(map!=null) {
+ if (map!=null) {
map.clear();
}
return Result.ok();
@@ -118,14 +118,14 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
Date dbStamp = info.get(trans, name,cacheIdx);
// Check for cache Entry and whether it is still good (a good Cache Entry is same or after DBEntry, so we use "before" syntax)
- if(cached!=null && dbStamp.before(cached.timestamp)) {
+ if (cached!=null && dbStamp.before(cached.timestamp)) {
ld = (List<DATA>)cached.data;
rld = Result.ok(ld);
} else {
rld = getter.get();
- if(rld.isOK()) { // only store valid lists
+ if (rld.isOK()) { // only store valid lists
map.put(key, new Dated(rld.value,expireIn)); // successful item found gets put in cache
-// } else if(rld.status == Result.ERR_Backend){
+// } else if (rld.status == Result.ERR_Backend){
// map.remove(key);
}
}
@@ -138,8 +138,8 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
* @param dao
*/
public static void startCleansing(AuthzEnv env, CachedDAO<?,?,?> ... dao) {
- for(CachedDAO<?,?,?> d : dao) {
- for(int i=0;i<d.segSize;++i) {
+ for (CachedDAO<?,?,?> d : dao) {
+ for (int i=0;i<d.segSize;++i) {
startCleansing(env, d.table()+i);
}
}
@@ -147,7 +147,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
public static<T extends Trans> void startRefresh(AuthzEnv env, CIDAO<AuthzTrans> cidao) {
- if(infoTimer==null) {
+ if (infoTimer==null) {
infoTimer = new Timer("CachedDAO Info Refresh Timer");
int minRefresh = 10*1000*60; // 10 mins Integer.parseInt(env.getProperty(CACHE_MIN_REFRESH_INTERVAL,"2000")); // 2 second minimum refresh
infoTimer.schedule(new Refresh(env,cidao, minRefresh), 1000, minRefresh); // note: Refresh from DB immediately
@@ -156,7 +156,7 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
public static void stopTimer() {
Cache.stopTimer();
- if(infoTimer!=null) {
+ if (infoTimer!=null) {
infoTimer.cancel();
infoTimer = null;
}
@@ -182,14 +182,14 @@ public class Cached<TRANS extends Trans, DATA extends Cacheable> extends Cache<T
long now = System.currentTimeMillis();
long interval = now-lastRun;
- if(interval < minRefresh || interval < Math.min(env.transRate(),maxRefresh)) return;
+ if (interval < minRefresh || interval < Math.min(env.transRate(),maxRefresh)) return;
lastRun = now;
AuthzTrans trans = env.newTransNoAvg();
Result<Void> rv = cidao.check(trans);
- if(rv.status!=Result.OK) {
+ if (rv.status!=Result.OK) {
env.error().log("Error in CacheInfo Refresh",rv.details);
}
- if(env.debug().isLoggable()) {
+ if (env.debug().isLoggable()) {
StringBuilder sb = new StringBuilder("Cache Info Refresh: ");
trans.auditTrail(0, sb, Env.REMOTE);
env.debug().log(sb);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
index 9375502c..cf410d0b 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CachedDAO.java
@@ -52,7 +52,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
this.dao = dao;
//read_str = "Cached READ for " + dao.table();
// dirty_str = "Cache DIRTY on " + dao.table();
- if(dao instanceof CassDAOImpl) {
+ if (dao instanceof CassDAOImpl) {
((CassDAOImpl<?,?>)dao).cache = this;
}
}
@@ -80,14 +80,14 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public static String keyFromObjs(Object ... objs) {
String key;
- if(objs.length==1 && objs[0] instanceof String) {
+ if (objs.length==1 && objs[0] instanceof String) {
key = (String)objs[0];
} else {
StringBuilder sb = new StringBuilder();
boolean first = true;
- for(Object o : objs) {
- if(o!=null) {
- if(first) {
+ for (Object o : objs) {
+ if (o!=null) {
+ if (first) {
first =false;
} else {
sb.append('|');
@@ -102,7 +102,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public Result<DATA> create(TRANS trans, DATA data) {
Result<DATA> d = dao.create(trans,data);
- if(d.status==Status.OK) {
+ if (d.status==Status.OK) {
add(d.value);
} else {
trans.error().log(d.errorString());
@@ -134,7 +134,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
@Override
public final Result<List<DATA>> get() {
return call();
-// if(result.isOKhasData()) { // Note, given above logic, could exist, but stale
+// if (result.isOKhasData()) { // Note, given above logic, could exist, but stale
// return result.value;
// } else {
// return null;
@@ -146,11 +146,11 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public Result<List<DATA>> read(final TRANS trans, final Object ... objs) {
DAOGetter getter = new DAOGetter(trans,dao,objs);
return get(trans, keyFromObjs(objs),getter);
-// if(ld!=null) {
+// if (ld!=null) {
// return Result.ok(ld);//.emptyList(ld.isEmpty());
// }
// // Result Result if exists
-// if(getter.result==null) {
+// if (getter.result==null) {
// return Result.err(Status.ERR_NotFound, "No Cache or Lookup found on [%s]",dao.table());
// }
// return getter.result;
@@ -160,11 +160,11 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
public Result<List<DATA>> read(final String key, final TRANS trans, final Object[] objs) {
DAOGetter getter = new DAOGetter(trans,dao,objs);
return get(trans, key, getter);
-// if(ld!=null) {
+// if (ld!=null) {
// return Result.ok(ld);//.emptyList(ld.isEmpty());
// }
// // Result Result if exists
-// if(getter.result==null) {
+// if (getter.result==null) {
// return Result.err(Status.ERR_NotFound, "No Cache or Lookup found on [%s]",dao.table());
// }
// return getter.result;
@@ -176,7 +176,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
}
public Result<Void> update(TRANS trans, DATA data) {
Result<Void> d = dao.update(trans, data);
- if(d.status==Status.OK) {
+ if (d.status==Status.OK) {
add(data);
} else {
trans.error().log(d.errorString());
@@ -185,14 +185,14 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
}
public Result<Void> delete(TRANS trans, DATA data, boolean reread) {
- if(reread) { // If reread, get from Cache, if possible, not DB exclusively
+ if (reread) { // If reread, get from Cache, if possible, not DB exclusively
Result<List<DATA>> rd = read(trans,data);
- if(rd.notOK()) {
+ if (rd.notOK()) {
return Result.err(rd);
// } else {
// trans.error().log(rd.errorString());
}
- if(rd.isEmpty()) {
+ if (rd.isEmpty()) {
data.invalidate(this);
return Result.err(Status.ERR_NotFound,"Not Found");
}
@@ -205,7 +205,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
@Override
public void close(TRANS trans) {
- if(dao!=null) {
+ if (dao!=null) {
dao.close(trans);
}
}
@@ -221,7 +221,7 @@ public class CachedDAO<TRANS extends Trans,D extends DAO<TRANS,DATA>,DATA extend
}
public void invalidate(TRANS trans, DATA data) {
- if(info.touch(trans, dao.table(),data.invalidate(this)).notOK()) {
+ if (info.touch(trans, dao.table(),data.invalidate(this)).notOK()) {
trans.error().log("Cannot touch CacheInfo for Role");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
index 9b168a83..b8062fcd 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassAccess.java
@@ -64,9 +64,9 @@ public class CassAccess {
// @SuppressWarnings("deprecation")
public static synchronized Cluster cluster(Env env, String prefix) throws APIException, IOException {
- if(cb == null) {
+ if (cb == null) {
String pre;
- if(prefix==null) {
+ if (prefix==null) {
pre="";
} else {
env.info().log("Cassandra Connection for ",prefix);
@@ -74,19 +74,19 @@ public class CassAccess {
}
cb = Cluster.builder();
String str = env.getProperty(pre+CASSANDRA_CLUSTERS_PORT,env.getProperty(CASSANDRA_CLUSTERS_PORT,"9042"));
- if(str!=null) {
+ if (str!=null) {
env.init().log("Cass Port = ",str );
cb.withPort(Integer.parseInt(str));
}
str = env.getProperty(pre+CASSANDRA_CLUSTERS_USER_NAME,env.getProperty(CASSANDRA_CLUSTERS_USER_NAME,null));
- if(str!=null) {
+ if (str!=null) {
env.init().log("Cass User = ",str );
String epass = env.getProperty(pre + CASSANDRA_CLUSTERS_PASSWORD,env.getProperty(CASSANDRA_CLUSTERS_PASSWORD,null));
- if(epass==null) {
+ if (epass==null) {
throw new APIException("No Password configured for " + str);
}
//TODO Figure out way to ensure Decryptor setting in AuthzEnv
- if(env instanceof AuthzEnv) {
+ if (env instanceof AuthzEnv) {
cb.withCredentials(str,((AuthzEnv)env).decrypt(epass,true));
} else {
cb.withCredentials(str, env.decryptor().decrypt(epass));
@@ -94,9 +94,9 @@ public class CassAccess {
}
str = env.getProperty(pre+CASSANDRA_RESET_EXCEPTIONS,env.getProperty(CASSANDRA_RESET_EXCEPTIONS,null));
- if(str!=null) {
+ if (str!=null) {
env.init().log("Cass ResetExceptions = ",str );
- for(String ex : Split.split(',', str)) {
+ for (String ex : Split.split(',', str)) {
resetExceptions.add(new Resettable(env,ex));
}
}
@@ -105,7 +105,7 @@ public class CassAccess {
Double lat = str!=null?Double.parseDouble(str):null;
str = env.getProperty(Config.CADI_LONGITUDE);
Double lon = str!=null?Double.parseDouble(str):null;
- if(lat == null || lon == null) {
+ if (lat == null || lon == null) {
throw new APIException(Config.CADI_LATITUDE + " and/or " + Config.CADI_LONGITUDE + " are not set");
}
@@ -118,23 +118,23 @@ public class CassAccess {
String bestDC = null;
int numInBestDC = 1;
double mlat, mlon,temp,distance = Double.MAX_VALUE;
- for(int i=0;i<machs.length;++i) {
+ for (int i=0;i<machs.length;++i) {
String[] minfo = Split.split(':',machs[i]);
- if(minfo.length>0) {
+ if (minfo.length>0) {
cpoints[i]=minfo[0];
}
- if(minfo.length>3) {
- if(minfo[1].equals(bestDC)) {
+ if (minfo.length>3) {
+ if (minfo[1].equals(bestDC)) {
++numInBestDC;
} else {
// Calc closest DC with Great Circle
mlat = Double.parseDouble(minfo[2]);
mlon = Double.parseDouble(minfo[3]);
// Note: GreatCircle Distance is always >= 0.0 (not negative)
- if((temp=GreatCircle.calc(lat, lon, mlat, mlon)) < distance) {
+ if ((temp=GreatCircle.calc(lat, lon, mlat, mlon)) < distance) {
distance = temp;
- if(bestDC==null || !bestDC.equals(minfo[1])) {
+ if (bestDC==null || !bestDC.equals(minfo[1])) {
bestDC = minfo[1];
numInBestDC = 1;
}
@@ -145,7 +145,7 @@ public class CassAccess {
cb.addContactPoints(cpoints);
- if(bestDC!=null) {
+ if (bestDC!=null) {
// 8/26/2016 Management has determined that Accuracy is preferred over speed in bad situations
// Local DC Aware Load Balancing appears to have the highest normal performance, with the best
// Degraded Accuracy
@@ -171,18 +171,18 @@ public class CassAccess {
@SuppressWarnings("unchecked")
public Resettable(Env env, String propData) throws APIException {
- if(propData!=null && propData.length()>1) {
+ if (propData!=null && propData.length()>1) {
String[] split = Split.split(':', propData);
- if(split.length>0) {
+ if (split.length>0) {
try {
cls = (Class<? extends Exception>)Class.forName(split[0]);
} catch (ClassNotFoundException e) {
throw new APIException("Declared Cassandra Reset Exception, " + propData + ", cannot be ClassLoaded");
}
}
- if(split.length>1) {
+ if (split.length>1) {
messages=new ArrayList<>();
- for(int i=1;i<split.length;++i) {
+ for (int i=1;i<split.length;++i) {
String str = split[i];
int start = str.startsWith("\"")?1:0;
int end = str.length()-(str.endsWith("\"")?1:0);
@@ -195,11 +195,11 @@ public class CassAccess {
}
public boolean matches(Exception ex) {
- if(ex.getClass().equals(cls)) {
- if(messages!=null) {
+ if (ex.getClass().equals(cls)) {
+ if (messages!=null) {
String msg = ex.getMessage();
- for(String m : messages) {
- if(msg.contains(m)) {
+ for (String m : messages) {
+ if (msg.contains(m)) {
return true;
}
}
@@ -210,11 +210,11 @@ public class CassAccess {
}
public static final boolean isResetException(Exception e) {
- if(e==null) {
+ if (e==null) {
return true;
}
- for(Resettable re : resetExceptions) {
- if(re.matches(e)) {
+ for (Resettable re : resetExceptions) {
+ if (re.matches(e)) {
return true;
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
index fae8f693..58c4386b 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/CassDAOImpl.java
@@ -120,25 +120,25 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
StringBuilder sbwc = new StringBuilder();
StringBuilder sbup = new StringBuilder();
- if(keylimit>0) {
- for(int i=0;i<end;++i) {
- if(i>0) {
+ if (keylimit>0) {
+ for (int i=0;i<end;++i) {
+ if (i>0) {
sbfc.append(',');
sbq.append(',');
- if(i<keylimit) {
+ if (i<keylimit) {
sbwc.append(" AND ");
}
}
sbfc.append(fields[i].getName());
sbq.append('?');
- if(i>=keylimit) {
- if(i>keylimit) {
+ if (i>=keylimit) {
+ if (i>keylimit) {
sbup.append(',');
}
sbup.append(fields[i].getName());
sbup.append("=?");
}
- if(i<keylimit) {
+ if (i<keylimit) {
sbwc.append(fields[i].getName());
sbwc.append("=?");
}
@@ -149,7 +149,7 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
readPS = new PSInfo(trans, "SELECT " + sbfc + " FROM " + table + " WHERE " + sbwc + ';',loader,readConsistency);
// Note: UPDATES can't compile if there are no fields besides keys... Use "Insert"
- if(sbup.length()==0) {
+ if (sbup.length()==0) {
updatePS = createPS; // the same as an insert
} else {
updatePS = new PSInfo(trans, "UPDATE " + table + " SET " + sbup + " WHERE " + sbwc + ';',loader,writeConsistency);
@@ -184,17 +184,17 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
* execute element.
*/
public Result<DATA> create(TRANS trans, DATA data) {
- if(createPS==null) {
+ if (createPS==null) {
return Result.err(Result.ERR_NotImplemented,"Create is disabled for %s",getClass().getSimpleName());
}
- if(async) /*ResultSetFuture */ {
+ if (async) /*ResultSetFuture */ {
Result<ResultSetFuture> rs = createPS.execAsync(trans, C_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
} else {
Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
}
@@ -206,26 +206,26 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
* Read the Unique Row associated with Full Keys
*/
public Result<List<DATA>> read(TRANS trans, DATA data) {
- if(readPS==null) {
+ if (readPS==null) {
return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
}
return readPS.read(trans, R_TEXT, data);
}
public Result<List<DATA>> read(TRANS trans, Object ... key) {
- if(readPS==null) {
+ if (readPS==null) {
return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
}
return readPS.read(trans, R_TEXT, key);
}
public Result<DATA> readPrimKey(TRANS trans, Object ... key) {
- if(readPS==null) {
+ if (readPS==null) {
return Result.err(Result.ERR_NotImplemented,"Read is disabled for %s",getClass().getSimpleName());
}
Result<List<DATA>> rld = readPS.read(trans, R_TEXT, key);
- if(rld.isOK()) {
- if(rld.isEmpty()) {
+ if (rld.isOK()) {
+ if (rld.isEmpty()) {
return Result.err(Result.ERR_NotFound,rld.details);
} else {
return Result.ok(rld.value.get(0));
@@ -240,17 +240,17 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
}
public Result<Void> update(TRANS trans, DATA data, boolean async) {
- if(updatePS==null) {
+ if (updatePS==null) {
return Result.err(Result.ERR_NotImplemented,"Update is disabled for %s",getClass().getSimpleName());
}
- if(async)/* ResultSet rs =*/ {
+ if (async)/* ResultSet rs =*/ {
Result<ResultSetFuture> rs = updatePS.execAsync(trans, U_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
} else {
Result<ResultSet> rs = updatePS.exec(trans, U_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
}
@@ -261,41 +261,41 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
// This method Sig for Cached...
public Result<Void> delete(TRANS trans, DATA data, boolean reread) {
- if(deletePS==null) {
+ if (deletePS==null) {
return Result.err(Result.ERR_NotImplemented,"Delete is disabled for %s",getClass().getSimpleName());
}
// Since Deleting will be stored off, for possible re-constitution, need the whole thing
- if(reread) {
+ if (reread) {
Result<List<DATA>> rd = read(trans,data);
- if(rd.notOK()) {
+ if (rd.notOK()) {
return Result.err(rd);
}
- if(rd.isEmpty()) {
+ if (rd.isEmpty()) {
return Result.err(Status.ERR_NotFound,"Not Found");
}
- for(DATA d : rd.value) {
- if(async) {
+ for (DATA d : rd.value) {
+ if (async) {
Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, d);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
} else {
Result<ResultSet> rs = deletePS.exec(trans, D_TEXT, d);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
}
wasModified(trans, CRUD.delete, d);
}
} else {
- if(async)/* ResultSet rs =*/ {
+ if (async)/* ResultSet rs =*/ {
Result<ResultSetFuture> rs = deletePS.execAsync(trans, D_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
} else {
Result<ResultSet> rs = deletePS.exec(trans, D_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
}
@@ -317,9 +317,9 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
public static final String CASS_WRITE_CONSISTENCY="cassandra.writeConsistency";
protected static ConsistencyLevel readConsistency(AuthzTrans trans, String table) {
String prop = trans.getProperty(CASS_READ_CONSISTENCY+'.'+table);
- if(prop==null) {
+ if (prop==null) {
prop = trans.getProperty(CASS_READ_CONSISTENCY);
- if(prop==null) {
+ if (prop==null) {
return ConsistencyLevel.ONE; // this is Cassandra Default
}
}
@@ -328,9 +328,9 @@ public class CassDAOImpl<TRANS extends TransStore,DATA> extends AbsCassDAO<TRANS
protected static ConsistencyLevel writeConsistency(AuthzTrans trans, String table) {
String prop = trans.getProperty(CASS_WRITE_CONSISTENCY+'.'+table);
- if(prop==null) {
+ if (prop==null) {
prop = trans.getProperty(CASS_WRITE_CONSISTENCY);
- if(prop==null) {
+ if (prop==null) {
return ConsistencyLevel.ONE; // this is Cassandra Default\
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
index cdfd0697..4a078f90 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Loader.java
@@ -60,14 +60,14 @@ public abstract class Loader<DATA> {
rv = new Object[size];
body(data,0,rv);
int body = size-keylimit();
- if(body>0) {
+ if (body>0) {
key(data,body,rv);
}
break;
default:
rv = new Object[size];
key(data,0,rv);
- if(size>keylimit()) {
+ if (size>keylimit()) {
body(data,keylimit(),rv);
}
break;
@@ -76,7 +76,7 @@ public abstract class Loader<DATA> {
}
public static void writeString(DataOutputStream os, String s) throws IOException {
- if(s==null) {
+ if (s==null) {
os.writeInt(-1);
} else {
switch(s.length()) {
@@ -108,7 +108,7 @@ public abstract class Loader<DATA> {
case 0: return "";
default:
// Cover case where there is a large string, without always allocating a large buffer.
- if(l>buff.length) {
+ if (l>buff.length) {
buff = new byte[l];
}
is.read(buff,0,l);
@@ -127,11 +127,11 @@ public abstract class Loader<DATA> {
* @throws IOException
*/
public static void writeStringSet(DataOutputStream os, Collection<String> set) throws IOException {
- if(set==null) {
+ if (set==null) {
os.writeInt(-1);
} else {
os.writeInt(set.size());
- for(String s : set) {
+ for (String s : set) {
writeString(os, s);
}
}
@@ -140,11 +140,11 @@ public abstract class Loader<DATA> {
public static Set<String> readStringSet(DataInputStream is, byte[] buff) throws IOException {
int l = is.readInt();
- if(l<0) {
+ if (l<0) {
return null;
}
Set<String> set = new HashSet<>(l);
- for(int i=0;i<l;++i) {
+ for (int i=0;i<l;++i) {
set.add(readString(is,buff));
}
return set;
@@ -152,11 +152,11 @@ public abstract class Loader<DATA> {
public static List<String> readStringList(DataInputStream is, byte[] buff) throws IOException {
int l = is.readInt();
- if(l<0) {
+ if (l<0) {
return null;
}
List<String> list = new ArrayList<>(l);
- for(int i=0;i<l;++i) {
+ for (int i=0;i<l;++i) {
list.add(Loader.readString(is,buff));
}
return list;
@@ -169,12 +169,12 @@ public abstract class Loader<DATA> {
* @throws IOException
*/
public static void writeStringMap(DataOutputStream os, Map<String,String> map) throws IOException {
- if(map==null) {
+ if (map==null) {
os.writeInt(-1);
} else {
Set<Entry<String, String>> es = map.entrySet();
os.writeInt(es.size());
- for(Entry<String,String> e : es) {
+ for (Entry<String,String> e : es) {
writeString(os, e.getKey());
writeString(os, e.getValue());
}
@@ -184,11 +184,11 @@ public abstract class Loader<DATA> {
public static Map<String,String> readStringMap(DataInputStream is, byte[] buff) throws IOException {
int l = is.readInt();
- if(l<0) {
+ if (l<0) {
return null;
}
Map<String,String> map = new HashMap<>(l);
- for(int i=0;i<l;++i) {
+ for (int i=0;i<l;++i) {
String key = readString(is,buff);
map.put(key,readString(is,buff));
}
@@ -200,11 +200,11 @@ public abstract class Loader<DATA> {
}
public static int readHeader(DataInputStream is, final int magic, final int version) throws IOException {
- if(is.readInt()!=magic) {
+ if (is.readInt()!=magic) {
throw new IOException("Corrupted Data Stream");
}
int v = is.readInt();
- if(version<0 || v>version) {
+ if (version<0 || v>version) {
throw new IOException("Unsupported Data Version: " + v);
}
return v;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
index eb5885f0..106999d3 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedCredDAO.java
@@ -57,7 +57,7 @@ public class CachedCredDAO extends CachedDAO<AuthzTrans, CredDAO, CredDAO.Data>
};
Result<List<CredDAO.Data>> lurd = get(trans, id, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserNotFound,"No User Cred found");
}
return lurd;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
index a18e6a67..13180ab1 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedPermDAO.java
@@ -46,13 +46,13 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
};
Result<List<Data>> lurd = get(trans, ns, getter);
- if(lurd.isOKhasData()) {
+ if (lurd.isOKhasData()) {
return lurd;
} else {
}
-// if(getter.result==null) {
-// if(lurd==null) {
+// if (getter.result==null) {
+// if (lurd==null) {
return Result.err(Status.ERR_PermissionNotFound,"No Permission found - " + lurd.details);
// } else {
// return Result.ok(lurd);
@@ -81,7 +81,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
// Note: Can reuse index1 here, because there is no name collision versus response
Result<List<Data>> lurd = get(trans, ns+'|'+type, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_PermissionNotFound,"No Permission found");
}
return lurd;
@@ -106,7 +106,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
public Result<Void> addRole(AuthzTrans trans, PermDAO.Data perm, RoleDAO.Data role) {
Result<Void> rv = dao().addRole(trans,perm,role.encode());
- if(trans.debug().isLoggable())
+ if (trans.debug().isLoggable())
trans.debug().log("Adding",role.encode(),"to", perm, "with CachedPermDAO.addRole");
invalidate(trans,perm);
return rv;
@@ -114,7 +114,7 @@ public class CachedPermDAO extends CachedDAO<AuthzTrans,PermDAO, PermDAO.Data> {
public Result<Void> delRole(AuthzTrans trans, Data perm, RoleDAO.Data role) {
Result<Void> rv = dao().delRole(trans,perm,role.encode());
- if(trans.debug().isLoggable())
+ if (trans.debug().isLoggable())
trans.debug().log("Removing",role.encode(),"from", perm, "with CachedPermDAO.delRole");
invalidate(trans,perm);
return rv;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
index 1d8e6709..99fac2da 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedRoleDAO.java
@@ -45,7 +45,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
};
Result<List<Data>> lurd = get(trans, ns, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_RoleNotFound,"No Role found");
}
return lurd;
@@ -59,7 +59,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
};
Result<List<Data>> lurd = get(trans, name, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_RoleNotFound,"No Role found");
}
return lurd;
@@ -74,7 +74,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
public Result<Void> addPerm(AuthzTrans trans, RoleDAO.Data rd, PermDAO.Data perm) {
Result<Void> rv = dao().addPerm(trans,rd,perm);
- if(trans.debug().isLoggable())
+ if (trans.debug().isLoggable())
trans.debug().log("Adding",perm,"to", rd, "with CachedRoleDAO.addPerm");
invalidate(trans, rd);
return rv;
@@ -82,7 +82,7 @@ public class CachedRoleDAO extends CachedDAO<AuthzTrans,RoleDAO, RoleDAO.Data> {
public Result<Void> delPerm(AuthzTrans trans, RoleDAO.Data rd, PermDAO.Data perm) {
Result<Void> rv = dao().delPerm(trans,rd,perm);
- if(trans.debug().isLoggable())
+ if (trans.debug().isLoggable())
trans.debug().log("Removing",perm,"from", rd, "with CachedRoleDAO.addPerm");
invalidate(trans, rd);
return rv;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
index 2121b136..c1aa9017 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cached/CachedUserRoleDAO.java
@@ -53,9 +53,9 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
DAOGetter getter = new DAOGetter(trans,dao()) {
public Result<List<Data>> call() {
// If the call is for THIS user, and it exists, get from TRANS, add to TRANS if not.
- if(user!=null && user.equals(trans.user())) {
+ if (user!=null && user.equals(trans.user())) {
Result<List<Data>> transLD = trans.get(transURSlot,null);
- if(transLD==null ) {
+ if (transLD==null ) {
transLD = dao.readByUser(trans, user);
}
return transLD;
@@ -65,7 +65,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
}
};
Result<List<Data>> lurd = get(trans, user, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,"UserRole not found for [%s]",user);
}
return lurd;
@@ -79,7 +79,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
}
};
Result<List<Data>> lurd = get(trans, role, getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,"UserRole not found for [%s]",role);
}
return lurd;
@@ -88,12 +88,12 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
public Result<List<UserRoleDAO.Data>> readUserInRole(final AuthzTrans trans, final String user, final String role) {
DAOGetter getter = new DAOGetter(trans,dao()) {
public Result<List<Data>> call() {
- if(user.equals(trans.user())) {
+ if (user.equals(trans.user())) {
Result<List<Data>> rrbu = readByUser(trans, user);
- if(rrbu.isOK()) {
+ if (rrbu.isOK()) {
List<Data> ld = new ArrayList<>(1);
- for(Data d : rrbu.value) {
- if(d.role.equals(role)) {
+ for (Data d : rrbu.value) {
+ if (d.role.equals(role)) {
ld.add(d);
break;
}
@@ -107,7 +107,7 @@ public class CachedUserRoleDAO extends CachedDAO<AuthzTrans,UserRoleDAO, UserRol
}
};
Result<List<Data>> lurd = get(trans, keyFromObjs(user,role), getter);
- if(lurd.isOK() && lurd.isEmpty()) {
+ if (lurd.isOK() && lurd.isEmpty()) {
return Result.err(Status.ERR_UserRoleNotFound,"UserRole not found for role [%s] and user [%s]",role,user);
}
return lurd;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
index 1948ac65..cc4135ee 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ApprovalDAO.java
@@ -99,7 +99,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
data.operation = row.getString(7);
data.last_notified = row.getTimestamp(8);
// This is used to get "WRITETIME(STATUS)" from Approval, which gives us an "updated"
- if(row.getColumnDefinitions().size()>9) {
+ if (row.getColumnDefinitions().size()>9) {
// Rows reported in MicroSeconds
data.updated = new Date(row.getLong(9)/1000);
}
@@ -168,11 +168,11 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
@Override
public Result<Data> create(AuthzTrans trans, Data data) {
// If ID is not set (typical), create one.
- if(data.id==null) {
+ if (data.id==null) {
data.id = Chrono.dateToUUID(System.currentTimeMillis());
}
Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
return Result.ok(data);
@@ -200,14 +200,14 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
*/
@Override
public Result<Void> delete(AuthzTrans trans, Data data, boolean reread) {
- if(reread || data.status == null) { // if Memo is empty, likely not full record
+ if (reread || data.status == null) { // if Memo is empty, likely not full record
Result<ResultSet> rd = readPS.exec(trans, R_TEXT, data);
- if(rd.notOK()) {
+ if (rd.notOK()) {
return Result.err(rd);
}
ApprovalLoader.deflt.load(data, rd.value.one());
}
- if("approved".equals(data.status) || "denied".equals(data.status)) {
+ if ("approved".equals(data.status) || "denied".equals(data.status)) {
StringBuilder sb = new StringBuilder("BEGIN BATCH\n");
sb.append("INSERT INTO ");
sb.append(TABLELOG);
@@ -228,7 +228,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
sb.append("APPLY BATCH;\n");
TimeTaken tt = trans.start("DELETE APPROVAL",Env.REMOTE);
try {
- if(async) {
+ if (async) {
getSession(trans).executeAsync(sb.toString());
return Result.ok();
} else {
@@ -270,7 +270,7 @@ public class ApprovalDAO extends CassDAOImpl<AuthzTrans,ApprovalDAO.Data> {
: (modified.name() + "d approval for " + data.user);
// Detail?
// Reconstruct?
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
index 6702476a..e0c0c0d4 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/ArtiDAO.java
@@ -170,7 +170,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
writeString(os, data.mechid);
writeString(os, data.machine);
os.writeInt(data.type.size());
- for(String s : data.type) {
+ for (String s : data.type) {
writeString(os, s);
}
writeString(os, data.sponsor);
@@ -181,9 +181,9 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
writeString(os, data.notify);
os.writeLong(data.expires==null?-1:data.expires.getTime());
os.writeInt(data.renewDays);
- if(data.sans!=null) {
+ if (data.sans!=null) {
os.writeInt(data.sans.size());
- for(String s : data.sans) {
+ for (String s : data.sans) {
writeString(os, s);
}
} else {
@@ -200,7 +200,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
data.machine = readString(is,buff);
int size = is.readInt();
data.type = new HashSet<>(size);
- for(int i=0;i<size;++i) {
+ for (int i=0;i<size;++i) {
data.type.add(readString(is,buff));
}
data.sponsor = readString(is,buff);
@@ -214,7 +214,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
data.renewDays = is.readInt();
size = is.readInt();
data.sans = new HashSet<>(size);
- for(int i=0;i<size;++i) {
+ for (int i=0;i<size;++i) {
data.sans.add(readString(is,buff));
}
}
@@ -222,7 +222,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
private void init(AuthzTrans trans) {
// Set up sub-DAOs
- if(historyDAO==null) {
+ if (historyDAO==null) {
historyDAO = new HistoryDAO(trans,this);
}
@@ -288,7 +288,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
? String.format("%s by %s", override[0], hd.user)
: String.format("%sd %s for %s",modified.name(),data.mechid,data.machine);
// Detail?
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -296,7 +296,7 @@ public class ArtiDAO extends CassDAOImpl<AuthzTrans,ArtiDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
index e3f994c0..4aa94866 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java
@@ -138,7 +138,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
}
public static<T extends Trans> void startUpdate(AuthzEnv env, HMangr hman, SecuritySetter<HttpURLConnection> ss, String ip, int port) {
- if(cacheUpdate==null) {
+ if (cacheUpdate==null) {
Thread t= new Thread(cacheUpdate = new CacheUpdate(env,hman,ss, ip,port),"CacheInfo Update Thread");
t.setDaemon(true);
t.start();
@@ -146,7 +146,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
}
public static<T extends Trans> void stopUpdate() {
- if(cacheUpdate!=null) {
+ if (cacheUpdate!=null) {
cacheUpdate.go=false;
}
}
@@ -195,9 +195,9 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
@Override
public Integer code(Rcli<?> client) throws APIException, CadiException {
URI to = client.getURI();
- if(!to.getAuthority().equals(authority)) {
+ if (!to.getAuthority().equals(authority)) {
Future<Void> f = client.delete("/mgmt/cache/"+type+'/'+segs,VOID_CT);
- if(f.get(hman.readTimeout())) {
+ if (f.get(hman.readTimeout())) {
++total;
} else {
trans.error().log("Error During AAF Peer Notify",f.code(),f.body());
@@ -216,14 +216,14 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
set = null;
}
public void add(int[] ints) {
- if(set==null) {
+ if (set==null) {
set = new HashSet<>();
- for(int i=0;i<raw.length;++i) {
+ for (int i=0;i<raw.length;++i) {
set.add(raw[i]);
}
}
- for(int i=0;i<ints.length;++i) {
+ for (int i=0;i<ints.length;++i) {
set.add(ints[i]);
}
}
@@ -232,9 +232,9 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
public String toString() {
StringBuilder sb = new StringBuilder();
boolean first = true;
- if(set==null) {
- for(int i : raw) {
- if(first) {
+ if (set==null) {
+ for (int i : raw) {
+ if (first) {
first=false;
} else {
sb.append(',');
@@ -242,8 +242,8 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
sb.append(i);
}
} else {
- for(Integer i : set) {
- if(first) {
+ for (Integer i : set) {
+ if (first) {
first=false;
} else {
sb.append(',');
@@ -260,7 +260,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
do {
try {
Transfer data = notifyDQ.poll(4,TimeUnit.SECONDS);
- if(data==null) {
+ if (data==null) {
continue;
}
@@ -271,37 +271,37 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
long start=0;
// Do a block poll first
do {
- if(gather==null) {
+ if (gather==null) {
start = System.nanoTime();
trans = env.newTransNoAvg();
cc = new CacheClear(trans);
gather = new HashMap<>();
}
IntHolder prev = gather.get(data.table);
- if(prev==null) {
+ if (prev==null) {
gather.put(data.table,new IntHolder(data.segs));
} else {
prev.add(data.segs);
}
// continue while there is data
- } while((data = notifyDQ.poll())!=null);
- if(gather!=null) {
- for(Entry<String, IntHolder> es : gather.entrySet()) {
+ } while ((data = notifyDQ.poll())!=null);
+ if (gather!=null) {
+ for (Entry<String, IntHolder> es : gather.entrySet()) {
cc.set(es);
try {
- if(hman.all(ss, cc, false)!=null) {
+ if (hman.all(ss, cc, false)!=null) {
++count;
}
} catch (Exception e) {
trans.error().log(e, "Error on Cache Update");
}
}
- if(env.debug().isLoggable()) {
+ if (env.debug().isLoggable()) {
float millis = (System.nanoTime()-start)/1000000f;
StringBuilder sb = new StringBuilder("Direct Cache Refresh: ");
sb.append("Updated ");
sb.append(count);
- if(count==1) {
+ if (count==1) {
sb.append(" entry for ");
} else {
sb.append(" entries for ");
@@ -309,7 +309,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
int peers = count<=0?0:cc.total/count;
sb.append(peers);
sb.append(" client");
- if(peers!=1) {
+ if (peers!=1) {
sb.append('s');
}
sb.append(" in ");
@@ -323,7 +323,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
go = false;
Thread.currentThread().interrupt();
}
- } while(go);
+ } while (go);
}
}
@@ -347,9 +347,9 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
/////////////
// ConcurrentQueues are open-ended. We don't want any Memory leaks
// Note: we keep a separate counter, because "size()" on a Linked Queue is expensive
- if(cacheUpdate!=null) {
+ if (cacheUpdate!=null) {
try {
- if(!CacheUpdate.notifyDQ.offer(new CacheUpdate.Transfer(name, seg),2,TimeUnit.SECONDS)) {
+ if (!CacheUpdate.notifyDQ.offer(new CacheUpdate.Transfer(name, seg),2,TimeUnit.SECONDS)) {
trans.error().log("Cache Notify Queue is not accepting messages, bouncing may be appropriate" );
}
} catch (InterruptedException e) {
@@ -367,7 +367,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
start.append(": ");
StringBuilder sb = new StringBuilder("BEGIN BATCH\n");
boolean first = true;
- for(int s : seg) {
+ for (int s : seg) {
sb.append(UPDATE_SP);
sb.append(TABLE);
sb.append(" SET touched=dateof(now()) WHERE name = '");
@@ -375,7 +375,7 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
sb.append("' AND seg = ");
sb.append(s);
sb.append(";\n");
- if(first) {
+ if (first) {
first =false;
} else {
start.append(',');
@@ -413,24 +413,24 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
String lastName = null;
Date[] dates = null;
- for(Row row : rs.all()) {
+ for (Row row : rs.all()) {
String name = row.getString(0);
int seg = row.getInt(1);
- if(!name.equals(lastName)) {
+ if (!name.equals(lastName)) {
dates = info.get(name);
lastName=name;
}
- if(dates==null) {
+ if (dates==null) {
dates=new Date[seg+1];
info.put(name,dates);
- } else if(dates.length<=seg) {
+ } else if (dates.length<=seg) {
Date[] temp = new Date[seg+1];
System.arraycopy(dates, 0, temp, 0, dates.length);
dates = temp;
info.put(name, dates);
}
Date temp = row.getTimestamp(2);
- if(dates[seg]==null || dates[seg].before(temp)) {
+ if (dates[seg]==null || dates[seg].before(temp)) {
dates[seg]=temp;
}
}
@@ -443,16 +443,16 @@ public class CacheInfoDAO extends CassDAOImpl<AuthzTrans,CacheInfoDAO.Data> impl
@Override
public Date get(AuthzTrans trans, String table, int seg) {
Date[] dates = info.get(table);
- if(dates==null) {
+ if (dates==null) {
dates = new Date[seg+1];
touch(trans,table, seg);
- } else if(dates.length<=seg) {
+ } else if (dates.length<=seg) {
Date[] temp = new Date[seg+1];
System.arraycopy(dates, 0, temp, 0, dates.length);
dates = temp;
}
Date rv = dates[seg];
- if(rv==null) {
+ if (rv==null) {
rv=dates[seg]=startTime;
}
return rv;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
index 00c9ae90..6c23938f 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CertDAO.java
@@ -143,7 +143,7 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
writeString(os, data.x500);
writeString(os, data.x509);
writeString(os, data.ca);
- if(data.serial==null) {
+ if (data.serial==null) {
os.writeInt(-1);
} else {
byte[] dsba = data.serial.toByteArray();
@@ -164,9 +164,9 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
data.ca = readString(is,buff);
int i = is.readInt();
data.serial=null;
- if(i>=0) {
+ if (i>=0) {
byte[] bytes = new byte[i]; // a bit dangerous, but lessened because of all the previous sized data reads
- if(is.read(bytes)>0) {
+ if (is.read(bytes)>0) {
data.serial = new BigInteger(bytes);
}
}
@@ -180,10 +180,10 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
private void init(AuthzTrans trans) throws APIException, IOException {
// Set up sub-DAOs
- if(historyDAO==null) {
+ if (historyDAO==null) {
historyDAO = new HistoryDAO(trans,this);
}
- if(infoDAO==null) {
+ if (infoDAO==null) {
infoDAO = new CacheInfoDAO(trans,this);
}
@@ -226,7 +226,7 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
? String.format("%s by %s", override[0], hd.user)
: (modified.name() + "d certificate info for " + data.id);
// Detail?
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -234,10 +234,10 @@ public class CertDAO extends CassDAOImpl<AuthzTrans,CertDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).status!=Status.OK) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).status!=Status.OK) {
trans.error().log("Cannot touch Cert");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
index 5bcba9d9..7674c7e8 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CredDAO.java
@@ -158,7 +158,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
os.writeInt(data.other==null?0:data.other);
writeString(os, data.ns);
writeString(os, data.notes);
- if(data.cred==null) {
+ if (data.cred==null) {
os.writeInt(-1);
} else {
int l = data.cred.limit()-data.cred.position();
@@ -183,10 +183,10 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
int i = is.readInt();
data.cred=null;
- if(i>=0) {
+ if (i>=0) {
byte[] bytes = new byte[i]; // a bit dangerous, but lessened because of all the previous sized data reads
int read = is.read(bytes);
- if(read>0) {
+ if (read>0) {
data.cred = ByteBuffer.wrap(bytes);
}
}
@@ -195,10 +195,10 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
private void init(AuthzTrans trans) throws APIException, IOException {
// Set up sub-DAOs
- if(historyDAO==null) {
+ if (historyDAO==null) {
historyDAO = new HistoryDAO(trans,this);
}
- if(infoDAO==null) {
+ if (infoDAO==null) {
infoDAO = new CacheInfoDAO(trans,this);
}
@@ -241,7 +241,7 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
? String.format("%s by %s", override[0], hd.user)
: (modified.name() + "d credential for " + data.id);
// Detail?
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -249,10 +249,10 @@ public class CredDAO extends CassDAOImpl<AuthzTrans,CredDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).status!=Status.OK) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).status!=Status.OK) {
trans.error().log("Cannot touch Cred");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
index 6b0ea2df..a98f101f 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/FutureDAO.java
@@ -143,14 +143,14 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
*/
public Result<FutureDAO.Data> create(AuthzTrans trans, FutureDAO.Data data, String id) {
// If ID is not set (typical), create one.
- if(data.id==null) {
+ if (data.id==null) {
StringBuilder sb = new StringBuilder(trans.user());
sb.append(data.target);
sb.append(System.currentTimeMillis());
data.id = UUID.nameUUIDFromBytes(sb.toString().getBytes());
}
Result<ResultSet> rs = createPS.exec(trans, C_TEXT, data);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
wasModified(trans, CRUD.create, data, null, id);
@@ -175,7 +175,7 @@ public class FutureDAO extends CassDAOImpl<AuthzTrans,FutureDAO.Data> {
hd.subject = subject?override[1]:"";
hd.memo = memo?String.format("%s by %s", override[0], hd.user):data.memo;
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
index ce7e5477..a40b28fb 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/HistoryDAO.java
@@ -174,7 +174,7 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
public Result<List<Data>> readByYYYYMM(AuthzTrans trans, int yyyymm) {
Result<ResultSet> rs = readByYRMN.exec(trans, "yr_mon", yyyymm);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
return extract(defLoader,rs.value,null,dflt);
@@ -186,22 +186,22 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
* month - the month in a year ...values 1 - 12
**/
public Result<List<Data>> readByUser(AuthzTrans trans, String user, int ... yyyymm) {
- if(yyyymm.length==0) {
+ if (yyyymm.length==0) {
return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified");
}
Result<ResultSet> rs = readByUser.exec(trans, "user", user);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
return extract(defLoader,rs.value,null,yyyymm.length>0?new YYYYMM(yyyymm):dflt);
}
public Result<List<Data>> readBySubject(AuthzTrans trans, String subject, String target, int ... yyyymm) {
- if(yyyymm.length==0) {
+ if (yyyymm.length==0) {
return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified");
}
Result<ResultSet> rs = readBySubject.exec(trans, "subject", subject, target);
- if(rs.notOK()) {
+ if (rs.notOK()) {
return Result.err(rs);
}
return extract(defLoader,rs.value,null,yyyymm.length>0?new YYYYMM(yyyymm):dflt);
@@ -215,8 +215,8 @@ public class HistoryDAO extends CassDAOImpl<AuthzTrans, HistoryDAO.Data> {
@Override
public boolean ok(Data data) {
int dym = data.yr_mon;
- for(int ym:yyyymm) {
- if(dym==ym) {
+ for (int ym:yyyymm) {
+ if (dym==ym) {
return true;
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
index 5d7aebed..757efa5f 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/LocateDAO.java
@@ -162,11 +162,11 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
os.writeFloat(data.latitude);
os.writeFloat(data.longitude);
writeString(os, data.protocol);
- if(data.subprotocol==null) {
+ if (data.subprotocol==null) {
os.writeInt(0);
} else {
os.writeInt(data.subprotocol.size());
- for(String s: data.subprotocol) {
+ for (String s: data.subprotocol) {
writeString(os,s);
}
}
@@ -192,11 +192,11 @@ public class LocateDAO extends CassDAOImpl<AuthzTrans,LocateDAO.Data> {
int size = is.readInt();
data.subprotocol = new HashSet<>(size);
- for(int i=0;i<size;++i) {
+ for (int i=0;i<size;++i) {
data.subprotocol.add(readString(is,buff));
}
String port_key = readString(is,buff);
- if(port_key.length()>0) {
+ if (port_key.length()>0) {
data.port_key=UUID.fromString(port_key);
} else {
data.port_key = null;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
index 29ac379b..192887b9 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/Namespace.java
@@ -55,9 +55,9 @@ public class Namespace implements Bytification {
description = ndd.description;
type = ndd.type;
parent = ndd.parent;
- if(ndd.attrib!=null && !ndd.attrib.isEmpty()) {
+ if (ndd.attrib!=null && !ndd.attrib.isEmpty()) {
attrib = new ArrayList<>();
- for( Entry<String, String> entry : ndd.attrib.entrySet()) {
+ for ( Entry<String, String> entry : ndd.attrib.entrySet()) {
attrib.add(new Pair<String,String>(entry.getKey(),entry.getValue()));
}
}
@@ -70,9 +70,9 @@ public class Namespace implements Bytification {
description = ndd.description;
type = ndd.type;
parent = ndd.parent;
- if(ndd.attrib!=null && !ndd.attrib.isEmpty()) {
+ if (ndd.attrib!=null && !ndd.attrib.isEmpty()) {
attrib = new ArrayList<>();
- for( Entry<String, String> entry : ndd.attrib.entrySet()) {
+ for ( Entry<String, String> entry : ndd.attrib.entrySet()) {
attrib.add(new Pair<String,String>(entry.getKey(),entry.getValue()));
}
}
@@ -141,7 +141,7 @@ public class Namespace implements Bytification {
*/
@Override
public boolean equals(Object arg0) {
- if(arg0==null || !(arg0 instanceof Namespace)) {
+ if (arg0==null || !(arg0 instanceof Namespace)) {
return false;
}
return name.equals(((Namespace)arg0).name);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
index 30f0d6b5..f769e38c 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsDAO.java
@@ -149,10 +149,10 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
private void init(AuthzTrans trans) throws APIException, IOException {
// Set up sub-DAOs
- if(historyDAO==null) {
+ if (historyDAO==null) {
historyDAO = new HistoryDAO(trans, this);
}
- if(infoDAO==null) {
+ if (infoDAO==null) {
infoDAO = new CacheInfoDAO(trans,this);
}
@@ -205,11 +205,11 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
os.writeInt(data.type);
writeString(os,data.description);
writeString(os,data.parent);
- if(data.attrib==null) {
+ if (data.attrib==null) {
os.writeInt(-1);
} else {
os.writeInt(data.attrib.size());
- for(Entry<String, String> es : data.attrib(false).entrySet()) {
+ for (Entry<String, String> es : data.attrib(false).entrySet()) {
writeString(os,es.getKey());
writeString(os,es.getValue());
}
@@ -227,9 +227,9 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
data.description = readString(is,buff);
data.parent = readString(is,buff);
int count = is.readInt();
- if(count>0) {
+ if (count>0) {
Map<String, String> da = data.attrib(true);
- for(int i=0;i<count;++i) {
+ for (int i=0;i<count;++i) {
da.put(readString(is,buff), readString(is,buff));
}
}
@@ -241,7 +241,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<Data> create(AuthzTrans trans, Data data) {
String ns = data.name;
// Ensure Parent is set
- if(data.parent==null) {
+ if (data.parent==null) {
return Result.err(Result.ERR_BadData, "Need parent for %s", ns);
}
@@ -254,7 +254,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
getSession(trans).execute(stmt.toString());
//// TEST CODE for Exception
// boolean force = true;
-// if(force) {
+// if (force) {
// throw new com.datastax.driver.core.exceptions.NoHostAvailableException(new HashMap<>());
//// throw new com.datastax.driver.core.exceptions.AuthenticationException(new InetSocketAddress(9999),"Sample Message");
// }
@@ -272,7 +272,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<Void> update(AuthzTrans trans, Data data) {
String ns = data.name;
// Ensure Parent is set
- if(data.parent==null) {
+ if (data.parent==null) {
return Result.err(Result.ERR_BadData, "Need parent for %s", ns);
}
@@ -281,26 +281,26 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
try {
Map<String, String> localAttr = data.attrib;
Result<Map<String, String>> rremoteAttr = readAttribByNS(trans,ns);
- if(rremoteAttr.notOK()) {
+ if (rremoteAttr.notOK()) {
return Result.err(rremoteAttr);
}
// update Attributes
String str;
- for(Entry<String, String> es : localAttr.entrySet()) {
+ for (Entry<String, String> es : localAttr.entrySet()) {
str = rremoteAttr.value.get(es.getKey());
- if(str==null || !str.equals(es.getValue())) {
+ if (str==null || !str.equals(es.getValue())) {
attribUpdateStmt(stmt, ns, es.getKey(),es.getValue());
}
}
// No point in deleting... insert overwrites...
-// for(Entry<String, String> es : remoteAttr.entrySet()) {
+// for (Entry<String, String> es : remoteAttr.entrySet()) {
// str = localAttr.get(es.getKey());
-// if(str==null || !str.equals(es.getValue())) {
+// if (str==null || !str.equals(es.getValue())) {
// attribDeleteStmt(stmt, ns, es.getKey());
// }
// }
- if(stmt.length()>BEGIN_BATCH.length()) {
+ if (stmt.length()>BEGIN_BATCH.length()) {
stmt.append(APPLY_BATCH);
getSession(trans).execute(stmt.toString());
}
@@ -320,11 +320,11 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<List<Data>> read(AuthzTrans trans, Data data) {
Result<List<Data>> rld = super.read(trans, data);
- if(rld.isOKhasData()) {
- for(Data d : rld.value) {
+ if (rld.isOKhasData()) {
+ for (Data d : rld.value) {
// Note: Map is null at this point, save time/mem by assignment
Result<Map<String, String>> rabn = readAttribByNS(trans,d.name);
- if(rabn.isOK()) {
+ if (rabn.isOK()) {
d.attrib = rabn.value;
} else {
return Result.err(rabn);
@@ -341,11 +341,11 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
public Result<List<Data>> read(AuthzTrans trans, Object... key) {
Result<List<Data>> rld = super.read(trans, key);
- if(rld.isOKhasData()) {
- for(Data d : rld.value) {
+ if (rld.isOKhasData()) {
+ for (Data d : rld.value) {
// Note: Map is null at this point, save time/mem by assignment
Result<Map<String, String>> rabn = readAttribByNS(trans,d.name);
- if(rabn.isOK()) {
+ if (rabn.isOK()) {
d.attrib = rabn.value;
} else {
return Result.err(rabn);
@@ -385,7 +385,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
+ ns
+ "';");
- for(Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
+ for (Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
Row r = iter.next();
map.put(r.getString(0), r.getString(1));
}
@@ -408,7 +408,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
+ key
+ "';");
- for(Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
+ for (Iterator<Row> iter = rs.iterator();iter.hasNext(); ) {
Row r = iter.next();
set.add(r.getString(0));
}
@@ -489,7 +489,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
private void attribInsertStmts(StringBuilder stmt, Data data) {
// INSERT new Attrib
- for(Entry<String,String> es : data.attrib(false).entrySet() ) {
+ for (Entry<String,String> es : data.attrib(false).entrySet() ) {
stmt.append(" ");
attribInsertStmt(stmt,data.name,es.getKey(),es.getValue());
}
@@ -541,7 +541,7 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
hd.target = TABLE;
hd.subject = subject ? override[1] : data.name;
hd.memo = memo ? override[0] : (data.name + " was " + modified.name() + 'd' );
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -549,10 +549,10 @@ public class NsDAO extends CassDAOImpl<AuthzTrans,NsDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
trans.error().log("Cannot touch CacheInfo");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
index a64c0a94..2beeaf38 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsSplit.java
@@ -28,10 +28,10 @@ public class NsSplit {
public NsSplit(NsDAO.Data nsd, String child) {
this.nsd = nsd;
- if(child.startsWith(nsd.name)) {
+ if (child.startsWith(nsd.name)) {
ns = nsd.name;
int dot = ns.length();
- if(dot<child.length() && child.charAt(dot)=='.') {
+ if (dot<child.length() && child.charAt(dot)=='.') {
name = child.substring(dot+1);
} else {
name="";
@@ -48,7 +48,7 @@ public class NsSplit {
this.nsd = new NsDAO.Data();
nsd.name = ns;
int dot = ns.lastIndexOf('.');
- if(dot>=0) {
+ if (dot>=0) {
nsd.parent = ns.substring(0, dot);
} else {
nsd.parent = ".";
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
index 59e18ae9..e656a555 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/NsType.java
@@ -46,8 +46,8 @@ public enum NsType {
* @return
*/
public static NsType fromType(int t) {
- for(NsType nst : values()) {
- if(t==nst.type) {
+ for (NsType nst : values()) {
+ if (t==nst.type) {
return nst;
}
}
@@ -60,9 +60,9 @@ public enum NsType {
* @return
*/
public static NsType fromString(String s) {
- if(s!=null) {
- for(NsType nst : values()) {
- if(nst.name().equals(s)) {
+ if (s!=null) {
+ for (NsType nst : values()) {
+ if (nst.name().equals(s)) {
return nst;
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
index c02387b1..6e1057b8 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/PermDAO.java
@@ -114,13 +114,13 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
*/
public static Result<Data> decode(AuthzTrans trans, Question q, String p) {
String[] ss = Split.splitTrim('|', p,4);
- if(ss[2]==null) {
+ if (ss[2]==null) {
return Result.err(Status.ERR_BadData,"Perm Encodings must be separated by '|'");
}
Data data = new Data();
- if(ss[3]==null) { // older 3 part encoding must be evaluated for NS
+ if (ss[3]==null) { // older 3 part encoding must be evaluated for NS
Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
data.ns=nss.value.ns;
@@ -146,15 +146,15 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
*/
public static Result<String[]> decodeToArray(AuthzTrans trans, Question q, String p) {
String[] ss = Split.splitTrim('|', p,4);
- if(ss[2]==null) {
+ if (ss[2]==null) {
return Result.err(Status.ERR_BadData,"Perm Encodings must be separated by '|'");
}
- if(ss[3]==null) { // older 3 part encoding must be evaluated for NS
+ if (ss[3]==null) { // older 3 part encoding must be evaluated for NS
ss[3] = ss[2];
ss[2] = ss[1];
Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
ss[1] = nss.value.name;
@@ -191,7 +191,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
String[] s = name.split("\\|");
Result<NsSplit> rdns = q.deriveNsSplit(trans, s[0]);
Data rv = new PermDAO.Data();
- if(rdns.isOKhasData()) {
+ if (rdns.isOKhasData()) {
switch(s.length) {
case 3:
rv.type=s[1];
@@ -482,7 +482,7 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
hd.memo = String.format("%sd %s|%s|%s", modified.name(),data.fullType(),data.instance,data.action);
}
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -490,10 +490,10 @@ public class PermDAO extends CassDAOImpl<AuthzTrans,PermDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
trans.error().log("Cannot touch CacheInfo");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
index 4489d268..127dd4e2 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/RoleDAO.java
@@ -124,9 +124,9 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
public static Result<Data> decode(AuthzTrans trans, Question q, String r) {
String[] ss = Split.splitTrim('|', r,2);
Data data = new Data();
- if(ss[1]==null) { // older 1 part encoding must be evaluated for NS
+ if (ss[1]==null) { // older 1 part encoding must be evaluated for NS
Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
data.ns=nss.value.ns;
@@ -161,9 +161,9 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
*/
public static Result<String[]> decodeToArray(AuthzTrans trans, Question q, String p) {
String[] ss = Split.splitTrim('|', p,2);
- if(ss[1]==null) { // older 1 part encoding must be evaluated for NS
+ if (ss[1]==null) { // older 1 part encoding must be evaluated for NS
Result<NsSplit> nss = q.deriveNsSplit(trans, ss[0]);
- if(nss.notOK()) {
+ if (nss.notOK()) {
return Result.err(nss);
}
ss[0] = nss.value.ns;
@@ -287,7 +287,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
}
public Result<List<Data>> readChildren(AuthzTrans trans, String ns, String role) {
- if(role.length()==0 || "*".equals(role)) {
+ if (role.length()==0 || "*".equals(role)) {
return psChildren.read(trans, R_TEXT, new Object[]{ns, FIRST_CHAR, LAST_CHAR});
} else {
return psChildren.read(trans, R_TEXT, new Object[]{ns, role+DOT, role+DOT_PLUS_ONE});
@@ -392,7 +392,7 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
hd.target = TABLE;
hd.subject = subject ? override[1] : data.fullName();
hd.memo = memo ? override[0] : (data.fullName() + " was " + modified.name() + 'd' );
- if(modified==CRUD.delete) {
+ if (modified==CRUD.delete) {
try {
hd.reconstruct = data.bytify();
} catch (IOException e) {
@@ -400,10 +400,10 @@ public class RoleDAO extends CassDAOImpl<AuthzTrans,RoleDAO.Data> {
}
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
trans.error().log("Cannot touch CacheInfo for Role");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
index 7b9f7b91..26f9a995 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/UserRoleDAO.java
@@ -127,7 +127,7 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
public boolean role(AuthzTrans trans, Question ques, String role) {
this.role = role;
Result<NsSplit> rnss = ques.deriveNsSplit(trans, role);
- if(rnss.isOKhasData()) {
+ if (rnss.isOKhasData()) {
ns = rnss.value.ns;
rname = rnss.value.name;
return true;
@@ -304,15 +304,15 @@ public class UserRoleDAO extends CassDAOImpl<AuthzTrans,UserRoleDAO.Data> {
: "n/a";
}
- if(historyDAO.create(trans, hd).status!=Status.OK) {
+ if (historyDAO.create(trans, hd).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
- if(historyDAO.create(trans, hdRole).status!=Status.OK) {
+ if (historyDAO.create(trans, hdRole).status!=Status.OK) {
trans.error().log("Cannot log to History");
}
// uses User as Segment
- if(infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
+ if (infoDAO.touch(trans, TABLE,data.invalidate(cache)).notOK()) {
trans.error().log("Cannot touch CacheInfo");
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
index f0a59582..0bc23c92 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/CassExecutor.java
@@ -47,7 +47,7 @@ public class CassExecutor implements Executor {
@Override
public boolean inRole(String name) {
Result<NsSplit> nss = q.deriveNsSplit(trans, name);
- if(nss.notOK())return false;
+ if (nss.notOK())return false;
return q.roleDAO.read(trans, nss.value.ns,nss.value.name).isOKhasData();
}
@@ -58,7 +58,7 @@ public class CassExecutor implements Executor {
@Override
public String namespace() throws Exception {
Result<Data> res = q.validNSOfDomain(trans,trans.user());
- if(res.isOK()) {
+ if (res.isOK()) {
String user[] = trans.user().split("\\.");
return user[user.length-1] + '.' + user[user.length-2];
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
index f3aae2ec..f440a8cd 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Function.java
@@ -81,9 +81,9 @@ public class Function {
* @return
*/
public static FUTURE_OP toFO(String value) {
- if(value!=null) {
- for(FUTURE_OP fo : values()) {
- if(fo.name().equals(value)){
+ if (value!=null) {
+ for (FUTURE_OP fo : values()) {
+ if (fo.name().equals(value)){
return fo;
}
}
@@ -194,16 +194,16 @@ public class Function {
String reason;
if (orgUser == null) {
return Result.err(Status.ERR_Policy,"%s is not a valid user at %s",u,org.getName());
- } else if((reason=orgUser.mayOwn())!=null) {
+ } else if ((reason=orgUser.mayOwn())!=null) {
if (org.isTestEnv()) {
String reason2;
- if((reason2=org.validate(trans, Policy.AS_RESPONSIBLE,new CassExecutor(trans, this), u))!=null) { // can masquerade as responsible
+ if ((reason2=org.validate(trans, Policy.AS_RESPONSIBLE,new CassExecutor(trans, this), u))!=null) { // can masquerade as responsible
trans.debug().log(reason2);
return Result.err(Status.ERR_Policy,CANNOT_BE_THE_OWNER_OF_A_NAMESPACE,orgUser.fullName(),orgUser.id(),namespace.name,reason);
}
// a null means ok
} else {
- if(orgUser.isFound()) {
+ if (orgUser.isFound()) {
return Result.err(Status.ERR_Policy,CANNOT_BE_THE_OWNER_OF_A_NAMESPACE,orgUser.fullName(),orgUser.id(),namespace.name, reason);
} else {
return Result.err(Status.ERR_Policy,u + " is an invalid Identity");
@@ -267,7 +267,7 @@ public class Function {
// or helpful for Operations folks..
// Admins can be empty, because they can be changed by lower level
// NSs
- // if(ns.admin(false).isEmpty()) {
+ // if (ns.admin(false).isEmpty()) {
// ns.admin(true).add(user);
// }
if (namespace.admin != null) {
@@ -334,9 +334,9 @@ public class Function {
for (RoleDAO.Data rdd : rrdc.value) {
// Remove old Role from Perms, save them off
List<PermDAO.Data> lpdd = new ArrayList<>();
- for(String p : rdd.perms(false)) {
+ for (String p : rdd.perms(false)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans,q,p);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
PermDAO.Data pdd = rpdd.value;
lpdd.add(pdd);
q.permDAO.delRole(trans, pdd, rdd);
@@ -358,13 +358,13 @@ public class Function {
// "create" per se
if ((rq = q.roleDAO.create(trans, rdd)).isOK()) {
// Put Role back into Perm, with correct info
- for(PermDAO.Data pdd : lpdd) {
+ for (PermDAO.Data pdd : lpdd) {
q.permDAO.addRole(trans, pdd, rdd);
}
// Change data for User Roles
Result<List<UserRoleDAO.Data>> rurd = q.userRoleDAO.readByRole(trans, rdd.fullName());
- if(rurd.isOKhasData()) {
- for(UserRoleDAO.Data urd : rurd.value) {
+ if (rurd.isOKhasData()) {
+ for (UserRoleDAO.Data urd : rurd.value) {
urd.ns = rdd.ns;
urd.rname = rdd.name;
q.userRoleDAO.update(trans, urd);
@@ -389,9 +389,9 @@ public class Function {
// Remove old Perm from Roles, save them off
List<RoleDAO.Data> lrdd = new ArrayList<>();
- for(String rl : pdd.roles(false)) {
+ for (String rl : pdd.roles(false)) {
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,q,rl);
- if(rrdd.isOKhasData()) {
+ if (rrdd.isOKhasData()) {
RoleDAO.Data rdd = rrdd.value;
lrdd.add(rdd);
q.roleDAO.delPerm(trans, rdd, pdd);
@@ -408,7 +408,7 @@ public class Function {
.substring(targetNameDot) : "";
if ((rq = q.permDAO.create(trans, pdd)).isOK()) {
// Put Role back into Perm, with correct info
- for(RoleDAO.Data rdd : lrdd) {
+ for (RoleDAO.Data rdd : lrdd) {
q.roleDAO.addPerm(trans, rdd, pdd);
}
@@ -698,7 +698,7 @@ public class Function {
} else {
if (org.isTestEnv()) {
String reason2;
- if((reason2 = org.validate(trans, Policy.AS_RESPONSIBLE, new CassExecutor(trans, this), id))==null) {
+ if ((reason2 = org.validate(trans, Policy.AS_RESPONSIBLE, new CassExecutor(trans, this), id))==null) {
return Result.ok();
} else {
trans.debug().log(reason2);
@@ -726,7 +726,7 @@ public class Function {
rq = q.mayUser(trans, trans.user(), rq.value, Access.write);
if (rq.notOK()) {
Result<List<UserRoleDAO.Data>> ruinr = q.userRoleDAO.readUserInRole(trans, trans.user(),ns+".owner");
- if(!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
+ if (!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
return Result.err(rq);
}
}
@@ -748,7 +748,7 @@ public class Function {
"%s is not a valid %s Credential", user, org.getName());
}
//TODO find out how to make sure good ALTERNATE OAUTH DOMAIN USER
-// } else if(user.endsWith(ALTERNATE OAUTH DOMAIN)) {
+// } else if (user.endsWith(ALTERNATE OAUTH DOMAIN)) {
// return Result.ok();
} else {
Result<List<CredDAO.Data>> cdr = q.credDAO.readID(trans, user);
@@ -794,7 +794,7 @@ public class Function {
if (rq.notOK()) {
// Even though not a "writer", Owners still determine who gets to be an Admin
Result<List<UserRoleDAO.Data>> ruinr = q.userRoleDAO.readUserInRole(trans, trans.user(),ns+".owner");
- if(!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
+ if (!(ruinr.isOKhasData() && ruinr.value.get(0).expires.after(new Date()))) {
return Result.err(rq);
}
}
@@ -827,9 +827,9 @@ public class Function {
// Remove old Perm from Roles, save them off
List<RoleDAO.Data> lrdd = new ArrayList<>();
- for(String rl : pdd.roles(false)) {
+ for (String rl : pdd.roles(false)) {
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans,q,rl);
- if(rrdd.isOKhasData()) {
+ if (rrdd.isOKhasData()) {
RoleDAO.Data rdd = rrdd.value;
lrdd.add(rdd);
q.roleDAO.delPerm(trans, rdd, pdd);
@@ -846,7 +846,7 @@ public class Function {
// Use direct Create/Delete, because switching namespaces
if ((pd = q.permDAO.create(trans, pdd)).isOK()) {
// Put Role back into Perm, with correct info
- for(RoleDAO.Data rdd : lrdd) {
+ for (RoleDAO.Data rdd : lrdd) {
q.roleDAO.addPerm(trans, rdd, pdd);
}
@@ -892,9 +892,9 @@ public class Function {
}
// Remove old Role from Perms, save them off
List<PermDAO.Data> lpdd = new ArrayList<>();
- for(String p : rdd.perms(false)) {
+ for (String p : rdd.perms(false)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans,q,p);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
PermDAO.Data pdd = rpdd.value;
lpdd.add(pdd);
q.permDAO.delRole(trans, pdd, rdd);
@@ -912,7 +912,7 @@ public class Function {
// Use direct Create/Delete, because switching namespaces
if ((rd = q.roleDAO.create(trans, rdd)).isOK()) {
// Put Role back into Perm, with correct info
- for(PermDAO.Data pdd : lpdd) {
+ for (PermDAO.Data pdd : lpdd) {
q.permDAO.addRole(trans, pdd, rdd);
}
@@ -973,7 +973,7 @@ public class Function {
// For each Role
for (String role : roles = perm.roles(true)) {
Result<RoleDAO.Data> rdd = RoleDAO.Data.decode(trans,q,role);
- if(rdd.isOKhasData()) {
+ if (rdd.isOKhasData()) {
RoleDAO.Data rd = rdd.value;
if (!fromApproval) {
// May User write to the Role in question.
@@ -1038,7 +1038,7 @@ public class Function {
for (String role : fullperm.roles) {
Result<Void> rv = null;
Result<RoleDAO.Data> rrdd = RoleDAO.Data.decode(trans, q, role);
- if(rrdd.isOKhasData()) {
+ if (rrdd.isOKhasData()) {
trans.debug().log("Removing", role, "from", fullperm, "on Perm Delete");
if ((rv = q.roleDAO.delPerm(trans, rrdd.value, fullperm)).notOK()) {
if (rv.notOK()) {
@@ -1131,19 +1131,19 @@ public class Function {
if (!fromApproval) {
Result<NsDAO.Data> rRoleCo = q.deriveFirstNsForType(trans, role.ns, NsType.COMPANY);
- if(rRoleCo.notOK()) {
+ if (rRoleCo.notOK()) {
return Result.err(rRoleCo);
}
Result<NsDAO.Data> rPermCo = q.deriveFirstNsForType(trans, pd.ns, NsType.COMPANY);
- if(rPermCo.notOK()) {
+ if (rPermCo.notOK()) {
return Result.err(rPermCo);
}
// Not from same company
- if(!rRoleCo.value.name.equals(rPermCo.value.name)) {
+ if (!rRoleCo.value.name.equals(rPermCo.value.name)) {
Result<Data> r;
// Only grant if User ALSO has Write ability in Other Company
- if((r = q.mayUser(trans, user, role, Access.write)).notOK()) {
+ if ((r = q.mayUser(trans, user, role, Access.write)).notOK()) {
return Result.err(r);
}
}
@@ -1279,7 +1279,7 @@ public class Function {
break;
}
}
- if(!notFound) {
+ if (!notFound) {
break;
}
}
@@ -1343,14 +1343,14 @@ public class Function {
*/
public Result<Void> addUserRole(AuthzTrans trans,UserRoleDAO.Data urData) {
Result<Void> rv;
- if(Question.ADMIN.equals(urData.rname)) {
+ if (Question.ADMIN.equals(urData.rname)) {
rv = mayAddAdmin(trans, urData.ns, urData.user);
- } else if(Question.OWNER.equals(urData.rname)) {
+ } else if (Question.OWNER.equals(urData.rname)) {
rv = mayAddOwner(trans, urData.ns, urData.user);
} else {
rv = checkValidID(trans, new Date(), urData.user);
}
- if(rv.notOK()) {
+ if (rv.notOK()) {
return rv;
}
@@ -1378,7 +1378,7 @@ public class Function {
public Result<Void> addUserRole(AuthzTrans trans, String user, String ns, String rname) {
try {
- if(trans.org().getIdentity(trans, user)==null) {
+ if (trans.org().getIdentity(trans, user)==null) {
return Result.err(Result.ERR_BadData,user+" is an Invalid Identity for " + trans.org().getName());
}
} catch (OrganizationException e) {
@@ -1476,9 +1476,9 @@ public class Function {
Result<List<UserRoleDAO.Data>> rrbr = q.userRoleDAO
.readByRole(trans, nsd.name + Question.DOT_OWNER);
if (rrbr.isOKhasData()) {
- for(UserRoleDAO.Data urd : rrbr.value) {
+ for (UserRoleDAO.Data urd : rrbr.value) {
Identity owner = org.getIdentity(trans, urd.user);
- if(owner==null) {
+ if (owner==null) {
return Result.err(Result.ERR_NotFound,urd.user + " is not a Valid Owner of " + nsd.name);
} else {
owners.add(owner);
@@ -1487,7 +1487,7 @@ public class Function {
}
}
- if(owners.isEmpty()) {
+ if (owners.isEmpty()) {
return Result.err(Result.ERR_NotFound,"No Owners found for " + nsd.name);
}
@@ -1501,17 +1501,17 @@ public class Function {
final UUID ticket = fr.value.id;
sb.append(", Approvals: ");
Boolean first[] = new Boolean[]{true};
- if(op!=FUTURE_OP.A) {
+ if (op!=FUTURE_OP.A) {
for (Identity u : approvers) {
Result<ApprovalDAO.Data> r = addIdentity(trans,sb,first,user,data.memo,op,u,ticket,org.getApproverType());
- if(r.notOK()) {
+ if (r.notOK()) {
return Result.err(r);
}
}
}
for (Identity u : owners) {
Result<ApprovalDAO.Data> r = addIdentity(trans,sb,first,user,data.memo,op,u,ticket,"owner");
- if(r.notOK()) {
+ if (r.notOK()) {
return Result.err(r);
}
}
@@ -1534,7 +1534,7 @@ public class Function {
@Override
public UserRoleDAO.Data get(AuthzTrans trans, Object ... keys) {
Result<List<UserRoleDAO.Data>> r = q.userRoleDAO.read(trans, keys);
- if(r.isOKhasData()) {
+ if (r.isOKhasData()) {
return r.value.get(0);
} else {
return null;
@@ -1556,18 +1556,18 @@ public class Function {
public Result<OP_STATUS> performFutureOp(final AuthzTrans trans, FUTURE_OP fop, FutureDAO.Data curr, Lookup<List<ApprovalDAO.Data>> la, Lookup<UserRoleDAO.Data> lur) {
// Pre-Evaluate if ReApproval is already done.
UserRoleDAO.Data urdd = null;
- if(fop.equals(FUTURE_OP.A) && curr.target.equals(FOP_USER_ROLE) && curr.construct!=null) {
+ if (fop.equals(FUTURE_OP.A) && curr.target.equals(FOP_USER_ROLE) && curr.construct!=null) {
try {
// Get Expected UserRole from Future
urdd = new UserRoleDAO.Data();
urdd.reconstitute(curr.construct);
// Get Current UserRole from lookup
UserRoleDAO.Data lurdd = lur.get(trans, urdd.user,urdd.role);
- if(lurdd==null) {
+ if (lurdd==null) {
q.futureDAO.delete(trans, curr, false);
return OP_STATUS.RL;
} else {
- if(curr.expires.compareTo(lurdd.expires)<0) {
+ if (curr.expires.compareTo(lurdd.expires)<0) {
q.futureDAO.delete(trans, curr, false);
return OP_STATUS.RL;
}
@@ -1579,21 +1579,21 @@ public class Function {
boolean aDenial = false;
int cntSuper=0, appSuper=0,cntOwner=0, appOwner=0;
- for(ApprovalDAO.Data add : la.get(trans)) {
+ for (ApprovalDAO.Data add : la.get(trans)) {
switch(add.status) {
case "approved":
- if("owner".equals(add.type)) {
+ if ("owner".equals(add.type)) {
++cntOwner;
++appOwner;
- } else if("supervisor".equals(add.type)) {
+ } else if ("supervisor".equals(add.type)) {
++cntSuper;
++appSuper;
}
break;
case "pending":
- if("owner".equals(add.type)) {
+ if ("owner".equals(add.type)) {
++cntOwner;
- } else if("supervisor".equals(add.type)) {
+ } else if ("supervisor".equals(add.type)) {
++cntSuper;
}
break;
@@ -1604,18 +1604,18 @@ public class Function {
}
Result<OP_STATUS> ros=null;
- if(aDenial) {
+ if (aDenial) {
// Note: Denial will be Audit-logged.
// for (ApprovalDAO.Data ad : allApprovalsForTicket.value) {
// q.approvalDAO.delete(trans, ad, false);
// }
ros = OP_STATUS.RD;
- if(q.futureDAO.delete(trans, curr, false).notOK()) {
+ if (q.futureDAO.delete(trans, curr, false).notOK()) {
trans.info().printf("Future %s could not be deleted", curr.id.toString());
} else {
if (FOP_USER_ROLE.equalsIgnoreCase(curr.target)) {
// A Denial means we must remove UserRole
- if(fop.equals(FUTURE_OP.U) || fop.equals(FUTURE_OP.A)) {
+ if (fop.equals(FUTURE_OP.U) || fop.equals(FUTURE_OP.A)) {
UserRoleDAO.Data data = new UserRoleDAO.Data();
try {
data.reconstitute(curr.construct);
@@ -1631,7 +1631,7 @@ public class Function {
// Decision: If not Denied, and at least owner, if exists, and at least one Super, if exists
boolean goDecision = (cntOwner>0?appOwner>0:true) && (cntSuper>0?appSuper>0:true);
- if(goDecision) {
+ if (goDecision) {
// should check if any other pendings before performing
// actions
try {
@@ -1684,7 +1684,7 @@ public class Function {
default:
}
} else if (FOP_USER_ROLE.equalsIgnoreCase(curr.target)) {
- if(urdd==null) {
+ if (urdd==null) {
urdd = new UserRoleDAO.Data();
urdd.reconstitute(curr.construct);
}
@@ -1737,7 +1737,7 @@ public class Function {
}
q.futureDAO.delete(trans, curr, false);
} // end for goDecision
- if(ros==null) {
+ if (ros==null) {
//return Result.err(Status.ACC_Future, "Full Approvals not obtained: No action taken");
ros = OP_STATUS.RP;
}
@@ -1747,7 +1747,7 @@ public class Function {
// Convenience method for setting OPSTatus Results
private Result<OP_STATUS> set(Result<OP_STATUS> rs, Result<?> orig) {
- if(orig.isOK()) {
+ if (orig.isOK()) {
return rs;
} else {
return Result.err(orig);
@@ -1767,8 +1767,8 @@ public class Function {
ad.operation = op.name();
// Note ad.updated is created in System
Result<ApprovalDAO.Data> r = q.approvalDAO.create(trans,ad);
- if(r.isOK()) {
- if(first[0]) {
+ if (r.isOK()) {
+ if (first[0]) {
first[0] = false;
} else {
sb.append(", ");
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
index 6bb440ad..98621457 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/PermLookup.java
@@ -75,17 +75,17 @@ class PermLookup {
}
public Result<List<UserRoleDAO.Data>> getUserRoles() {
- if(userRoles==null) {
+ if (userRoles==null) {
userRoles = q.userRoleDAO.readByUser(trans,user);
- if(userRoles.isOKhasData()) {
+ if (userRoles.isOKhasData()) {
List<UserRoleDAO.Data> lurdd = new ArrayList<>();
Date now = new Date();
- for(UserRoleDAO.Data urdd : userRoles.value) {
- if(urdd.expires.after(now)) { // Remove Expired
+ for (UserRoleDAO.Data urdd : userRoles.value) {
+ if (urdd.expires.after(now)) { // Remove Expired
lurdd.add(urdd);
}
}
- if(lurdd.size()==0) {
+ if (lurdd.size()==0) {
return userRoles = Result.err(Status.ERR_UserNotFound,
"%s not found or not associated with any Roles: ",
user);
@@ -101,18 +101,18 @@ class PermLookup {
}
public Result<List<RoleDAO.Data>> getRoles() {
- if(roles==null) {
+ if (roles==null) {
Result<List<UserRoleDAO.Data>> rur = getUserRoles();
- if(rur.isOK()) {
+ if (rur.isOK()) {
List<RoleDAO.Data> lrdd = new ArrayList<>();
for (UserRoleDAO.Data urdata : rur.value) {
// Gather all permissions from all Roles
- if(urdata.ns==null || urdata.rname==null) {
+ if (urdata.ns==null || urdata.rname==null) {
return Result.err(Status.ERR_BadData,"DB Content Error: nulls in User Role %s %s", urdata.user,urdata.role);
} else {
Result<List<RoleDAO.Data>> rlrd = q.roleDAO.read(
trans, urdata.ns, urdata.rname);
- if(rlrd.isOK()) {
+ if (rlrd.isOK()) {
lrdd.addAll(rlrd.value);
}
}
@@ -127,7 +127,7 @@ class PermLookup {
}
public Result<Set<String>> getPermNames() {
- if(permNames==null) {
+ if (permNames==null) {
Result<List<RoleDAO.Data>> rlrd = getRoles();
if (rlrd.isOK()) {
Set<String> pns = new TreeSet<>();
@@ -144,16 +144,16 @@ class PermLookup {
}
public Result<List<PermDAO.Data>> getPerms(boolean lookup) {
- if(perms==null) {
+ if (perms==null) {
// Note: It should be ok for a Valid user to have no permissions -
// Jonathan 8/12/2013
Result<Set<String>> rss = getPermNames();
- if(rss.isOK()) {
+ if (rss.isOK()) {
List<PermDAO.Data> lpdd = new ArrayList<>();
for (String perm : rss.value) {
- if(lookup) {
+ if (lookup) {
Result<String[]> ap = PermDAO.Data.decodeToArray(trans, q, perm);
- if(ap.isOK()) {
+ if (ap.isOK()) {
Result<List<PermDAO.Data>> rlpd = q.permDAO.read(perm,trans,ap.value);
if (rlpd.isOKhasData()) {
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
index 152412a2..e63bc52a 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/hl/Question.java
@@ -166,17 +166,17 @@ public class Question {
// Only want to aggressively cleanse User related Caches... The others,
// just normal refresh
- if(startClean) {
+ if (startClean) {
CachedDAO.startCleansing(trans.env(), credDAO, userRoleDAO);
CachedDAO.startRefresh(trans.env(), cacheInfoDAO);
}
// Set a Timer to Check Caches to send messages for Caching changes
- if(specialLogSlot==null) {
+ if (specialLogSlot==null) {
specialLogSlot = trans.slot(AuthzTransFilter.SPECIAL_LOG_SLOT);
}
- if(transIDSlot==null) {
+ if (transIDSlot==null) {
transIDSlot = trans.slot(AuthzTransFilter.TRANS_ID_SLOT);
}
@@ -226,25 +226,25 @@ public class Question {
public Result<List<PermDAO.Data>> getPermsByUserFromRolesFilter(AuthzTrans trans, String user, String forUser) {
PermLookup plUser = PermLookup.get(trans, this, user);
Result<Set<String>> plPermNames = plUser.getPermNames();
- if(plPermNames.notOK()) {
+ if (plPermNames.notOK()) {
return Result.err(plPermNames);
}
Set<String> nss;
- if(forUser.equals(user)) {
+ if (forUser.equals(user)) {
nss = null;
} else {
// Setup a TreeSet to check on Namespaces to
nss = new TreeSet<>();
PermLookup fUser = PermLookup.get(trans, this, forUser);
Result<Set<String>> forUpn = fUser.getPermNames();
- if(forUpn.notOK()) {
+ if (forUpn.notOK()) {
return Result.err(forUpn);
}
- for(String pn : forUpn.value) {
+ for (String pn : forUpn.value) {
Result<String[]> decoded = PermDAO.Data.decodeToArray(trans, this, pn);
- if(decoded.isOKhasData()) {
+ if (decoded.isOKhasData()) {
nss.add(decoded.value[0]);
} else {
trans.error().log(pn,", derived from a Role, is invalid:",decoded.errorString());
@@ -255,11 +255,11 @@ public class Question {
List<PermDAO.Data> rlpUser = new ArrayList<>();
Result<PermDAO.Data> rpdd;
PermDAO.Data pdd;
- for(String pn : plPermNames.value) {
+ for (String pn : plPermNames.value) {
rpdd = PermDAO.Data.decode(trans, this, pn);
- if(rpdd.isOKhasData()) {
+ if (rpdd.isOKhasData()) {
pdd=rpdd.value;
- if(nss==null || nss.contains(pdd.ns)) {
+ if (nss==null || nss.contains(pdd.ns)) {
rlpUser.add(pdd);
}
} else {
@@ -314,7 +314,7 @@ public class Question {
return Result.err(pr);
}
- if(lookup) {
+ if (lookup) {
Result<List<PermDAO.Data>> rlpd = permDAO.read(trans, pr.value);
if (rlpd.isOKhasData()) {
for (PermDAO.Data pData : rlpd.value) {
@@ -368,7 +368,7 @@ public class Question {
return Result.ok(r.value.get(0));
} else {
int dot;
- if(child==null) {
+ if (child==null) {
return Result.err(Status.ERR_NsNotFound, "No Namespace");
} else {
dot = child.lastIndexOf('.');
@@ -384,12 +384,12 @@ public class Question {
public Result<NsDAO.Data> deriveFirstNsForType(AuthzTrans trans, String str, NsType type) {
NsDAO.Data nsd;
- for(String lookup = str;!".".equals(lookup) && lookup!=null;) {
+ for (String lookup = str;!".".equals(lookup) && lookup!=null;) {
Result<List<NsDAO.Data>> rld = nsDAO.read(trans, lookup);
- if(rld.isOKhasData()) {
+ if (rld.isOKhasData()) {
nsd=rld.value.get(0);
lookup = nsd.parent;
- if(type.type == nsd.type) {
+ if (type.type == nsd.type) {
return Result.ok(nsd);
}
} else {
@@ -455,13 +455,13 @@ public class Question {
public Result<NsDAO.Data> validNSOfDomain(AuthzTrans trans, String id) {
// Take domain, reverse order, and check on NS
String ns;
- if(id.indexOf('@')<0) { // it's already an ns, not an ID
+ if (id.indexOf('@')<0) { // it's already an ns, not an ID
ns = id;
} else {
ns = domain2ns(id);
}
if (ns.length() > 0) {
- if(!trans.org().getDomain().equals(ns)) {
+ if (!trans.org().getDomain().equals(ns)) {
Result<List<NsDAO.Data>> rlnsd = nsDAO.read(trans, ns);
if (rlnsd.isOKhasData()) {
return Result.ok(rlnsd.value.get(0));
@@ -490,7 +490,7 @@ public class Question {
Result<NsDAO.Data> rv = mayUserVirtueOfNS(trans, user, ndd, ":" + ndd.name + ":ns", access.name());
if (rv.isOK()) {
return rv;
- } else if(rv.status==Result.ERR_Backend) {
+ } else if (rv.status==Result.ERR_Backend) {
return Result.err(rv);
} else {
return Result.err(Status.ERR_Denied, "[%s] may not %s in NS [%s]",
@@ -532,7 +532,7 @@ public class Question {
+ rdd.ns + roleInst, access.name());
if (rnsd.isOK()) {
return rnsd;
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
@@ -543,7 +543,7 @@ public class Question {
":" + rdd.ns + ":ns", access.name());
if (rv.isOK()) {
return rv;
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
} else {
return Result.err(Status.ERR_Denied, "[%s] may not %s Role [%s]",
@@ -582,7 +582,7 @@ public class Question {
Result<NsDAO.Data> rnsd = mayUserVirtueOfNS(trans, user, ndd, ":" + pdd.ns + permInst, access.name());
if (rnsd.isOK()) {
return rnsd;
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
@@ -603,7 +603,7 @@ public class Question {
public Result<Void> mayUser(AuthzTrans trans, DelegateDAO.Data dd, Access access) {
try {
Result<NsDAO.Data> rnsd = deriveNs(trans, domain2ns(trans.user()));
- if(rnsd.isOKhasData() && mayUserVirtueOfNS(trans,trans.user(),rnsd.value, ":" + rnsd.value.name + ":ns", access.name()).isOK()) {
+ if (rnsd.isOKhasData() && mayUserVirtueOfNS(trans,trans.user(),rnsd.value, ":" + rnsd.value.name + ":ns", access.name()).isOK()) {
return Result.ok();
}
boolean isUser = trans.user().equals(dd.user);
@@ -663,7 +663,7 @@ public class Question {
Result<List<UserRoleDAO.Data>> rurd;
if ((rurd = userRoleDAO.readUserInRole(trans, user, ns+DOT_ADMIN)).isOKhasData()) {
return Result.ok(nsd);
- } else if(rurd.status==Result.ERR_Backend) {
+ } else if (rurd.status==Result.ERR_Backend) {
return Result.err(rurd);
}
@@ -679,12 +679,12 @@ public class Question {
Result<NsDAO.Data> rnsd = deriveNs(trans, ns.substring(0, dot));
if (rnsd.isOK()) {
rnsd = mayUserVirtueOfNS(trans, user, rnsd.value, ns_and_type,access);
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
if (rnsd.isOK()) {
return Result.ok(nsd);
- } else if(rnsd.status==Result.ERR_Backend) {
+ } else if (rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
}
@@ -712,7 +712,7 @@ public class Question {
if (ns.equals(pd.ns)) {
if (type.equals(pd.type)) {
if (PermEval.evalInstance(pd.instance, instance)) {
- if(PermEval.evalAction(pd.action, action)) { // don't return action here, might miss other action
+ if (PermEval.evalAction(pd.action, action)) { // don't return action here, might miss other action
return true;
}
}
@@ -733,7 +733,7 @@ public class Question {
}
Result<Date> rv = null;
- if(result.isOK()) {
+ if (result.isOK()) {
if (result.isEmpty()) {
rv = Result.err(Status.ERR_UserNotFound, user);
if (willSpecialLog(trans,user)) {
@@ -743,14 +743,14 @@ public class Question {
Date now = new Date();//long now = System.currentTimeMillis();
// Bug noticed 6/22. Sorting on the result can cause Concurrency Issues.
List<CredDAO.Data> cddl;
- if(result.value.size() > 1) {
+ if (result.value.size() > 1) {
cddl = new ArrayList<>(result.value.size());
- for(CredDAO.Data old : result.value) {
- if(old.type==CredDAO.BASIC_AUTH || old.type==CredDAO.BASIC_AUTH_SHA256) {
+ for (CredDAO.Data old : result.value) {
+ if (old.type==CredDAO.BASIC_AUTH || old.type==CredDAO.BASIC_AUTH_SHA256) {
cddl.add(old);
}
}
- if(cddl.size()>1) {
+ if (cddl.size()>1) {
Collections.sort(cddl,new Comparator<CredDAO.Data>() {
@Override
public int compare(org.onap.aaf.auth.dao.cass.CredDAO.Data a,
@@ -766,7 +766,7 @@ public class Question {
Date expired = null;
StringBuilder debug = willSpecialLog(trans,user)?new StringBuilder():null;
for (CredDAO.Data cdd : cddl) {
- if(!cdd.id.equals(user)) {
+ if (!cdd.id.equals(user)) {
trans.error().log("doesUserCredMatch DB call does not match for user: " + user);
}
if (cdd.expires.after(now)) {
@@ -776,7 +776,7 @@ public class Question {
switch(cdd.type) {
case CredDAO.BASIC_AUTH:
byte[] md5=Hash.hashMD5(cred);
- if(Hash.compareTo(md5,dbcred)==0) {
+ if (Hash.compareTo(md5,dbcred)==0) {
checkLessThanDays(trans,7,now,cdd);
return Result.ok(cdd.expires);
} else if (debug!=null) {
@@ -789,7 +789,7 @@ public class Question {
bb.put(cred);
byte[] hash = Hash.hashSHA256(bb.array());
- if(Hash.compareTo(hash,dbcred)==0) {
+ if (Hash.compareTo(hash,dbcred)==0) {
checkLessThanDays(trans,7,now,cdd);
return Result.ok(cdd.expires);
} else if (debug!=null) {
@@ -803,17 +803,17 @@ public class Question {
trans.error().log(e);
}
} else {
- if(expired==null || expired.before(cdd.expires)) {
+ if (expired==null || expired.before(cdd.expires)) {
expired = cdd.expires;
}
}
} // end for each
- if(debug==null) {
+ if (debug==null) {
trans.audit().printf("No cred matches ip=%s, user=%s\n",trans.ip(),user);
} else {
trans.audit().printf("No cred matches ip=%s, user=%s %s\n",trans.ip(),user,debug.toString());
}
- if(expired!=null) {
+ if (expired!=null) {
// Note: this is only returned if there are no good Credentials
rv = Result.err(Status.ERR_Security,
"Credentials %s from %s expired %s",trans.user(), trans.ip(), Chrono.dateTime(expired));
@@ -840,7 +840,7 @@ public class Question {
private void checkLessThanDays(AuthzTrans trans, int days, Date now, Data cdd) {
long close = now.getTime() + (days * 86400000);
long cexp=cdd.expires.getTime();
- if(cexp<close) {
+ if (cexp<close) {
int daysLeft = days-(int)((close-cexp)/86400000);
trans.audit().printf("user=%s,ip=%s,expires=%s,days=%d,msg=\"Password expires in less than %d day%s\"",
cdd.id,trans.ip(),Chrono.dateOnlyStamp(cdd.expires),daysLeft, daysLeft,daysLeft==1?"":"s");
@@ -849,7 +849,7 @@ public class Question {
public Result<CredDAO.Data> userCredSetup(AuthzTrans trans, CredDAO.Data cred) {
- if(cred.type==CredDAO.RAW) {
+ if (cred.type==CredDAO.RAW) {
TimeTaken tt = trans.start("Hash Cred", Env.SUB);
try {
cred.type = CredDAO.BASIC_AUTH_SHA256;
@@ -935,32 +935,32 @@ public class Question {
if (all || NsDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, NsDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, NsDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, NsDAO.TABLE, seg);
}
if (all || PermDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, PermDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, PermDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, PermDAO.TABLE,seg);
}
if (all || RoleDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, RoleDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, RoleDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, RoleDAO.TABLE,seg);
}
if (all || UserRoleDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, UserRoleDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, UserRoleDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, UserRoleDAO.TABLE,seg);
}
if (all || CredDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, CredDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, CredDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, CredDAO.TABLE,seg);
}
if (all || CertDAO.TABLE.equals(cname)) {
int seg[] = series(NsDAO.CACHE_SEG);
- for(int i: seg) {cacheClear(trans, CertDAO.TABLE,i);}
+ for (int i: seg) {cacheClear(trans, CertDAO.TABLE,i);}
rv = cacheInfoDAO.touch(trans, CertDAO.TABLE,seg);
}
@@ -999,11 +999,11 @@ public class Question {
public boolean isDelegated(AuthzTrans trans, String user, String approver, Map<String,Result<List<DelegateDAO.Data>>> rldd ) {
Result<List<DelegateDAO.Data>> userDelegatedFor = rldd.get(user);
- if(userDelegatedFor==null) {
+ if (userDelegatedFor==null) {
userDelegatedFor=delegateDAO.readByDelegate(trans, user);
rldd.put(user, userDelegatedFor);
}
- if(userDelegatedFor.isOKhasData()) {
+ if (userDelegatedFor.isOKhasData()) {
for (DelegateDAO.Data curr : userDelegatedFor.value) {
if (curr.user.equals(approver) && curr.delegate.equals(user)
&& curr.expires.after(new Date())) {
@@ -1016,8 +1016,8 @@ public class Question {
public static boolean willSpecialLog(AuthzTrans trans, String user) {
Boolean b = trans.get(specialLogSlot, null);
- if(b==null) { // we haven't evaluated in this trans for Special Log yet
- if(specialLog==null) {
+ if (b==null) { // we haven't evaluated in this trans for Special Log yet
+ if (specialLog==null) {
return false;
} else {
b = specialLog.contains(user);
@@ -1042,21 +1042,21 @@ public class Question {
specialLog = new HashSet<>();
}
boolean rc = specialLog.add(id);
- if(rc) {
+ if (rc) {
trans.trace().printf("Trace on for %s requested by %s",id,trans.user());
}
return rc;
}
public static synchronized boolean specialLogOff(AuthzTrans trans, String id) {
- if(specialLog==null) {
+ if (specialLog==null) {
return false;
}
boolean rv = specialLog.remove(id);
if (specialLog.isEmpty()) {
specialLog = null;
}
- if(rv) {
+ if (rv) {
trans.trace().printf("Trace off for %s requested by %s",id,trans.user());
}
return rv;
@@ -1086,8 +1086,8 @@ public class Question {
public boolean isAdmin(AuthzTrans trans, String user, String ns) {
Date now = new Date();
Result<List<UserRoleDAO.Data>> rur = userRoleDAO.read(trans, user,ns+DOT_ADMIN);
- if(rur.isOKhasData()) {for(UserRoleDAO.Data urdd : rur.value){
- if(urdd.expires.after(now)) {
+ if (rur.isOKhasData()) {for (UserRoleDAO.Data urdd : rur.value){
+ if (urdd.expires.after(now)) {
return true;
}
}};
@@ -1097,8 +1097,8 @@ public class Question {
public boolean isOwner(AuthzTrans trans, String user, String ns) {
Result<List<UserRoleDAO.Data>> rur = userRoleDAO.read(trans, user,ns+DOT_OWNER);
Date now = new Date();
- if(rur.isOKhasData()) {for(UserRoleDAO.Data urdd : rur.value){
- if(urdd.expires.after(now)) {
+ if (rur.isOKhasData()) {for (UserRoleDAO.Data urdd : rur.value){
+ if (urdd.expires.after(now)) {
return true;
}
}};
@@ -1109,8 +1109,8 @@ public class Question {
Result<List<UserRoleDAO.Data>> rur = userRoleDAO.readByRole(trans,ns+DOT_OWNER);
Date now = new Date();
int count = 0;
- if(rur.isOKhasData()) {for(UserRoleDAO.Data urdd : rur.value){
- if(urdd.expires.after(now)) {
+ if (rur.isOKhasData()) {for (UserRoleDAO.Data urdd : rur.value){
+ if (urdd.expires.after(now)) {
++count;
}
}};
@@ -1129,7 +1129,7 @@ public class Question {
byte[] from = name.getBytes();
StringBuilder sb = new StringBuilder();
byte f;
- for(int i=0;i<from.length;++i) {
+ for (int i=0;i<from.length;++i) {
f=(byte)(from[i]); // printables;
sb.append((char)((f>>4)+0x61));
sb.append((char)((f&0x0F)+0x61));
@@ -1141,7 +1141,7 @@ public class Question {
byte[] from = name.getBytes();
StringBuilder sb = new StringBuilder();
char c;
- for(int i=0;i<from.length;++i) {
+ for (int i=0;i<from.length;++i) {
c = (char)((from[i]-0x61)<<4);
c |= (from[++i]-0x61);
sb.append(c);
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
index 1fb050b8..93fab977 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLocator.java
@@ -57,13 +57,13 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
super(env.access(), name, 1000L /* Don't hit DB more than once a second */);
this.env = env;
this.ldao = ldao;
- if(version!=null) {
+ if (version!=null) {
try {
String[] v = Split.split('.',version);
- if(v.length>0) {major = Integer.parseInt(v[0]);}
- if(v.length>1) {minor = Integer.parseInt(v[1]);}
- if(v.length>2) {patch = Integer.parseInt(v[2]);}
- if(v.length>3) {pkg = Integer.parseInt(v[3]);}
+ if (v.length>0) {major = Integer.parseInt(v[0]);}
+ if (v.length>1) {minor = Integer.parseInt(v[1]);}
+ if (v.length>2) {patch = Integer.parseInt(v[2]);}
+ if (v.length>3) {pkg = Integer.parseInt(v[3]);}
} catch (NumberFormatException e) {
throw new LocatorException("Invalid Version String: " + version);
}
@@ -83,13 +83,13 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
public boolean refresh() {
AuthzTrans trans = env.newTransNoAvg();
Result<List<Data>> rl = ldao.readByName(trans, name);
- if(rl.isOK()) {
+ if (rl.isOK()) {
LinkedList<EP> epl = new LinkedList<>();
- for(Data d : rl.value) {
-// if(myhostname!=null && d.port==myport && d.hostname.equals(myhostname)) {
+ for (Data d : rl.value) {
+// if (myhostname!=null && d.port==myport && d.hostname.equals(myhostname)) {
// continue;
// }
- if((major<0 || major==d.major) &&
+ if ((major<0 || major==d.major) &&
(minor<0 || minor<=d.minor) &&
(patch<0 || patch==d.patch) &&
(pkg<0 || pkg ==d.pkg)) {
@@ -104,7 +104,7 @@ public class DirectAAFLocator extends AbsAAFLocator<AuthzTrans> {
endpoint.setLatitude(d.latitude);
endpoint.setLongitude(d.longitude);
endpoint.setProtocol(d.protocol);
- for(String s : d.subprotocol(false)) {
+ for (String s : d.subprotocol(false)) {
endpoint.getSubprotocol().add(s);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
index 75f6c7a5..59613961 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFLur.java
@@ -61,10 +61,10 @@ public class DirectAAFLur implements Lur {
Result<List<Data>> pdr = question.getPermsByUser(trans, bait.getName(),false);
switch(pdr.status) {
case OK:
- for(PermDAO.Data d : pdr.value) {
- if(!rv) {
+ for (PermDAO.Data d : pdr.value) {
+ if (!rv) {
for (Permission p : pond) {
- if(new PermPermission(d).match(p)) {
+ if (new PermPermission(d).match(p)) {
rv=true;
break;
}
@@ -86,7 +86,7 @@ public class DirectAAFLur implements Lur {
Result<List<Data>> pdr = question.getPermsByUser(env.newTrans(), bait.getName(),false);
switch(pdr.status) {
case OK:
- for(PermDAO.Data d : pdr.value) {
+ for (PermDAO.Data d : pdr.value) {
permissions.add(new PermPermission(d));
}
break;
@@ -135,23 +135,23 @@ public class DirectAAFLur implements Lur {
@Override
public boolean match(Permission p) {
- if(p==null) {
+ if (p==null) {
return false;
}
PermDAO.Data pd;
- if(p instanceof DirectAAFLur.PermPermission) {
+ if (p instanceof DirectAAFLur.PermPermission) {
pd = ((DirectAAFLur.PermPermission)p).data;
- if(data.ns.equals(pd.ns))
- if(data.type.equals(pd.type))
- if(data.instance!=null && (data.instance.equals(pd.instance) || "*".equals(data.instance)))
- if(data.action!=null && (data.action.equals(pd.action) || "*".equals(data.action)))
+ if (data.ns.equals(pd.ns))
+ if (data.type.equals(pd.type))
+ if (data.instance!=null && (data.instance.equals(pd.instance) || "*".equals(data.instance)))
+ if (data.action!=null && (data.action.equals(pd.action) || "*".equals(data.action)))
return true;
} else{
String[] lp = p.getKey().split("\\|");
- if(lp.length<3)return false;
- if(data.fullType().equals(lp[0]))
- if(data.instance!=null && (data.instance.equals(lp[1]) || "*".equals(data.instance)))
- if(data.action!=null && (data.action.equals(lp[2]) || "*".equals(data.action)))
+ if (lp.length<3)return false;
+ if (data.fullType().equals(lp[0]))
+ if (data.instance!=null && (data.instance.equals(lp[1]) || "*".equals(data.instance)))
+ if (data.action!=null && (data.action.equals(lp[2]) || "*".equals(data.action)))
return true;
}
return false;
@@ -180,9 +180,9 @@ public class DirectAAFLur implements Lur {
@Override
public Permission createPerm(String p) {
String[] params = Split.split('|', p);
- if(params.length==3) {
+ if (params.length==3) {
Result<NsSplit> nss = question.deriveNsSplit(NullTrans.singleton(), params[0]);
- if(nss.isOK()) {
+ if (nss.isOK()) {
return new PermPermission(nss.value.ns,nss.value.name,params[1],params[2]);
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
index 9d4cd05f..3ef532b4 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectAAFUserPass.java
@@ -54,12 +54,12 @@ public class DirectAAFUserPass implements CredVal {
public boolean validate(String user, Type type, byte[] pass, Object state) {
try {
AuthzTrans trans;
- if(state !=null) {
- if(state instanceof AuthzTrans) {
+ if (state !=null) {
+ if (state instanceof AuthzTrans) {
trans = (AuthzTrans)state;
} else {
trans = env.newTransNoAvg();
- if(state instanceof HttpServletRequest) {
+ if (state instanceof HttpServletRequest) {
trans.set((HttpServletRequest)state);
}
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
index 6dd5e006..f3351dae 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectCertIdentity.java
@@ -53,10 +53,10 @@ public class DirectCertIdentity implements CertIdentity {
@Override
public TaggedPrincipal identity(HttpServletRequest req, X509Certificate cert, byte[] _certBytes) throws CertificateException {
byte[] certBytes = _certBytes;
- if(cert==null && certBytes==null) {
+ if (cert==null && certBytes==null) {
return null;
}
- if(certBytes==null) {
+ if (certBytes==null) {
certBytes = cert.getEncoded();
}
byte[] fingerprint = X509Taf.getFingerPrint(certBytes);
@@ -64,7 +64,7 @@ public class DirectCertIdentity implements CertIdentity {
AuthzTrans trans = (AuthzTrans) req.getAttribute(TransFilter.TRANS_TAG);
Result<List<Data>> cresp = certDAO.read(trans, ByteBuffer.wrap(fingerprint));
- if(cresp.isOKhasData()) {
+ if (cresp.isOKhasData()) {
Data cdata = cresp.value.get(0);
return new X509Principal(cdata.id,cert,certBytes,null);
}
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
index caededa2..aa6bf8c5 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectLocatorCreator.java
@@ -40,7 +40,7 @@ public class DirectLocatorCreator implements AbsAAFLocator.LocatorCreator {
@Override
public AbsAAFLocator<?> create(String key, String version) throws LocatorException {
DirectAAFLocator dal = new DirectAAFLocator(env,locateDAO,key,version);
- if(myhostname!=null) {
+ if (myhostname!=null) {
dal.setSelf(myhostname, myport);
}
return dal;
diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
index da7044cf..9eea77e3 100644
--- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
+++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/direct/DirectRegistrar.java
@@ -45,14 +45,14 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
try {
String latitude = access.getProperty(Config.CADI_LATITUDE, null);
- if(latitude==null) {
+ if (latitude==null) {
latitude = access.getProperty("AFT_LATITUDE", null);
}
String longitude = access.getProperty(Config.CADI_LONGITUDE, null);
- if(longitude==null) {
+ if (longitude==null) {
longitude = access.getProperty("AFT_LONGITUDE", null);
}
- if(latitude==null || longitude==null) {
+ if (latitude==null || longitude==null) {
throw new CadiException(Config.CADI_LATITUDE + " and " + Config.CADI_LONGITUDE + " is required");
} else {
locate.latitude = Float.parseFloat(latitude);
@@ -64,18 +64,18 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
locate.minor = split.length>1?Integer.parseInt(split[1]):0;
locate.major = split.length>0?Integer.parseInt(split[0]):0;
locate.hostname = access.getProperty(Config.AAF_REGISTER_AS, null);
- if(locate.hostname==null) {
+ if (locate.hostname==null) {
locate.hostname = access.getProperty(Config.HOSTNAME, null);
}
- if(locate.hostname==null) {
+ if (locate.hostname==null) {
locate.hostname = Inet4Address.getLocalHost().getHostName();
}
String subprotocols = access.getProperty(Config.CADI_PROTOCOLS, null);
- if(subprotocols==null) {
+ if (subprotocols==null) {
locate.protocol="http";
} else {
locate.protocol="https";
- for(String s : Split.split(',', subprotocols)) {
+ for (String s : Split.split(',', subprotocols)) {
locate.subprotocol(true).add(s);
}
}
@@ -87,7 +87,7 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
@Override
public Result<Void> update(AuthzEnv env) {
org.onap.aaf.auth.layer.Result<Void> dr = ldao.update(env.newTransNoAvg(), locate);
- if(dr.isOK()) {
+ if (dr.isOK()) {
return Result.ok(200, null);
} else {
return Result.err(503, dr.errorString());
@@ -100,7 +100,7 @@ public class DirectRegistrar implements Registrant<AuthzEnv> {
@Override
public Result<Void> cancel(AuthzEnv env) {
org.onap.aaf.auth.layer.Result<Void> dr = ldao.delete(env.newTransNoAvg(), locate, false);
- if(dr.isOK()) {
+ if (dr.isOK()) {
return Result.ok(200, null);
} else {
return Result.err(503, dr.errorString());