Search in sources :

Example 6 with ImageStoreJoinVO

use of com.cloud.api.query.vo.ImageStoreJoinVO in project cloudstack by apache.

the class ViewResponseHelper method createImageStoreResponse.

public static List<ImageStoreResponse> createImageStoreResponse(ImageStoreJoinVO... stores) {
    Hashtable<Long, ImageStoreResponse> vrDataList = new Hashtable<Long, ImageStoreResponse>();
    // Initialise the vrdatalist with the input data
    for (ImageStoreJoinVO vr : stores) {
        ImageStoreResponse vrData = vrDataList.get(vr.getId());
        if (vrData == null) {
            // first time encountering this vm
            vrData = ApiDBUtils.newImageStoreResponse(vr);
        } else {
            // update tags
            vrData = ApiDBUtils.fillImageStoreDetails(vrData, vr);
        }
        vrDataList.put(vr.getId(), vrData);
    }
    return new ArrayList<ImageStoreResponse>(vrDataList.values());
}
Also used : ImageStoreResponse(org.apache.cloudstack.api.response.ImageStoreResponse) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) ImageStoreJoinVO(com.cloud.api.query.vo.ImageStoreJoinVO)

Aggregations

ImageStoreJoinVO (com.cloud.api.query.vo.ImageStoreJoinVO)6 ArrayList (java.util.ArrayList)6 TemplateFilter (com.cloud.template.VirtualMachineTemplate.TemplateFilter)4 Pair (com.cloud.utils.Pair)4 Filter (com.cloud.utils.db.Filter)4 List (java.util.List)4 Hashtable (java.util.Hashtable)2 ImageStoreResponse (com.cloud.api.response.ImageStoreResponse)1 ImageStoreResponse (org.apache.cloudstack.api.response.ImageStoreResponse)1