Merge "AAFcli.java -Declare "value" on a separate line"
[aaf/authz.git] / auth / auth-gui / src / main / java / org / onap / aaf / auth / gui / pages / CMArtifactShow.java
index 0992ad3..2362951 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -63,7 +63,7 @@ import certman.v1_0.Artifacts.Artifact;
 import certman.v1_0.CertInfo;
 
 public class CMArtifactShow extends Page {
-    
+
     public static final String HREF = "/gui/cmarti";
     public static final String NAME = "ArtifactsShow";
     private static ArtiTable arti;
@@ -72,14 +72,14 @@ public class CMArtifactShow extends Page {
 
 
     public CMArtifactShow(final AAF_GUI gui, Page ... breadcrumbs) throws APIException, IOException {
-        super(gui.env, NAME, HREF, Params.values() , 
+        super(gui.env, NAME, HREF, Params.values() ,
                 new BreadCrumbs(breadcrumbs),
                 arti = new ArtiTable(gui.env)
                 );
         // Setting so we can get access to HTMLGen clone and Slots
         arti.set(this,slotCode);
     }
-    
+
     private static class ArtiTable extends Table<AAF_GUI, AuthzTrans> {
         private static Model model;
         private SlotCode<AuthzTrans> sc;
@@ -108,21 +108,21 @@ public class CMArtifactShow extends Page {
                         }
                     },"class=std");
         }
-        
+
 
         public void set(CMArtifactShow cmArtifactShow, SlotCode<AuthzTrans> sc) {
             this.sc = sc;
             model.set(cmArtifactShow,sc);
         }
-        
+
         @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")));
                 }
@@ -132,7 +132,7 @@ public class CMArtifactShow extends Page {
     }
     /**
      * Implement the table content for Cred Detail
-     * 
+     *
      * @author Jeremiah
      *
      */
@@ -151,11 +151,11 @@ public class CMArtifactShow extends Page {
         public String[] headers() {
             return headers;
         }
-        
+
         @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, ""));
@@ -167,9 +167,9 @@ public class CMArtifactShow extends Page {
                     public Void code(Rcli<?> client) throws CadiException, ConnectException, APIException {
                         Future<CertInfo>  fuCI = client.read("/cert/id/"+id,gui.certInfoDF);
                         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);
@@ -214,7 +214,7 @@ public class CMArtifactShow extends Page {
                                 }
 
                                 rv.add(new AbsCell[] {
-                                    new TextCell(arti.getMachine(),"style=width:20%;"), 
+                                    new TextCell(arti.getMachine(),"style=width:20%;"),
                                     new TextCell(arti.getDir(),"style=width:25%;"),
                                     new TextCell(arti.getCa(),"style=width:2%;text-align:center;"),
                                     new TextCell(renew==null?
@@ -247,5 +247,5 @@ public class CMArtifactShow extends Page {
         }
 
     }
-    
+
 }