use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.
the class DataCenterJoinDaoImpl method newDataCenterResponse.
@Override
public ZoneResponse newDataCenterResponse(ResponseView view, DataCenterJoinVO dataCenter, Boolean showCapacities, Boolean showResourceImage) {
ZoneResponse zoneResponse = new ZoneResponse();
zoneResponse.setId(dataCenter.getUuid());
zoneResponse.setName(dataCenter.getName());
zoneResponse.setSecurityGroupsEnabled(ApiDBUtils.isSecurityGroupEnabledInZone(dataCenter.getId()));
zoneResponse.setLocalStorageEnabled(dataCenter.isLocalStorageEnabled());
if ((dataCenter.getDescription() != null) && !dataCenter.getDescription().equalsIgnoreCase("null")) {
zoneResponse.setDescription(dataCenter.getDescription());
}
if (view == ResponseView.Full) {
zoneResponse.setDns1(dataCenter.getDns1());
zoneResponse.setDns2(dataCenter.getDns2());
zoneResponse.setIp6Dns1(dataCenter.getIp6Dns1());
zoneResponse.setIp6Dns2(dataCenter.getIp6Dns2());
zoneResponse.setInternalDns1(dataCenter.getInternalDns1());
zoneResponse.setInternalDns2(dataCenter.getInternalDns2());
// FIXME zoneResponse.setVlan(dataCenter.get.getVnet());
zoneResponse.setGuestCidrAddress(dataCenter.getGuestNetworkCidr());
if (showCapacities != null && showCapacities) {
zoneResponse.setCapacitites(ApiResponseHelper.getDataCenterCapacityResponse(dataCenter.getId()));
}
}
// set network domain info
zoneResponse.setDomain(dataCenter.getDomain());
// set domain info
zoneResponse.setDomainId(dataCenter.getDomainUuid());
zoneResponse.setDomainName(dataCenter.getDomainName());
zoneResponse.setNetworkType(dataCenter.getNetworkType().toString());
zoneResponse.setAllocationState(dataCenter.getAllocationState().toString());
zoneResponse.setZoneToken(dataCenter.getZoneToken());
zoneResponse.setDhcpProvider(dataCenter.getDhcpProvider());
// update tag information
List<ResourceTagJoinVO> resourceTags = ApiDBUtils.listResourceTagViewByResourceUUID(dataCenter.getUuid(), ResourceObjectType.Zone);
for (ResourceTagJoinVO resourceTag : resourceTags) {
ResourceTagResponse tagResponse = ApiDBUtils.newResourceTagResponse(resourceTag, false);
zoneResponse.addTag(tagResponse);
}
if (showResourceImage) {
ResourceIconVO resourceIcon = ApiDBUtils.getResourceIconByResourceUUID(dataCenter.getUuid(), ResourceObjectType.Zone);
if (resourceIcon != null) {
ResourceIconResponse iconResponse = ApiDBUtils.newResourceIconResponse(resourceIcon);
zoneResponse.setResourceIconResponse(iconResponse);
}
}
zoneResponse.setResourceDetails(ApiDBUtils.getResourceDetails(dataCenter.getId(), ResourceObjectType.Zone));
zoneResponse.setHasAnnotation(annotationDao.hasAnnotations(dataCenter.getUuid(), AnnotationService.EntityType.ZONE.name(), _accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId())));
zoneResponse.setObjectName("zone");
return zoneResponse;
}
use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.
the class ListVMsCmd method updateVMResponse.
protected void updateVMResponse(List<UserVmResponse> response) {
for (UserVmResponse vmResponse : response) {
ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.UserVm, vmResponse.getId());
if (resourceIcon == null) {
ResourceTag.ResourceObjectType type = ResourceTag.ResourceObjectType.Template;
String uuid = vmResponse.getTemplateId();
if (vmResponse.getIsoId() != null) {
uuid = vmResponse.getIsoId();
type = ResourceTag.ResourceObjectType.ISO;
}
resourceIcon = resourceIconManager.getByResourceTypeAndUuid(type, uuid);
if (resourceIcon == null) {
continue;
}
}
ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon);
vmResponse.setResourceIconResponse(iconResponse);
}
}
use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.
the class ListUsersCmd method updateUserResponse.
private void updateUserResponse(List<UserResponse> response) {
for (UserResponse userResponse : response) {
ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.User, userResponse.getObjectId());
if (resourceIcon == null) {
resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Account, userResponse.getAccountId());
if (resourceIcon == null) {
continue;
}
}
ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon);
userResponse.setResourceIconResponse(iconResponse);
}
}
use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.
the class ListAccountsCmd method updateAccountResponse.
private void updateAccountResponse(List<AccountResponse> response) {
for (AccountResponse accountResponse : response) {
ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Account, accountResponse.getObjectId());
if (resourceIcon == null) {
continue;
}
ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon);
accountResponse.setResourceIconResponse(iconResponse);
}
}
use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.
the class ListProjectsCmd method updateProjectResponse.
private void updateProjectResponse(List<ProjectResponse> response) {
for (ProjectResponse projectResponse : response) {
ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Project, projectResponse.getId());
if (resourceIcon == null) {
continue;
}
ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon);
projectResponse.setResourceIconResponse(iconResponse);
}
}
Aggregations