use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class BackendGlusterHookResource method get.
@Override
public GlusterHook get() {
GlusterHook hook = performGet(QueryType.GetGlusterHookById, new GlusterHookQueryParameters(guid, true));
QueryReturnValue result = runQuery(QueryType.GetGlusterHookContent, new GlusterHookContentQueryParameters(guid));
if (result != null && result.getSucceeded() && result.getReturnValue() != null) {
hook.setContent(result.getReturnValue());
}
return hook;
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class BackendGlusterVolumeResource method getProfileStatistics.
@Override
public Response getProfileStatistics(Action action) {
boolean nfsStats = isNfsStatistics();
QueryReturnValue result = runQuery(QueryType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileParameters(Guid.createGuidFromString(parent.getParent().get().getId()), guid, nfsStats));
if (result != null && result.getSucceeded() && result.getReturnValue() != null) {
GlusterVolumeProfileInfo info = result.getReturnValue();
GlusterVolumeProfileDetails statistics = GlusterVolumeProfileInfoMapper.map(info, null);
statistics = LinkHelper.addLinks(statistics);
return Response.ok(statistics).build();
} else {
// throw exception
throw new WebFaultException(null, localize(Messages.BACKEND_FAILED), Response.Status.INTERNAL_SERVER_ERROR);
}
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class BackendEngineKatelloErrataResource method list.
@Override
public KatelloErrata list() {
ErrataData errataData = null;
try {
QueryReturnValue returnValue = runQuery(QueryType.GetErrataForEngine, new GetErrataCountsParameters());
if (!returnValue.getSucceeded()) {
backendFailure(returnValue.getExceptionString());
}
errataData = returnValue.getReturnValue();
} catch (Exception e) {
handleError(e, false);
}
if (errataData == null) {
return new KatelloErrata();
}
return mapCollection(errataData.getErrata());
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class BackendExternalComputeResourceResource method get.
@Override
public ExternalComputeResource get() {
// Convert the resource identifier to the host group name:
String name = hex2string(id);
// The backend query that retrieves the list of hosts groups needs a complete provider instance, the id isn't
// enough:
Provider provider = BackendExternalProviderHelper.getProvider(this, providerId);
// The backend doesn't have a way to retrieve a host by ide, so we have to iterate them:
ProviderQueryParameters parameters = new ProviderQueryParameters();
parameters.setProvider(provider);
QueryReturnValue result = runQuery(QueryType.GetComputeResourceFromExternalProvider, parameters);
List<org.ovirt.engine.core.common.businessentities.ExternalComputeResource> entities = result.getReturnValue();
if (entities != null) {
for (org.ovirt.engine.core.common.businessentities.ExternalComputeResource entity : entities) {
if (name.equals(entity.getName())) {
return addLinks(populate(map(entity), entity));
}
}
}
// No luck:
return notFound();
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class BackendExternalHostGroupResource method get.
@Override
public ExternalHostGroup get() {
// Convert the resource identifier to the host group name:
String name = hex2string(id);
// The backend query that retrieves the list of hosts groups needs a complete provider instance, the id isn't
// enough:
Provider provider = BackendExternalProviderHelper.getProvider(this, providerId);
// The backend doesn't have a way to retrieve a host by ide, so we have to iterate them:
ProviderQueryParameters parameters = new ProviderQueryParameters();
parameters.setProvider(provider);
QueryReturnValue result = runQuery(QueryType.GetHostGroupsFromExternalProvider, parameters);
List<org.ovirt.engine.core.common.businessentities.ExternalHostGroup> entities = result.getReturnValue();
if (entities != null) {
for (org.ovirt.engine.core.common.businessentities.ExternalHostGroup entity : entities) {
if (name.equals(entity.getName())) {
return addLinks(populate(map(entity), entity));
}
}
}
// No luck:
return notFound();
}
Aggregations