use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class NetworkVmListModel method remove.
private void remove() {
if (getWindow() != null) {
return;
}
List<VmNetworkInterface> vnics = new ArrayList<>();
for (Object item : getSelectedItems()) {
PairQueryable<VmNetworkInterface, VM> pair = (PairQueryable<VmNetworkInterface, VM>) item;
vnics.add(pair.getFirst());
}
RemoveVmInterfaceModel model = new RemoveVmInterfaceModel(this, vnics, true);
setWindow(model);
}
use of org.ovirt.engine.core.common.businessentities.VM 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());
}
}));
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class NetworkVmListModel method updateActionAvailability.
private void updateActionAvailability() {
ArrayList<VM> vms = new ArrayList<>();
Iterable<PairQueryable<VmNetworkInterface, VM>> selectedItems = getSelectedItems() != null ? getSelectedItems() : new ArrayList();
for (PairQueryable<VmNetworkInterface, VM> item : selectedItems) {
vms.add(item.getSecond());
}
getRemoveCommand().setIsExecutionAllowed(ActionUtils.canExecute(vms, VM.class, ActionType.RemoveVmInterface) && getSelectedItems() != null && !getSelectedItems().isEmpty() && canRemoveVnics());
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class PoolDiskListModel method onEntityChanged.
@Override
protected void onEntityChanged() {
super.onEntityChanged();
VmPool pool = getEntity();
if (pool != null) {
Frontend.getInstance().runQuery(QueryType.GetVmDataByPoolId, new IdQueryParameters(pool.getVmPoolId()), new AsyncQuery<QueryReturnValue>(result -> {
if (result != null) {
VM vm = result.getReturnValue();
if (vm == null) {
return;
}
setVM(vm);
syncSearch();
}
}));
}
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class PoolInterfaceListModel method onEntityChanged.
@Override
protected void onEntityChanged() {
super.onEntityChanged();
VmPool pool = getEntity();
if (pool != null) {
Frontend.getInstance().runQuery(QueryType.GetVmDataByPoolId, new IdQueryParameters(pool.getVmPoolId()), new AsyncQuery<QueryReturnValue>(result -> {
if (result != null) {
VM vm = result.getReturnValue();
if (vm == null) {
return;
}
syncSearch(QueryType.GetVmInterfacesByVmId, new IdQueryParameters(vm.getId()));
}
}));
}
}
Aggregations