Update aaf client module
[aaf/authz.git] / authz-cmd / src / main / java / com / att / cmd / perm / List.java
diff --git a/authz-cmd/src/main/java/com/att/cmd/perm/List.java b/authz-cmd/src/main/java/com/att/cmd/perm/List.java
deleted file mode 100644 (file)
index d87c29e..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- *  *      http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- *  * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package com.att.cmd.perm;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.Comparator;\r
-\r
-import com.att.cadi.CadiException;\r
-import com.att.cadi.client.Future;\r
-import com.att.cadi.client.Rcli;\r
-import com.att.cadi.client.Retryable;\r
-import com.att.cmd.AAFcli;\r
-import com.att.cmd.BaseCmd;\r
-import com.att.inno.env.APIException;\r
-\r
-import aaf.v2_0.Nss;\r
-import aaf.v2_0.Perms;\r
-import aaf.v2_0.Pkey;\r
-\r
-\r
-public class List extends BaseCmd<Perm> {\r
-//     private static final String LIST_PERM_DETAILS = "list permission details";\r
-       \r
-       public List(Perm parent) {\r
-               super(parent,"list");\r
-\r
-               cmds.add(new ListByUser(this));\r
-               cmds.add(new ListByName(this));\r
-               cmds.add(new ListByNS(this));\r
-               cmds.add(new ListByRole(this));\r
-               cmds.add(new ListActivity(this));\r
-       }\r
-       // Package Level on purpose\r
-       abstract class ListPerms extends Retryable<Integer> {\r
-               protected int list(Future<Perms> fp,Rcli<?> client, String header, String parentPerm) throws CadiException, APIException  {\r
-                       if(fp.get(AAFcli.timeout())) {  \r
-                               ArrayList<String> permNss = null;\r
-                               if (aafcli.isDetailed()) {\r
-                                       permNss = new ArrayList<String>();\r
-                                       String permNs = null;\r
-                                       for(Pkey perm : fp.value.getPerm()) {   \r
-                                               if (permNs != null && perm.getType().contains(permNs)) {\r
-                                                   permNss.add(permNs);\r
-                                               } else {\r
-                                                       Future<Nss> fpn = null;\r
-                                                       String permType = perm.getType();\r
-                                                       permNs = permType;\r
-                                                       do {\r
-                                                               permNs = permType.substring(0,permNs.lastIndexOf('.'));\r
-                                                               fpn = client.read("/authz/nss/"+permNs,getDF(Nss.class));\r
-                                                       } while (!fpn.get(AAFcli.timeout()));\r
-                                                       permNss.add(permNs);\r
-                                               }\r
-                                       }                                               \r
-                               } \r
-                               report(fp,permNss,header, parentPerm);\r
-                       } else {\r
-                               error(fp);\r
-                       }\r
-                       return fp.code();\r
-               }\r
-       }\r
-\r
-       private static final Comparator<aaf.v2_0.Perm> permCompare = new Comparator<aaf.v2_0.Perm>() {\r
-               @Override\r
-               public int compare(aaf.v2_0.Perm a, aaf.v2_0.Perm b) {\r
-                       int rc;\r
-                       if((rc=a.getType().compareTo(b.getType()))!=0) {\r
-                           return rc;\r
-                       }\r
-                       if((rc=a.getInstance().compareTo(b.getInstance()))!=0) {\r
-                           return rc;\r
-                       }\r
-                       return a.getAction().compareTo(b.getAction());\r
-               }\r
-       };\r
-       \r
-       void report(Future<Perms> fp, ArrayList<String> permNss, String ... str) {\r
-               reportHead(str);\r
-               if (this.aafcli.isDetailed()) {         \r
-                       String format = reportColHead("%-20s %-15s %-30s %-15s\n   %-75s\n","PERM NS","Type","Instance","Action", "Description");\r
-                       Collections.sort(fp.value.getPerm(),permCompare);\r
-                       for(aaf.v2_0.Perm p : fp.value.getPerm()) {\r
-                               String permNs = permNss.remove(0);\r
-                               pw().format(format,\r
-                                       permNs,\r
-                                       p.getType().substring(permNs.length()+1),\r
-                                       p.getInstance(),\r
-                                       p.getAction(),\r
-                                       p.getDescription()==null?"":p.getDescription());\r
-                       }\r
-                       pw().println();\r
-               } else {\r
-                       String format = reportColHead("%-30s %-30s %-10s\n","PERM Type","Instance","Action");\r
-\r
-                       Collections.sort(fp.value.getPerm(),permCompare);\r
-                       for(aaf.v2_0.Perm p : fp.value.getPerm()) {\r
-                               pw().format(format,\r
-                                       p.getType(),\r
-                                       p.getInstance(),\r
-                                       p.getAction());\r
-                       }\r
-                       pw().println();\r
-               }\r
-       }\r
-\r
-}\r