use of com.cloud.server.ResourceTag.ResourceObjectType in project cloudstack by apache.
the class QueryManagerImpl method listDetailOptions.
@Override
public DetailOptionsResponse listDetailOptions(final ListDetailOptionsCmd cmd) {
final ResourceObjectType type = cmd.getResourceType();
final String resourceUuid = cmd.getResourceId();
final Map<String, List<String>> options = new HashMap<>();
switch(type) {
case Template:
case UserVm:
HypervisorType hypervisorType = HypervisorType.None;
if (StringUtils.isNotEmpty(resourceUuid) && ResourceObjectType.Template.equals(type)) {
hypervisorType = _templateDao.findByUuid(resourceUuid).getHypervisorType();
}
if (StringUtils.isNotEmpty(resourceUuid) && ResourceObjectType.UserVm.equals(type)) {
hypervisorType = _vmInstanceDao.findByUuid(resourceUuid).getHypervisorType();
}
fillVMOrTemplateDetailOptions(options, hypervisorType);
break;
default:
throw new CloudRuntimeException("Resource type not supported.");
}
if (CallContext.current().getCallingAccount().getType() != Account.ACCOUNT_TYPE_ADMIN) {
final List<String> userDenyListedSettings = Stream.of(QueryService.UserVMDeniedDetails.value().split(",")).map(item -> (item).trim()).collect(Collectors.toList());
for (final String detail : userDenyListedSettings) {
if (options.containsKey(detail)) {
options.remove(detail);
}
}
}
return new DetailOptionsResponse(options);
}
Aggregations