Search in sources :

Example 1 with BrickStatisticalQuery

use of org.ovirt.engine.api.restapi.resource.BrickStatisticalQuery in project ovirt-engine by oVirt.

the class BackendGlusterBrickResource method getStatisticsResource.

@Override
public StatisticsResource getStatisticsResource() {
    EntityIdResolver<Guid> resolver = new QueryIdResolver<Guid>(QueryType.GetGlusterBrickById, IdQueryParameters.class) {

        @Override
        public GlusterBrickEntity lookupEntity(Guid id) throws BackendFailureException {
            GlusterBrickEntity brickEntity = getEntity(GlusterBrickEntity.class, QueryType.GetGlusterBrickById, new IdQueryParameters(id), null, true);
            GlusterVolumeEntity volumeEntity = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(brickEntity.getVolumeId()), null, true);
            GlusterVolumeAdvancedDetails detailsEntity = getEntity(GlusterVolumeAdvancedDetails.class, QueryType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsParameters(volumeEntity.getClusterId(), volumeEntity.getId(), brickEntity.getId(), true), null, true);
            brickEntity.setBrickDetails(detailsEntity.getBrickDetails().get(0));
            return brickEntity;
        }
    };
    BrickStatisticalQuery query = new BrickStatisticalQuery(resolver, newModel(id));
    return inject(new BackendStatisticsResource<>(GlusterBrickEntity.class, guid, query));
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) GlusterVolumeAdvancedDetailsParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters) BrickStatisticalQuery(org.ovirt.engine.api.restapi.resource.BrickStatisticalQuery) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

BrickStatisticalQuery (org.ovirt.engine.api.restapi.resource.BrickStatisticalQuery)1 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)1 GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 GlusterVolumeAdvancedDetailsParameters (org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1