* 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.
protected static final int lineLength = 80;
- private final static String hformat = "%-23s %-5s %-20s %-35s\n";
+ private static final String hformat = "%-23s %-5s %-20s %-35s\n";
public static final String STARTDATE = "startdate";
public static final String ENDDATE = "enddate";
-
+
private String name;
private final Param[] params;
private int required;
protected final Cmd parent;
protected final List<Cmd> children;
- private final static ConcurrentHashMap<Class<?>,RosettaDF<?>> dfs = new ConcurrentHashMap<>();
+ private static final ConcurrentHashMap<Class<?>,RosettaDF<?>> dfs = new ConcurrentHashMap<>();
public final AAFcli aafcli;
protected Access access;
private AuthzEnv env;
++required;
}
}
-
+
String temp = access.getProperty(Config.AAF_DEFAULT_REALM,null);
if (temp!=null && !temp.startsWith("@")) {
defaultRealm = '@' + temp;
defaultRealm="<Set Default Realm>";
}
}
-
+
public final int exec(int idx, String ... args) throws CadiException, APIException, LocatorException {
if (args.length-idx<required) {
throw new CadiException(build(new StringBuilder("Too few args: "),null).toString());
}
return _exec(idx,args);
}
-
+
protected abstract int _exec(int idx, final String ... args) throws CadiException, APIException, LocatorException;
-
+
public void detailedHelp(int indent,StringBuilder sb) {
}
protected void multiChar(StringBuilder sb, int length, char c, int indent) {
sb.append('\n');
- for (int i=0;i<indent;++i)sb.append(' ');
- for (int i=indent;i<length;++i)sb.append(c);
+ for (int i=0;i<indent;++i) {
+ sb.append(' ');
+ }
+ for (int i=indent;i<length;++i) {
+ sb.append(c);
+ }
}
public StringBuilder build(StringBuilder sb, StringBuilder detail) {
sb.append(p.tag);
sb.append(p.required?"> ": "] ");
}
-
+
boolean first = true;
for (Cmd child : children) {
if (!(child instanceof DeprecatedCMD)) {
multiChar(sb,indent,' ',0);
} else {
// Write parents for Detailed Report
- Stack<String> stack = new Stack<String>();
+ Stack<String> stack = new Stack<>();
for (Cmd c = child.parent;c!=null;c=c.parent) {
if (c.name!=null) {
stack.push(c.name);
}
return sb;
}
-
+
protected void error(Future<?> future) {
StringBuilder sb = new StringBuilder("Failed");
String desc = future.body();
pw().println(sb);
}
-
+
private void withCode(StringBuilder sb, Integer code) {
sb.append(" with code ");
sb.append(code);
if ((str = access.getProperty(Cmd.STARTDATE,null))!=null) {
req.setStart(Chrono.timeStamp(Date.valueOf(str)));
}
-
+
if ((str = access.getProperty(Cmd.ENDDATE,null))!=null) {
req.setEnd(Chrono.timeStamp(Date.valueOf(str)));
}
/**
* For Derived classes, who have ENV in this parent
- *
+ *
* @param cls
* @return
* @throws APIException
}
} else {
pw().println(header);
- for (int i=0;i<lineLength;++i)pw().print('-');
+ for (int i=0;i<lineLength;++i) {
+ pw().print('-');
+ }
pw().println();
-
+
pw().format(hformat,"Date","Table","User","Memo");
- for (int i=0;i<lineLength;++i)pw().print('-');
+ for (int i=0;i<lineLength;++i) {
+ pw().print('-');
+ }
pw().println();
-
+
// Save Server time by Sorting locally
List<Item> items = history.getItem();
- java.util.Collections.sort(items, new Comparator<Item>() {
- @Override
- public int compare(Item o1, Item o2) {
- return o2.getTimestamp().compare(o1.getTimestamp());
- }
- });
-
+ java.util.Collections.sort(items, (Comparator<Item>) (o1, o2) -> o2.getTimestamp().compare(o1.getTimestamp()));
+
for (History.Item item : items) {
GregorianCalendar gc = item.getTimestamp().toGregorianCalendar();
pw().format(hformat,
}
}
}
-
+
/**
* Turn String Array into a | delimited String
* @param options
}
return sb.toString();
}
-
+
/**
* return which index number the Option matches.
- *
+ *
* throws an Exception if not part of this Option Set
- *
+ *
* @param options
* @param test
* @return
return i;
}
}
+ pw().printf("%s is not a valid cmd\n",test);
throw new CadiException(build(new StringBuilder("Invalid Option: "),null).toString());
}
-// protected RosettaEnv env() {
-// return aafcli.env;
-// }
-
protected HMangr hman() {
return aafcli.hman;
}
retryable.item(aafcli.prevCall.item());
retryable.lastClient=aafcli.prevCall.lastClient;
}
-
+
RET ret = aafcli.hman.same(aafcli.ss,retryable);
-
+
// Store last call in AAFcli, because Cmds are all different instances.
aafcli.prevCall = retryable;
return ret;
public String getName() {
return name;
}
-
+
public void reportHead(String ... str) {
pw().println();
boolean first = true;
pw().println();
reportLine();
}
-
+
public String reportColHead(String format, String ... args) {
pw().format(format,(Object[])args);
reportLine();
}
public void reportLine() {
- for (int i=0;i<lineLength;++i)pw().print('-');
+ for (int i=0;i<lineLength;++i) {
+ pw().print('-');
+ }
pw().println();
}
-
+
protected void setQueryParamsOn(Rcli<?> rcli) {
StringBuilder sb=null;
String force;
//
// /**
// * If Force is set, will return True once only, then revert to "FALSE".
-// *
+// *
// * @return
// */
// protected String checkForce() {
return parent.toString();
}
}
-
-// private String getOrgRealm() {
-// return ;
-// }
-//
+
/**
* Appends shortID with Realm, but only when allowed by Organization
- * @throws OrganizationException
+ * @throws OrganizationException
*/
public String fullID(String id) {
if (id != null) {