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);
}
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());
}
}
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;
}
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);
}
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);
}
}
Aggregations