Search in sources :

Example 16 with GlusterBricks

use of org.ovirt.engine.api.model.GlusterBricks in project ovirt-engine by oVirt.

the class BackendGlusterBricksResource method resolveCreatedList.

@SuppressWarnings("unchecked")
protected GlusterBricks resolveCreatedList(ActionReturnValue result, EntityIdResolver<Guid> entityResolver) {
    try {
        GlusterBricks bricks = new GlusterBricks();
        for (Guid id : (List<Guid>) result.getActionReturnValue()) {
            GlusterBrickEntity created = entityResolver.resolve(id);
            bricks.getGlusterBricks().add(addLinks(populate(map(created), created)));
        }
        return bricks;
    } catch (Exception e) {
        // we tolerate a failure in the entity resolution
        // as the substantive action (entity creation) has
        // already succeeded
        e.printStackTrace();
        return null;
    }
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) ArrayList(java.util.ArrayList) List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) WebApplicationException(javax.ws.rs.WebApplicationException)

Aggregations

GlusterBricks (org.ovirt.engine.api.model.GlusterBricks)16 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)7 Test (org.junit.Test)6 GlusterVolume (org.ovirt.engine.api.model.GlusterVolume)6 AbstractBackendCollectionResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)6 Response (javax.ws.rs.core.Response)4 Action (org.ovirt.engine.api.model.Action)4 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)4 UriInfo (javax.ws.rs.core.UriInfo)3 WebApplicationException (javax.ws.rs.WebApplicationException)2 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Cluster (org.ovirt.engine.api.model.Cluster)1 Options (org.ovirt.engine.api.model.Options)1 V3GlusterBricks (org.ovirt.engine.api.v3.types.V3GlusterBricks)1 V3GlusterVolume (org.ovirt.engine.api.v3.types.V3GlusterVolume)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1