* org.onap.aaf
* ===========================================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2018 IBM.
* ===========================================================================
* 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.
public class Delg extends BaseCmd<User> {
static final String AUTHZ_DELG = "/authz/delegate";
- private final static String[] options = {"add","upd","del"};
+ private static final String[] options = {"add","upd","del"};
- public Delg(User user) throws APIException {
+ public Delg(User user){
super(user,"delegate",
new Param(optionsToString(options),true),
new Param("from",true),
int idx = index;
DelgRequest dr = new DelgRequest();
setStartEnd(dr);
-
+
int option= whichOption(options, args[idx++]);
String user = fullID(args[idx++]);
dr.setUser(user);
- if(option<2) {
+ if (option<2) {
String delegate = fullID(args[idx++]);
dr.setDelegate(delegate);
- if(option<2 && args.length>idx) {
+ if (option<2 && args.length>idx) {
Date date;
try {
- date = Chrono.dateOnlyFmt.parse(args[idx++]);
+ date = Chrono.dateOnlyFmt.parse(args[idx]);
} catch (ParseException e) {
throw new CadiException(e);
}
dr.setEnd(Chrono.timeStamp(date));
}
}
-
+
Future<DelgRequest> fp;
RosettaDF<DelgRequest> df = getDF(DelgRequest.class);
String verb;
setQueryParamsOn(client);
switch(option) {
- case 0:
+ case 0:
fp = client.create(AUTHZ_DELG, df, dr);
verb = "Added";
break;
- case 1:
- fp = client.update(AUTHZ_DELG, df, dr);
+ case 1:
+ fp = client.update(AUTHZ_DELG, df, dr);
verb = "Updated";
break;
- case 2:
- fp = client.delete(AUTHZ_DELG, df, dr);
+ case 2:
+ fp = client.delete(AUTHZ_DELG, df, dr);
verb = "Deleted";
break;
default:
throw new CadiException("Bad Argument");
};
-
- if(fp.get(AAFcli.timeout())) {
+
+ if (fp.get(AAFcli.timeout())) {
pw().append("Delegate ");
pw().println(verb);
} else {
}
@Override
- public void detailedHelp(int _indent, StringBuilder sb) {
- int indent = _indent;
+ public void detailedHelp(int indentParam, StringBuilder sb) {
+ int indent = indentParam;
detailLine(sb,indent,"Add, Update or Delete Delegate");
indent+=2;
detailLine(sb,indent,"A Delegate is a person who will temporarily cover the Approval and");