X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-cmd%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fcmd%2Frole%2FCreateDelete.java;h=a41256be837d21e09b48c963c8f7a99bcf9fbb7b;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=f9dcbcd82b20847dfd6ade217cc64b21510c5e9a;hpb=4b5a7d721d994a49057e9bfb403c7bff1b376660;p=aaf%2Fauthz.git diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java index f9dcbcd8..a41256be 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/role/CreateDelete.java @@ -3,13 +3,15 @@ * 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. @@ -35,17 +37,17 @@ import org.onap.aaf.misc.env.APIException; import aaf.v2_0.RoleRequest; /** - * + * * @author Jonathan * */ public class CreateDelete extends Cmd { private static final String ROLE_PATH = "/authz/role"; - private final static String[] options = {"create","delete"}; + private static final String[] options = {"create","delete"}; public CreateDelete(Role parent) { - super(parent,null, + super(parent,null, new Param(optionsToString(options),true), - new Param("name",true)); + new Param("name",true)); } @Override @@ -56,13 +58,13 @@ public class CreateDelete extends Cmd { int idx = index; String action = args[idx++]; int option = whichOption(options, action); - + RoleRequest rr = new RoleRequest(); rr.setName(args[idx++]); - + // Set Start/End commands setStartEnd(rr); - + Future fp = null; String verb = null; int rv; @@ -79,7 +81,7 @@ public class CreateDelete extends Cmd { // Send "Force" if set setQueryParamsOn(client); fp = client.delete( - ROLE_PATH, // +args[idx++], + ROLE_PATH, // +args[idx++], getDF(RoleRequest.class), rr ); @@ -87,20 +89,20 @@ public class CreateDelete extends Cmd { break; default: // note, if not an option, whichOption throws Exception break; - + } boolean rolesSupplied = (args.length>idx); - if(fp == null) {// This useless code brought to you by Sonar. - throw new CadiException("No call made."); + if (fp == null) {// This useless code brought to you by Sonar. + throw new CadiException("No call made."); } - if(fp.get(AAFcli.timeout())) { + if (fp.get(AAFcli.timeout())) { rv=fp.code(); pw().print(verb); pw().println("d Role"); - if(rolesSupplied) { - for(;args.length>idx;++idx ) { + if (rolesSupplied) { + for (;args.length>idx;++idx ) { try { - if(201!=(rv=((Role)parent)._exec(0,new String[] {"user","add",rr.getName(),args[idx]}))) { + if (201!=(rv=((Role)parent)._exec(0,new String[] {"user","add",rr.getName(),args[idx]}))) { rv = 206 /*HttpStatus.PARTIAL_CONTENT_206*/; } } catch (LocatorException e) { @@ -109,7 +111,7 @@ public class CreateDelete extends Cmd { } } } else { - if((rv=fp.code())==202) { + if ((rv=fp.code())==202) { pw().print("Role "); pw().print(verb); pw().println(" Accepted, but requires Approvals before actualizing");