use of org.ovirt.engine.core.common.businessentities.comparators.NameableComparator in project ovirt-engine by oVirt.
the class AsyncDataProvider method getAllProvidersByProvidedEntity.
public void getAllProvidersByProvidedEntity(AsyncQuery<List<Provider<?>>> query, final VdcObjectType providedEntity) {
query.converterCallback = returnValue -> {
if (returnValue == null) {
return new ArrayList<>();
}
return ((Collection<Provider<?>>) returnValue).stream().filter(p -> p.getType().getProvidedTypes().contains(providedEntity)).sorted(new NameableComparator()).collect(Collectors.toList());
};
Frontend.getInstance().runQuery(QueryType.GetAllProviders, new GetAllProvidersParameters(), query);
}
use of org.ovirt.engine.core.common.businessentities.comparators.NameableComparator in project ovirt-engine by oVirt.
the class MoveOrCopyDiskModel method postInitStorageDomains.
protected void postInitStorageDomains() {
for (DiskModel disk : getDisks()) {
DiskImage diskImage = (DiskImage) disk.getDisk();
// Source storage domains
List<Guid> diskStorageIds = diskImage.getStorageIds();
List<StorageDomain> sourceStorageDomains = Linq.getStorageDomainsByIds(diskStorageIds, getActiveStorageDomains());
boolean isDiskBasedOnTemplate = !diskImage.getParentId().equals(Guid.Empty);
ArrayList<StorageDomain> destStorageDomains = getDestinationDomains(getActiveStorageDomains(), sourceStorageDomains, disk, isDiskBasedOnTemplate);
// Add prohibition reasons
if (sourceStorageDomains.isEmpty() || destStorageDomains.isEmpty()) {
problematicDisks.add(disk.getAlias().getEntity());
updateChangeability(disk, isDiskBasedOnTemplate, sourceStorageDomains.isEmpty(), destStorageDomains.isEmpty());
}
// Sort and add storage domains
Collections.sort(destStorageDomains, new NameableComparator());
Collections.sort(sourceStorageDomains, new NameableComparator());
disk.getStorageDomain().setItems(destStorageDomains);
disk.getSourceStorageDomain().setItems(sourceStorageDomains);
addSourceStorageDomainName(disk, sourceStorageDomains);
}
sortDisks();
postCopyOrMoveInit();
}
use of org.ovirt.engine.core.common.businessentities.comparators.NameableComparator in project ovirt-engine by oVirt.
the class ExportRepoImageModel method filterStorageDomains.
@Override
protected List<StorageDomain> filterStorageDomains(List<StorageDomain> storageDomains) {
List<StorageDomain> availableStorageDomains = new ArrayList<>();
// Take only GLANCE domains
for (StorageDomain storageDomainItem : storageDomains) {
if (storageDomainItem.getStorageType() == StorageType.GLANCE) {
availableStorageDomains.add(storageDomainItem);
}
}
// Sorting by name
Collections.sort(availableStorageDomains, new NameableComparator());
return availableStorageDomains;
}
use of org.ovirt.engine.core.common.businessentities.comparators.NameableComparator in project ovirt-engine by oVirt.
the class AdElementListModel method populateRoles.
protected void populateRoles(List<Role> roles) {
Role selectedRole = null;
List<Role> rolesToPopulate = new ArrayList<>();
for (Role role : roles) {
if (role.getId() != null) {
// ignore CONSUME_QUOTA_ROLE in UI
if (!role.getId().equals(ApplicationGuids.quotaConsumer.asGuid())) {
rolesToPopulate.add(role);
}
// select engine user if it exists
if (role.getId().equals(ApplicationGuids.engineUser.asGuid())) {
selectedRole = role;
}
}
}
rolesToPopulate.sort(new NameableComparator());
getRole().setItems(rolesToPopulate);
if (selectDefaultRole) {
if (selectedRole != null) {
getRole().setSelectedItem(selectedRole);
} else if (rolesToPopulate.size() > 0) {
// if engine user does not exist, pick the first on the list
getRole().setSelectedItem(rolesToPopulate.get(0));
}
} else {
getRole().setSelectedItem(null);
}
}
use of org.ovirt.engine.core.common.businessentities.comparators.NameableComparator in project ovirt-engine by oVirt.
the class DataCenterNetworkListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
super.syncSearch();
IdQueryParameters tempVar = new IdQueryParameters(getEntity().getId());
tempVar.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetAllNetworks, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<Network> newItems = returnValue.getReturnValue();
Collections.sort(newItems, new NameableComparator());
setItems(newItems);
}));
}
Aggregations