use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class ProviderNetworkListModel method syncSearch.
@Override
protected void syncSearch() {
Provider provider = getEntity();
if (provider == null) {
return;
}
super.syncSearch(QueryType.GetAllNetworksForProvider, new IdQueryParameters(provider.getId()));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class VnicProfileTemplateListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
IdQueryParameters params = new IdQueryParameters(getEntity().getId());
params.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetTemplatesByVnicProfileId, params, new AsyncQuery<QueryReturnValue>(returnValue -> setItems((Collection<VmTemplate>) returnValue.getReturnValue())));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class VnicProfileVmListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
IdQueryParameters params = new IdQueryParameters(getEntity().getId());
params.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetVmsByVnicProfileId, params, new AsyncQuery<QueryReturnValue>(returnValue -> setItems((Collection<VM>) returnValue.getReturnValue())));
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters 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());
}
}
});
}
}
use of org.ovirt.engine.core.common.queries.IdQueryParameters in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method updateGraphics.
protected void updateGraphics(Guid id) {
Frontend.getInstance().runQuery(QueryType.GetGraphicsDevices, new IdQueryParameters(id), new AsyncQuery<QueryReturnValue>(returnValue -> {
List<VmDevice> graphicsVmDevs = returnValue.getReturnValue();
List<GraphicsType> graphicsTypes = new ArrayList<>();
for (VmDevice graphicsVmDev : graphicsVmDevs) {
graphicsTypes.add(GraphicsType.fromString(graphicsVmDev.getDevice()));
}
boolean hasSpiceAndVnc = graphicsTypes.size() == 2 && graphicsTypes.containsAll(Arrays.asList(GraphicsType.SPICE, GraphicsType.VNC));
boolean canBeSelected = getModel().getGraphicsType().getItems().contains(UnitVmModel.GraphicsTypes.SPICE_AND_VNC);
if (hasSpiceAndVnc && canBeSelected) {
getModel().getGraphicsType().setSelectedItem(UnitVmModel.GraphicsTypes.SPICE_AND_VNC);
} else if (graphicsVmDevs.size() == 1) {
GraphicsType type = GraphicsType.fromString(graphicsVmDevs.get(0).getDevice());
getModel().getGraphicsType().setSelectedItem(UnitVmModel.GraphicsTypes.fromGraphicsType(type));
}
}));
}
Aggregations