return formErrorResponse(logger, e);
}
String response = new ResponseTemplate().execute(logger, connectionId, request, new ResponseCallback() {
public Object execute() throws Exception {
CollectionService collectionService = new CollectionServiceImpl(connectionId);
String status = null;
RequestMethod method = null;
for (RequestMethod m : RequestMethod.values()) {
if ((m.toString()).equals(action)) {
method = m;
break;
}
}
switch (method) {
case PUT: {
if (updateColl.equals("false")) {
status = collectionService.insertCollection(dbName, newCollName, (isCapped != null && isCapped.equals("on")), capSize, maxDocs, (autoIndexId != null && autoIndexId.equals("on")));
} else {
status = collectionService.updateCollection(dbName, selectedCollection, newCollName, (isCapped != null && isCapped.equals("on")), capSize, maxDocs, (autoIndexId != null && autoIndexId.equals("on")));
}
break;
}
case DELETE: {
status = collectionService.deleteCollection(dbName, selectedCollection);
break;
}
default: {
status = "Action parameter value is wrong";
break;