use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class AsyncDataProvider method updateVDSInterfaceList.
public void updateVDSInterfaceList(List<VDS> vdsList, Runnable callback) {
if (vdsList != null && !vdsList.isEmpty()) {
List<QueryType> types = new ArrayList<>();
List<QueryParametersBase> ids = new ArrayList<>();
vdsList.stream().forEach(vds -> {
types.add(QueryType.GetVdsInterfacesByVdsId);
ids.add(new IdQueryParameters(vds.getId()));
});
Frontend.getInstance().runMultipleQueries(types, ids, result -> {
List<QueryReturnValue> values = result.getReturnValues();
for (int i = 0; i < vdsList.size(); i++) {
QueryReturnValue interfaceQueryValue = values.get(i);
if (interfaceQueryValue.getReturnValue() != null) {
vdsList.get(i).getInterfaces().addAll(interfaceQueryValue.getReturnValue());
}
}
callback.run();
});
} else {
callback.run();
}
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class AsyncDataProvider method getAuthzExtensionsNames.
public void getAuthzExtensionsNames(AsyncQuery<List<String>> aQuery) {
aQuery.converterCallback = new ListConverter<>();
Frontend.getInstance().runQuery(QueryType.GetDomainList, new QueryParametersBase(), aQuery);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class AsyncDataProvider method countAllTemplates.
public void countAllTemplates(AsyncQuery<Integer> aQuery) {
aQuery.converterCallback = new CastingConverter<>();
Frontend.getInstance().runQuery(QueryType.GetVmTemplateCount, new QueryParametersBase(), aQuery);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class AsyncDataProvider method getAllVmTemplates.
public void getAllVmTemplates(AsyncQuery<List<VmTemplate>> aQuery, final boolean refresh) {
aQuery.converterCallback = new TemplateConverter();
QueryParametersBase params = new QueryParametersBase();
params.setRefresh(refresh);
Frontend.getInstance().runQuery(QueryType.GetAllVmTemplates, params, aQuery);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class InstanceTypeManager method updateAll.
/**
* First updates the list of instance types and selects the one which is supposed to be selected and then
* updates all the fields which are taken from the instance type (by calling the updateFields()).
*/
public void updateAll() {
final Guid selectedInstanceTypeId = getSelectedInstanceTypeId();
Frontend.getInstance().runQuery(QueryType.GetAllInstanceTypes, new QueryParametersBase(), new AsyncQuery<QueryReturnValue>(returnValue -> {
if (returnValue == null || !returnValue.getSucceeded()) {
return;
}
List<InstanceType> instanceTypes = new ArrayList<>();
// add this only if the user is allowed to
if (!getModel().isCreateInstanceOnly()) {
instanceTypes.add(CustomInstanceType.INSTANCE);
}
for (InstanceType instanceType : (Iterable<InstanceType>) returnValue.getReturnValue()) {
instanceTypes.add(instanceType);
}
getModel().getInstanceTypes().setItems(instanceTypes);
for (InstanceType instanceType : instanceTypes) {
if ((instanceType instanceof CustomInstanceType) && selectedInstanceTypeId == null) {
getModel().getInstanceTypes().setSelectedItem(CustomInstanceType.INSTANCE);
break;
}
if (instanceType.getId() == null || selectedInstanceTypeId == null) {
continue;
}
if (instanceType.getId().equals(selectedInstanceTypeId)) {
getModel().getInstanceTypes().setSelectedItem(instanceType);
break;
}
}
if (getModel().getInstanceTypes().getSelectedItem() instanceof CustomInstanceType) {
// detach if the instance type is "custom"
getModel().getAttachedToInstanceType().setEntity(false);
}
updateFields();
}));
}
Aggregations