summaryrefslogtreecommitdiffstats
path: root/auth/auth-cmd
diff options
context:
space:
mode:
Diffstat (limited to 'auth/auth-cmd')
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java25
-rw-r--r--auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java21
2 files changed, 19 insertions, 27 deletions
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
index 8fc79401..3dae0fa5 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/List.java
@@ -38,6 +38,11 @@ import aaf.v2_0.Users.User;
public class List extends BaseCmd<NS> {
+ private static final String cformat = " %-30s %-6s %-24s\n";
+ private static final String pformat = " %-30s %-24s %-15s\n";
+ private static final String sformat = " %-72s\n";
+ protected static final String kformat = " %-72s\n";
+
public List(NS parent) {
super(parent,"list");
cmds.add(new ListByName(this));
@@ -51,10 +56,6 @@ public class List extends BaseCmd<NS> {
cmds.add(new ListChildren(this));
cmds.add(new ListNsKeysByAttrib(this));
}
-
- private static final String sformat = " %-72s\n";
- protected static final String kformat = " %-72s\n";
-
public void report(Future<Nss> fp, String ... str) {
reportHead(str);
@@ -69,19 +70,19 @@ public class List extends BaseCmd<NS> {
pw().println(" Description");
pw().format(sformat,ns.getDescription()==null?"":ns.getDescription());
}
- if (ns.getAdmin().size()>0) {
+ if (!(ns.getAdmin().isEmpty())) {
pw().println(" Administrators");
for (String admin : ns.getAdmin()) {
pw().format(sformat,admin);
}
}
- if (ns.getResponsible().size()>0) {
+ if (!(ns.getResponsible().isEmpty())) {
pw().println(" Owners (Responsible for Namespace)");
for (String responsible : ns.getResponsible()) {
pw().format(sformat,responsible);
}
}
- if (ns.getAttrib().size()>0) {
+ if (!(ns.getAttrib().isEmpty())) {
pw().println(" Namespace Attributes");
for ( Ns.Attrib attr : ns.getAttrib()) {
StringBuilder sb = new StringBuilder(attr.getKey());
@@ -118,7 +119,7 @@ public class List extends BaseCmd<NS> {
}
public void reportRole(Future<Roles> fr) {
- if (fr!=null && fr.value!=null && fr.value.getRole().size()>0) {
+ if (fr!=null && fr.value!=null && !(fr.value.getRole().isEmpty())) {
pw().println(" Roles");
for (aaf.v2_0.Role r : fr.value.getRole()) {
pw().format(sformat,r.getName());
@@ -126,9 +127,8 @@ public class List extends BaseCmd<NS> {
}
}
- private static final String pformat = " %-30s %-24s %-15s\n";
public void reportPerm(Future<Perms> fp) {
- if (fp!=null && fp.value!=null && fp.value.getPerm().size()>0) {
+ if (fp!=null && fp.value!=null && !(fp.value.getPerm().isEmpty())) {
pw().println(" Permissions");
for (aaf.v2_0.Perm p : fp.value.getPerm()) {
pw().format(pformat,p.getType(),p.getInstance(),p.getAction());
@@ -136,10 +136,9 @@ public class List extends BaseCmd<NS> {
}
}
-
- private static final String cformat = " %-30s %-6s %-24s\n";
+
public void reportCred(Future<Users> fc) {
- if (fc!=null && fc.value!=null && fc.value.getUser().size()>0) {
+ if (fc!=null && fc.value!=null && !(fc.value.getUser().isEmpty())) {
pw().println(" Credentials");
java.util.List<User> users = fc.value.getUser();
Collections.sort(users, new Comparator<User>() {
diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
index 3074ab86..6733989e 100644
--- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
+++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/user/List.java
@@ -50,14 +50,11 @@ public class List extends BaseCmd<User> {
reportHead(str);
int idx = 0;
java.util.List<aaf.v2_0.Users.User> sorted = users.getUser();
- Collections.sort(sorted, new Comparator<aaf.v2_0.Users.User>() {
- @Override
- public int compare(aaf.v2_0.Users.User u1, aaf.v2_0.Users.User u2) {
- if (u1==null || u2 == null) {
- return -1;
- }
- return u1.getId().compareTo(u2.getId());
+ Collections.sort(sorted, (Comparator<aaf.v2_0.Users.User>) (u1, u2) -> {
+ if (u1==null || u2 == null) {
+ return -1;
}
+ return u1.getId().compareTo(u2.getId());
});
String format = reportColHead("%-40s %-10s %-30s\n","User","Type","Expires");
String date = "XXXX-XX-XX";
@@ -77,13 +74,9 @@ public class List extends BaseCmd<User> {
reportHead(title,id);
String format = reportColHead(" %-20s %-20s %-11s %-6s %12s\n","User","Approver","Type","Status","Updated");
java.util.List<Approval> lapp = approvals.getApprovals();
- Collections.sort(lapp, new Comparator<Approval>() {
- @Override
- public int compare(Approval a1, Approval a2) {
- return a1.getTicket().compareTo(a2.getTicket());
- }
- } );
- String ticket = null, prev = null;
+ Collections.sort(lapp, (Comparator<Approval>) (a1, a2) -> a1.getTicket().compareTo(a2.getTicket()));
+ String ticket = null;
+ String prev = null;
for (Approval app : lapp ) {
ticket = app.getTicket();
if (!ticket.equals(prev)) {