X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-gui%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fgui%2Fpages%2FNsInfoForm.java;h=2447c98bbe73ff42ddee7dc0ad36d8447c7678b7;hb=4b5a7d721d994a49057e9bfb403c7bff1b376660;hp=173b9500165027253cdb315b8d9d09090cfa88f9;hpb=824dc7b5fc0e1ccdf7f460479aff344727f0f01e;p=aaf%2Fauthz.git 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 173b9500..2447c98b 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 @@ -51,112 +51,112 @@ import aaf.v2_0.Nss.Ns; public class NsInfoForm extends Page { - // Package on purpose - static final String HREF = "/gui/onboard"; - static final String NAME = "Onboarding"; - static final String fields[] = {"ns","description","mots","owners","admins"}; - - public NsInfoForm(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException { - super(gui.env,NAME,HREF, fields, - new BreadCrumbs(breadcrumbs), - new NamedCode(true,"content") { + // Package on purpose + static final String HREF = "/gui/onboard"; + static final String NAME = "Onboarding"; + static final String fields[] = {"ns","description","mots","owners","admins"}; + + public NsInfoForm(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException { + super(gui.env,NAME,HREF, fields, + new BreadCrumbs(breadcrumbs), + new NamedCode(true,"content") { - private final Slot sID = gui.env.slot(NsInfoForm.NAME+'.'+NsInfoForm.fields[0]); - @Override - public void code(final Cache cache, final HTMLGen hgen) throws APIException, IOException { - // p tags not closing right using .p() - causes issues in IE8 password form - so using leaf for the moment - hgen.leaf(HTMLGen.H2).text("Namespace Info").end() - .leaf("p").text("Hover over Fields for Tool Tips, or click ") - .leaf(A,"href="+gui.env.getProperty(AAF_URL_GUI_ONBOARD,"")).text("Here").end() - .text(" for more information") - .end() - .incr("form","method=post"); - Mark table = new Mark(TABLE); - hgen.incr(table); - cache.dynamic(hgen, new DynamicCode() { - @SuppressWarnings("unchecked") - @Override - public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache cache, final HTMLGen hgen) throws APIException, IOException { - final String incomingID= trans.get(sID, ""); - final String[] info = new String[fields.length]; - final Object own_adm[] = new Object[2]; - for(int i=0;i0) { - TimeTaken tt = trans.start("AAF Namespace Info",Env.REMOTE); - try { - gui.clientAsUser(trans.getUserPrincipal(), new Retryable() { - @Override - public Void code(Rcli client) throws CadiException, ConnectException, APIException { - Future fn = client.read("/authz/nss/"+incomingID,gui.getDF(Nss.class)); - 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()) { - switch(attr.getKey()) { - case "mots": - info[2]=attr.getValue(); - default: - } - } - own_adm[0]=ns.getResponsible(); - own_adm[1]=ns.getAdmin(); - } - } else { - trans.error().log(fn.body()); - } - return null; - } - }); - } catch (Exception e) { - trans.error().log("Unable to access AAF for NS Info",incomingID); - e.printStackTrace(); - } finally { - tt.done(); - } - } - hgen.input(fields[0],"Namespace",false,"value="+info[0],"title=AAF Namespace") - .input(fields[1],"Description*",true,"value="+info[1],"title=Full Application Name, Tool Name or Group") - .input(fields[2],"MOTS ID",false,"value="+info[2],"title=MOTS ID if this is an Application, and has MOTS"); - Mark endTD = new Mark(),endTR=new Mark(); - // Owners - hgen.incr(endTR,HTMLGen.TR) - .incr(endTD,HTMLGen.TD) - .leaf("label","for="+fields[3]).text("Responsible Party") - .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)own_adm[0]) { - hgen.incr("label",true).text(s).end(); - } - } - hgen.end(endTR); + private final Slot sID = gui.env.slot(NsInfoForm.NAME+'.'+NsInfoForm.fields[0]); + @Override + public void code(final Cache cache, final HTMLGen hgen) throws APIException, IOException { + // p tags not closing right using .p() - causes issues in IE8 password form - so using leaf for the moment + hgen.leaf(HTMLGen.H2).text("Namespace Info").end() + .leaf("p").text("Hover over Fields for Tool Tips, or click ") + .leaf(A,"href="+gui.env.getProperty(AAF_URL_GUI_ONBOARD,"")).text("Here").end() + .text(" for more information") + .end() + .incr("form","method=post"); + Mark table = new Mark(TABLE); + hgen.incr(table); + cache.dynamic(hgen, new DynamicCode() { + @SuppressWarnings("unchecked") + @Override + public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache cache, final HTMLGen hgen) throws APIException, IOException { + final String incomingID= trans.get(sID, ""); + final String[] info = new String[fields.length]; + final Object own_adm[] = new Object[2]; + for(int i=0;i0) { + TimeTaken tt = trans.start("AAF Namespace Info",Env.REMOTE); + try { + gui.clientAsUser(trans.getUserPrincipal(), new Retryable() { + @Override + public Void code(Rcli client) throws CadiException, ConnectException, APIException { + Future fn = client.read("/authz/nss/"+incomingID,gui.getDF(Nss.class)); + 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()) { + switch(attr.getKey()) { + case "mots": + info[2]=attr.getValue(); + default: + } + } + own_adm[0]=ns.getResponsible(); + own_adm[1]=ns.getAdmin(); + } + } else { + trans.error().log(fn.body()); + } + return null; + } + }); + } catch (Exception e) { + trans.error().log("Unable to access AAF for NS Info",incomingID); + e.printStackTrace(); + } finally { + tt.done(); + } + } + hgen.input(fields[0],"Namespace",false,"value="+info[0],"title=AAF Namespace") + .input(fields[1],"Description*",true,"value="+info[1],"title=Full Application Name, Tool Name or Group") + .input(fields[2],"MOTS ID",false,"value="+info[2],"title=MOTS ID if this is an Application, and has MOTS"); + Mark endTD = new Mark(),endTR=new Mark(); + // Owners + hgen.incr(endTR,HTMLGen.TR) + .incr(endTD,HTMLGen.TD) + .leaf("label","for="+fields[3]).text("Responsible Party") + .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)own_adm[0]) { + hgen.incr("label",true).text(s).end(); + } + } + hgen.end(endTR); - // Admins - hgen.incr(endTR,HTMLGen.TR) - .incr(endTD,HTMLGen.TD) - .leaf("label","for="+fields[4]).text("Administrators") - .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)own_adm[1]) { - hgen.incr(HTMLGen.P,true).text(s).end(); - } - } - hgen.end(endTR) - .end(); - } - }); - hgen.end(); - hgen.tagOnly("input", "type=submit", "value=Submit") - .end(); + // Admins + hgen.incr(endTR,HTMLGen.TR) + .incr(endTD,HTMLGen.TD) + .leaf("label","for="+fields[4]).text("Administrators") + .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)own_adm[1]) { + hgen.incr(HTMLGen.P,true).text(s).end(); + } + } + hgen.end(endTR) + .end(); + } + }); + hgen.end(); + hgen.tagOnly("input", "type=submit", "value=Submit") + .end(); - } - }); - } + } + }); + } }