diff options
author | 2018-09-07 13:43:23 -0500 | |
---|---|---|
committer | 2018-09-07 13:43:26 -0500 | |
commit | 7e966914050e66219689001ff4ab601a49eef0ac (patch) | |
tree | b1bf643f2d191207adc7d9f6b41ac20f56083e76 /auth/auth-gui/src/main/java | |
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-gui/src/main/java')
42 files changed, 285 insertions, 285 deletions
diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java index ecbd0a25..e533abbe 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/cui/CUI.java @@ -51,7 +51,7 @@ public class CUI extends HttpCode<AuthzTrans, Void> { int c; StringBuilder cmd = new StringBuilder(); - while((c=isr.read())>=0) { + while ((c=isr.read())>=0) { cmd.append((char)c); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java index 84ad1b1f..48164227 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/AAF_GUI.java @@ -124,7 +124,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E slot_httpServletRequest = env.slot(HTTP_SERVLET_REQUEST); String[] component = Split.split(':', access.getProperty(Config.AAF_COMPONENT, "N/A:2.x")); - if(component.length>1) { + if (component.length>1) { deployedVersion =component[1]; } else { deployedVersion = "2.x"; @@ -217,7 +217,7 @@ public class AAF_GUI extends AbsService<AuthzEnv, AuthzTrans> implements State<E } public void writeError(AuthzTrans trans, Future<?> fp, HTMLGen hgen, int indent) { - if(hgen!=null) { + if (hgen!=null) { String msg = aafCon.readableErrMsg(fp); hgen.incr(HTMLGen.P,"style=text-indent:"+indent*10+"px") .text("<font color=\"red\"><i>Error</i>:</font> ") diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java index c5c14d3f..4f1a7e82 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/BreadCrumbs.java @@ -55,18 +55,18 @@ public class BreadCrumbs extends NamedCode { HttpServletRequest req = trans.get(gui.slot_httpServletRequest, null); StringBuilder key = new StringBuilder(); String value, hidden; - for(Page p : breadcrumbs) { + for (Page p : breadcrumbs) { hidden=""; // Add keys for page from commandline, where possible. - if(p.fields().length>0) { + if (p.fields().length>0) { boolean first = true; key.setLength(0); - for(String field : p.fields()) { - if((value=req.getParameter(field))==null) { + for (String field : p.fields()) { + if ((value=req.getParameter(field))==null) { hidden="style=display:none;"; break; } - if(first) { + if (first) { first = false; key.append('?'); } else { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java index d1817531..c25d6641 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Display.java @@ -38,7 +38,7 @@ public class Display { final String[] fields = page.fields(); final Slot slots[] = new Slot[fields.length]; String prefix = page.name() + '.'; - for(int i=0;i<slots.length;++i) { + for (int i=0;i<slots.length;++i) { slots[i] = gui.env.slot(prefix + fields[i]); } @@ -49,26 +49,26 @@ public class Display { * we turn such names into arrays with same index number. Then, we place them in the Transaction "Properties" so that * it can be transferred to subclasses easily. */ - if(meth.equals(HttpMethods.POST)) { + if (meth.equals(HttpMethods.POST)) { // Here, we'll expect FORM URL Encoded Data, which we need to get from the body gui.route(gui.env, meth, page.url(), new HttpCode<AuthzTrans,AAF_GUI>(gui,page.name()) { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { trans.put(gui.slot_httpServletRequest, req); - for(int i=0; i<fields.length;++i) { + for (int i=0; i<fields.length;++i) { int idx = fields[i].indexOf("[]"); - if(idx<0) { // single value + if (idx<0) { // single value trans.put(slots[i], req.getParameter(fields[i])); // assume first value } else { // multi value - Expect Values to be set with Field root name "field.<int>" corresponding to an array of types String field=fields[i].substring(0, idx)+'.'; String[] array = new String[16]; - for(Enumeration<String> names = req.getParameterNames(); names.hasMoreElements();) { + for (Enumeration<String> names = req.getParameterNames(); names.hasMoreElements();) { String key = names.nextElement(); - if(key.startsWith(field)) { + if (key.startsWith(field)) { try { int x = Integer.parseInt(key.substring(field.length())); - if(x>=array.length) { + if (x>=array.length) { String[] temp = new String[x+10]; System.arraycopy(temp, 0, temp, 0, array.length); array = temp; @@ -95,20 +95,20 @@ public class Display { @Override public void handle(AuthzTrans trans, HttpServletRequest req, HttpServletResponse resp) throws Exception { trans.put(gui.slot_httpServletRequest, req); - for(int i=0; i<slots.length;++i) { + for (int i=0; i<slots.length;++i) { int idx = fields[i].indexOf("[]"); - if(idx<0) { // single value + if (idx<0) { // single value trans.put(slots[i], req.getParameter(fields[i])); } else { // multi value String[] array = new String[30]; String field=fields[i].substring(0, idx); - for(Enumeration<String> mm = req.getParameterNames();mm.hasMoreElements();) { + for (Enumeration<String> mm = req.getParameterNames();mm.hasMoreElements();) { String key = mm.nextElement(); - if(key.startsWith(field)) { + if (key.startsWith(field)) { try { int x = Integer.parseInt(key.substring(field.length())); - if(x>=array.length) { + if (x>=array.length) { String[] temp = new String[x+10]; System.arraycopy(temp, 0, temp, 0, array.length); array = temp; diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java index cc51983b..40aef8fb 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Form.java @@ -45,7 +45,7 @@ public class Form extends NamedCode { @Override public void code(final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { - if(preamble!=null) { + if (preamble!=null) { hgen.incr("p","class=preamble").text(preamble).end(); } hgen.incr("form","method=post"); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java index 37576008..435197c8 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/NamedCode.java @@ -51,7 +51,7 @@ public abstract class NamedCode implements ContentCode { public void addAttr(boolean first, String attr) { String[] temp = new String[idattrs.length+1]; - if(first) { + if (first) { temp[0] = attr; System.arraycopy(idattrs, 0, temp, 1, idattrs.length); } else { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java index 6010dd8b..deed77c0 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/OrgLookupFilter.java @@ -48,16 +48,16 @@ public class OrgLookupFilter implements Filter { @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain fc) throws IOException, ServletException { final AuthzTrans trans = (AuthzTrans) req.getAttribute(TransFilter.TRANS_TAG); - if(req instanceof HttpServletRequest) { + if (req instanceof HttpServletRequest) { Principal p = ((HttpServletRequest)req).getUserPrincipal(); - if(p instanceof TaggedPrincipal) { + if (p instanceof TaggedPrincipal) { ((TaggedPrincipal)p).setTagLookup(new TaggedPrincipal.TagLookup() { @Override public String lookup() throws CadiException { Identity id; try { id = trans.org().getIdentity(trans, p.getName()); - if(id!=null && id.isFound()) { + if (id!=null && id.isFound()) { return id.firstName(); } } catch (OrganizationException e) { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java index a44a4846..1e067c44 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Page.java @@ -102,7 +102,7 @@ public class Page extends HTMLCacheGen { super(CacheGen.PRETTY, new PageCode(env, 1, content)); fields = new String[en.length]; int i=-1; - for(Enum<?> p : en) { + for (Enum<?> p : en) { fields[++i]=p.name(); } @@ -110,8 +110,8 @@ public class Page extends HTMLCacheGen { bcUrl = url; // Mark which fields must be "no_cache" boolean no_cacheTemp=false; - for(NamedCode nc : content) { - if(nc.no_cache()) { + for (NamedCode nc : content) { + if (nc.no_cache()) { no_cacheTemp=true; break; } @@ -124,7 +124,7 @@ public class Page extends HTMLCacheGen { public Page(AuthzEnv env, String name, String url, int backdots, String [] fields, final NamedCode ... content) throws APIException,IOException { super(CacheGen.PRETTY, new PageCode(env, backdots, content)); - if(fields==null) { + if (fields==null) { this.fields = new String[0]; } else { this.fields = fields; @@ -133,8 +133,8 @@ public class Page extends HTMLCacheGen { bcUrl = url; // Mark which fields must be "no_cache" boolean no_cacheTemp=false; - for(NamedCode nc : content) { - if(nc.no_cache()) { + for (NamedCode nc : content) { + if (nc.no_cache()) { no_cacheTemp=true; break; } @@ -220,7 +220,7 @@ public class Page extends HTMLCacheGen { // Obtain User Info, and print TaggedPrincipal p = trans.getUserPrincipal(); String user,secured; - if(p==null) { + if (p==null) { user = "please choose a Login Authority"; secured = "NOT Secure!"; } else { @@ -251,7 +251,7 @@ public class Page extends HTMLCacheGen { int cIdx; ContentCode nc; // If BreadCrumbs, put here - if(content.length>0 && content[0] instanceof BreadCrumbs) { + if (content.length>0 && content[0] instanceof BreadCrumbs) { nc = content[0]; Mark ctnt = hgen.divID(nc.idattrs()); nc.code(cache, hgen); @@ -265,7 +265,7 @@ public class Page extends HTMLCacheGen { Mark inner = hgen.divID("inner"); // Content - for(int i=cIdx;i<content.length;++i) { + for (int i=cIdx;i<content.length;++i) { nc = content[i]; Mark ctnt = hgen.divID(nc.idattrs()); nc.code(cache, hgen); @@ -280,28 +280,28 @@ public class Page extends HTMLCacheGen { hgen.incr("h2").text("Related Links").end(); hgen.incr(UL); String aaf_help = env.getProperty(AAF_URL_AAF_HELP,null); - if(aaf_help!=null) { + if (aaf_help!=null) { hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_AAF_HELP),"target=_blank").text("AAF WIKI").end(2); String sub = env.getProperty(AAF_URL_AAF_HELP+".sub"); - if(sub!=null) { + if (sub!=null) { hgen.incr(UL,"style=margin-left:5%"); - for(String s : Split.splitTrim(',', sub)) { + for (String s : Split.splitTrim(',', sub)) { hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_AAF_HELP+".sub."+s),"target=_blank").text(s.replace('+', ' ')).end(2); } hgen.end(); } } aaf_help = env.getProperty(AAF_URL_CADI_HELP,null); - if(aaf_help!=null) { + if (aaf_help!=null) { hgen.leaf(LI).leaf(A,"href="+aaf_help,"target=_blank").text("CADI WIKI").end(2); } String tools = env.getProperty(AAFURL_TOOLS); - if(tools!=null) { + if (tools!=null) { hgen.hr() .incr(HTMLGen.UL,"style=margin-left:5%") .leaf(HTMLGen.H3).text("Related Tools").end(); - for(String tool : Split.splitTrim(',',tools)) { + for (String tool : Split.splitTrim(',',tools)) { hgen.leaf(LI).leaf(A,"href="+env.getProperty(AAF_URL_TOOL_DOT+tool),"target=_blank").text(tool.replace('+', ' ')).end(2); } hgen.end(); @@ -350,10 +350,10 @@ public class Page extends HTMLCacheGen { */ public static BROWSER browser(AuthzTrans trans, Slot slot) { BROWSER br = trans.get(slot, null); - if(br==null) { + if (br==null) { String agent = trans.agent(); int msie; - if(agent.contains("iPhone") /* other phones? */) { + if (agent.contains("iPhone") /* other phones? */) { br=BROWSER.iPhone; } else if ((msie = agent.indexOf("MSIE"))>=0) { msie+=5; @@ -379,14 +379,14 @@ public class Page extends HTMLCacheGen { protected static synchronized Permission getPerm(String instance, String action) { Map<String,Permission> msp = perms.get(instance); Permission p; - if(msp==null) { + if (msp==null) { msp = new HashMap<>(); perms.put(instance, msp); p=null; } else { p = msp.get(instance); } - if(p==null) { + if (p==null) { p=new AAFPermission(PERM_NS, PERM_CA_TYPE,instance,action); msp.put(action, p); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java index 844270ed..7462de80 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/SlotCode.java @@ -31,7 +31,7 @@ public abstract class SlotCode<TRANS extends TransStore> extends NamedCode { public SlotCode(boolean no_cache,EnvStore<?> env, String root, Enum<?> ... params) { super(no_cache,root); slots = new Slot[params.length]; - for(int i=0;i<params.length;++i) { + for (int i=0;i<params.length;++i) { slots[i] = env.slot(root + '.' + params[i].name()); } } @@ -41,7 +41,7 @@ public abstract class SlotCode<TRANS extends TransStore> extends NamedCode { } public<T> T get(TRANS trans,int idx, T dflt) { - if(idx>slots.length) { + if (idx>slots.length) { return dflt; } return trans.get(slots[idx],dflt); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java index 079593c9..6451c4e7 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/Table.java @@ -57,15 +57,15 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named public Table(String title, TRANS trans, Data<S,TRANS> data, String name, String ... attrs) { super(true,name); // prefix=postfix=null; - for(String a : attrs) { + for (String a : attrs) { addAttr(false, a); } ROW_MSG_SLOT=trans.slot("TABLE_ROW_MSG"); EMPTY_TABLE_SLOT=trans.slot("TABLE_EMPTY"); this.columns = data.headers(); boolean alt = false; - for(String s : attrs) { - if("class=std".equals(s) || "class=stdform".equals(s)) { + for (String s : attrs) { + if ("class=std".equals(s) || "class=stdform".equals(s)) { alt=true; } } @@ -89,7 +89,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named Mark tr = new Mark(); hgen.incr(table,TABLE); - if(title==null) { + if (title==null) { cache.dynamic(hgen, new DynamicCode<HTMLGen,S,TRANS>() { @Override public void code(S state, TRANS trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { @@ -100,7 +100,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named hgen.leaf("caption", "class=title").text(title).end(); } hgen.incr(tr,TR); - for(String column : columns) { + for (String column : columns) { hgen.leaf("th").text(column).end(); } hgen.end(tr); @@ -110,7 +110,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named // End Table hgen.end(table); - if(other!=null) { + if (other!=null) { other.code(cache,hgen); } @@ -119,10 +119,10 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named @Override public void code(S state, TRANS trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { String msg; - if((msg = trans.get(EMPTY_TABLE_SLOT, null))!=null) { + if ((msg = trans.get(EMPTY_TABLE_SLOT, null))!=null) { hgen.incr("style").text("#inner tr,caption,input,p.preamble {display: none;}#inner p.notfound {margin: 0px 0px 0px 20px}").end(); hgen.incr(HTMLGen.P,"class=notfound").text(msg).end().br(); - } else if((msg=trans.get(ROW_MSG_SLOT,null))!=null) { + } else if ((msg=trans.get(ROW_MSG_SLOT,null))!=null) { hgen.p(msg).br(); } } @@ -181,9 +181,9 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named int alt = this.alt; Cells cells = data.get(trans,state); - if(cells.cells.length>0) { - for(AbsCell[] row : cells.cells) { - if(row.length==0) { + if (cells.cells.length>0) { + for (AbsCell[] row : cells.cells) { + if (row.length==0) { hgen.text("</table>") .hr() .text("<table>"); @@ -198,7 +198,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named alt=1; hgen.incr(tr,TR,"class=alt"); } - for(AbsCell cell :row) { + for (AbsCell cell :row) { hgen.leaf(td, TD,cell.attrs()); cell.write(hgen); hgen.end(td); @@ -207,7 +207,7 @@ public class Table<S extends State<Env>, TRANS extends TransStore> extends Named } } // Pass Msg back to Table code, in order to place after Table Complete - if(cells.msg!=null) { + if (cells.msg!=null) { trans.put(ROW_MSG_SLOT,cells.msg); } } else { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java index f362418e..cf3a6715 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/XFrameFilter.java @@ -52,7 +52,7 @@ public class XFrameFilter implements Filter { @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain fc) throws IOException, ServletException { - if(resp instanceof HttpServletResponse) { + if (resp instanceof HttpServletResponse) { @SuppressWarnings("unused") HttpServletResponse hresp = (HttpServletResponse)resp; ((HttpServletResponse)resp).addHeader("X-Frame-Options", xframe); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java index 235683d5..7d57b3d8 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiDocs.java @@ -176,11 +176,11 @@ public class ApiDocs extends Page { @Override public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Api> fa = client.read("/api",gui.getDF(Api.class)); - if(fa.get(5000)) { + if (fa.get(5000)) { tt.done(); TimeTaken tt2 = trans.start("Load Data", Env.SUB); try { - if(fa.value!=null)for(Route r : fa.value.getRoute()) { + if (fa.value!=null)for (Route r : fa.value.getRoute()) { String path = r.getPath(); // Build info StringBuilder desc = new StringBuilder(); @@ -188,39 +188,39 @@ public class ApiDocs extends Page { desc.append("<p class=double>"); desc.append(r.getDesc()); - if(r.getComments().size()>0) { - for(String ct : r.getComments()) { + if (r.getComments().size()>0) { + for (String ct : r.getComments()) { desc.append("</p><p class=api_comment>"); desc.append(ct); } } - if(r.getParam().size()>0) { + if (r.getParam().size()>0) { desc.append("<hr><p class=api_label>Parameters</p>"); - for(String params : r.getParam()) { + for (String params : r.getParam()) { String param[] = params.split("\\s*\\|\\s*"); desc.append("</p><p class=api_contentType>"); desc.append(param[0]); desc.append(" : "); desc.append(param[1]); - if("true".equalsIgnoreCase(param[2])) { + if ("true".equalsIgnoreCase(param[2])) { desc.append(" (Required)"); } } } - if(r.getExpected()!=0) { + if (r.getExpected()!=0) { desc.append("</p><p class=api_label>Expected HTTP Code</p><p class=api_comment>"); desc.append(r.getExpected()); } - if(r.getExplicitErr().size()!=0) { + if (r.getExplicitErr().size()!=0) { desc.append("</p><p class=api_label>Explicit HTTP Error Codes</p><p class=api_comment>"); boolean first = true; - for(int ee : r.getExplicitErr()) { - if(first) { + for (int ee : r.getExplicitErr()) { + if (first) { first = false; } else { desc.append(", "); @@ -232,11 +232,11 @@ public class ApiDocs extends Page { desc.append("</p><p class=api_label>"); desc.append("GET".equals(r.getMeth())?"Accept:":"ContentType:"); Collections.sort(r.getContentType()); - if(r.getPath().startsWith("/authn/basicAuth")) { + if (r.getPath().startsWith("/authn/basicAuth")) { desc.append("</p><p class=api_contentType>text/plain"); } - for(String ct : r.getContentType()) { - if(ct.contains("version=2")) { + for (String ct : r.getContentType()) { + if (ct.contains("version=2")) { desc.append("</p><p class=api_contentType><a href=\"./example/"); try { desc.append(Symm.base64noSplit.encode(ct)); @@ -258,16 +258,16 @@ public class ApiDocs extends Page { new TextCell(desc.toString()), }; - if(path.startsWith("/authz/perm")) { + if (path.startsWith("/authz/perm")) { sa[0] = perms.size()==0?new TextCell("PERMISSION"):BLANK; perms.add(sa); - } else if(path.startsWith("/authz/role") || path.startsWith("/authz/userRole")) { + } else if (path.startsWith("/authz/role") || path.startsWith("/authz/userRole")) { sa[0] = roles.size()==0?new TextCell("ROLE"):BLANK; roles.add(sa); - } else if(path.startsWith("/authz/ns")) { + } else if (path.startsWith("/authz/ns")) { sa[0] = ns.size()==0?new TextCell("NAMESPACE"):BLANK; ns.add(sa); - } else if(path.startsWith("/authn/basicAuth") + } else if (path.startsWith("/authn/basicAuth") || path.startsWith("/authn/validate") || path.startsWith("/authz/user")) { sa[0] = user.size()==0?new TextCell("USER"):BLANK; @@ -277,7 +277,7 @@ public class ApiDocs extends Page { aafOnly.add(sa); } } - //TODO if(trans.fish(p)) + //TODO if (trans.fish(p)) prepare(rv, perms,roles,ns,user); } finally { tt2.done(); @@ -301,8 +301,8 @@ public class ApiDocs extends Page { private void prepare(ArrayList<AbsCell[]> rv, ArrayList<AbsCell[]> ... all) { AbsCell lead; AbsCell[] row; - for(ArrayList<AbsCell[]> al : all) { - if(al.size()>1) { + for (ArrayList<AbsCell[]> al : all) { + if (al.size()>1) { row = al.get(0); lead = row[0]; row[0]=BLANK; @@ -312,7 +312,7 @@ public class ApiDocs extends Page { public int compare(AbsCell[] ca1, AbsCell[] ca2) { int meth = ((TextCell)ca1[2]).name.compareTo( ((TextCell)ca2[2]).name); - if(meth == 0) { + if (meth == 0) { return (HttpMethods.valueOf(((TextCell)ca1[1]).name).compareTo( HttpMethods.valueOf(((TextCell)ca2[1]).name))); } else { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java index 3beed563..7da77607 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApiExample.java @@ -79,7 +79,7 @@ public class ApiExample extends Page { "application/Void+json" ); Future<String> fs2; - if(typecode.contains("Request+")) { + if (typecode.contains("Request+")) { fs2 = gui.client().read("/api/example/" + encoded+"?optional=true", "application/Void+json" ); @@ -88,19 +88,19 @@ public class ApiExample extends Page { } - if(fp.get(5000)) { + if (fp.get(5000)) { xgen.incr(HTMLGen.H1).text("Sample Code").end() .incr(HTMLGen.H5).text(typecode).end(); xgen.incr("pre"); - if(typecode.contains("+xml")) { + if (typecode.contains("+xml")) { xgen.xml(fp.body()); - if(fs2!=null && fs2.get(5000)) { + if (fs2!=null && fs2.get(5000)) { xgen.text(WITH_OPTIONAL_PARAMETERS); xgen.xml(fs2.body()); } } else { xgen.text(fp.body()); - if(fs2!=null && fs2.get(5000)) { + if (fs2!=null && fs2.get(5000)) { xgen.text(WITH_OPTIONAL_PARAMETERS); xgen.text(fs2.body()); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java index 507cb21a..8c90b491 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalAction.java @@ -63,16 +63,16 @@ public class ApprovalAction extends Page { lastPage += "?user="+user; } - if(appr==null) { + if (appr==null) { hgen.p("No Approvals have been selected."); } else { Approval app; final Approvals apps = new Approvals(); int count = 0; - for(String a : appr) { - if(a!=null) { + for (String a : appr) { + if (a!=null) { int idx = a.indexOf('|'); - if(idx>=0) { + if (idx>=0) { app = new Approval(); app.setStatus(a.substring(0,idx)); app.setTicket(a.substring(++idx)); @@ -82,7 +82,7 @@ public class ApprovalAction extends Page { } } } - if(apps.getApprovals().isEmpty()) { + if (apps.getApprovals().isEmpty()) { hgen.p("No Approvals have been sent."); } else { TimeTaken tt = trans.start("AAF Update Approvals",Env.REMOTE); @@ -93,7 +93,7 @@ public class ApprovalAction extends Page { public Boolean code(Rcli<?> client) throws APIException, CadiException { boolean fail2 = true; Future<Approvals> fa = client.update("/authz/approval",gui.getDF(Approvals.class),apps); - if(fa.get(AAF_GUI.TIMEOUT)) { + if (fa.get(AAF_GUI.TIMEOUT)) { // Do Remote Call fail2 = false; hgen.p(total + (total==1?" Approval has":" Approvals have") + " been Saved"); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java index 14d434cb..27fd5274 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/ApprovalForm.java @@ -146,9 +146,9 @@ public class ApprovalForm extends Page { public Integer code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Approvals> fa = client.read("/authz/approval/approver/"+trans.user(),gui.getDF(Approvals.class)); int numLeft = 0; - if(fa.get(AAF_GUI.TIMEOUT)) { + if (fa.get(AAF_GUI.TIMEOUT)) { - if(fa.value!=null) { + if (fa.value!=null) { for (Approval appr : fa.value.getApprovals()) { if ("pending".equals(appr.getStatus())) { if (userParam!=null && !appr.getUser().equalsIgnoreCase(userParam)) { @@ -227,23 +227,23 @@ public class ApprovalForm extends Page { boolean userOK=true; for (Approval appr : currApproverList) { - if(++line<MAX_LINE) { // limit number displayed at one time. + if (++line<MAX_LINE) { // limit number displayed at one time. AbsCell userCell; String user = appr.getUser(); - if(user.equals(prevUser)) { + if (user.equals(prevUser)) { userCell = AbsCell.Null; } else if (user.endsWith(DOMAIN_OF_USER)){ userOK=true; String title; Organization org = OrganizationFactory.obtain(trans.env(), user); - if(org==null) { + if (org==null) { title=""; } else { Identity au = org.getIdentity(trans, user); - if(au!=null) { - if("MECHID".equals(au.type())) { + if (au!=null) { + if ("MECHID".equals(au.type())) { Identity managedBy = au.responsibleTo(); - if(managedBy==null) { + if (managedBy==null) { title ="title=" + au.type(); } else { title="title=Sponsor is " + managedBy.fullName(); @@ -276,10 +276,10 @@ public class ApprovalForm extends Page { } } } - if(numLeft>0) { + if (numLeft>0) { msg = "After these, there will be " + numLeft + " approvals left to process"; } - if(rv.isEmpty()) { + if (rv.isEmpty()) { if (numLeft>0) { msg = "No Approvals to process at this time for user " + userParam +". You have " + numLeft + " other approvals to process."; diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java index 8088a700..d32c7dc3 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeAction.java @@ -77,34 +77,34 @@ trans.info().log("Step 1"); final String machine = trans.get(sMachine,null); final String ca = trans.get(sCA, null); final String sans = ((String)trans.get(sSans,null)); - if(sans!=null) { - for(String s: Split.splitTrim(',', sans)) { + if (sans!=null) { + for (String s: Split.splitTrim(',', sans)) { arti.getSans().add(s); } } // Disallow IP entries, except by special Permission - if(!trans.fish(getPerm(ca,"ip"))) { + if (!trans.fish(getPerm(ca,"ip"))) { boolean ok=true; - if(IPValidator.ip(machine)) { + if (IPValidator.ip(machine)) { ok=false; } - if(ok) { - for(String s: arti.getSans()) { - if(IPValidator.ip(s)) { + if (ok) { + for (String s: arti.getSans()) { + if (IPValidator.ip(s)) { ok=false; break; } } } - if(!ok) { + if (!ok) { hgen.p("Policy Failure: IPs in certificates are only allowed by Exception."); return; } } // Disallow Domain based Definitions without exception - if(machine.startsWith("*")) { // Domain set - if(!trans.fish(getPerm(ca, "domain"))) { + if (machine.startsWith("*")) { // Domain set + if (!trans.fish(getPerm(ca, "domain"))) { hgen.p("Policy Failure: Domain Artifact Declarations are only allowed by Exception."); return; } @@ -119,8 +119,8 @@ trans.info().log("Step 1"); arti.setRenewDays(Integer.parseInt((String)trans.get(sRenewal, null))); arti.setNotification((String)trans.get(sNotify, null)); String[] checkbox = trans.get(sType,null); - for(int i=0;i<CMArtiChangeForm.types.length;++i) { - if("on".equals(checkbox[i])) { + for (int i=0;i<CMArtiChangeForm.types.length;++i) { + if ("on".equals(checkbox[i])) { arti.getType().add(CMArtiChangeForm.types[i]); } } @@ -144,14 +144,14 @@ trans.info().log("Step 1"); case CMArtiChangeForm.CREATE: Future<Artifacts> fc; rv = fc = client.create("/cert/artifacts", gui.artifactsDF, artifacts); - if(fc.get(AAFcli.timeout())) { + if (fc.get(AAFcli.timeout())) { hgen.p("Created Artifact " + arti.getMechid() + " on " + arti.getMachine()); ok.set(true); } break; case CMArtiChangeForm.UPDATE: Future<Artifacts> fu = client.update("/cert/artifacts", gui.artifactsDF, artifacts); - if((rv=fu).get(AAFcli.timeout())) { + if ((rv=fu).get(AAFcli.timeout())) { hgen.p("Artifact " + arti.getMechid() + " on " + arti.getMachine() + " is updated"); ok.set(true); } @@ -159,12 +159,12 @@ trans.info().log("Step 1"); case CMArtiChangeForm.COPY: Future<Artifacts> future = client.read("/cert/artifacts/"+arti.getMechid()+'/'+arti.getMachine(), gui.artifactsDF); rv = future; - if(future.get(AAFcli.timeout())) { - for(Artifact a : future.value.getArtifact()) { // only one, because these two are key - for(String newMachine :Split.split(',', trans.get(sOther, ""))) { + if (future.get(AAFcli.timeout())) { + for (Artifact a : future.value.getArtifact()) { // only one, because these two are key + for (String newMachine :Split.split(',', trans.get(sOther, ""))) { a.setMachine(newMachine); Future<Artifacts> fup = client.update("/cert/artifacts", gui.artifactsDF, future.value); - if(fup.get(AAFcli.timeout())) { + if (fup.get(AAFcli.timeout())) { hgen.p("Copied to " + newMachine); ok.set(true); } @@ -175,7 +175,7 @@ trans.info().log("Step 1"); case CMArtiChangeForm.DELETE: Future<Void> fv; rv = fv = client.delete("/cert/artifacts/"+arti.getMechid()+"/"+arti.getMachine(),"application/json"); - if(fv.get(AAFcli.timeout())) { + if (fv.get(AAFcli.timeout())) { hgen.p("Deleted " + arti.getMechid() + " on " + arti.getMachine()); ok.set(true); deleted.set(true); @@ -185,11 +185,11 @@ trans.info().log("Step 1"); return rv; } }); - if(!ok.get()) { - if(f==null) { + if (!ok.get()) { + if (f==null) { hgen.p("Unknown Command"); } else { - if(f.body().contains("%")) { + if (f.body().contains("%")) { Error err = gui.getDF(Error.class).newData().in(TYPE.JSON).load(f.body()).asObject(); hgen.p(Vars.convert(err.getText(),err.getVariables())); } else { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java index 0268f498..ee55fdbc 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtiChangeForm.java @@ -138,25 +138,25 @@ public class CMArtiChangeForm extends Page { @Override public Artifact code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Artifacts> fa = client.read("/cert/artifacts/"+incomingID+'/'+incomingMach, gui.artifactsDF); - if(fa.get(AAFcli.timeout())) { - for(Artifact arti : fa.value.getArtifact()) { + if (fa.get(AAFcli.timeout())) { + for (Artifact arti : fa.value.getArtifact()) { return arti; // just need the first one } } return null; } }); - if(arti==null) { + if (arti==null) { Organization org = OrganizationFactory.get(trans); Identity user = org.getIdentity(trans, incomingID); - if(user==null) { + if (user==null) { hgen.p("The mechID you typed, \"" + incomingID + "\", is not a valid " + org.getName() + " ID"); return; } arti = new Artifact(); arti.setMechid(incomingID); Identity managedBy = user.responsibleTo(); - if(managedBy == null) { + if (managedBy == null) { arti.setSponsor("Unknown Sponsor"); } else { arti.setSponsor(managedBy.fullID()); @@ -173,7 +173,7 @@ public class CMArtiChangeForm extends Page { submitText = CREATE; delete = false; } else { - if(arti.getNotification()==null) { + if (arti.getNotification()==null) { Organization org = OrganizationFactory.get(trans); Identity user = org.getIdentity(trans, incomingID); arti.setNotification("mailto:"+user.email()); @@ -184,15 +184,15 @@ public class CMArtiChangeForm extends Page { .input(fields[0],"AppID*",true,"value="+arti.getMechid()) .input("sponsor", "Sponsor",false,"value="+arti.getSponsor(),"readonly","style=border:none;background-color:white;") .input(fields[1],"FQDN*",true,"value="+arti.getMachine(),"style=width:130%;"); -// if(maySans) { +// if (maySans) { hgen.incr(HTMLGen.TR).incr(HTMLGen.TD).end() .incr(HTMLGen.TD,"class=subtext").text("Use Fully Qualified Domain Names (that will be in DNS), "); - if(!trans.fish(getPerm(arti.getCa(),"ip"))) { + if (!trans.fish(getPerm(arti.getCa(),"ip"))) { hgen.text("NO "); } StringBuilder sb = null; - for(String s: arti.getSans()) { - if(sb==null) { + for (String s: arti.getSans()) { + if (sb==null) { sb = new StringBuilder(); } else { sb.append(", "); @@ -212,7 +212,7 @@ public class CMArtiChangeForm extends Page { .incr(HTMLGen.TR) .incr(HTMLGen.TD).leaf("label","for=types","required").text("Artifact Types").end(2) .incr(HTMLGen.TD); - for(int i=0;i<types.length;++i) { + for (int i=0;i<types.length;++i) { hgen.leaf("input","type=checkbox","name=types."+i,arti.getType().contains(types[i])?"checked":"").text(types[i]).end().br(); } @@ -232,7 +232,7 @@ public class CMArtiChangeForm extends Page { hgen.tagOnly("input","id="+fields[8],"name="+fields[8],"value="+submitText,"style=display:none;"); hgen.tagOnly("input","id=theButton","type=submit", "orig="+submitText,"value="+submitText); - } catch(CadiException | LocatorException | OrganizationException e) { + } catch (CadiException | LocatorException | OrganizationException e) { throw new APIException(e); } } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java index 0992ad3d..85797cb5 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CMArtifactShow.java @@ -118,11 +118,11 @@ public class CMArtifactShow extends Page { @Override protected String title(AuthzTrans trans) { StringBuilder sb = new StringBuilder("X509 Certificates"); - if(sc!=null) { // initialized + if (sc!=null) { // initialized sb.append(" for "); String id = sc.get(trans,Params.id,""); sb.append(id); - if(id.indexOf('@')<0) { + if (id.indexOf('@')<0) { sb.append('@'); sb.append(FQI.reverseDomain(sc.get(trans, Params.ns,"missingDomain"))); } @@ -155,7 +155,7 @@ public class CMArtifactShow extends Page { @Override public Cells get(final AuthzTrans trans, final AAF_GUI gui) { String str = sc.get(trans,Params.id, null); - if(str==null) { + if (str==null) { return Cells.EMPTY; } final String id = str.indexOf('@')>=0?str:str + '@' + FQI.reverseDomain(sc.get(trans,Params.ns, "")); @@ -169,7 +169,7 @@ public class CMArtifactShow extends Page { Future<Artifacts> fuArt = client.read("/cert/artifacts?mechid="+id, gui.artifactsDF); X509Certificate[] lc; - if(fuCI.get(AAFcli.timeout())) { + if (fuCI.get(AAFcli.timeout())) { TimeTaken tt1 = trans.start("x509Certificate", Env.SUB); try { Collection<? extends Certificate> xcs = Factory.toX509Certificate(fuCI.value.getCerts()); @@ -185,8 +185,8 @@ public class CMArtifactShow extends Page { lc = null; trans.error().log("Cannot retrieve Certificates for " + id); } - if(fuArt.get(AAFcli.timeout())) { - for(Artifact arti : fuArt.value.getArtifact()) { + if (fuArt.get(AAFcli.timeout())) { + for (Artifact arti : fuArt.value.getArtifact()) { StringWriter sw = new StringWriter(); HTMLGen hgen = cas.clone(sw); Mark mark = new Mark(); @@ -195,17 +195,17 @@ public class CMArtifactShow extends Page { .text("Details") .end(mark); Date last = null; - if(lc!=null) { - for(X509Certificate xc : lc) { - if(xc.getSubjectDN().getName().contains("CN="+arti.getMachine())) { - if(last==null || last.before(xc.getNotAfter())) { + if (lc!=null) { + for (X509Certificate xc : lc) { + if (xc.getSubjectDN().getName().contains("CN="+arti.getMachine())) { + if (last==null || last.before(xc.getNotAfter())) { last = xc.getNotAfter(); } } } } GregorianCalendar renew; - if(last!=null) { + if (last!=null) { renew = new GregorianCalendar(); renew.setTime(last); renew.add(GregorianCalendar.DAY_OF_MONTH,arti.getRenewDays()*-1); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java index 7daee3dd..00e58c87 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredDetail.java @@ -90,13 +90,13 @@ public class CredDetail extends Page { Mark js = new Mark(), fn=new Mark(); hgen.js(js).function(fn,"newArtifact") .text("id=document.getElementById('id');") - .text("if(id.value=='') {alert('Enter the id in box');} else {") + .text("if (id.value=='') {alert('Enter the id in box');} else {") .text("window.open('"+CMArtiChangeForm.HREF+"?id='+id.value+'&ns="+ns+"','_self');}" ) .end(fn) .function("newPassword") .text("id=document.getElementById('id');") - .text("if(id.value=='') {alert('Enter the id in box');} else {") + .text("if (id.value=='') {alert('Enter the id in box');} else {") .text("window.open('"+PassChangeForm.HREF+"?id='+id.value+'@"+domain+"&ns="+ns+"','_self');}" ) .end(js); @@ -145,7 +145,7 @@ public class CredDetail extends Page { public Cells get(final AuthzTrans trans, final AAF_GUI gui) { final String ns = sc.get(trans, Params.ns, ""); final String id = sc.get(trans, Params.id, ""); - if(ns==null) { + if (ns==null) { return Cells.EMPTY; } final ArrayList<AbsCell[]> rv = new ArrayList<>(); @@ -156,7 +156,7 @@ public class CredDetail extends Page { @Override public List<Artifact> code(Rcli<?> client)throws CadiException, ConnectException, APIException { Future<Artifacts> fa = client.read("/cert/artifacts?ns="+ns,gui.artifactsDF); - if(fa.get(AAFcli.timeout())) { + if (fa.get(AAFcli.timeout())) { return fa.value.getArtifact(); } else { return null; @@ -165,8 +165,8 @@ public class CredDetail extends Page { }); final Set<String> lns = new HashSet<>(); - if(la!=null) { - for(Artifact a : la){ + if (la!=null) { + for (Artifact a : la){ lns.add(a.getMechid()); } } @@ -174,7 +174,7 @@ public class CredDetail extends Page { @Override public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Users> fu = client.read("/authn/creds/ns/"+ns,gui.getDF(Users.class)); - if(fu.get(AAFcli.timeout())) { + if (fu.get(AAFcli.timeout())) { // Organize User entries Map<String,List<Map<Integer,List<User>>>> users = new HashMap<>(); @@ -183,26 +183,26 @@ public class CredDetail extends Page { List<User> lu = null; for (User u : fu.value.getUser()) { - if(u.getType() == 200) { + if (u.getType() == 200) { lns.remove(u.getId()); } lmu = users.get(u.getId()); - if(lmu==null) { + if (lmu==null) { users.put(u.getId(),lmu=new ArrayList<>()); } mu=null; - for(Map<Integer,List<User>> xmu : lmu) { - if(xmu.containsKey(u.getType())) { + for (Map<Integer,List<User>> xmu : lmu) { + if (xmu.containsKey(u.getType())) { mu = xmu; } } - if(mu==null) { + if (mu==null) { lmu.add(mu=new HashMap<>()); } lu = mu.get(u.getType()); - if(lu==null) { + if (lu==null) { mu.put(u.getType(),lu = new ArrayList<>()); } lu.add(u); @@ -218,7 +218,7 @@ public class CredDetail extends Page { StringWriter creds = new StringWriter(); hgen = cd.clone(creds); Mark div = hgen.divID(key,ulm.getKey().equals(id)?"":"style=display:none;"); - for(Map<Integer, List<User>> miu : ulm.getValue()) { + for (Map<Integer, List<User>> miu : ulm.getValue()) { Mark utable = new Mark(); hgen.leaf(utable,HTMLGen.TABLE); @@ -226,7 +226,7 @@ public class CredDetail extends Page { String cls; boolean first = true; - for( Entry<Integer, List<User>> es : miu.entrySet()) { + for ( Entry<Integer, List<User>> es : miu.entrySet()) { Collections.sort(es.getValue(),new Comparator<User>() { @Override public int compare(User u1, User u2) { @@ -237,22 +237,22 @@ public class CredDetail extends Page { int xcnt = 0; XMLGregorianCalendar oldest=null, newest=null; String id = null; - for(User u: es.getValue()) { - if(id==null) { + for (User u: es.getValue()) { + if (id==null) { id = u.getId(); } // Need to compile entries for Certificates on this screen - if(es.getKey()==200) { + if (es.getKey()==200) { ++xcnt; - if(oldest==null || oldest.compare(u.getExpires())<0) { + if (oldest==null || oldest.compare(u.getExpires())<0) { oldest = u.getExpires(); } - if(newest==null || newest.compare(u.getExpires())<0) { + if (newest==null || newest.compare(u.getExpires())<0) { newest = u.getExpires(); } } else { hgen.leaf(uRow,HTMLGen.TR); - if(first) { + if (first) { hgen.leaf(HTMLGen.TD,cls="class=detailFirst",STYLE_WIDTH_10); switch(es.getKey()) { case 1: @@ -274,7 +274,7 @@ public class CredDetail extends Page { "&date="+u.getExpires().toXMLFormat() + "&type="+u.getType()) .text("Delete").end(); - if(first && es.getKey()<10) { // Change Password Screen + if (first && es.getKey()<10) { // Change Password Screen hgen.leaf(HTMLGen.A,"class=button","href="+PassChangeForm.HREF+"?id="+id+"&ns="+ns) .text("Add") .end(); @@ -287,7 +287,7 @@ public class CredDetail extends Page { hgen.end(uRow); } } - if(xcnt>0) { // print compilations, if any, of Certificate + if (xcnt>0) { // print compilations, if any, of Certificate hgen.leaf(uRow,HTMLGen.TR) .leaf(HTMLGen.TD,cls="class=detailFirst",STYLE_WIDTH_10).text("x509").end() .leaf(HTMLGen.TD, cls,STYLE_WIDTH_20) @@ -316,7 +316,7 @@ public class CredDetail extends Page { new TextCell(creds.toString(),STYLE_WIDTH_70) }); } - for(String missing : lns) { + for (String missing : lns) { StringWriter buttons = new StringWriter(); HTMLGen hgen = cd.clone(buttons); hgen.leaf(HTMLGen.A,"class=button","href="+CMArtifactShow.HREF+"?id="+missing+"&ns="+ns) diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java index 5b614edc..3fd69aca 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/LoginLanding.java @@ -56,10 +56,10 @@ public class LoginLanding extends Page { @Override public void code(AAF_GUI authGUI, AuthzTrans trans, Cache<HTMLGen> cache, HTMLGen xgen) throws APIException, IOException { HttpServletRequest req = trans.get(gui.slot_httpServletRequest, null); - if(req!=null) { + if (req!=null) { String query = req.getQueryString(); - if(query!=null) { - for(String qs : query.split("&")) { + if (query!=null) { + for (String qs : query.split("&")) { int equals = qs.indexOf('='); xgen.leaf(HTMLGen.A, "href="+URLDecoder.decode(qs.substring(equals+1),Config.UTF_8)).text(qs.substring(0,equals).replace('_', ' ')).end(); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java index faf657e7..c7515e00 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsDetail.java @@ -76,7 +76,7 @@ public class NsDetail extends Page { model.set(this); keySlot = gui.env.slot(NAME+".ns"); gw_url = gui.env.getProperty(Config.GW_URL); - if(gw_url==null) { + if (gw_url==null) { gw_url=""; } else { gw_url+="/aaf/2.0"; @@ -101,12 +101,12 @@ public class NsDetail extends Page { final String nsName = trans.get(keySlot, null); Validator v = new Validator(); v.ns(nsName); - if(v.err()) { + if (v.err()) { trans.warn().printf("Error in NsDetail Request: %s", v.errs()); return Cells.EMPTY; } - if(nsName==null) { + if (nsName==null) { return Cells.EMPTY; } final ArrayList<AbsCell[]> rv = new ArrayList<>(); @@ -119,12 +119,12 @@ public class NsDetail extends Page { public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Nss> fn = client.read("/authz/nss/"+nsName,gui.getDF(Nss.class)); - if(fn.get(AAF_GUI.TIMEOUT)) { + if (fn.get(AAF_GUI.TIMEOUT)) { tt.done(); try { // TimeTaken tt = trans.start("Load Data", Env.SUB); - for(Ns n : fn.value.getNs()) { + for (Ns n : fn.value.getNs()) { String desc = (n.getDescription()!=null?n.getDescription():BLANK); rv.add(new AbsCell[]{new TextCell("Description:"),new TextCell(desc)}); @@ -145,7 +145,7 @@ public class NsDetail extends Page { gui.getDF(Roles.class) ); List<String> roles = new ArrayList<>(); - if(fr.get(AAFcli.timeout())) { + if (fr.get(AAFcli.timeout())) { for (Role r : fr.value.getRole()) { roles.add(r.getName()); } @@ -159,7 +159,7 @@ public class NsDetail extends Page { ); List<String> perms = new ArrayList<>(); - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { for (Perm p : fp.value.getPerm()) { perms.add(p.getType() + "|" + p.getInstance() + "|" + p.getAction()); } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java index 7d11e66f..bca6c92c 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsHistory.java @@ -164,7 +164,7 @@ public class NsHistory extends Page { final String oName = trans.get(name,null); final String oDates = trans.get(dates,null); - if(oName==null) { + if (oName==null) { return Cells.EMPTY; } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java index 8a2da3d3..cb942c6c 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoAction.java @@ -71,9 +71,9 @@ public class NsInfoAction extends Page { if (id==null || id.indexOf('@')<=0) { hgen.p("Data Entry Failure: Please enter a valid ID, including domain."); - } else if(password == null || password2 == null || currPass == null) { + } else if (password == null || password2 == null || currPass == null) { hgen.p("Data Entry Failure: Both Password Fields need entries."); - } else if(!password.equals(password2)) { + } else if (!password.equals(password2)) { hgen.p("Data Entry Failure: Passwords do not match."); } else { // everything else is checked by Server final CredRequest cred = new CredRequest(); @@ -93,21 +93,21 @@ public class NsInfoAction extends Page { boolean go; boolean fail = true; fcr.get(5000); - if(fcr.code() == 200) { + if (fcr.code() == 200) { hgen.p("Current Password validated"); go = true; } else { hgen.p(String.format("Invalid Current Password: %d %s",fcr.code(),fcr.body())); go = false; } - if(go) { + if (go) { tt.done(); tt = trans.start("AAF Change Password",Env.REMOTE); try { // Change over Cred to reset mode cred.setPassword(password); String start = trans.get(startDate, null); - if(start!=null) { + if (start!=null) { try { cred.setStart(Chrono.timeStamp(Chrono.dateOnlyFmt.parse(start))); } catch (ParseException e) { @@ -121,7 +121,7 @@ public class NsInfoAction extends Page { cred ); - if(fcr.get(5000)) { + if (fcr.get(5000)) { // Do Remote Call hgen.p("New Password has been added."); fail = false; @@ -145,7 +145,7 @@ public class NsInfoAction extends Page { } } hgen.br(); - if(fail) { + if (fail) { hgen.incr("a",true,"href="+PassChangeForm.HREF+"?id="+id).text("Try again").end(); } else { hgen.incr("a",true,"href="+Home.HREF).text("Home").end(); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java index 2447c98b..2306a1a5 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NsInfoForm.java @@ -80,21 +80,21 @@ public class NsInfoForm extends Page { final String incomingID= trans.get(sID, ""); final String[] info = new String[fields.length]; final Object own_adm[] = new Object[2]; - for(int i=0;i<info.length;++i) { + for (int i=0;i<info.length;++i) { info[i]=""; } - if(incomingID.length()>0) { + if (incomingID.length()>0) { TimeTaken tt = trans.start("AAF Namespace Info",Env.REMOTE); try { gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Void>() { @Override public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Nss> fn = client.read("/authz/nss/"+incomingID,gui.getDF(Nss.class)); - if(fn.get(AAF_GUI.TIMEOUT)) { - for(Ns ns : fn.value.getNs()) { + if (fn.get(AAF_GUI.TIMEOUT)) { + for (Ns ns : fn.value.getNs()) { info[0]=ns.getName(); info[1]=ns.getDescription(); - for(Ns.Attrib attr: ns.getAttrib()) { + for (Ns.Attrib attr: ns.getAttrib()) { switch(attr.getKey()) { case "mots": info[2]=attr.getValue(); @@ -128,8 +128,8 @@ public class NsInfoForm extends Page { .end(endTD) .incr(endTD,HTMLGen.TD) .tagOnly("input","id="+fields[3],"title=Owner of App, must be an Non-Bargained Employee"); - if(own_adm[0]!=null) { - for(String s : (List<String>)own_adm[0]) { + if (own_adm[0]!=null) { + for (String s : (List<String>)own_adm[0]) { hgen.incr("label",true).text(s).end(); } } @@ -142,8 +142,8 @@ public class NsInfoForm extends Page { .end(endTD) .incr(endTD,HTMLGen.TD) .tagOnly("input","id="+fields[4],"title=Admins may be employees, contractors or mechIDs"); - if(own_adm[1]!=null) { - for(String s : (List<String>)own_adm[1]) { + if (own_adm[1]!=null) { + for (String s : (List<String>)own_adm[1]) { hgen.incr(HTMLGen.P,true).text(s).end(); } } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java index b2a6e368..6f090a49 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/NssShow.java @@ -85,7 +85,7 @@ public class NssShow extends Page { public Cells get(final AuthzTrans trans, final AAF_GUI gui) { ArrayList<AbsCell[]> rv = new ArrayList<>(); List<Ns> nss = trans.get(sNssByUser, null); - if(nss==null) { + if (nss==null) { TimeTaken tt = trans.start("AAF Nss by User for " + privilege,Env.REMOTE); try { nss = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<List<Ns>>() { @@ -93,10 +93,10 @@ public class NssShow extends Page { public List<Ns> code(Rcli<?> client) throws CadiException, ConnectException, APIException { List<Ns> nss = null; Future<Nss> fp = client.read("/authz/nss/either/" + trans.user(),gui.getDF(Nss.class)); - if(fp.get(AAF_GUI.TIMEOUT)) { + if (fp.get(AAF_GUI.TIMEOUT)) { TimeTaken tt = trans.start("Load Data for " + privilege, Env.SUB); try { - if(fp.value!=null) { + if (fp.value!=null) { nss = fp.value.getNs(); Collections.sort(nss, new Comparator<Ns>() { public int compare(Ns ns1, Ns ns2) { @@ -121,9 +121,9 @@ public class NssShow extends Page { } } - if(nss!=null) { - for(Ns n : nss) { - if((isAdmin && !n.getAdmin().isEmpty()) + if (nss!=null) { + for (Ns n : nss) { + if ((isAdmin && !n.getAdmin().isEmpty()) || (!isAdmin && !n.getResponsible().isEmpty())) { AbsCell[] sa = new AbsCell[] { new RefCell(n.getName(),NsDetail.HREF diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java index aafd0c96..10af074a 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeAction.java @@ -82,9 +82,9 @@ public class PassChangeAction extends Page { if (id==null || id.indexOf('@')<=0) { hgen.p("Data Entry Failure: Please enter a valid ID, including domain."); - } else if(password == null || password2 == null) { + } else if (password == null || password2 == null) { hgen.p("Data Entry Failure: Both Password Fields need entries."); - } else if(!password.equals(password2)) { + } else if (!password.equals(password2)) { hgen.p("Data Entry Failure: Passwords do not match."); } else { // everything else is checked by Server final CredRequest cred = new CredRequest(); @@ -98,30 +98,30 @@ public class PassChangeAction extends Page { boolean go = false; try { Organization org = OrganizationFactory.obtain(trans.env(), id); - if(org!=null) { + if (org!=null) { go = PassChangeForm.skipCurrent(trans, org.getIdentity(trans, id)); } - } catch(OrganizationException e) { + } catch (OrganizationException e) { trans.error().log(e); } - if(cred.getPassword()==null) { + if (cred.getPassword()==null) { try { - if(!go) { + if (!go) { go=gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Boolean>() { @Override public Boolean code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Users> fc = client.read("/authn/creds/id/"+id,gui.getDF(Users.class)); - if(fc.get(AAFcli.timeout())) { + if (fc.get(AAFcli.timeout())) { GregorianCalendar now = new GregorianCalendar(); - for(aaf.v2_0.Users.User u : fc.value.getUser()) { - if(u.getType()<10 && u.getExpires().toGregorianCalendar().after(now)) { + for (aaf.v2_0.Users.User u : fc.value.getUser()) { + if (u.getType()<10 && u.getExpires().toGregorianCalendar().after(now)) { return false; // an existing, non expired, password type exists } } return true; // no existing, no expired password } else { - if(fc.code()==404) { // not found... + if (fc.code()==404) { // not found... return true; } else { trans.error().log(gui.aafCon.readableErrMsg(fc)); @@ -131,7 +131,7 @@ public class PassChangeAction extends Page { } }); } - if(!go) { + if (!go) { hgen.p("Current Password required").br(); } } catch (LocatorException e) { @@ -144,7 +144,7 @@ public class PassChangeAction extends Page { // Note: Need "Post", because of hiding password in SSL Data Future<CredRequest> fcr = client.create("/authn/validate",gui.getDF(CredRequest.class),cred); fcr.get(5000); - if(fcr.code() == 200) { + if (fcr.code() == 200) { hgen.p("Current Password validated").br(); go = true; } else { @@ -156,13 +156,13 @@ public class PassChangeAction extends Page { tt.done(); } } - if(go) { + if (go) { TimeTaken tt = trans.start("AAF Change Password",Env.REMOTE); try { // Change over Cred to reset mode cred.setPassword(password); String start = trans.get(startDate, null); - if(start!=null) { + if (start!=null) { try { cred.setStart(Chrono.timeStamp(Chrono.dateOnlyFmt.parse(start))); } catch (ParseException e) { @@ -171,7 +171,7 @@ public class PassChangeAction extends Page { } Future<CredRequest> fcr = gui.clientAsUser(trans.getUserPrincipal()).create("/authn/cred",gui.getDF(CredRequest.class),cred); - if(fcr.get(AAFcli.timeout())) { + if (fcr.get(AAFcli.timeout())) { // Do Remote Call hgen.p("New Password has been added. The previous one is still valid until Expiration."); fail = false; @@ -194,10 +194,10 @@ public class PassChangeAction extends Page { } hgen.br(); - if(fail) { + if (fail) { hgen.incr(HTMLGen.A,true,"class=greenbutton","href="+PassChangeForm.HREF+"?id="+id).text("Try again").end(); } else { - if(ns==null) { + if (ns==null) { hgen.incr(HTMLGen.A,true,"class=greenbutton","href="+Home.HREF).text("Back").end(); } else { hgen.incr(HTMLGen.A,true,"class=greenbutton","href="+CredDetail.HREF+"?id="+id+"&ns="+ns).text("Back").end(); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java index dcaed047..499c02dd 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassChangeForm.java @@ -81,14 +81,14 @@ public class PassChangeForm extends Page { public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { String incomingID= trans.get(sID, ""); boolean skipCurrent = false; - if(incomingID.length()>0) { + if (incomingID.length()>0) { try { Organization org = OrganizationFactory.obtain(trans.env(), incomingID); - if(org==null) { + if (org==null) { hgen.incr(HTMLGen.H4,"style=color:red;").text("Error: There is no supported company for ").text(incomingID).end(); } else { Identity user = org.getIdentity(trans, incomingID); - if(user==null) { + if (user==null) { int at = incomingID.indexOf('@'); hgen.incr(HTMLGen.H4,"style=color:red;").text("Error: You are not the sponsor of '").text(at<0?incomingID:incomingID.substring(0,at)) .text("' defined at ").text(org.getName()).end(); @@ -97,23 +97,23 @@ public class PassChangeForm extends Page { // Owners/or the IDs themselves are allowed to reset password without previous one skipCurrent=skipCurrent(trans, user); - if(!skipCurrent) { + if (!skipCurrent) { final String id = incomingID; try { skipCurrent=gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Boolean>() { @Override public Boolean code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Users> fc = client.read("/authn/creds/id/"+id,gui.getDF(Users.class)); - if(fc.get(AAFcli.timeout())) { + if (fc.get(AAFcli.timeout())) { GregorianCalendar now = new GregorianCalendar(); - for(aaf.v2_0.Users.User u : fc.value.getUser()) { - if(u.getType()<10 && u.getType()>=1 && u.getExpires().toGregorianCalendar().after(now)) { + for (aaf.v2_0.Users.User u : fc.value.getUser()) { + if (u.getType()<10 && u.getType()>=1 && u.getExpires().toGregorianCalendar().after(now)) { return false; // an existing, non expired, password type exists } } return true; // no existing, no expired password } else { - if(fc.code()==404) { // not found... + if (fc.code()==404) { // not found... return true; } else { trans.error().log(gui.aafCon.readableErrMsg(fc)); @@ -135,10 +135,10 @@ public class PassChangeForm extends Page { } hgen.input(fields[0],"ID*",true,"value="+incomingID,(incomingID.length()==0?"":"readonly")); - if(!skipCurrent) { + if (!skipCurrent) { hgen.input(fields[1],"Current Password*",true,"type=password"); } - if(skipCurrent) { + if (skipCurrent) { hgen.input(fields[1],"",false,"type=hidden", "value=").end(); } @@ -166,10 +166,10 @@ public class PassChangeForm extends Page { public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { try { Organization org = OrganizationFactory.obtain(trans.env(),trans.getUserPrincipal().getName()); - if(org!=null) { + if (org!=null) { hgen.incr(HTMLGen.H4).text("Password Rules for ").text(org.getName()).end() .incr(HTMLGen.UL); - for(String line : org.getPasswordRules()) { + for (String line : org.getPasswordRules()) { hgen.leaf(HTMLGen.LI).text(line).end(); } hgen.end(); @@ -187,14 +187,14 @@ public class PassChangeForm extends Page { // Package on Purpose static boolean skipCurrent(AuthzTrans trans, Identity user) throws OrganizationException { - if(user!=null) { + if (user!=null) { // Should this be an abstractable Policy? String tuser = trans.user(); - if(user.fullID().equals(trans.user())) { + if (user.fullID().equals(trans.user())) { return true; } else { Identity manager = user.responsibleTo(); - if(tuser.equals(user.fullID()) || manager.isFound()) { + if (tuser.equals(user.fullID()) || manager.isFound()) { return true; } } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java index 2ad7ca5e..f66e8bcb 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PassDeleteAction.java @@ -65,13 +65,13 @@ public class PassDeleteAction extends Page { @Override public String code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<CredRequest> fcr = client.delete("/authn/cred", gui.getDF(CredRequest.class),cr); - if(!fcr.get(AAFcli.timeout())) { + if (!fcr.get(AAFcli.timeout())) { return gui.aafCon.readableErrMsg(fcr); } return null; } }); - if(err==null) { + if (err==null) { hgen.p("Password " + cr.getId() + ", " + cr.getEntry() + " is Deleted"); } else { hgen.p(err); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java index a4970e3c..22c3fd4d 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java @@ -125,10 +125,10 @@ public class PendingRequestsShow extends Page { TimeTaken tt = trans.start("AAF Get Approvals by User",Env.REMOTE); try { Future<Approvals> fa = client.read("/authz/approval/user/"+trans.user(),gui.getDF(Approvals.class)); - if(fa.get(5000)) { + if (fa.get(5000)) { tt.done(); tt = trans.start("Load Data", Env.SUB); - if(fa.value!=null) { + if (fa.value!=null) { List<Approval> approvals = fa.value.getApprovals(); Collections.sort(approvals, new Comparator<Approval>() { @Override @@ -140,7 +140,7 @@ public class PendingRequestsShow extends Page { }); String prevTicket = null; - for(Approval a : approvals) { + for (Approval a : approvals) { String approver = a.getApprover(); String approverShort = approver.substring(0,approver.indexOf('@')); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java index 750f725f..7d31d0e4 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermDetail.java @@ -92,7 +92,7 @@ public class PermDetail extends Page { .permInstance(pInstance) .permAction(pAction); - if(v.err()) { + if (v.err()) { trans.warn().printf("Error in PermDetail Request: %s", v.errs()); return Cells.EMPTY; } @@ -108,17 +108,17 @@ public class PermDetail extends Page { try { Future<Perms> fp= client.read("/authz/perms/"+pType + '/' + pInstance + '/' + pAction,gui.getDF(Perms.class)); - if(fp.get(AAF_GUI.TIMEOUT)) { + if (fp.get(AAF_GUI.TIMEOUT)) { tt.done(); tt = trans.start("Load Data", Env.SUB); List<Perm> ps = fp.value.getPerm(); - if(!ps.isEmpty()) { + if (!ps.isEmpty()) { Perm perm = fp.value.getPerm().get(0); String desc = (perm.getDescription()!=null?perm.getDescription():BLANK); rv.add(new AbsCell[]{new TextCell("Description:"),new TextCell(desc)}); boolean first=true; - for(String r : perm.getRoles()) { - if(first){ + for (String r : perm.getRoles()) { + if (first){ first=false; rv.add(new AbsCell[] { new TextCell("Associated Roles:"), diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java index 8839ed81..9d53c535 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantAction.java @@ -94,7 +94,7 @@ public class PermGrantAction extends Page { grantReq ); - if(fgrant.get(5000)) { + if (fgrant.get(5000)) { hgen.p("Permission has been granted to role."); fail = false; } else { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java index 1ecf3d30..71958060 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermGrantForm.java @@ -108,7 +108,7 @@ public class PermGrantForm extends Page { hgen .incr("option", "value=").text("Other").end() .end(selectRow); - if(roleValue==null) { + if (roleValue==null) { hgen.input(fields[3],"Role", true, "placeholder=or type a role here"); } else { hgen.input(fields[3],"Role",true, "value="+roleValue); @@ -133,7 +133,7 @@ public class PermGrantForm extends Page { TimeTaken tt = trans.start("AAF get my roles",Env.REMOTE); try { Future<Roles> fr = client.read("/authz/roles/user/"+trans.user(),gui.getDF(Roles.class)); - if(fr.get(5000)) { + if (fr.get(5000)) { tt.done(); tt = trans.start("Load Data", Env.SUB); if (fr.value != null) for (Role r : fr.value.getRole()) { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java index f3464bf9..bbaf419f 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermHistory.java @@ -171,7 +171,7 @@ public class PermHistory extends Page { final String oName = trans.get(sType,null); final String oDates = trans.get(sDates,null); - if(oName==null) { + if (oName==null) { return Cells.EMPTY; } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java index 22ba95b9..7dff0815 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PermsShow.java @@ -84,11 +84,11 @@ public class PermsShow extends Page { @Override public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException { Future<Perms> fp = client.read("/authz/perms/user/"+trans.user(), gui.getDF(Perms.class)); - if(fp.get(5000)) { + if (fp.get(5000)) { TimeTaken ttld = trans.start("Load Data", Env.SUB); try { - if(fp.value!=null) { - for(Perm p : fp.value.getPerm()) { + if (fp.value!=null) { + for (Perm p : fp.value.getPerm()) { AbsCell[] sa = new AbsCell[] { new RefCell(p.getType(),PermDetail.HREF +"?type="+p.getType() diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java index 0d0d03ad..090b6e3c 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RequestDetail.java @@ -80,7 +80,7 @@ public class RequestDetail extends Page { public Cells get(final AuthzTrans trans, final AAF_GUI gui) { Cells rv=Cells.EMPTY; final String ticket = trans.get(sTicket, null); - if(ticket!=null) { + if (ticket!=null) { try { rv = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Cells>() { @Override @@ -93,7 +93,7 @@ public class RequestDetail extends Page { gui.getDF(Approvals.class) ); - if(fa.get(AAF_GUI.TIMEOUT)) { + if (fa.get(AAF_GUI.TIMEOUT)) { if (!trans.user().equals(fa.value.getApprovals().get(0).getUser())) { return Cells.EMPTY; } diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java index d5a89c2c..bfc258bc 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetail.java @@ -107,7 +107,7 @@ public class RoleDetail extends Page { final String pRole = trans.get(sRoleName, null); Validator v = new Validator(); v.role(pRole); - if(v.err()) { + if (v.err()) { trans.warn().printf("Error in PermDetail Request: %s", v.errs()); return; } @@ -121,9 +121,9 @@ public class RoleDetail extends Page { try { Future<Roles> fr = client.read("/authz/roles/"+pRole+"?ns",gui.getDF(Roles.class)); Future<UserRoles> fur = client.read("/authz/userRoles/role/"+pRole,gui.getDF(UserRoles.class)); - if(fr.get(AAF_GUI.TIMEOUT)) { + if (fr.get(AAF_GUI.TIMEOUT)) { List<Role> roles = fr.value.getRole(); - if(!roles.isEmpty()) { + if (!roles.isEmpty()) { Role role = fr.value.getRole().get(0); trans.put(sRole, role); Boolean mayWrite = trans.fish(new AAFPermission(role.getNs(),ACCESS,":role:"+role.getName(),"write")); @@ -131,7 +131,7 @@ public class RoleDetail extends Page { Boolean mayApprove = trans.fish(new AAFPermission(role.getNs(),ACCESS,":role:"+role.getName(),"approve")); trans.put(sMayApprove, mayApprove); - if(mayWrite || mayApprove) { + if (mayWrite || mayApprove) { Mark js = new Mark(); Mark fn = new Mark(); hgen.js(js) @@ -160,7 +160,7 @@ public class RoleDetail extends Page { return false; } - if(fur.get(AAF_GUI.TIMEOUT)) { + if (fur.get(AAF_GUI.TIMEOUT)) { trans.put(sUserRole, fur.value.getUserRole()); } else { trans.error().printf("Error calling AAF for UserRoles in GUI, Role Detail %d: %s",fr.code(),fr.body()); @@ -184,7 +184,7 @@ public class RoleDetail extends Page { final Role role = trans.get(sRole,null); ArrayList<AbsCell[]> rv = new ArrayList<>(); - if(role!=null) { + if (role!=null) { boolean mayWrite = trans.get(sMayWrite, false); boolean mayApprove = trans.get(sMayApprove, false); @@ -192,7 +192,7 @@ public class RoleDetail extends Page { rv.add(new AbsCell[]{ new TextCell("Role:","width=45%"), new TextCell(pRole)}); - if(mayWrite) { + if (mayWrite) { rv.add(new AbsCell[]{ new TextCell("Description:","width=45%"), new TextInputCell("description","textInput",desc,"id=descText","onkeypress=touchedDesc()"), @@ -211,9 +211,9 @@ public class RoleDetail extends Page { boolean protectedRole = role.getName().endsWith(".owner") || role.getName().endsWith(".admin"); boolean first = true; - for(Pkey r : role.getPerms()) { + for (Pkey r : role.getPerms()) { String key=r.getType() + '|' + r.getInstance() + '|' + r.getAction(); - if(mayWrite) { + if (mayWrite) { rv.add(new AbsCell[] { AbsCell.Null, protectedRole && r.getType().endsWith(".access") @@ -223,7 +223,7 @@ public class RoleDetail extends Page { new TextCell(key) }); } else { - if(first) { + if (first) { rv.add(new AbsCell[] { new TextCell("Associated Permissions:","width=45%"), new TextCell(key) @@ -238,7 +238,7 @@ public class RoleDetail extends Page { } } - if(mayApprove) { + if (mayApprove) { rv.add(AbsCell.HLINE); // @@ -249,8 +249,8 @@ public class RoleDetail extends Page { }); List<UserRole> userroles = trans.get(sUserRole,null); - if(userroles!=null) { - for(UserRole ur : userroles) { + if (userroles!=null) { + for (UserRole ur : userroles) { String tag = "userrole"; rv.add(new AbsCell[] { @@ -284,10 +284,10 @@ public class RoleDetail extends Page { @Override public void postfix(AAF_GUI state, AuthzTrans trans, final Cache<HTMLGen> cache, final HTMLGen hgen) { final Mark mark = trans.get(sMark, null); - if(mark!=null) { + if (mark!=null) { hgen.tagOnly("input", "type=submit", "value=Submit"); final String pNS = trans.get(sNS, null); - if(pNS!=null && pNS.length()>0) { + if (pNS!=null && pNS.length()>0) { hgen.leaf(mark,HTMLGen.A,"href="+NsDetail.HREF+"?ns="+pNS,"class=greenbutton").text("Back").end(mark); } hgen.end(mark); diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java index 1f00d955..fb64cd6e 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleDetailAction.java @@ -67,7 +67,7 @@ public class RoleDetailAction extends Page { public void code(final AAF_GUI gui, final AuthzTrans trans,final Cache<HTMLGen> cache, final HTMLGen hgen) throws APIException, IOException { final HttpServletRequest req = trans.get(sReq, null); final String role = getSingleParam(req,"role"); - if(role==null) { + if (role==null) { hgen.text("Parameter 'role' is required").end(); } else { // Run Validations @@ -79,14 +79,14 @@ public class RoleDetailAction extends Page { List<TypedFuture> ltf = new ArrayList<>(); String text; Map<String, String[]> pm = (Map<String, String[]>)req.getParameterMap(); - for(final Entry<String, String[]> es : pm.entrySet()) { - for(final String v : es.getValue()) { + for (final Entry<String, String[]> es : pm.entrySet()) { + for (final String v : es.getValue()) { TimeTaken tt = null; try { switch(es.getKey()) { case "desc": // Check box set String desc = getSingleParam(req, "description"); - if(desc!=null) { + if (desc!=null) { text = "Setting Description on " + role + " to " + desc; tt = trans.start(text, Env.REMOTE); RoleRequest rr = new RoleRequest(); @@ -102,7 +102,7 @@ public class RoleDetailAction extends Page { text = "Ungranting Permission '" + v + "' from '" + role + '\''; tt = trans.start(text, Env.REMOTE); String[] pf = Split.splitTrim('|', v); - if(pf.length==3) { + if (pf.length==3) { Pkey perm = new Pkey(); perm.setType(pf[0]); perm.setInstance(pf[1]); @@ -135,7 +135,7 @@ public class RoleDetailAction extends Page { // System.out.println(es.getKey() + "=" + v); } } finally { - if(tt!=null) { + if (tt!=null) { tt.done(); tt=null; } @@ -143,11 +143,11 @@ public class RoleDetailAction extends Page { } } - if(ltf.isEmpty()) { + if (ltf.isEmpty()) { hgen.p("No Changes"); } else { - for(TypedFuture tf : ltf) { - if(tf.future.get(5000)) { + for (TypedFuture tf : ltf) { + if (tf.future.get(5000)) { hgen.p("<font color=\"green\"><i>Success</i>:</font> " + tf.text); } else { // Note: if handling of special Error codes is required, use diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java index 234b82c2..fdf6f9e3 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RoleHistory.java @@ -165,7 +165,7 @@ public class RoleHistory extends Page { final String oDates = trans.get(dates,null); Cells rv = Cells.EMPTY; - if(oName!=null) { + if (oName!=null) { try { rv = gui.clientAsUser(trans.getUserPrincipal(), new Retryable<Cells>() { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java index ffa8e3c2..414c4161 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/RolesShow.java @@ -95,7 +95,7 @@ public class RolesShow extends Page { try { Future<UserRoles> fur = client.read("/authz/userRoles/user/"+trans.user(),gui.getDF(UserRoles.class)); if (fur.get(5000) && fur.value != null) for (UserRole u : fur.value.getUserRole()) { - if(u.getExpires().compare(Chrono.timeStamp()) < 0) { + if (u.getExpires().compare(Chrono.timeStamp()) < 0) { AbsCell[] sa = new AbsCell[] { new TextCell(u.getRole() + "*", CLASS_EXPIRED), new TextCell(new SimpleDateFormat(DATE_TIME_FORMAT).format(u.getExpires().toGregorianCalendar().getTime()),CLASS_EXPIRED), diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java index 04e0e845..ed4c19d9 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleExtend.java @@ -68,7 +68,7 @@ public class UserRoleExtend extends Page { @Override public Void code(Rcli<?> client)throws CadiException, ConnectException, APIException { Future<Void> fv = client.update("/authz/userRole/extend/"+user+"/"+role+"?request=true"); - if(fv.get(5000)) { + if (fv.get(5000)) { // not sure if we'll ever hit this hgen.p("Extended User ["+ user+"] in Role [" +role+"]"); } else { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java index 73aa3e9f..11126f89 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/UserRoleRemove.java @@ -70,7 +70,7 @@ public class UserRoleRemove extends Page { Future<Void> fv = client.delete( "/authz/userRole/"+user+"/"+role+"?request=true",Void.class); - if(fv.get(5000)) { + if (fv.get(5000)) { // not sure if we'll ever hit this hgen.p("User ["+ user+"] Removed from Role [" +role+"]"); } else { diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java index 5fc82140..759d87f4 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/table/RefCell.java @@ -36,7 +36,7 @@ public class RefCell extends AbsCell { public RefCell(String name, String href, boolean newWindow, String... attributes) { this.name = name; - if(newWindow) { + if (newWindow) { str = new String[attributes.length+2]; str[attributes.length]="target=_blank"; } else { |