Search in sources :

Example 1 with ComputeElementBulkRep

use of com.emc.storageos.model.compute.ComputeElementBulkRep in project coprhd-controller by CoprHD.

the class ComputeElementService method queryBulkResourceReps.

@Override
public ComputeElementBulkRep queryBulkResourceReps(List<URI> ids) {
    Iterator<ComputeElement> _dbIterator = _dbClient.queryIterativeObjects(getResourceClass(), ids);
    return new ComputeElementBulkRep(BulkList.wrapping(_dbIterator, new Function<ComputeElement, ComputeElementRestRep>() {

        @Override
        public ComputeElementRestRep apply(ComputeElement ce) {
            Host associatedHost = getAssociatedHost(ce, _dbClient);
            Cluster cluster = null;
            if (associatedHost != null && !NullColumnValueGetter.isNullURI(associatedHost.getCluster())) {
                cluster = _dbClient.queryObject(Cluster.class, associatedHost.getCluster());
            }
            ComputeElementRestRep restRep = ComputeMapper.map(ce, associatedHost, cluster);
            return restRep;
        }
    }));
}
Also used : Function(com.google.common.base.Function) ComputeElementBulkRep(com.emc.storageos.model.compute.ComputeElementBulkRep) ComputeElement(com.emc.storageos.db.client.model.ComputeElement) Cluster(com.emc.storageos.db.client.model.Cluster) Host(com.emc.storageos.db.client.model.Host) ComputeElementRestRep(com.emc.storageos.model.compute.ComputeElementRestRep)

Aggregations

Cluster (com.emc.storageos.db.client.model.Cluster)1 ComputeElement (com.emc.storageos.db.client.model.ComputeElement)1 Host (com.emc.storageos.db.client.model.Host)1 ComputeElementBulkRep (com.emc.storageos.model.compute.ComputeElementBulkRep)1 ComputeElementRestRep (com.emc.storageos.model.compute.ComputeElementRestRep)1 Function (com.google.common.base.Function)1