mirror of https://github.com/apache/cloudstack.git
api_refactoring: Fix build issue with api_refactoring branch.
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
3d04bfcadc
commit
eba353099e
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<? extends GenericDao> 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<Long> listParam = new ArrayList<Long>();
|
||||
listParam = (List)field.get(cmd);
|
||||
|
||||
for(Long entityId : listParam){
|
||||
ControlledEntity entityObj = (ControlledEntity)daoClassInstance.findById(entityId);
|
||||
entitiesToAccess.add(entityObj);
|
||||
}
|
||||
break;
|
||||
/*case STRING:
|
||||
List<String> listParam = new ArrayList<String>();
|
||||
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<? extends GenericDao> 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<Long> listParam = new ArrayList<Long>();
|
||||
listParam = (List) field.get(cmd);
|
||||
|
||||
for (Long entityId : listParam) {
|
||||
ControlledEntity entityObj = (ControlledEntity) daoClassInstance.findById(entityId);
|
||||
entitiesToAccess.add(entityObj);
|
||||
}
|
||||
break;
|
||||
/*
|
||||
* case STRING: List<String> listParam =
|
||||
* new ArrayList<String>(); 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ public class AutoScaleManagerImpl<Type> 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<ControlledEntity>());
|
||||
|
||||
if (autoscaleUserId == null) {
|
||||
autoscaleUserId = UserContext.current().getCallerUserId();
|
||||
|
|
|
|||
Loading…
Reference in New Issue