use of com.emc.storageos.geomodel.ResourcesResponse in project coprhd-controller by CoprHD.
the class GeoServiceClient method queryObjects.
/**
* Get the GeoVisible resources with given ids
*
* @param clazz the resource type to be queried
* @param ids List of the resource IDs
* @return list of resources
* @throws Exception
*/
public <T extends GeoVisibleResource> Iterator<T> queryObjects(Class<T> clazz, List<URI> ids) throws Exception {
BulkIdParam param = new BulkIdParam();
param.setIds(ids);
WebResource rRoot = createRequest(GEOVISIBLE_URI + clazz.getName() + "/objects");
rRoot.accept(MediaType.APPLICATION_OCTET_STREAM);
ClientResponse resp = addSignature(rRoot).post(ClientResponse.class, param);
InputStream input = resp.getEntityInputStream();
ObjectInputStream objInputStream = new ObjectInputStream(input);
@SuppressWarnings("unchecked") ResourcesResponse<T> resources = (ResourcesResponse<T>) objInputStream.readObject();
List<T> list = resources.getObjects();
return list.iterator();
}
use of com.emc.storageos.geomodel.ResourcesResponse in project coprhd-controller by CoprHD.
the class QueryService method genResourcesResponse.
private Response genResourcesResponse(QueryResultList<?> queryResult) {
ResourcesResponse<Object> resp = new ResourcesResponse();
int count = 0;
Iterator<?> it = queryResult.iterator();
while (it.hasNext()) {
count++;
resp.add(it.next());
}
resp.setSize(count);
return Response.ok(getStreamingOutput(resp), MediaType.APPLICATION_OCTET_STREAM).build();
}
use of com.emc.storageos.geomodel.ResourcesResponse in project coprhd-controller by CoprHD.
the class QueryService method genResourcesResponse.
private <T> Response genResourcesResponse(Iterator<T> objs) {
ResourcesResponse<T> resp = new ResourcesResponse();
int count = 0;
while (objs.hasNext()) {
count++;
resp.add(objs.next());
}
resp.setSize(count);
return Response.ok(getStreamingOutput(resp), MediaType.APPLICATION_OCTET_STREAM).build();
}
Aggregations