use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class AbstractBackendDiskProfileResource method addLinks.
@Override
protected DiskProfile addLinks(DiskProfile model, Class<? extends BaseResource> suggestedParent, String... subCollectionMembersToExclude) {
if (model.isSetQos() && model.getQos().isSetId()) {
QosBase qos = getEntity(QosBase.class, QueryType.GetQosById, new IdQueryParameters(asGuid(model.getQos().getId())), "qos");
model.getQos().setDataCenter(new DataCenter());
model.getQos().getDataCenter().setId(qos.getStoragePoolId().toString());
}
return super.addLinks(model, suggestedParent, subCollectionMembersToExclude);
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class BackendAssignedPermissionsResource method getUserById.
public DbUser getUserById(Guid userId) {
IdQueryParameters queryParameters = new IdQueryParameters(userId);
QueryReturnValue userQueryResponse = runQuery(QueryType.GetAnyDbUserByUserId, queryParameters);
DbUser returnValue = null;
if (userQueryResponse != null && userQueryResponse.getSucceeded()) {
returnValue = userQueryResponse.getReturnValue();
}
return returnValue;
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters 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));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method remove.
@Override
public Response remove(Action action) {
GlusterBricks bricks = action.getBricks();
if (bricks.getGlusterBricks().size() > 0) {
for (GlusterBrick brick : bricks.getGlusterBricks()) {
validateParameters(brick, "id|name");
}
}
int replicaCount = ParametersHelper.getIntegerParameter(httpHeaders, uriInfo, REPLICA_COUNT, 0, 0);
GlusterVolumeRemoveBricksParameters params = toParameters(bricks);
params.setReplicaCount(replicaCount);
GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), "");
if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) {
return performAction(ActionType.CommitRemoveGlusterVolumeBricks, params);
} else {
return performAction(ActionType.GlusterVolumeRemoveBricks, params);
}
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method activate.
@Override
public Response activate(Action action) {
validateParameters(action, "bricks");
validateBrickNames(action);
GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), "");
if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) {
return stopMigrate(action);
} else {
Fault fault = new Fault();
fault.setReason(localize(Messages.CANNOT_ACTIVATE_UNLESS_MIGRATION_COMPLETED));
throw new WebApplicationException(Response.status(Response.Status.CONFLICT).entity(fault).build());
}
}
Aggregations