use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class SystemPermissionListModel method syncSearch.
@Override
protected void syncSearch() {
super.syncSearch();
QueryParametersBase params = new QueryParametersBase();
params.setRefresh(false);
Frontend.getInstance().runQuery(QueryType.GetSystemPermissions, params, new SetItemsAsyncQuery());
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class RoleListModel method syncSearch.
@Override
protected void syncSearch() {
super.syncSearch();
QueryParametersBase tempVar = new QueryParametersBase();
tempVar.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetAllRoles, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<Role> filteredList = new ArrayList<>();
for (Role item : (ArrayList<Role>) returnValue.getReturnValue()) {
// ignore CONSUME_QUOTA_ROLE in UI
if (item.getId().equals(ApplicationGuids.quotaConsumer.asGuid())) {
continue;
}
if (getItemsFilter() == null || getItemsFilter() == item.getType()) {
filteredList.add(item);
}
}
Collections.sort(filteredList, new NameableComparator());
setItems(filteredList);
}));
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class ClusterPolicyListModel method fetchClusterPolicies.
private void fetchClusterPolicies() {
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
ArrayList<ClusterPolicy> list = returnValue.getReturnValue();
Collections.sort(list, Comparator.comparing(ClusterPolicy::isLocked).reversed().thenComparing(ClusterPolicy::getName, new LexoNumericComparator()));
setItems(list);
});
QueryParametersBase parametersBase = new QueryParametersBase();
parametersBase.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetClusterPolicies, parametersBase, asyncQuery);
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase 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);
});
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class VmListModel method initRemoveDisksCheckboxes.
private void initRemoveDisksCheckboxes(final Map<Guid, EntityModel> vmsMap) {
ArrayList<QueryParametersBase> params = new ArrayList<>();
ArrayList<QueryType> queries = new ArrayList<>();
for (Entry<Guid, EntityModel> entry : vmsMap.entrySet()) {
if (entry.getValue().getIsChangable()) {
// No point in fetching VM disks from ones that already determined
// is unchangeable since they are already initialized
params.add(new IdQueryParameters(entry.getKey()));
queries.add(QueryType.GetAllDisksByVmId);
}
}
// revise when refactoring org.ovirt.engine.ui.Frontend to support runMultipleQuery with a single query
if (!params.isEmpty()) {
Frontend.getInstance().runMultipleQueries(queries, params, result -> {
for (int i = 0; i < result.getReturnValues().size(); i++) {
if (result.getReturnValues().get(i).getSucceeded()) {
Guid vmId = ((IdQueryParameters) result.getParameters().get(i)).getId();
initRemoveDisksChecboxesPost(vmId, (List<Disk>) result.getReturnValues().get(i).getReturnValue());
}
}
});
}
}
Aggregations