Search in sources :

Example 1 with GetErrataCountsParameters

use of org.ovirt.engine.core.common.queries.GetErrataCountsParameters 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 2 with GetErrataCountsParameters

use of org.ovirt.engine.core.common.queries.GetErrataCountsParameters in project ovirt-engine by oVirt.

the class BackendVmKatelloErrataResource method list.

@Override
public KatelloErrata list() {
    ErrataData errataData = null;
    try {
        QueryReturnValue returnValue = runQuery(QueryType.GetErrataForVm, new GetErrataCountsParameters(asGuid(vmId)));
        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 3 with GetErrataCountsParameters

use of org.ovirt.engine.core.common.queries.GetErrataCountsParameters in project ovirt-engine by oVirt.

the class AbstractErrataCountModel method runQuery.

public void runQuery(Guid guid) {
    // $NON-NLS-1$
    startProgress("getCount");
    AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
        stopProgress();
        ErrataCounts resultEntity = returnValue.getReturnValue();
        // Set message to null to make sure the actual setMessage creates an event.
        setMessage(null);
        if (resultEntity != null && returnValue.getSucceeded()) {
            setErrataCounts(resultEntity);
        } else {
            setMessage(// $NON-NLS-1$
            constants.katelloProblemRetrievingErrata() + " " + returnValue.getExceptionMessage());
        }
    });
    asyncQuery.setHandleFailure(true);
    Frontend.getInstance().runQuery(getQueryType(), new GetErrataCountsParameters(guid), asyncQuery);
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts) GetErrataCountsParameters(org.ovirt.engine.core.common.queries.GetErrataCountsParameters)

Example 4 with GetErrataCountsParameters

use of org.ovirt.engine.core.common.queries.GetErrataCountsParameters in project ovirt-engine by oVirt.

the class AbstractErrataListModel method runQuery.

private void runQuery(Guid guid) {
    AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
        if (returnValue.getSucceeded()) {
            ErrataData errataData = returnValue.getReturnValue();
            unfilteredResultList = errataData.getErrata();
            // manual client-side filter
            // TODO: Use filtering and pagination options by GetErrataCountsParameters.setErrataFilter(filter)
            setItems(filter(unfilteredResultList));
        } else {
            // $NON-NLS-1$
            setMessage(constants.katelloProblemRetrievingErrata() + " " + returnValue.getExceptionMessage());
        }
    });
    asyncQuery.setHandleFailure(true);
    Frontend.getInstance().runQuery(getQueryType(), new GetErrataCountsParameters(guid), asyncQuery);
}
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)

Example 5 with GetErrataCountsParameters

use of org.ovirt.engine.core.common.queries.GetErrataCountsParameters in project ovirt-engine by oVirt.

the class BackendHostKatelloErrataResource method list.

@Override
public KatelloErrata list() {
    ErrataData errataData = null;
    try {
        QueryReturnValue returnValue = runQuery(QueryType.GetErrataForHost, new GetErrataCountsParameters(asGuid(hostId)));
        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)

Aggregations

GetErrataCountsParameters (org.ovirt.engine.core.common.queries.GetErrataCountsParameters)5 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)5 ErrataData (org.ovirt.engine.core.common.businessentities.ErrataData)4 KatelloErrata (org.ovirt.engine.api.model.KatelloErrata)3 ErrataCounts (org.ovirt.engine.core.common.businessentities.ErrataCounts)1