Change listAll to return a boolean and fix a typo

Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
This commit is contained in:
Ian Duffy 2013-06-12 17:31:23 +01:00 committed by Abhinandan Prateek
parent e405703d5c
commit 776301ce6f

View File

@ -43,10 +43,9 @@ public class LDAPConfigCmd extends BaseCmd {
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
//////////////// API parameters ///////////////////// //////////////// API parameters /////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN, description="If true return current LDAP configuration")
@Parameter(name=ApiConstants.LIST_ALL, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com") private Boolean listAll;
private String listall;
@Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com") @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com")
private String hostname; private String hostname;
@ -78,10 +77,10 @@ public class LDAPConfigCmd extends BaseCmd {
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
public String getListAll() { public Boolean getListAll() {
return listall == null ? "false" : listall; return listAll == null ? Boolean.FALSE : listAll;
} }
public String getBindPassword() { public String getBindPassword() {
return bindPassword; return bindPassword;
} }
@ -156,16 +155,15 @@ public class LDAPConfigCmd extends BaseCmd {
InsufficientCapacityException, ServerApiException, InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException { ConcurrentOperationException, ResourceAllocationException {
try { try {
if ("true".equalsIgnoreCase(getListAll())){ if (getListAll()){
// return the existing conf // return the existing conf
LDAPConfigCmd cmd = _configService.listLDAPConfig(this); LDAPConfigCmd cmd = _configService.listLDAPConfig(this);
LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(), LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(), cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN());
cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN());
lr.setResponseName(getCommandName()); lr.setResponseName(getCommandName());
this.setResponseObject(lr); this.setResponseObject(lr);
} }
else if (getHostname()==null || getSearchBase() == null || getQueryFilter() == null) { else if (getHostname()==null || getSearchBase() == null || getQueryFilter() == null) {
throw new InvalidParameterValueException("You need to provide hostname, serachbase and queryfilter to configure your LDAP server"); throw new InvalidParameterValueException("You need to provide hostname, searchbase and queryfilter to configure your LDAP server");
} }
else { else {
boolean result = _configService.updateLDAP(this); boolean result = _configService.updateLDAP(this);