use of org.ovirt.engine.ui.uicompat.IFrontendMultipleQueryAsyncCallback in project ovirt-engine by oVirt.
the class AsyncDataProvider method initCpuMap.
private void initCpuMap() {
cpuMap = new HashMap<>();
final List<QueryType> queryTypes = new ArrayList<>();
final List<QueryParametersBase> queryParams = new ArrayList<>();
for (Version version : Version.ALL) {
queryTypes.add(QueryType.GetAllServerCpuList);
queryParams.add(new GetAllServerCpuListParameters(version));
}
final IFrontendMultipleQueryAsyncCallback callback = result -> {
for (int i = 0; i < result.getReturnValues().size(); i++) {
final List<ServerCpu> cpus = result.getReturnValues().get(i).getReturnValue();
final Version version = ((GetAllServerCpuListParameters) result.getParameters().get(i)).getVersion();
initCpuMapForVersion(version, cpus);
}
};
Frontend.getInstance().runMultipleQueries(queryTypes, queryParams, callback);
}
use of org.ovirt.engine.ui.uicompat.IFrontendMultipleQueryAsyncCallback in project ovirt-engine by oVirt.
the class VmInterfaceListModel method updateNetworkFilterParameterMap.
private void updateNetworkFilterParameterMap(List<VmNetworkInterface> vmInterfaces) {
List<QueryType> queryTypes = new ArrayList<>();
List<QueryParametersBase> queryParametersBases = new ArrayList<>();
vmInterfaces.stream().forEach(iface -> {
queryTypes.add(QueryType.GetVmInterfaceFilterParametersByVmInterfaceId);
queryParametersBases.add(new IdQueryParameters(iface.getId()));
});
final IFrontendMultipleQueryAsyncCallback callback = multiResult -> {
Map<Guid, List<VmNicFilterParameter>> networkFilterMap = new HashMap<>(vmInterfaces.size());
for (int i = 0; i < multiResult.getReturnValues().size(); i++) {
List<VmNicFilterParameter> params = multiResult.getReturnValues().get(i).getReturnValue();
networkFilterMap.put(vmInterfaces.get(i).getId(), params);
}
setMapNicFilterParameter(networkFilterMap);
setItems(vmInterfaces);
};
if (vmInterfaces.isEmpty()) {
setItems(vmInterfaces);
}
Frontend.getInstance().runMultipleQueries(queryTypes, queryParametersBases, callback);
}
Aggregations