diff options
author | Instrumental <jonathan.gathman@att.com> | 2018-09-07 13:43:23 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2018-09-07 13:43:26 -0500 |
commit | 7e966914050e66219689001ff4ab601a49eef0ac (patch) | |
tree | b1bf643f2d191207adc7d9f6b41ac20f56083e76 /auth/auth-cmd | |
parent | ead32f193586e39b59bb366bddf70e665173a52d (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-cmd')
47 files changed, 287 insertions, 287 deletions
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java index c308e775..ea366576 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/AAFcli.java @@ -161,7 +161,7 @@ public class AAFcli { sb.append(largs[idx], e, v); if ((e = largs[idx].indexOf(']', v)) >= 0) { String p = access.getProperty(largs[idx].substring(v + 2, e),null); - if(p==null) { + if (p==null) { p = System.getProperty(largs[idx].substring(v+2,e)); } ++e; @@ -183,7 +183,7 @@ public class AAFcli { while (rv && idx < largs.length) { // Allow Script to change Credential if (!gui) { - if("as".equalsIgnoreCase(largs[idx])) { + if ("as".equalsIgnoreCase(largs[idx])) { if (largs.length > ++idx) { // get Password from Props with ID as Key String user = largs[idx++]; @@ -255,13 +255,13 @@ public class AAFcli { } - if("REQUEST".equalsIgnoreCase(largs[idx])) { + if ("REQUEST".equalsIgnoreCase(largs[idx])) { request=true; ++idx; - } else if("FORCE".equalsIgnoreCase(largs[idx])) { + } else if ("FORCE".equalsIgnoreCase(largs[idx])) { force="true"; ++idx; - } else if("DETAILS".equalsIgnoreCase(largs[idx])) { + } else if ("DETAILS".equalsIgnoreCase(largs[idx])) { showDetails=true; ++idx; } else if ("set".equalsIgnoreCase(largs[idx])) { @@ -271,11 +271,11 @@ public class AAFcli { if (equals < 0) { tag = largs[idx]; value = access.getProperty(Config.AAF_APPPASS,null); - if(value==null) { + if (value==null) { break; } else { value = access.decrypt(value, false); - if(value==null) { + if (value==null) { break; } access.getProperties().put(tag, value); @@ -287,11 +287,11 @@ public class AAFcli { pw.println("set " + tag + ' ' + value); } boolean isTrue = "TRUE".equalsIgnoreCase(value); - if("FORCE".equalsIgnoreCase(tag)) { + if ("FORCE".equalsIgnoreCase(tag)) { force = value; - } else if("REQUEST".equalsIgnoreCase(tag)) { + } else if ("REQUEST".equalsIgnoreCase(tag)) { request = isTrue; - } else if("DETAILS".equalsIgnoreCase(tag)) { + } else if ("DETAILS".equalsIgnoreCase(tag)) { showDetails = isTrue; } else { access.getProperties().put(tag, value); @@ -380,7 +380,7 @@ public class AAFcli { } else { quote = ch; } - } else if(ch=='|' && quote==0) { + } else if (ch=='|' && quote==0) { arr.add(sb.toString()); sb.setLength(0); start = true; @@ -437,7 +437,7 @@ public class AAFcli { try { PropAccess access = aafsso.access(); - if(aafsso.ok()) { + if (aafsso.ok()) { Define.set(access); AuthzEnv env = new AuthzEnv(access); @@ -450,7 +450,7 @@ public class AAFcli { for (int i = 0; i < args.length; ++i) { if ("-i".equalsIgnoreCase(args[i])) { rdr = new InputStreamReader(System.in); - // } else if("-o".equalsIgnoreCase(args[i])) { + // } else if ("-o".equalsIgnoreCase(args[i])) { // // shall we do something different? Output stream is // already done... } else if ("-f".equalsIgnoreCase(args[i])) { @@ -488,7 +488,7 @@ public class AAFcli { aafsso.setStdErrDefault(); // Note, with AAF Locator, this may not longer be necessary 3/2018 Jonathan - if(!aafsso.loginOnly()) { + if (!aafsso.loginOnly()) { // try { // loc = new AAFLocator(si,new URI(access.getProperty(Config.AAF_URL))); // } catch (Throwable t) { @@ -502,7 +502,7 @@ public class AAFcli { TIMEOUT = Integer.parseInt(access.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)); // HMangr hman = new HMangr(access, loc).readTimeout(TIMEOUT).apiVersion(Config.AAF_DEFAULT_VERSION); - if(access.getProperty(Config.AAF_DEFAULT_REALM)==null) { + if (access.getProperty(Config.AAF_DEFAULT_REALM)==null) { access.setProperty(Config.AAF_DEFAULT_REALM, "people.osaaf.org"); aafsso.addProp(Config.AAF_DEFAULT_REALM, "people.osaaf.org"); } @@ -511,13 +511,13 @@ public class AAFcli { aafcon.hman(), aafcon.securityInfo(), aafcon.securityInfo().defSS); // new HBasicAuthSS(si,aafsso.user(), access.decrypt(aafsso.enc_pass(),false))); // } - if(!ignoreDelay) { + if (!ignoreDelay) { File delay = new File("aafcli.delay"); - if(delay.exists()) { + if (delay.exists()) { BufferedReader br = new BufferedReader(new FileReader(delay)); try { globalDelay = Integer.parseInt(br.readLine()); - } catch(Exception e) { + } catch (Exception e) { access.log(Level.DEBUG,e); } finally { br.close(); @@ -596,7 +596,7 @@ public class AAFcli { System.err.println(err); } } - if(noexit==null) { + if (noexit==null) { return; } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java index 168d2753..77d1894f 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/BaseCmd.java @@ -45,20 +45,20 @@ public class BaseCmd<CMD extends Cmd> extends Cmd { @Override public int _exec( int idx, final String ... args) throws CadiException, APIException, LocatorException { - if(args.length-idx<1) { + if (args.length-idx<1) { pw().println(build(new StringBuilder(),null).toString()); } else { String s = args[idx]; String name; Cmd empty = null; - for(Cmd c: cmds) { + for (Cmd c: cmds) { name = c.getName(); - if(name==null && empty==null) { // Mark with Command is null, and take the first one. + if (name==null && empty==null) { // Mark with Command is null, and take the first one. empty = c; - } else if(s.equalsIgnoreCase(c.getName())) + } else if (s.equalsIgnoreCase(c.getName())) return c.exec(idx+1, args); } - if(empty!=null) { + if (empty!=null) { return empty.exec(idx, args); // If name is null, don't account for it on command line. Jonathan 4-29 } pw().println("Instructions not understood."); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java index 9ec126b4..3a0c869b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Cmd.java @@ -92,21 +92,21 @@ public abstract class Cmd { this.aafcli = aafcli; this.env = aafcli.env; this.access = aafcli.access; - if(parent!=null) { + if (parent!=null) { parent.children.add(this); } children = new ArrayList<>(); this.params = params; this.name = name; required=0; - for(Param p : params) { - if(p.required) { + for (Param p : params) { + if (p.required) { ++required; } } String temp = access.getProperty(Config.AAF_DEFAULT_REALM,null); - if(temp!=null && !temp.startsWith("@")) { + if (temp!=null && !temp.startsWith("@")) { defaultRealm = '@' + temp; } else { defaultRealm="<Set Default Realm>"; @@ -114,7 +114,7 @@ public abstract class Cmd { } public final int exec(int idx, String ... args) throws CadiException, APIException, LocatorException { - if(args.length-idx<required) { + if (args.length-idx<required) { throw new CadiException(build(new StringBuilder("Too few args: "),null).toString()); } return _exec(idx,args); @@ -135,7 +135,7 @@ public abstract class Cmd { protected void api(StringBuilder sb, int indent, HttpMethods meth, String pathInfo, Class<?> cls,boolean head) { final String smeth = meth.name(); - if(head) { + if (head) { sb.append('\n'); detailLine(sb,indent,"APIs:"); } @@ -145,7 +145,7 @@ public abstract class Cmd { sb.append(' '); sb.append(pathInfo); String cliString = aafcli.typeString(cls,true); - if(indent+smeth.length()+pathInfo.length()+cliString.length()+2>80) { + if (indent+smeth.length()+pathInfo.length()+cliString.length()+2>80) { sb.append(" ..."); multiChar(sb,indent+3+smeth.length(),' ',0); } else { // same line @@ -156,54 +156,54 @@ public abstract class Cmd { protected void multiChar(StringBuilder sb, int length, char c, int indent) { sb.append('\n'); - for(int i=0;i<indent;++i)sb.append(' '); - for(int i=indent;i<length;++i)sb.append(c); + for (int i=0;i<indent;++i)sb.append(' '); + for (int i=indent;i<length;++i)sb.append(c); } public StringBuilder build(StringBuilder sb, StringBuilder detail) { - if(name!=null) { + if (name!=null) { sb.append(name); sb.append(' '); } int line = sb.lastIndexOf("\n")+1; - if(line<0) { + if (line<0) { line=0; } int indent = sb.length()-line; - for(Param p : params) { + for (Param p : params) { sb.append(p.required?'<':'['); sb.append(p.tag); sb.append(p.required?"> ": "] "); } boolean first = true; - for(Cmd child : children) { - if(!(child instanceof DeprecatedCMD)) { - if(first) { + for (Cmd child : children) { + if (!(child instanceof DeprecatedCMD)) { + if (first) { first = false; - } else if(detail==null) { + } else if (detail==null) { multiChar(sb,indent,' ',0); } else { // Write parents for Detailed Report Stack<String> stack = new Stack<String>(); - for(Cmd c = child.parent;c!=null;c=c.parent) { - if(c.name!=null) { + for (Cmd c = child.parent;c!=null;c=c.parent) { + if (c.name!=null) { stack.push(c.name); } } - if(!stack.isEmpty()) { + if (!stack.isEmpty()) { sb.append(" "); - while(!stack.isEmpty()) { + while (!stack.isEmpty()) { sb.append(stack.pop()); sb.append(' '); } } } child.build(sb,detail); - if(detail!=null) { + if (detail!=null) { child.detailedHelp(4, detail); // If Child wrote something, then add, bracketing by lines - if(detail.length()>0) { + if (detail.length()>0) { multiChar(sb,80,'-',2); sb.append(detail); sb.append('\n'); @@ -223,9 +223,9 @@ public abstract class Cmd { StringBuilder sb = new StringBuilder("Failed"); String desc = future.body(); int code = future.code(); - if(desc==null || desc.length()==0) { + if (desc==null || desc.length()==0) { withCode(sb,code); - } else if(desc.startsWith("{")) { + } else if (desc.startsWith("{")) { StringReader sr = new StringReader(desc); try { // Note: 11-18-2013, JonathanGathman. This rather convoluted Message Structure required by TSS Restful Specs, reflecting "Northbound" practices. @@ -240,7 +240,7 @@ public abstract class Cmd { String var = vars.get(varCounter); ++varCounter; if (messageBody.indexOf("%" + varCounter) >= 0) { - if((pipe = var.indexOf('|'))>=0) { // In AAF, we use a PIPE for Choice + if ((pipe = var.indexOf('|'))>=0) { // In AAF, we use a PIPE for Choice if (aafcli.isTest()) { String expiresStr = var.substring(pipe); var = var.replace(expiresStr, "[Placeholder]"); @@ -260,7 +260,7 @@ public abstract class Cmd { withCode(sb,code); sb.append(" (Note: Details cannot be obtained from Error Structure)"); } - } else if(desc.startsWith("<html>")){ // Core Jetty, etc sends HTML for Browsers + } else if (desc.startsWith("<html>")){ // Core Jetty, etc sends HTML for Browsers withCode(sb,code); } else { sb.append(" with code "); @@ -296,11 +296,11 @@ public abstract class Cmd { protected void setStartEnd(Request req) { // Set Start/End Dates, if exist String str; - if((str = access.getProperty(Cmd.STARTDATE,null))!=null) { + if ((str = access.getProperty(Cmd.STARTDATE,null))!=null) { req.setStart(Chrono.timeStamp(Date.valueOf(str))); } - if((str = access.getProperty(Cmd.ENDDATE,null))!=null) { + if ((str = access.getProperty(Cmd.ENDDATE,null))!=null) { req.setEnd(Chrono.timeStamp(Date.valueOf(str))); } } @@ -326,7 +326,7 @@ public abstract class Cmd { @SuppressWarnings("unchecked") public static <T> RosettaDF<T> getDF(AuthzEnv env, Class<T> cls) throws APIException { RosettaDF<T> rdf = (RosettaDF<T>)dfs.get(cls); - if(rdf == null) { + if (rdf == null) { rdf = env.newDataFactory(cls); dfs.put(cls, rdf); } @@ -341,11 +341,11 @@ public abstract class Cmd { } } else { pw().println(header); - for(int i=0;i<lineLength;++i)pw().print('-'); + for (int i=0;i<lineLength;++i)pw().print('-'); pw().println(); pw().format(hformat,"Date","Table","User","Memo"); - for(int i=0;i<lineLength;++i)pw().print('-'); + for (int i=0;i<lineLength;++i)pw().print('-'); pw().println(); // Save Server time by Sorting locally @@ -357,7 +357,7 @@ public abstract class Cmd { } }); - for(History.Item item : items) { + for (History.Item item : items) { GregorianCalendar gc = item.getTimestamp().toGregorianCalendar(); pw().format(hformat, dateFmt.format(gc.getTime()), @@ -376,8 +376,8 @@ public abstract class Cmd { public static String optionsToString(String[] options) { StringBuilder sb = new StringBuilder(); boolean first = true; - for(String s : options) { - if(first) { + for (String s : options) { + if (first) { first = false; } else { sb.append('|'); @@ -398,8 +398,8 @@ public abstract class Cmd { * @throws Exception */ public int whichOption(String[] options, String test) throws CadiException { - for(int i=0;i<options.length;++i) { - if(options[i].equals(test)) { + for (int i=0;i<options.length;++i) { + if (options[i].equals(test)) { return i; } } @@ -416,7 +416,7 @@ public abstract class Cmd { public<RET> RET same(Retryable<RET> retryable) throws APIException, CadiException, LocatorException { // We're storing in AAFCli, because we know it's always the same, and single threaded - if(aafcli.prevCall!=null) { + if (aafcli.prevCall!=null) { retryable.item(aafcli.prevCall.item()); retryable.lastClient=aafcli.prevCall.lastClient; } @@ -450,9 +450,9 @@ public abstract class Cmd { pw().println(); boolean first = true; int i=0; - for(String s : str) { - if(first) { - if(++i>1) { + for (String s : str) { + if (first) { + if (++i>1) { first = false; pw().print("["); } @@ -461,7 +461,7 @@ public abstract class Cmd { } pw().print(s); } - if(!first) { + if (!first) { pw().print(']'); } pw().println(); @@ -475,25 +475,25 @@ public abstract class Cmd { } public void reportLine() { - for(int i=0;i<lineLength;++i)pw().print('-'); + for (int i=0;i<lineLength;++i)pw().print('-'); pw().println(); } protected void setQueryParamsOn(Rcli<?> rcli) { StringBuilder sb=null; String force; - if((force=aafcli.forceString())!=null) { + if ((force=aafcli.forceString())!=null) { sb = new StringBuilder("force="); sb.append(force); } - if(aafcli.addRequest()) { - if(sb==null) { + if (aafcli.addRequest()) { + if (sb==null) { sb = new StringBuilder("future=true"); } else { sb.append("&future=true"); } } - if(sb!=null && rcli!=null) { + if (sb!=null && rcli!=null) { rcli.setQueryParams(sb.toString()); } } @@ -504,7 +504,7 @@ public abstract class Cmd { // * @return // */ // protected String checkForce() { -// if(TRUE.equalsIgnoreCase(env.getProperty(FORCE, FALSE))) { +// if (TRUE.equalsIgnoreCase(env.getProperty(FORCE, FALSE))) { // env.setProperty(FORCE, FALSE); // return "true"; // } @@ -513,7 +513,7 @@ public abstract class Cmd { public String toString() { StringBuilder sb = new StringBuilder(); - if(parent==null) { // ultimate parent + if (parent==null) { // ultimate parent build(sb,null); return sb.toString(); } else { @@ -530,7 +530,7 @@ public abstract class Cmd { * @throws OrganizationException */ public String fullID(String id) { - if(id != null) { + if (id != null) { if (id.indexOf('@') < 0) { id+=defaultRealm; } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java index bd70d9e5..66a3355a 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/Help.java @@ -53,27 +53,27 @@ public class Help extends Cmd { details = aafcli.isDetailed()?new StringBuilder():null; String comp = args.length>idx?args[idx++]:null; - if("help".equalsIgnoreCase(comp)) { + if ("help".equalsIgnoreCase(comp)) { build(sb,null); detailedHelp(4, sb); sb.append('\n'); } else { - for(Cmd c : cmds) { - if(!(c instanceof DeprecatedCMD)) { - if(comp!=null) { - if(comp.equals(c.getName())) { + for (Cmd c : cmds) { + if (!(c instanceof DeprecatedCMD)) { + if (comp!=null) { + if (comp.equals(c.getName())) { multiChar(sb,2,' ',0); c.build(sb,details); } } else { - if(first) { + if (first) { first=false; } else { multiChar(sb,80,'-',2); } multiChar(sb,2,' ',0); c.build(sb,details); - if(details!=null) { + if (details!=null) { c.detailedHelp(4, sb); // multiChar(sb,80,'-',2); } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java index ca8a72ca..5c74dda8 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Clear.java @@ -48,7 +48,7 @@ public class Clear extends Cmd { public int _exec(int _idx, String ... args) throws CadiException, APIException, LocatorException { int idx = _idx; int rv=409; - for(final String name : args[idx++].split(COMMA)) { + for (final String name : args[idx++].split(COMMA)) { rv = all(new Retryable<Integer>() { @Override public Integer code(Rcli<?> client) throws APIException, CadiException { @@ -57,11 +57,11 @@ public class Clear extends Cmd { "/mgmt/cache/"+name, Void.class ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().println("Cleared Cache for " + name + " on " + client); rv=200; } else { - if(rv==409)rv = fp.code(); + if (rv==409)rv = fp.code(); error(fp); } return rv; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java index 17f23729..159a51bc 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Deny.java @@ -59,9 +59,9 @@ public class Deny extends BaseCmd<Mgmt> { String action = args[idx++]; final int option = whichOption(options, action); int rv=409; - for(final String name : args[idx++].split(COMMA)) { + for (final String name : args[idx++].split(COMMA)) { final String append; - if(isID && name.indexOf("@")<0) { + if (isID && name.indexOf("@")<0) { append='@'+ access.getProperty(Config.AAF_DEFAULT_REALM,null); } else { append = ""; @@ -82,11 +82,11 @@ public class Deny extends BaseCmd<Mgmt> { fp = client.delete(path, Void.class); resp = " deleted"; } - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().println(name + append + resp + " on " + client); rv=fp.code(); } else { - if(rv==409)rv = fp.code(); + if (rv==409)rv = fp.code(); error(fp); } return rv; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java index 535de3bb..db59df0a 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/Log.java @@ -49,9 +49,9 @@ public class Log extends BaseCmd<Mgmt> { int idx = _idx; final int option = whichOption(options, args[idx++]); - for(String name : args[idx++].split(COMMA)) { + for (String name : args[idx++].split(COMMA)) { final String fname; - if(name.indexOf("@")<0) { + if (name.indexOf("@")<0) { fname=name+'@'+ access.getProperty(Config.AAF_DEFAULT_REALM,null); } else { fname = name; @@ -78,12 +78,12 @@ public class Log extends BaseCmd<Mgmt> { msg = "Ignored"; } - if(fp!=null) { - if(fp.get(AAFcli.timeout())) { + if (fp!=null) { + if (fp.get(AAFcli.timeout())) { pw().println(msg + " Special Log for " + fname + " on " + client); rv=200; } else { - if(rv==409)rv = fp.code(); + if (rv==409)rv = fp.code(); error(fp); } return rv; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java index a52d5dc7..cd10ef60 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/mgmt/SessClear.java @@ -56,11 +56,11 @@ public class SessClear extends Cmd { "/mgmt/dbsession", Void.class ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().println("Cleared DBSession on " + client); rv=200; } else { - if(rv==409)rv = fp.code(); + if (rv==409)rv = fp.code(); error(fp); } return rv; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java index f1952fa9..90141819 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Admin.java @@ -54,7 +54,7 @@ public class Admin extends BaseCmd<NS> { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Void> fp = null; - for(String id : ids) { + for (String id : ids) { id = fullID(id); String verb; switch(option) { @@ -70,7 +70,7 @@ public class Admin extends BaseCmd<NS> { throw new CadiException("Bad Argument"); }; - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().append("Admin "); pw().append(id); pw().append(verb); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java index f1b2621d..31dad45c 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java @@ -50,8 +50,8 @@ public class Attrib extends BaseCmd<NS> { final String ns = args[idx+1]; final String key = args[idx+2]; final String value; - if(option!=2) { - if(args.length<=idx+3) { + if (option!=2) { + if (args.length<=idx+3) { throw new CadiException("Not added: Need more Data"); } value = args[idx+3]; @@ -83,10 +83,10 @@ public class Attrib extends BaseCmd<NS> { default: throw new CadiException("Bad Argument"); }; - if(fp==null) { + if (fp==null) { return 500; } else { - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().println(message); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java index 1719ada7..05d66881 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Create.java @@ -56,16 +56,16 @@ public class Create extends Cmd { nr.setName(args[idx++]); String[] responsible = args[idx++].split(COMMA); - for(String s : responsible) { + for (String s : responsible) { nr.getResponsible().add(fullID(s)); } String[] admin; - if(args.length>idx) { + if (args.length>idx) { admin = args[idx++].split(COMMA); } else { admin = responsible; } - for(String s : admin) { + for (String s : admin) { nr.getAdmin().add(fullID(s)); } @@ -82,10 +82,10 @@ public class Create extends Cmd { getDF(NsRequest.class), nr ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().println("Created Namespace"); } else { - if(fp.code()==202) { + if (fp.code()==202) { pw().println("Namespace Creation Accepted, but requires Approvals before actualizing"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java index 99ac7ed2..7da6c26b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Delete.java @@ -56,7 +56,7 @@ public class Delete extends Cmd { setQueryParamsOn(client); Future<Void> fp = client.delete(path.toString(),Void.class); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().println("Deleted Namespace"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java index 18823297..e521d616 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Describe.java @@ -70,11 +70,11 @@ public class Describe extends Cmd { nsr ); - if(fn.get(AAFcli.timeout())) { + if (fn.get(AAFcli.timeout())) { rv=fn.code(); pw().println("Description added to Namespace"); } else { - if((rv=fn.code())==202) { + if ((rv=fn.code())==202) { pw().print("Adding description"); pw().println(" Accepted, but requires Approvals before actualizing"); } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java index 01b3ad14..8fc79401 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java @@ -58,34 +58,34 @@ public class List extends BaseCmd<NS> { public void report(Future<Nss> fp, String ... str) { reportHead(str); - if(fp==null) { + if (fp==null) { pw().println(" *** Namespace Not Found ***"); } - if(fp!=null && fp.value!=null) { - for(Ns ns : fp.value.getNs()) { + if (fp!=null && fp.value!=null) { + for (Ns ns : fp.value.getNs()) { pw().println(ns.getName()); if (this.aafcli.isDetailed()) { pw().println(" Description"); pw().format(sformat,ns.getDescription()==null?"":ns.getDescription()); } - if(ns.getAdmin().size()>0) { + if (ns.getAdmin().size()>0) { pw().println(" Administrators"); - for(String admin : ns.getAdmin()) { + for (String admin : ns.getAdmin()) { pw().format(sformat,admin); } } - if(ns.getResponsible().size()>0) { + if (ns.getResponsible().size()>0) { pw().println(" Owners (Responsible for Namespace)"); - for(String responsible : ns.getResponsible()) { + for (String responsible : ns.getResponsible()) { pw().format(sformat,responsible); } } - if(ns.getAttrib().size()>0) { + if (ns.getAttrib().size()>0) { pw().println(" Namespace Attributes"); - for( Ns.Attrib attr : ns.getAttrib()) { + for ( Ns.Attrib attr : ns.getAttrib()) { StringBuilder sb = new StringBuilder(attr.getKey()); - if(attr.getValue()==null || attr.getValue().length()>0) { + if (attr.getValue()==null || attr.getValue().length()>0) { sb.append('='); sb.append(attr.getValue()); } @@ -99,7 +99,7 @@ public class List extends BaseCmd<NS> { public void reportName(Future<Nss> fp, String ... str) { reportHead(str); - if(fp!=null && fp.value!=null) { + if (fp!=null && fp.value!=null) { java.util.List<Ns> nss = fp.value.getNs(); Collections.sort(nss, new Comparator<Ns>() { @Override @@ -108,7 +108,7 @@ public class List extends BaseCmd<NS> { } }); - for(Ns ns : nss) { + for (Ns ns : nss) { pw().println(ns.getName()); if (this.aafcli.isDetailed() && ns.getDescription() != null) { pw().println(" " + ns.getDescription()); @@ -118,9 +118,9 @@ public class List extends BaseCmd<NS> { } public void reportRole(Future<Roles> fr) { - if(fr!=null && fr.value!=null && fr.value.getRole().size()>0) { + if (fr!=null && fr.value!=null && fr.value.getRole().size()>0) { pw().println(" Roles"); - for(aaf.v2_0.Role r : fr.value.getRole()) { + for (aaf.v2_0.Role r : fr.value.getRole()) { pw().format(sformat,r.getName()); } } @@ -128,9 +128,9 @@ public class List extends BaseCmd<NS> { private static final String pformat = " %-30s %-24s %-15s\n"; public void reportPerm(Future<Perms> fp) { - if(fp!=null && fp.value!=null && fp.value.getPerm().size()>0) { + if (fp!=null && fp.value!=null && fp.value.getPerm().size()>0) { pw().println(" Permissions"); - for(aaf.v2_0.Perm p : fp.value.getPerm()) { + for (aaf.v2_0.Perm p : fp.value.getPerm()) { pw().format(pformat,p.getType(),p.getInstance(),p.getAction()); } } @@ -139,7 +139,7 @@ public class List extends BaseCmd<NS> { private static final String cformat = " %-30s %-6s %-24s\n"; public void reportCred(Future<Users> fc) { - if(fc!=null && fc.value!=null && fc.value.getUser().size()>0) { + if (fc!=null && fc.value!=null && fc.value.getUser().size()>0) { pw().println(" Credentials"); java.util.List<User> users = fc.value.getUser(); Collections.sort(users, new Comparator<User>() { @@ -148,7 +148,7 @@ public class List extends BaseCmd<NS> { return u1.getId().compareTo(u2.getId()); } }); - for(aaf.v2_0.Users.User u : users) { + for (aaf.v2_0.Users.User u : users) { if (this.aafcli.isTest()) { pw().format(sformat,u.getId()); } else { @@ -160,7 +160,7 @@ public class List extends BaseCmd<NS> { public static String getType(User u) { Integer type; - if((type=u.getType())==null) { + if ((type=u.getType())==null) { type = 9999; } switch(type) { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java index 52b9a108..f8f82466 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListActivity.java @@ -59,7 +59,7 @@ public class ListActivity extends Cmd { getDF(History.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { activity(fp.value, HEADER + " [ " + ns + " ]"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java index 06de6cab..e62207a0 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListAdminResponsible.java @@ -56,9 +56,9 @@ public class ListAdminResponsible extends Cmd { String apipart = "owner".equals(title)?"responsible":title; Future<Nss> fn = client.read("/authz/nss/"+apipart+"/"+user,getDF(Nss.class)); - if(fn.get(AAFcli.timeout())) { + if (fn.get(AAFcli.timeout())) { ((List)parent).reportName(fn,HEADER + title + " privileges for ",user); - } else if(fn.code()==404) { + } else if (fn.code()==404) { ((List)parent).report(null,HEADER + title + " privileges for ",user); return 200; } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java index ffd3cf01..3189b88b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListByName.java @@ -59,29 +59,29 @@ public class ListByName extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class)); - if(fn.get(AAFcli.timeout())) { + if (fn.get(AAFcli.timeout())) { ((List)parent).report(fn,HEADER,ns); - if(fn.value!=null) { - for(Ns n : fn.value.getNs()) { + if (fn.value!=null) { + for (Ns n : fn.value.getNs()) { Future<Roles> fr = client.read("/authz/roles/ns/"+n.getName(), getDF(Roles.class)); - if(fr.get(AAFcli.timeout())) { + if (fr.get(AAFcli.timeout())) { ((List)parent).reportRole(fr); } } - for(Ns n : fn.value.getNs()) { + for (Ns n : fn.value.getNs()) { Future<Perms> fp = client.read("/authz/perms/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":""), getDF(Perms.class)); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { ((List)parent).reportPerm(fp); } } - for(Ns n : fn.value.getNs()) { + for (Ns n : fn.value.getNs()) { Future<Users> fu = client.read("/authn/creds/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":""), getDF(Users.class)); - if(fu.get(AAFcli.timeout())) { + if (fu.get(AAFcli.timeout())) { ((List)parent).reportCred(fu); } } } - } else if(fn.code()==404) { + } else if (fn.code()==404) { ((List)parent).report(null,HEADER,ns); return 200; } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java index 6d514df8..b3b0bcfc 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListChildren.java @@ -56,12 +56,12 @@ public class ListChildren extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Nss> fn = client.read("/authz/nss/children/"+ns,getDF(Nss.class)); - if(fn.get(AAFcli.timeout())) { + if (fn.get(AAFcli.timeout())) { parent.reportHead(HEADER); - for(Ns ns : fn.value.getNs()) { + for (Ns ns : fn.value.getNs()) { pw().format(List.kformat, ns.getName()); } - } else if(fn.code()==404) { + } else if (fn.code()==404) { ((List)parent).report(null,HEADER,ns); return 200; } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java index df72ff08..01b0f21c 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListNsKeysByAttrib.java @@ -58,12 +58,12 @@ public class ListNsKeysByAttrib extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Keys> fn = client.read("/authz/ns/attrib/"+attrib,getDF(Keys.class)); - if(fn.get(AAFcli.timeout())) { + if (fn.get(AAFcli.timeout())) { parent.reportHead(HEADER); - for(String key : fn.value.getKey()) { + for (String key : fn.value.getKey()) { pw().printf(List.kformat, key); } - } else if(fn.code()==404) { + } else if (fn.code()==404) { parent.reportHead(HEADER); pw().println(" *** No Namespaces Found ***"); return 200; diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java index 1347b918..eadf1c97 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersContact.java @@ -65,42 +65,42 @@ public class ListUsersContact extends Cmd { public Integer code(Rcli<?> client) throws CadiException, APIException { ((ListUsers)parent).report(HEADER,ns); Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class)); - if(fn.get(AAFcli.timeout())) { - if(fn.value!=null) { + if (fn.get(AAFcli.timeout())) { + if (fn.value!=null) { Set<String> uset = detail?null:new HashSet<>(); - for(Ns n : fn.value.getNs()) { + for (Ns n : fn.value.getNs()) { Future<Roles> fr = client.read("/authz/roles/ns/"+n.getName(), getDF(Roles.class)); - if(fr.get(AAFcli.timeout())) { - for(Role r : fr.value.getRole()) { - if(detail) { + if (fr.get(AAFcli.timeout())) { + for (Role r : fr.value.getRole()) { + if (detail) { ((ListUsers)parent).report(r.getName()); } Future<Users> fus = client.read( "/authz/users/role/"+r.getName(), getDF(Users.class) ); - if(fus.get(AAFcli.timeout())) { - for(User u : fus.value.getUser()) { - if(detail) { + if (fus.get(AAFcli.timeout())) { + for (User u : fus.value.getUser()) { + if (detail) { ((ListUsers)parent).report(" ",u); } else { uset.add(u.getId()); } } - } else if(fn.code()==404) { + } else if (fn.code()==404) { return 200; } } } } - if(uset!=null) { - for(String u : uset) { + if (uset!=null) { + for (String u : uset) { pw().print(" "); pw().println(u); } } } - } else if(fn.code()==404) { + } else if (fn.code()==404) { return 200; } else { error(fn); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java index 301e1508..c0838cb7 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersInRole.java @@ -65,42 +65,42 @@ public class ListUsersInRole extends Cmd { public Integer code(Rcli<?> client) throws CadiException, APIException { ((ListUsers)parent).report(HEADER,ns); Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class)); - if(fn.get(AAFcli.timeout())) { - if(fn.value!=null) { + if (fn.get(AAFcli.timeout())) { + if (fn.value!=null) { Set<String> uset = detail?null:new HashSet<>(); - for(Ns n : fn.value.getNs()) { + for (Ns n : fn.value.getNs()) { Future<Roles> fr = client.read("/authz/roles/ns/"+n.getName(), getDF(Roles.class)); - if(fr.get(AAFcli.timeout())) { - for(Role r : fr.value.getRole()) { - if(detail) { + if (fr.get(AAFcli.timeout())) { + for (Role r : fr.value.getRole()) { + if (detail) { ((ListUsers)parent).report(r.getName()); } Future<Users> fus = client.read( "/authz/users/role/"+r.getName(), getDF(Users.class) ); - if(fus.get(AAFcli.timeout())) { - for(User u : fus.value.getUser()) { - if(detail) { + if (fus.get(AAFcli.timeout())) { + for (User u : fus.value.getUser()) { + if (detail) { ((ListUsers)parent).report(" ",u); } else { uset.add(u.getId()); } } - } else if(fn.code()==404) { + } else if (fn.code()==404) { return 200; } } } } - if(uset!=null) { - for(String u : uset) { + if (uset!=null) { + for (String u : uset) { pw().print(" "); pw().println(u); } } } - } else if(fn.code()==404) { + } else if (fn.code()==404) { return 200; } else { error(fn); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java index 472070d9..96ca95ee 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/ListUsersWithPerm.java @@ -65,42 +65,42 @@ public class ListUsersWithPerm extends Cmd { public Integer code(Rcli<?> client) throws CadiException, APIException { ((ListUsers)parent).report(HEADER,ns); Future<Nss> fn = client.read("/authz/nss/"+ns,getDF(Nss.class)); - if(fn.get(AAFcli.timeout())) { - if(fn.value!=null) { + if (fn.get(AAFcli.timeout())) { + if (fn.value!=null) { Set<String> uset = detail?null:new HashSet<>(); - for(Ns n : fn.value.getNs()) { + for (Ns n : fn.value.getNs()) { Future<Perms> fp = client.read("/authz/perms/ns/"+n.getName()+(aafcli.isDetailed()?"?ns":"") , getDF(Perms.class)); - if(fp.get(AAFcli.timeout())) { - for(Perm p : fp.value.getPerm()) { + if (fp.get(AAFcli.timeout())) { + for (Perm p : fp.value.getPerm()) { String perm = p.getType()+'/'+p.getInstance()+'/'+p.getAction(); - if(detail)((ListUsers)parent).report(perm); + if (detail)((ListUsers)parent).report(perm); Future<Users> fus = client.read( "/authz/users/perm/"+perm, getDF(Users.class) ); - if(fus.get(AAFcli.timeout())) { - for(User u : fus.value.getUser()) { - if(detail) + if (fus.get(AAFcli.timeout())) { + for (User u : fus.value.getUser()) { + if (detail) ((ListUsers)parent).report(" ",u); else uset.add(u.getId()); } - } else if(fn.code()==404) { + } else if (fn.code()==404) { return 200; } } } } - if(uset!=null) { - for(String u : uset) { + if (uset!=null) { + for (String u : uset) { pw().print(" "); pw().println(u); } } } - } else if(fn.code()==404) { + } else if (fn.code()==404) { return 200; } else { error(fn); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java index e5e50187..35dd6b96 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Owner.java @@ -55,7 +55,7 @@ public class Owner extends BaseCmd<NS> { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { Future<Void> fp=null; - for(String id : ids) { + for (String id : ids) { id=fullID(id); String verb; switch(option) { @@ -71,7 +71,7 @@ public class Owner extends BaseCmd<NS> { throw new CadiException("Bad Argument"); }; - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().append(id); pw().append(verb); pw().append("responsible for "); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java index 1f123cff..be49cf28 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Create.java @@ -65,9 +65,9 @@ public class Create extends Cmd { boolean force = aafcli.forceString()!=null; int rv; - if(roles!=null && force) { // Make sure Roles are Created + if (roles!=null && force) { // Make sure Roles are Created RoleRequest rr = new RoleRequest(); - for(String role : roles) { + for (String role : roles) { rr.setName(role);; Future<RoleRequest> fr = client.create( "/authz/role", @@ -96,13 +96,13 @@ public class Create extends Cmd { getDF(PermRequest.class), pr ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { rv = fp.code(); pw().println("Created Permission"); - if(roles!=null) { - if(aafcli.forceString()!=null) { // Make sure Roles are Created + if (roles!=null) { + if (aafcli.forceString()!=null) { // Make sure Roles are Created RoleRequest rr = new RoleRequest(); - for(String role : roles) { + for (String role : roles) { rr.setName(role);; Future<RoleRequest> fr = client.create( "/authz/role", @@ -120,7 +120,7 @@ public class Create extends Cmd { } try { - if(201!=(rv=((Perm)parent)._exec(0, + if (201!=(rv=((Perm)parent)._exec(0, new String[] {"grant",pr.getType(),pr.getInstance(),pr.getAction(),roleCommas}))) { rv = 206 /*HttpStatus.PARTIAL_CONTENT_206*/; } @@ -130,9 +130,9 @@ public class Create extends Cmd { } } else { rv = fp.code(); - if(rv==409 && force) { + if (rv==409 && force) { rv = 201; - } else if(rv==202) { + } else if (rv==202) { pw().println("Permission Creation Accepted, but requires Approvals before actualizing"); if (roles!=null) pw().println("You need to grant the roles after approval."); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java index ed52a071..0f0c0011 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Delete.java @@ -65,10 +65,10 @@ public class Delete extends Cmd { "/authz/perm", getDF(PermRequest.class), pk); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().println("Deleted Permission"); } else { - if(fp.code()==202) { + if (fp.code()==202) { pw().println("Permission Deletion Accepted, but requires Approvals before actualizing"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java index 8396f7d3..bb894ca7 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Describe.java @@ -76,11 +76,11 @@ public class Describe extends Cmd { pr ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { rv=fp.code(); pw().println("Description added to Permission"); } else { - if((rv=fp.code())==202) { + if ((rv=fp.code())==202) { pw().print("Adding description"); pw().println(" Accepted, but requires Approvals before actualizing"); } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java index 4ed411ba..dd45fb4b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Grant.java @@ -75,9 +75,9 @@ public class Grant extends Cmd { if (option != 2) { String[] roles = args[idx++].split(","); String strA,strB; - for(String role : roles) { + for (String role : roles) { rpr.setRole(role); - if(option==0) { + if (option==0) { // You can request to Grant Permission to a Role setQueryParamsOn(client); frpr = client.create( @@ -98,7 +98,7 @@ public class Grant extends Cmd { strA = "UnGranted Permission ["; strB = "] from Role ["; } - if(frpr.get(AAFcli.timeout())) { + if (frpr.get(AAFcli.timeout())) { pw().println(strA + pk.getType() + '|' + pk.getInstance() + '|' + pk.getAction() + strB + role +']'); } else { @@ -122,7 +122,7 @@ public class Grant extends Cmd { "/authz/role/perm", getDF(RolePermRequest.class), rpr); - if(frpr.get(AAFcli.timeout())) { + if (frpr.get(AAFcli.timeout())) { pw().println("Set Permission's Roles to [" + allRoles + "]"); } else { error(frpr); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java index 48b8a488..5df2afa2 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/List.java @@ -48,7 +48,7 @@ public class List extends BaseCmd<Perm> { // Package Level on purpose abstract class ListPerms extends Retryable<Integer> { protected int list(Future<Perms> fp,String header, String parentPerm) throws CadiException, APIException { - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { report(fp,header, parentPerm); } else { error(fp); @@ -61,10 +61,10 @@ public class List extends BaseCmd<Perm> { @Override public int compare(aaf.v2_0.Perm a, aaf.v2_0.Perm b) { int rc; - if((rc=a.getType().compareTo(b.getType()))!=0) { + if ((rc=a.getType().compareTo(b.getType()))!=0) { return rc; } - if((rc=a.getInstance().compareTo(b.getInstance()))!=0) { + if ((rc=a.getInstance().compareTo(b.getInstance()))!=0) { return rc; } return a.getAction().compareTo(b.getAction()); @@ -80,9 +80,9 @@ public class List extends BaseCmd<Perm> { String descFmt = " %-75s\n"; reportColHead(format + descFmt,"[PERM NS].Type","Instance","Action", "Description"); Collections.sort(fp.value.getPerm(),permCompare); - for(aaf.v2_0.Perm p : fp.value.getPerm()) { + for (aaf.v2_0.Perm p : fp.value.getPerm()) { String pns = p.getNs(); - if(pns==null) { + if (pns==null) { pw().format(format, p.getType(), p.getInstance(), @@ -94,7 +94,7 @@ public class List extends BaseCmd<Perm> { p.getAction()); } String desc = p.getDescription(); - if(desc!=null && desc.length()>0) { + if (desc!=null && desc.length()>0) { pw().format(descFmt,p.getDescription()); } } @@ -103,7 +103,7 @@ public class List extends BaseCmd<Perm> { String format = reportColHead(permFormat,"PERM Type","Instance","Action"); Collections.sort(fp.value.getPerm(),permCompare); - for(aaf.v2_0.Perm p : fp.value.getPerm()) { + for (aaf.v2_0.Perm p : fp.value.getPerm()) { pw().format(format, p.getType(), p.getInstance(), diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java index c59e9b5a..c96220a5 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListActivity.java @@ -57,7 +57,7 @@ public class ListActivity extends Cmd { "/authz/hist/perm/"+type, getDF(History.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { activity(fp.value, HEADER + " [ " + type + " ]"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java index 550386cf..325f45db 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/ListByUser.java @@ -51,12 +51,12 @@ public class ListByUser extends Cmd { @Override public Integer code(Rcli<?> client) throws CadiException, APIException { StringBuilder sb = null; - if("true".equalsIgnoreCase(aafcli.forceString())) { + if ("true".equalsIgnoreCase(aafcli.forceString())) { sb = new StringBuilder(); sb.append("?force"); } - if(aafcli.isDetailed()) { - if(sb==null) { + if (aafcli.isDetailed()) { + if (sb==null) { sb = new StringBuilder('?'); } else { sb.append('&'); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java index 620e1e04..dbadd8a0 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/perm/Rename.java @@ -71,12 +71,12 @@ public class Rename extends Cmd { pr ); int rv; - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { rv = fp.code(); pw().println("Updated Permission"); } else { rv = fp.code(); - if(rv==202) { + if (rv==202) { pw().println("Permission Update Accepted, but requires Approvals before actualizing"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java index f9dcbcd8..320bac5b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java @@ -90,17 +90,17 @@ public class CreateDelete extends Cmd { } boolean rolesSupplied = (args.length>idx); - if(fp == null) {// This useless code brought to you by Sonar. + if (fp == null) {// This useless code brought to you by Sonar. throw new CadiException("No call made."); } - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { rv=fp.code(); pw().print(verb); pw().println("d Role"); - if(rolesSupplied) { - for(;args.length>idx;++idx ) { + if (rolesSupplied) { + for (;args.length>idx;++idx ) { try { - if(201!=(rv=((Role)parent)._exec(0,new String[] {"user","add",rr.getName(),args[idx]}))) { + if (201!=(rv=((Role)parent)._exec(0,new String[] {"user","add",rr.getName(),args[idx]}))) { rv = 206 /*HttpStatus.PARTIAL_CONTENT_206*/; } } catch (LocatorException e) { @@ -109,7 +109,7 @@ public class CreateDelete extends Cmd { } } } else { - if((rv=fp.code())==202) { + if ((rv=fp.code())==202) { pw().print("Role "); pw().print(verb); pw().println(" Accepted, but requires Approvals before actualizing"); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java index e8001040..f4d24fb1 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/Describe.java @@ -70,11 +70,11 @@ public class Describe extends Cmd { rr ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { rv=fp.code(); pw().println("Description added to role"); } else { - if((rv=fp.code())==202) { + if ((rv=fp.code())==202) { pw().print("Adding description"); pw().println(" Accepted, but requires Approvals before actualizing"); } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java index ec8d8ee3..f8a633af 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/List.java @@ -61,16 +61,16 @@ public class List extends BaseCmd<Role> { // Package Level on purpose abstract class ListRoles extends Retryable<Integer> { protected int list(Future<Roles> fr,Rcli<?> client, String header) throws APIException, CadiException { - if(fr.get(AAFcli.timeout())) { + if (fr.get(AAFcli.timeout())) { Perms perms=null; if (aafcli.isDetailed()) { - for(aaf.v2_0.Role r : fr.value.getRole()) { + for (aaf.v2_0.Role r : fr.value.getRole()) { Future<Perms> fp = client.read( "/authz/perms/role/"+r.getName()+(aafcli.isDetailed()?"?ns":""), getDF(Perms.class) ); - if(fp.get(AAFcli.timeout())) { - if(perms==null) { + if (fp.get(AAFcli.timeout())) { + if (perms==null) { perms = fp.value; } else { perms.getPerm().addAll(fp.value.getPerm()); @@ -101,7 +101,7 @@ public class List extends BaseCmd<Role> { public void report(Roles roles, Perms perms, UserRoles urs, String ... str) { reportHead(str); XMLGregorianCalendar now = Chrono.timeStamp().normalize(); - if(roles==null || roles.getRole().isEmpty()) { + if (roles==null || roles.getRole().isEmpty()) { pw().println("<No Roles Found>"); } else if (aafcli.isDetailed()){ if (aafcli.isDetailed() && str[0].toLowerCase().contains(LIST_ROLES_BY_NAME)) { @@ -113,25 +113,25 @@ public class List extends BaseCmd<Role> { String fullFormat = roleFormat+permFormat; reportColHead(fullFormat,"[ROLE NS].Name","","[PERM NS].Type","Instance","Action"); Collections.sort(roles.getRole(),roleCompare); - for(aaf.v2_0.Role r : roles.getRole()) { + for (aaf.v2_0.Role r : roles.getRole()) { String roleName = r.getName(); String ns = r.getNs(); - if(aafcli.isTest()) { - if(ns==null) { + if (aafcli.isTest()) { + if (ns==null) { pw().format(roleFormat, roleName,XXXX_XX_XX); } else { pw().format(roleFormat, "["+ns+"]"+roleName.substring(ns.length()),XXXX_XX_XX); } } else { UserRole ur = get(roleName,urs); - if(ur!=null && now.compare(ur.getExpires().normalize())>0) { - if(ns==null) { + if (ur!=null && now.compare(ur.getExpires().normalize())>0) { + if (ns==null) { pw().format(roleExpiredFormat, roleName,Chrono.dateOnlyStamp(ur.getExpires())); } else { pw().format(roleExpiredFormat, "["+ns+"]"+roleName.substring(ns.length()),Chrono.dateOnlyStamp(ur.getExpires())); } } else { - if(ns==null) { + if (ns==null) { pw().format(roleFormat, roleName,ur!=null?Chrono.dateOnlyStamp(ur.getExpires()):""); } else { pw().format(roleFormat, "["+ns+"]"+roleName.substring(ns.length()),ur!=null?Chrono.dateOnlyStamp(ur.getExpires()):""); @@ -139,9 +139,9 @@ public class List extends BaseCmd<Role> { } } - for(Pkey pkey : r.getPerms()) { + for (Pkey pkey : r.getPerms()) { Perm perm = get(pkey,perms); - if(perm==null || perm.getNs()==null) { + if (perm==null || perm.getNs()==null) { pw().format(permFormat, pkey.getType(), pkey.getInstance(), @@ -159,12 +159,12 @@ public class List extends BaseCmd<Role> { String fullFormat = roleFormat; reportColHead(fullFormat,"ROLE Name","","PERM Type","Instance","Action"); Collections.sort(roles.getRole(),roleCompare); - for(aaf.v2_0.Role r : roles.getRole()) { + for (aaf.v2_0.Role r : roles.getRole()) { if (urs != null) { String roleName = r.getName(); - if(!aafcli.isTest()) { + if (!aafcli.isTest()) { UserRole ur = get(roleName,urs); - if(ur!=null && now.compare(ur.getExpires().normalize())>0) { + if (ur!=null && now.compare(ur.getExpires().normalize())>0) { pw().format(roleExpiredFormat, roleName+"*",Chrono.dateOnlyStamp(ur.getExpires())); } else { pw().format(roleFormat, roleName,ur!=null?Chrono.dateOnlyStamp(ur.getExpires()):""); @@ -174,7 +174,7 @@ public class List extends BaseCmd<Role> { } } else { pw().format(roleFormatNoDate, r.getName()); - for(Pkey perm : r.getPerms()) { + for (Pkey perm : r.getPerms()) { pw().format(permFormat, perm.getType(), perm.getInstance(), @@ -185,9 +185,9 @@ public class List extends BaseCmd<Role> { } } private Perm get(Pkey pkey, Perms perms) { - if(perms!=null) { - for(Perm p : perms.getPerm()) { - if(pkey.getAction().equals(p.getAction()) && + if (perms!=null) { + for (Perm p : perms.getPerm()) { + if (pkey.getAction().equals(p.getAction()) && pkey.getInstance().equals(p.getInstance()) && pkey.getType().equals(p.getType())) { return p; @@ -198,9 +198,9 @@ public class List extends BaseCmd<Role> { } // The assumption is that these UserRoles are already pulled in by User... no need to check private UserRole get(String roleName, UserRoles urs) { - if(urs!=null) { - for(UserRole ur : urs.getUserRole()) { - if(roleName.equals(ur.getRole())) { + if (urs!=null) { + for (UserRole ur : urs.getUserRole()) { + if (roleName.equals(ur.getRole())) { return ur; } } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java index 1f6f18f7..603ec33b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListActivity.java @@ -57,7 +57,7 @@ public class ListActivity extends Cmd { "/authz/hist/role/"+role, getDF(History.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { activity(fp.value,HEADER + " [ " + role + " ]"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java index c9ed37a4..bdcf1e50 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/ListByUser.java @@ -68,13 +68,13 @@ public class ListByUser extends Cmd { "/authz/userRoles/user/"+user, getDF(UserRoles.class) ); - if(fr.get(AAFcli.timeout())) { + if (fr.get(AAFcli.timeout())) { if (aafcli.isDetailed()) { Future<Perms> fp = client.read( "/authz/perms/user/"+user+(aafcli.isDetailed()?"?ns":""), getDF(Perms.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { perms = fp.value; } } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java index c628eb17..364b3980 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/User.java @@ -69,7 +69,7 @@ public class User extends Cmd { // You can request to be added or removed from role. setQueryParamsOn(client); - for(String id: ids) { + for (String id: ids) { id=fullID(id); urr.setUser(id); switch(option) { @@ -97,7 +97,7 @@ public class User extends Cmd { default: // actually, should never get here... throw new CadiException("Invalid action [" + action + ']'); } - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().print(verb); pw().print(" User ["); pw().print(urr.getUser()); @@ -112,7 +112,7 @@ public class User extends Cmd { pw().println(" is Accepted, but requires Approvals before actualizing"); break; case 404: - if(option==3) { + if (option==3) { pw().println("Failed with code 404: UserRole is not found, or you do not have permission to view"); break; } @@ -139,7 +139,7 @@ public class User extends Cmd { "/authz/userRole/role", getDF(UserRoleRequest.class), urr); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().println("Set the Role to Users [" + allUsers + "]"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java index 40447c19..cc9ccf98 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Cred.java @@ -57,11 +57,11 @@ public class Cred extends Cmd { final CredRequest cr = new CredRequest(); cr.setId(args[idx++]); - if(option!=1 && option!=3) { - if(idx>=args.length) throw new CadiException("Password Required"); + if (option!=1 && option!=3) { + if (idx>=args.length) throw new CadiException("Password Required"); cr.setPassword(args[idx++]); } - if(args.length>idx) + if (args.length>idx) cr.setEntry(args[idx++]); // Set Start/End commands @@ -82,7 +82,7 @@ public class Cred extends Cmd { verb = "Added Credential ["; break; case 1: -// if(aafcli.addForce())cr.setForce("TRUE"); +// if (aafcli.addForce())cr.setForce("TRUE"); setQueryParamsOn(client); fp = client.delete(CRED_PATH, getDF(CredRequest.class), @@ -109,16 +109,16 @@ public class Cred extends Cmd { // case 4: // return clean.exec(cleanIDX, args); } - if(fp==null) { + if (fp==null) { return null; // get by Sonar check. } - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().print(verb); pw().print(cr.getId()); pw().println(']'); - } else if(fp.code()==202) { + } else if (fp.code()==202) { pw().println("Credential Action Accepted, but requires Approvals before actualizing"); - } else if(fp.code()==406 && option==1) { + } else if (fp.code()==406 && option==1) { pw().println("You cannot delete this Credential"); } else { pw().println(ATTEMPT_FAILED_SPECIFICS_WITHELD); @@ -126,7 +126,7 @@ public class Cred extends Cmd { return fp.code(); } }); - if(ret==null)ret = -1; + if (ret==null)ret = -1; return ret; } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java index 8587ac3d..3cb9fb04 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Delg.java @@ -64,10 +64,10 @@ public class Delg extends BaseCmd<User> { int option= whichOption(options, args[idx++]); String user = fullID(args[idx++]); dr.setUser(user); - if(option<2) { + if (option<2) { String delegate = fullID(args[idx++]); dr.setDelegate(delegate); - if(option<2 && args.length>idx) { + if (option<2 && args.length>idx) { Date date; try { date = Chrono.dateOnlyFmt.parse(args[idx++]); @@ -100,7 +100,7 @@ public class Delg extends BaseCmd<User> { throw new CadiException("Bad Argument"); }; - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { pw().append("Delegate "); pw().println(verb); } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java index 03148ce5..3074ab86 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java @@ -53,7 +53,7 @@ public class List extends BaseCmd<User> { Collections.sort(sorted, new Comparator<aaf.v2_0.Users.User>() { @Override public int compare(aaf.v2_0.Users.User u1, aaf.v2_0.Users.User u2) { - if(u1==null || u2 == null) { + if (u1==null || u2 == null) { return -1; } return u1.getId().compareTo(u2.getId()); @@ -61,8 +61,8 @@ public class List extends BaseCmd<User> { }); String format = reportColHead("%-40s %-10s %-30s\n","User","Type","Expires"); String date = "XXXX-XX-XX"; - for(aaf.v2_0.Users.User user : sorted) { - if(!aafcli.isTest()) { + for (aaf.v2_0.Users.User user : sorted) { + if (!aafcli.isTest()) { date = Chrono.dateOnlyStamp(user.getExpires()); } pw().format(format, @@ -84,9 +84,9 @@ public class List extends BaseCmd<User> { } } ); String ticket = null, prev = null; - for(Approval app : lapp ) { + for (Approval app : lapp ) { ticket = app.getTicket(); - if(!ticket.equals(prev)) { + if (!ticket.equals(prev)) { pw().print("Ticket: "); pw().println(ticket); } @@ -106,8 +106,8 @@ public class List extends BaseCmd<User> { reportHead(title,id); String format = reportColHead(" %-25s %-25s %-10s\n","User","Delegate","Expires"); String date = "XXXX-XX-XX"; - for(Delg delg : delgs.getDelgs()) { - if(!this.aafcli.isTest()) + for (Delg delg : delgs.getDelgs()) { + if (!this.aafcli.isTest()) date = Chrono.dateOnlyStamp(delg.getExpires()); pw().printf(format, delg.getUser(), diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java index 4bb87374..162dadac 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListActivity.java @@ -58,7 +58,7 @@ public class ListActivity extends Cmd { "/authz/hist/user/"+user, getDF(History.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { activity(fp.value,HEADER + " [ " + user + " ]"); } else { error(fp); diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java index d9379174..068aacb1 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListApprovals.java @@ -67,9 +67,9 @@ public class ListApprovals extends Cmd { "/authz/approval/"+type+'/'+fullValue, getDF(Approvals.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { ((List)parent).report(fp.value,HEADER + " by " + type,fullValue); - if(fp.code()==404) { + if (fp.code()==404) { return 200; } } else { diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java index 5cc7a52b..28b5c9e7 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListDelegates.java @@ -61,9 +61,9 @@ public class ListDelegates extends Cmd { "/authz/delegates/" + key + '/' + id, getDF(Delgs.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { ((List)parent).report(fp.value,HEADER + " by " + key, id); - if(fp.code()==404)return 200; + if (fp.code()==404)return 200; } else { error(fp); } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java index a71090ea..4977b752 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForCreds.java @@ -66,7 +66,7 @@ public class ListForCreds extends Cmd { "/authn/creds/"+which+'/'+value, getDF(Users.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { if (aafcli.isTest()) Collections.sort(fp.value.getUser(), new Comparator<User>() { @Override @@ -75,7 +75,7 @@ public class ListForCreds extends Cmd { } }); ((org.onap.aaf.auth.cmd.user.List)parent).report(fp.value,option==1,HEADER+which,value); - if(fp.code()==404)return 200; + if (fp.code()==404)return 200; } else { error(fp); } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java index 439c8af6..516713ef 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForPermission.java @@ -60,14 +60,14 @@ public class ListForPermission extends Cmd { int idx = index; String type = args[idx++]; String instance = args[idx++]; - if("\\*".equals(instance))instance="*"; + if ("\\*".equals(instance))instance="*"; String action = args[idx++]; - if("\\*".equals(action))action="*"; + if ("\\*".equals(action))action="*"; Future<Users> fp = client.read( "/authz/users/perm/"+type+'/'+instance+'/'+action, getDF(Users.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { if (aafcli.isTest()) Collections.sort(fp.value.getUser(), new Comparator<User>() { @Override @@ -76,7 +76,7 @@ public class ListForPermission extends Cmd { } }); ((org.onap.aaf.auth.cmd.user.List)parent).report(fp.value,false,HEADER,type+"|"+instance+"|"+action); - if(fp.code()==404)return 200; + if (fp.code()==404)return 200; } else { error(fp); } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java index 1d1b328a..b534240b 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/ListForRoles.java @@ -60,7 +60,7 @@ public class ListForRoles extends Cmd { "/authz/users/role/"+role, getDF(Users.class) ); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { if (aafcli.isTest()) Collections.sort(fp.value.getUser(), new Comparator<User>() { @Override @@ -69,7 +69,7 @@ public class ListForRoles extends Cmd { } }); ((org.onap.aaf.auth.cmd.user.List)parent).report(fp.value,false, HEADER,role); - if(fp.code()==404)return 200; + if (fp.code()==404)return 200; } else { error(fp); } diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java index 04b444a1..4bc99366 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/Role.java @@ -108,7 +108,7 @@ public class Role extends Cmd { pw().println(" Accepted, but requires Approvals before actualizing"); break; case 404: - if(option==3) { + if (option==3) { pw().println("Failed with code 404: UserRole is not found, or you do not have permission to view"); break; } |