Search in sources :

Example 96 with IdQueryParameters

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

the class BackendExternalProviderHelper method getProvider.

/**
 * Finds the provider that corresponds to the given identifier.
 *
 * @param resource the resource that will be used to perform the required queries
 * @param id the identifier of the provider
 * @return the reference to the provider or {@code null} if no such provider exists
 */
public static Provider getProvider(BackendResource resource, String id) {
    Guid guid = Guid.createGuidFromString(id);
    IdQueryParameters parameters = new IdQueryParameters(guid);
    return resource.getEntity(Provider.class, QueryType.GetProviderById, parameters, id, true);
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Guid(org.ovirt.engine.core.compat.Guid)

Example 97 with IdQueryParameters

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

the class BackendClusterResource method resetEmulatedMachine.

@Override
public Response resetEmulatedMachine(Action action) {
    QueryReturnValue result = runQuery(QueryType.GetClusterById, new IdQueryParameters(guid));
    if (result != null && result.getSucceeded() && result.getReturnValue() != null) {
        ManagementNetworkOnClusterOperationParameters param = new ManagementNetworkOnClusterOperationParameters(result.getReturnValue());
        param.setForceResetEmulatedMachine(true);
        return doAction(ActionType.UpdateCluster, param, action);
    } else {
        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build());
    }
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ManagementNetworkOnClusterOperationParameters(org.ovirt.engine.core.common.action.ManagementNetworkOnClusterOperationParameters) WebApplicationException(javax.ws.rs.WebApplicationException)

Example 98 with IdQueryParameters

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

the class BackendClustersResource method doPopulate.

@Override
protected org.ovirt.engine.api.model.Cluster doPopulate(org.ovirt.engine.api.model.Cluster cluster, Cluster entity) {
    final Guid clusterId = entity.getId();
    final org.ovirt.engine.core.common.businessentities.network.Network network = getOptionalEntity(org.ovirt.engine.core.common.businessentities.network.Network.class, QueryType.GetManagementNetwork, new IdQueryParameters(clusterId), clusterId.toString(), false);
    if (network != null) {
        final Network managementNetwork = new Network();
        managementNetwork.setCluster(cluster);
        managementNetwork.setId(network.getId().toString());
        cluster.setManagementNetwork(managementNetwork);
    }
    return cluster;
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Network(org.ovirt.engine.api.model.Network) Guid(org.ovirt.engine.core.compat.Guid)

Example 99 with IdQueryParameters

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

the class BackendCpuProfilesResource method validateParameters.

@Override
protected void validateParameters(CpuProfile cpuProfile) {
    validateParameters(cpuProfile, "name", "cluster.id");
    String clusterId = cpuProfile.getCluster().getId();
    // verify the cluster.id is well provided
    getEntity(Cluster.class, QueryType.GetClusterById, new IdQueryParameters(asGuid(clusterId)), "cluster: id=" + clusterId);
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters)

Example 100 with IdQueryParameters

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

the class BackendHostNicNetworkAttachmentsResource method verifyNicExistenceToHandle404StatusCode.

private void verifyNicExistenceToHandle404StatusCode() {
    List<VdsNetworkInterface> hostInterfaces = getBackendCollection(VdsNetworkInterface.class, QueryType.GetVdsInterfacesByVdsId, new IdQueryParameters(getHostId()));
    boolean found = false;
    for (VdsNetworkInterface hostInterface : hostInterfaces) {
        if (hostInterface.getId().equals(nicId)) {
            found = true;
            break;
        }
    }
    if (!found) {
        notFound(VdsNetworkInterface.class);
    }
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Aggregations

IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)268 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)89 Guid (org.ovirt.engine.core.compat.Guid)80 ArrayList (java.util.ArrayList)68 StorageDomainsAndStoragePoolIdQueryParameters (org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters)62 QueryType (org.ovirt.engine.core.common.queries.QueryType)59 List (java.util.List)47 Frontend (org.ovirt.engine.ui.frontend.Frontend)45 VM (org.ovirt.engine.core.common.businessentities.VM)42 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)36 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)35 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)26 Collection (java.util.Collection)25 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)25 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)25 Test (org.junit.Test)24 VDS (org.ovirt.engine.core.common.businessentities.VDS)24 HashMap (java.util.HashMap)22 ActionType (org.ovirt.engine.core.common.action.ActionType)21 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)19