X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-cmd%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fcmd%2Fns%2FAttrib.java;h=63089e45deb25de44eb9cc9d02917f6b75f6f280;hb=6dd9704640eb8cc8d6b4ccd266e40a3f6f589e75;hp=31dad45c651d49774b5dd153e5dccdd0236a7ec7;hpb=7e966914050e66219689001ff4ab601a49eef0ac;p=aaf%2Fauthz.git diff --git a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java index 31dad45c..63089e45 100644 --- a/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.java +++ b/auth/auth-cmd/src/main/java/org/onap/aaf/auth/cmd/ns/Attrib.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. @@ -33,9 +35,11 @@ import org.onap.aaf.cadi.client.Retryable; import org.onap.aaf.misc.env.APIException; public class Attrib extends BaseCmd { - private final static String[] options = {"add","upd","del"}; + private static final String[] options = {"add","upd","del"}; + private String authzString = "/authz/ns/"; + private String atrributeString = "/attrib/"; - public Attrib(NS ns) throws APIException { + public Attrib(NS ns) { super(ns,"attrib", new Param(optionsToString(options),true), new Param("ns-name",true), @@ -58,25 +62,25 @@ public class Attrib extends BaseCmd { } else { value = ""; } - + return same(new Retryable() { @Override - public Integer code(Rcli client) throws CadiException, APIException { + public Integer code(Rcli client) throws CadiException, APIException { Future fp = null; String message; switch(option) { - case 0: - fp = client.create("/authz/ns/"+ns+"/attrib/"+key+'/'+value,Void.class); + case 0: + fp = client.create(authzString+ns+atrributeString+key+'/'+value,Void.class); message = String.format("Add Attrib %s=%s to %s", key,value,ns); break; - case 1: - fp = client.update("/authz/ns/"+ns+"/attrib/"+key+'/'+value); + case 1: + fp = client.update(authzString+ns+atrributeString+key+'/'+value); message = String.format("Update Attrib %s=%s for %s", key,value,ns); break; - case 2: - fp = client.delete("/authz/ns/"+ns+"/attrib/"+key,Void.class); + case 2: + fp = client.delete(authzString+ns+atrributeString+key,Void.class); message = String.format("Attrib %s deleted from %s", key,ns); break; @@ -91,16 +95,16 @@ public class Attrib extends BaseCmd { } else { error(fp); } - - return fp.code(); + + return fp.code(); } } }); } @Override - public void detailedHelp(int _indent, StringBuilder sb) { - int indent = _indent; + public void detailedHelp(int indentValue, StringBuilder sb) { + int indent = indentValue; detailLine(sb,indent,"Add or Delete Administrator to/from Namespace"); indent+=4; detailLine(sb,indent,"name - Name of Namespace");