use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class ClusterServiceModel method filterServices.
private void filterServices() {
VDS selectedVds = hostList.getSelectedItem();
ServiceType serviceType = serviceTypeList.getSelectedItem();
ArrayList<EntityModel<GlusterServerService>> list = new ArrayList<>();
List<GlusterServerService> serviceList = new ArrayList<>(getActualServiceList());
Collections.sort(serviceList, Comparator.comparing(GlusterServerService::getHostName).thenComparing(g -> g.getServiceType().toString()));
for (GlusterServerService service : serviceList) {
if ((selectedVds == null || service.getHostName().equals(selectedVds.getHostName())) && (serviceType == null || service.getServiceType() == serviceType)) {
list.add(new EntityModel<>(service));
}
}
getServiceList().setItems(list);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class GlusterHookResolveConflictsModel method onSelectedHookSourceChanged.
private void onSelectedHookSourceChanged() {
EntityModel<GlusterServerHook> selectedItem = getHookSources().getSelectedItem();
if (selectedItem == null) {
return;
}
GlusterServerHook selectedServer = selectedItem.getEntity();
getServerHooksList().setSelectedItem(selectedServer);
if (selectedServer.getStatus() == GlusterHookStatus.MISSING) {
getContentModel().getContent().setEntity(null);
getContentModel().getStatus().setEntity(null);
getContentModel().getMd5Checksum().setEntity(null);
return;
}
getContentModel().getStatus().setEntity(selectedServer.getStatus());
getContentModel().getMd5Checksum().setEntity(selectedServer.getChecksum());
if (selectedServer.getContentType() == GlusterHookContentType.TEXT) {
startProgress();
AsyncDataProvider.getInstance().getGlusterHookContent(new AsyncQuery<>(content -> {
getContentModel().getContent().setEntity(content);
stopProgress();
}), getGlusterHookEntity().getId(), selectedServer.getServerId());
} else {
getContentModel().getContent().setEntity(null);
}
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class ExportRepoImageModel method setDiskImages.
public void setDiskImages(List<DiskImage> diskImages) {
ArrayList<EntityModel> entities = new ArrayList<>();
for (DiskImage i : diskImages) {
entities.add(new EntityModel(i));
}
setEntities(entities);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VmListModel method initRemoveDisksChecboxesPost.
private void initRemoveDisksChecboxesPost(Guid vmId, List<Disk> disks) {
EntityModel model = vmsRemoveMap.get(vmId);
if (disks.isEmpty()) {
updateRemoveDisksCheckBox(model, false, false, ConstantsManager.getInstance().getConstants().removeVmDisksNoDisksMsg());
return;
}
boolean isOnlySharedDisks = true;
boolean isSnapshotExists = false;
for (Disk disk : disks) {
if (!disk.isShareable()) {
isOnlySharedDisks = false;
if (disk.getDiskStorageType() == DiskStorageType.IMAGE) {
if (((DiskImage) disk).getSnapshots().size() > 1) {
isSnapshotExists = true;
break;
}
}
}
}
if (isSnapshotExists) {
updateRemoveDisksCheckBox(model, true, false, ConstantsManager.getInstance().getConstants().removeVmDisksSnapshotsMsg());
return;
}
if (isOnlySharedDisks) {
updateRemoveDisksCheckBox(model, false, false, ConstantsManager.getInstance().getConstants().removeVmDisksAllSharedMsg());
return;
}
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel 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());
}
}
});
}
}
Aggregations