use of org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator in project ovirt-engine by oVirt.
the class GetVmsRelatedToQuotaIdQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<VM> vms = vmDao.getAllVmsRelatedToQuotaId(getParameters().getId());
for (VM vm : vms) {
vmHandler.updateDisksFromDb(vm);
vmHandler.updateVmInitFromDB(vm.getStaticData(), true);
Collections.sort(vm.getDiskList(), new DiskByDiskAliasComparator());
imagesHandler.fillImagesBySnapshots(vm);
}
getQueryReturnValue().setReturnValue(vms);
}
use of org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator in project ovirt-engine by oVirt.
the class TemplateStorageListModel method setItems.
@Override
public void setItems(final Collection<StorageDomainModel> value) {
if (storageDomainModels != null) {
Collections.sort(storageDomainModels, Comparator.comparing(s -> s.getStorageDomain().getStorageName()));
itemsChanging(value, items);
items = storageDomainModels;
itemsChanged();
getItemsChangedEvent().raise(this, EventArgs.EMPTY);
// $NON-NLS-1$
onPropertyChanged(new PropertyChangedEventArgs("Items"));
storageDomainModels = null;
} else {
VmTemplate template = getEntity();
AsyncDataProvider.getInstance().getTemplateDiskList(new AsyncQuery<>(diskImages -> {
Collection<? extends Object> storageDomains = value;
List<StorageDomainModel> storageDomainModels = new ArrayList<>();
for (Object o : storageDomains) {
StorageDomain storageDomain = (StorageDomain) o;
StorageDomainModel storageDomainModel = new StorageDomainModel();
storageDomainModel.setStorageDomain(storageDomain);
ArrayList<DiskImage> disks = new ArrayList<>();
for (DiskImage diskImage : diskImages) {
if (diskImage.getStorageIds().contains(storageDomain.getId())) {
disks.add(diskImage);
}
}
Collections.sort(disks, new DiskByDiskAliasComparator());
storageDomainModel.setDisks(disks);
storageDomainModels.add(storageDomainModel);
}
TemplateStorageListModel.this.storageDomainModels = storageDomainModels;
setItems(value);
}), template.getId());
}
}
use of org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator in project ovirt-engine by oVirt.
the class TemplateDiskListModel method setDisks.
private void setDisks(Collection<DiskImage> value) {
ArrayList<DiskImage> disks = value != null ? new ArrayList<>(value) : new ArrayList<DiskImage>();
Collections.sort(disks, new DiskByDiskAliasComparator());
super.setItems(disks);
}
use of org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator in project ovirt-engine by oVirt.
the class TemplateImportDiskListModel method onEntityChanged.
@Override
protected void onEntityChanged() {
super.onEntityChanged();
if (getEntity() != null) {
ArrayList<DiskImage> list = new ArrayList<>();
VmTemplate template = (VmTemplate) getEntity();
for (Map.Entry<VmTemplate, List<DiskImage>> item : extendedItems) {
if (item.getKey().getQueryableId().equals(template.getQueryableId())) {
list.addAll(item.getValue());
Collections.sort(list, new DiskByDiskAliasComparator());
setItems(list);
return;
}
}
} else {
setItems(null);
}
}
use of org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator in project ovirt-engine by oVirt.
the class GetUserVmsByUserIdAndGroupsQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
List<VM> vmList = vmDao.getAllForUserWithGroupsAndUserRoles(getUserID());
for (VM vm : vmList) {
updateVmGuestAgentVersion(vm);
if (getParameters().getIncludeDiskData()) {
updateDisksFromDB(vm);
updateVmInit(vm);
Collections.sort(vm.getDiskList(), new DiskByDiskAliasComparator());
fillImagesBySnapshots(vm);
}
}
setReturnValue(vmList);
}
Aggregations