Search in sources :

Example 11 with ImageStoreResponse

use of org.apache.cloudstack.api.response.ImageStoreResponse 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

ImageStoreResponse (org.apache.cloudstack.api.response.ImageStoreResponse)11 ImageStore (com.cloud.storage.ImageStore)8 ServerApiException (org.apache.cloudstack.api.ServerApiException)7 DiscoveryException (com.cloud.exception.DiscoveryException)5 HashMap (java.util.HashMap)2 ImageStoreJoinVO (com.cloud.api.query.vo.ImageStoreJoinVO)1 StorageService (com.cloud.storage.StorageService)1 StorageStats (com.cloud.storage.StorageStats)1 ArrayList (java.util.ArrayList)1 Hashtable (java.util.Hashtable)1 ResponseGenerator (org.apache.cloudstack.api.ResponseGenerator)1 ListImageStoresCmd (org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd)1 Test (org.junit.Test)1