use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class RoleListModel method eventRaised.
@Override
public void eventRaised(Event ev, Object sender, EventArgs args) {
super.eventRaised(ev, sender, args);
if (getWindow() != null && sender == ((RoleModel) getWindow()).getIsAdminRole()) {
if (commandType == CommandType.New) {
List<ActionGroup> selectedActionGroups = new ArrayList<>();
selectedActionGroups.add(ActionGroup.LOGIN);
setAttachedActionGroups(selectedActionGroups);
} else {
Role role = getSelectedItem();
Frontend.getInstance().runQuery(QueryType.GetRoleActionGroupsByRoleId, new IdQueryParameters(role.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
publicAttachedActions = returnValue.getReturnValue();
setAttachedActionGroups(publicAttachedActions);
}));
}
}
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue 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.QueryReturnValue 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.QueryReturnValue in project ovirt-engine by oVirt.
the class GuideModel method checkVdsClusterChangeSucceeded.
protected void checkVdsClusterChangeSucceeded(final String searchStr, final List<ActionParametersBase> changeVdsParameterList, final List<ActionParametersBase> activateVdsParameterList) {
final Map<Guid, Guid> hostClusterIdMap = new HashMap<>();
for (ActionParametersBase param : changeVdsParameterList) {
hostClusterIdMap.put(((ChangeVDSClusterParameters) param).getVdsId(), ((ChangeVDSClusterParameters) param).getClusterId());
}
Frontend.getInstance().runQuery(QueryType.Search, new SearchParameters(searchStr, SearchType.VDS), new AsyncQuery<QueryReturnValue>(returnValue -> {
List<VDS> hosts = returnValue.getReturnValue();
boolean succeeded = true;
for (VDS host : hosts) {
if (!host.getClusterId().equals(hostClusterIdMap.get(host.getId()))) {
succeeded = false;
}
}
if (!succeeded) {
getWindow().stopProgress();
cancel();
errorPopupManager.show(ConstantsManager.getInstance().getConstants().hostChangeClusterTimeOut());
} else {
activateHostsAfterClusterChange(searchStr, activateVdsParameterList);
}
}));
}
use of org.ovirt.engine.core.common.queries.QueryReturnValue in project ovirt-engine by oVirt.
the class NetworkVmListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
GetVmsAndNetworkInterfacesByNetworkIdParameters params = new GetVmsAndNetworkInterfacesByNetworkIdParameters(getEntity().getId(), NetworkVmFilter.running.equals(getViewFilterType()));
params.setRefresh(getIsQueryFirstTime());
final NetworkVmFilter filter = getViewFilterType();
Frontend.getInstance().runQuery(QueryType.GetVmsAndNetworkInterfacesByNetworkId, params, new AsyncQuery<QueryReturnValue>(returnValue -> {
if (filter.equals(getViewFilterType())) {
setItems((Collection<PairQueryable<VmNetworkInterface, VM>>) returnValue.getReturnValue());
}
}));
}
Aggregations