Search in sources :

Example 1 with ResourceIconResponse

use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.

the class ResourceIconDaoImpl method listResourceIcons.

@Override
public List<ResourceIconResponse> listResourceIcons(List<String> resourceUuids, ResourceTag.ResourceObjectType resourceType) {
    SearchCriteria<ResourceIconVO> sc = AllFieldsSearch.create();
    sc.setParameters("uuid", resourceUuids.toArray());
    sc.setParameters("resourceType", resourceType);
    List<ResourceIconVO> resourceIcons = listBy(sc);
    List<ResourceIconResponse> iconResponses = new ArrayList<>();
    for (ResourceIconVO resourceIcon : resourceIcons) {
        ResourceIconResponse response = new ResourceIconResponse();
        response.setResourceId(resourceIcon.getResourceUuid());
        response.setResourceType(resourceIcon.getResourceType());
        response.setImage(resourceIcon.getIcon());
        response.setObjectName(ApiConstants.RESOURCE_ICON);
        iconResponses.add(response);
    }
    return iconResponses;
}
Also used : ResourceIconResponse(org.apache.cloudstack.api.response.ResourceIconResponse) ArrayList(java.util.ArrayList) ResourceIconVO(com.cloud.resource.icon.ResourceIconVO)

Example 2 with ResourceIconResponse

use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.

the class ResourceIconDaoImpl method newResourceIconResponse.

@Override
public ResourceIconResponse newResourceIconResponse(ResourceIcon resourceIcon) {
    ResourceIconResponse resourceIconResponse = new ResourceIconResponse();
    resourceIconResponse.setResourceId(resourceIcon.getResourceUuid());
    resourceIconResponse.setResourceType(resourceIcon.getResourceType());
    resourceIconResponse.setImage(resourceIcon.getIcon());
    resourceIconResponse.setObjectName(ApiConstants.RESOURCE_ICON);
    return resourceIconResponse;
}
Also used : ResourceIconResponse(org.apache.cloudstack.api.response.ResourceIconResponse)

Example 3 with ResourceIconResponse

use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.

the class ListDomainChildrenCmd method updateDomainResponse.

private void updateDomainResponse(List<DomainResponse> response) {
    for (DomainResponse domainResponse : response) {
        ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Domain, domainResponse.getId());
        if (resourceIcon == null) {
            continue;
        }
        ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon);
        domainResponse.setResourceIconResponse(iconResponse);
    }
}
Also used : ResourceIconResponse(org.apache.cloudstack.api.response.ResourceIconResponse) DomainResponse(org.apache.cloudstack.api.response.DomainResponse) ResourceIcon(com.cloud.server.ResourceIcon)

Example 4 with ResourceIconResponse

use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.

the class ListDomainsCmd method updateDomainResponse.

private void updateDomainResponse(List<DomainResponse> response) {
    for (DomainResponse domainResponse : response) {
        ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Domain, domainResponse.getId());
        if (resourceIcon == null) {
            continue;
        }
        ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon);
        domainResponse.setResourceIconResponse(iconResponse);
    }
}
Also used : ResourceIconResponse(org.apache.cloudstack.api.response.ResourceIconResponse) DomainResponse(org.apache.cloudstack.api.response.DomainResponse) ResourceIcon(com.cloud.server.ResourceIcon)

Example 5 with ResourceIconResponse

use of org.apache.cloudstack.api.response.ResourceIconResponse in project cloudstack by apache.

the class ListNetworksCmd method updateNetworkResponse.

private void updateNetworkResponse(List<NetworkResponse> response) {
    for (NetworkResponse networkResponse : response) {
        ResourceIcon resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Network, networkResponse.getId());
        if (resourceIcon == null) {
            resourceIcon = resourceIconManager.getByResourceTypeAndUuid(ResourceTag.ResourceObjectType.Vpc, networkResponse.getVpcId());
            if (resourceIcon == null) {
                continue;
            }
        }
        ResourceIconResponse iconResponse = _responseGenerator.createResourceIconResponse(resourceIcon);
        networkResponse.setResourceIconResponse(iconResponse);
    }
}
Also used : ResourceIconResponse(org.apache.cloudstack.api.response.ResourceIconResponse) PhysicalNetworkResponse(org.apache.cloudstack.api.response.PhysicalNetworkResponse) NetworkResponse(org.apache.cloudstack.api.response.NetworkResponse) ResourceIcon(com.cloud.server.ResourceIcon)

Aggregations

ResourceIconResponse (org.apache.cloudstack.api.response.ResourceIconResponse)13 ResourceIcon (com.cloud.server.ResourceIcon)10 ResourceIconVO (com.cloud.resource.icon.ResourceIconVO)2 DomainResponse (org.apache.cloudstack.api.response.DomainResponse)2 TemplateResponse (org.apache.cloudstack.api.response.TemplateResponse)2 ResourceTagJoinVO (com.cloud.api.query.vo.ResourceTagJoinVO)1 ResourceTag (com.cloud.server.ResourceTag)1 ArrayList (java.util.ArrayList)1 AccountResponse (org.apache.cloudstack.api.response.AccountResponse)1 NetworkResponse (org.apache.cloudstack.api.response.NetworkResponse)1 PhysicalNetworkResponse (org.apache.cloudstack.api.response.PhysicalNetworkResponse)1 ProjectResponse (org.apache.cloudstack.api.response.ProjectResponse)1 ResourceTagResponse (org.apache.cloudstack.api.response.ResourceTagResponse)1 UserResponse (org.apache.cloudstack.api.response.UserResponse)1 UserVmResponse (org.apache.cloudstack.api.response.UserVmResponse)1 VpcResponse (org.apache.cloudstack.api.response.VpcResponse)1 ZoneResponse (org.apache.cloudstack.api.response.ZoneResponse)1