diff --git a/api/src/com/cloud/api/response/UserVmResponse.java b/api/src/com/cloud/api/response/UserVmResponse.java index 572d4ed2d11..0e0d5c60426 100755 --- a/api/src/com/cloud/api/response/UserVmResponse.java +++ b/api/src/com/cloud/api/response/UserVmResponse.java @@ -336,6 +336,10 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp this.securityGroupList = securityGroups; } + public void addSecurityGroup(SecurityGroupResponse securityGroup){ + this.securityGroupList.add(securityGroup); + } + public void setProjectId(String projectId) { this.projectId = projectId; } diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 40847ea7e9d..fc2b6256bb7 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -473,58 +473,61 @@ public class ApiDispatcher { //for maps, specify access to be checkd on key or value. if(parameterAnnotation.resourceType() != null){ - Class[] entity = parameterAnnotation.resourceType(); - - if(ControlledEntity.class.isAssignableFrom(entity)){ - if (s_logger.isDebugEnabled()) { - s_logger.debug("entity name is:" + entity.getName()); - } - - if(s_instance._daoNameMap.containsKey(entity.getName())){ - Class daoClass = s_instance._daoNameMap.get(entity.getName()); - GenericDao daoClassInstance = s_instance._locator.getDao(daoClass); - - //Check if the parameter type is a single Id or list of id's/name's - switch (fieldType) { - case LIST: - CommandType listType = parameterAnnotation.collectionType(); - switch (listType) { - case LONG: - List listParam = new ArrayList(); - listParam = (List)field.get(cmd); - - for(Long entityId : listParam){ - ControlledEntity entityObj = (ControlledEntity)daoClassInstance.findById(entityId); - entitiesToAccess.add(entityObj); - } - break; - /*case STRING: - List listParam = new ArrayList(); - listParam = (List)field.get(cmd); - for(String entityName: listParam){ - ControlledEntity entityObj = (ControlledEntity)daoClassInstance(entityId); - entitiesToAccess.add(entityObj); - } - break; - */ - default: - break; - } - break; - case LONG: - Long entityId = (Long)field.get(cmd); - ControlledEntity entityObj = (ControlledEntity)daoClassInstance.findById(entityId); - entitiesToAccess.add(entityObj); - break; - default: - break; - } - - - } - - } - + Class[] entityList = parameterAnnotation.resourceType(); + for (Class entity : entityList){ + if (ControlledEntity.class.isAssignableFrom(entity)) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("entity name is:" + entity.getName()); + } + + if (s_instance._daoNameMap.containsKey(entity.getName())) { + Class daoClass = s_instance._daoNameMap.get(entity.getName()); + GenericDao daoClassInstance = s_instance._locator.getDao(daoClass); + + // Check if the parameter type is a single + // Id or list of id's/name's + switch (fieldType) { + case LIST: + CommandType listType = parameterAnnotation.collectionType(); + switch (listType) { + case LONG: + List listParam = new ArrayList(); + listParam = (List) field.get(cmd); + + for (Long entityId : listParam) { + ControlledEntity entityObj = (ControlledEntity) daoClassInstance.findById(entityId); + entitiesToAccess.add(entityObj); + } + break; + /* + * case STRING: List listParam = + * new ArrayList(); listParam = + * (List)field.get(cmd); for(String + * entityName: listParam){ + * ControlledEntity entityObj = + * (ControlledEntity + * )daoClassInstance(entityId); + * entitiesToAccess.add(entityObj); } + * break; + */ + default: + break; + } + break; + case LONG: + Long entityId = (Long) field.get(cmd); + ControlledEntity entityObj = (ControlledEntity) daoClassInstance.findById(entityId); + entitiesToAccess.add(entityObj); + break; + default: + break; + } + + } + + } + } + } } diff --git a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java index 5673c37bba3..35b6c9beac1 100644 --- a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java @@ -353,7 +353,7 @@ public class AutoScaleManagerImpl implements AutoScaleManager, AutoScaleSe * For ex. if projectId is given as a string instead of an long value, this * will be throwing an error. */ - ApiDispatcher.setupParameters(new DeployVMCmd(), deployParams); + ApiDispatcher.setupParameters(new DeployVMCmd(), deployParams, new ArrayList()); if (autoscaleUserId == null) { autoscaleUserId = UserContext.current().getCallerUserId();