use of org.ovirt.engine.core.common.businessentities.StorageDomainType in project ovirt-engine by oVirt.
the class StorageModelBehavior method getSelectableModelsByRole.
public ArrayList<IStorageModel> getSelectableModelsByRole() {
StorageDomainType role = getModel().getAvailableStorageDomainTypeItems().getSelectedItem();
List<IStorageModel> items = getModel().getStorageModelsByRole(role);
return getSelectableModels(items);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainType in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method attachInternal.
private void attachInternal(ListModel listModel, StorageDomainType storageType) {
if (getWindow() != null) {
return;
}
this.setStorageDomainType(storageType);
setWindow(listModel);
if (storageType == StorageDomainType.ISO) {
AsyncDataProvider.getInstance().getISOStorageDomainList(new AsyncQuery<>(list -> {
Collection<StorageDomain> currItems = getItems() != null ? getItems() : new ArrayList<>();
List<EntityModel> models = list.stream().filter(a -> currItems.stream().noneMatch(new Linq.IdPredicate<>(a.getId()))).map(EntityModel::new).collect(Collectors.toList());
postAttachInternal(models);
}));
} else {
AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(list -> {
List<EntityModel> models = new ArrayList<>();
boolean addToList;
Collection<StorageDomain> items1 = getItems() != null ? getItems() : new ArrayList<>();
for (StorageDomain a : list) {
addToList = false;
if (a.getStorageDomainSharedStatus() != StorageDomainSharedStatus.Unattached || items1.stream().anyMatch(new Linq.IdPredicate<>(a.getId()))) {
continue;
}
if (a.getStorageDomainType() == StorageDomainType.Volume) {
addToList = true;
} else if (a.getStorageDomainType() == getStorageDomainType()) {
if (getStorageDomainType() == StorageDomainType.Data) {
if (getEntity().getStoragePoolFormatType() == null) {
addToList = true;
} else if (getEntity().getStoragePoolFormatType().compareTo(a.getStorageStaticData().getStorageFormat()) >= 0) {
addToList = true;
} else {
if (a.getStorageStaticData().getStorageFormat() == StorageFormatType.V1 || a.getStorageStaticData().getStorageFormat() == StorageFormatType.V2) {
addToList = true;
}
}
} else if (getStorageDomainType() == StorageDomainType.ImportExport) {
addToList = true;
}
}
if (addToList) {
EntityModel tempVar2 = new EntityModel();
tempVar2.setEntity(a);
models.add(tempVar2);
}
}
postAttachInternal(models);
}));
}
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainType in project ovirt-engine by oVirt.
the class StoragesTree method getRootItem.
@Override
protected TreeItem getRootItem(StorageDomainModel storageDomainModel) {
HorizontalPanel panel = new HorizontalPanel();
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
StorageDomain storage = storageDomainModel.getStorageDomain();
// $NON-NLS-1$
addItemToPanel(panel, new Image(resources.storageImage()), "25px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), storage.getStorageName(), "");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<StorageDomainType>(), storage.getStorageDomainType(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<StorageDomainSharedStatus>(), storage.getStorageDomainSharedStatus(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getAvailableDiskSize(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getUsedDiskSize(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getTotalDiskSize(), "90px");
TreeItem treeItem = new TreeItem(panel);
treeItem.setUserObject(storage.getId());
return treeItem;
}
Aggregations