Fix the way to retrieve details map from api input.

This commit is contained in:
Min Chen 2013-05-06 11:30:34 -07:00
parent 7ad263b67e
commit 2e28515624
1 changed files with 17 additions and 2 deletions

View File

@ -16,6 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.cloudstack.api.APICommand;
@ -53,7 +56,7 @@ public class AddImageStoreCmd extends BaseCmd {
private String providerName;
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store")
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
private Map<String, String> details;
@ -71,7 +74,19 @@ public class AddImageStoreCmd extends BaseCmd {
}
public Map<String, String> getDetails() {
return details;
Map<String, String> detailsMap = null;
if (!details.isEmpty()) {
detailsMap = new HashMap<String, String>();
Collection<?> props = details.values();
Iterator<?> iter = props.iterator();
while (iter.hasNext()) {
HashMap<String, String> detail = (HashMap<String, String>) iter.next();
String key = detail.get("key");
String value = detail.get("value");
detailsMap.put(key, value);
}
}
return detailsMap;
}
public String getProviderName() {