Search in sources :

Example 51 with QueryReturnValue

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;
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GlusterHookContentQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterHookContentQueryParameters) GlusterHook(org.ovirt.engine.api.model.GlusterHook) GlusterHookQueryParameters(org.ovirt.engine.core.common.queries.gluster.GlusterHookQueryParameters)

Example 52 with QueryReturnValue

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);
    }
}
Also used : GlusterVolumeProfileInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GlusterVolumeProfileDetails(org.ovirt.engine.api.model.GlusterVolumeProfileDetails) GlusterVolumeProfileParameters(org.ovirt.engine.core.common.queries.gluster.GlusterVolumeProfileParameters)

Example 53 with QueryReturnValue

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());
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ErrataData(org.ovirt.engine.core.common.businessentities.ErrataData) GetErrataCountsParameters(org.ovirt.engine.core.common.queries.GetErrataCountsParameters) KatelloErrata(org.ovirt.engine.api.model.KatelloErrata)

Example 54 with QueryReturnValue

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();
}
Also used : ExternalComputeResource(org.ovirt.engine.api.model.ExternalComputeResource) ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) ExternalHostProvider(org.ovirt.engine.api.model.ExternalHostProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue)

Example 55 with QueryReturnValue

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();
}
Also used : ProviderQueryParameters(org.ovirt.engine.core.common.queries.ProviderQueryParameters) ExternalHostGroup(org.ovirt.engine.api.model.ExternalHostGroup) ExternalHostProvider(org.ovirt.engine.api.model.ExternalHostProvider) Provider(org.ovirt.engine.core.common.businessentities.Provider) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue)

Aggregations

QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)265 ArrayList (java.util.ArrayList)123 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)97 QueryType (org.ovirt.engine.core.common.queries.QueryType)85 List (java.util.List)74 Guid (org.ovirt.engine.core.compat.Guid)66 Frontend (org.ovirt.engine.ui.frontend.Frontend)64 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)54 VM (org.ovirt.engine.core.common.businessentities.VM)49 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)47 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)42 HashMap (java.util.HashMap)40 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)39 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 Test (org.junit.Test)38 Collection (java.util.Collection)34 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)33 Map (java.util.Map)31 ActionType (org.ovirt.engine.core.common.action.ActionType)31 VDS (org.ovirt.engine.core.common.businessentities.VDS)31