public List<IStorageModel> getStorageModelsByRole(StorageDomainType role) { List<IStorageModel> filteredModels = new LinkedList<>(); for (IStorageModel model : getStorageModels()) { if (model.getRole() == role) { filteredModels.add(model); } } return filteredModels; }
public void updateCurrentStorageItem() { StorageDomainType storageDomainType = getAvailableStorageDomainTypeItems().getSelectedItem(); StorageType storageType = getAvailableStorageTypeItems().getSelectedItem(); for (IStorageModel model : getStorageModels()) { if (model.getType() == storageType && model.getRole() == storageDomainType) { setCurrentStorageItem(model); break; } } }
protected void storageItemsChanged() { if (getStorageModels() != null) { for (Object item : getStorageModels()) { IStorageModel model = (IStorageModel) item; model.setContainer(this); if (item instanceof NfsStorageModel) { NfsStorageModel nfsModel = (NfsStorageModel) item; nfsModel.getPathChangedEvent().addListener(this); } } } }
@Override public void UpdateItemsAvailability() { super.UpdateItemsAvailability(); storage_pool dataCenter = (storage_pool) getModel().getDataCenter().getSelectedItem(); for (IStorageModel item : Linq.<IStorageModel>Cast(getModel().getItems())) { Model model = (Model) item; storage_domains isoStorage = DataProvider.GetIsoDomainByDataCenterId(dataCenter.getId()); storage_domains exportStorage = DataProvider.GetExportDomainByDataCenterId(dataCenter.getId()); // available type/function items are: // all in case of Unassigned DC. // ISO in case the specified DC doesn't have an attached ISO domain. // Export in case the specified DC doesn't have an attached export domain. model.setIsSelectable( (dataCenter.getId().equals(StorageModel.UnassignedDataCenterId) || (item.getRole() == StorageDomainType.ISO && isoStorage == null) || (item.getRole() == StorageDomainType.ImportExport && exportStorage == null))); } }