use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class PoolInterfaceListModel method onEntityChanged.
@Override
protected void onEntityChanged() {
super.onEntityChanged();
VmPool pool = getEntity();
if (pool != null) {
Frontend.getInstance().runQuery(QueryType.GetVmDataByPoolId, new IdQueryParameters(pool.getVmPoolId()), new AsyncQuery<QueryReturnValue>(result -> {
if (result != null) {
VM vm = result.getReturnValue();
if (vm == null) {
return;
}
syncSearch(QueryType.GetVmInterfacesByVmId, new IdQueryParameters(vm.getId()));
}
}));
}
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class QuotaUserListModel method syncSearch.
@Override
protected void syncSearch() {
super.syncSearch();
IdQueryParameters param = new IdQueryParameters(getEntity().getId());
param.setRefresh(getIsQueryFirstTime());
param.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetPermissionsToConsumeQuotaByQuotaId, param, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<Permission> list = returnValue.getReturnValue();
Map<Guid, Permission> map = new HashMap<>();
for (Permission permission : list) {
// filter out sys-admin and dc admin from consumers sub-tab
if (permission.getRoleId().equals(ApplicationGuids.superUser.asGuid()) || permission.getRoleId().equals(ApplicationGuids.dataCenterAdmin.asGuid())) {
continue;
}
if (!map.containsKey(permission.getAdElementId())) {
map.put(permission.getAdElementId(), permission);
} else {
if (map.get(permission.getAdElementId()).getRoleId().equals(ApplicationGuids.quotaConsumer.asGuid())) {
map.put(permission.getAdElementId(), permission);
}
}
}
list.clear();
for (Permission permission : map.values()) {
list.add(permission);
}
setItems(list);
}));
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class QuotaVmListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
super.syncSearch();
IdQueryParameters tempVar = new IdQueryParameters(getEntity().getId());
tempVar.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetVmsRelatedToQuotaId, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
setItems((ArrayList<VM>) returnValue.getReturnValue());
setIsEmpty(((List) getItems()).size() == 0);
}));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class DownloadImageHandler method start.
public void start() {
Frontend.getInstance().runAction(ActionType.TransferDiskImage, createInitParams(), result -> {
if (result.getReturnValue().getSucceeded()) {
Guid transferId = result.getReturnValue().getActionReturnValue();
Frontend.getInstance().runQuery(QueryType.GetImageTransferById, new IdQueryParameters(transferId), new AsyncQuery<QueryReturnValue>(returnValue -> {
ImageTransfer imageTransfer = returnValue.getReturnValue();
initiateDownload(imageTransfer);
}));
}
}, this);
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class RegisterEntityModel method updateClusterQuota.
private void updateClusterQuota(List<Cluster> clusters) {
if (!isQuotaEnabled()) {
return;
}
List<QueryType> queries = new ArrayList<>();
List<QueryParametersBase> params = new ArrayList<>();
for (Cluster cluster : clusters) {
queries.add(QueryType.GetAllRelevantQuotasForCluster);
params.add(new IdQueryParameters(cluster.getId()));
}
Frontend.getInstance().runMultipleQueries(queries, params, result -> {
Map<Guid, List<Quota>> clusterQuotasMap = new HashMap<>();
for (int i = 0; i < result.getReturnValues().size(); i++) {
List<Quota> quotas = result.getReturnValues().get(i).getReturnValue();
Guid clusterId = ((IdQueryParameters) result.getParameters().get(i)).getId();
clusterQuotasMap.put(clusterId, quotas);
}
getClusterQuotasMap().setEntity(clusterQuotasMap);
});
}
Aggregations