@Override
  protected List<StorageDomain> filterStorageDomains(List<StorageDomain> storageDomains) {
    List<StorageDomain> availableStorageDomains = new ArrayList<>();

    // Filtering out domains that are not active
    for (StorageDomain storageDomainItem : storageDomains) {
      if (Linq.isDataActiveStorageDomain(storageDomainItem)) {
        availableStorageDomains.add(storageDomainItem);
      }
    }

    // Sorting by name
    Collections.sort(availableStorageDomains, new NameableComparator());

    return availableStorageDomains;
  }
Ejemplo n.º 2
0
  public ArrayList<StorageDomain> filterStorageDomains(ArrayList<StorageDomain> storageDomains) {
    // filter only the Active storage domains (Active regarding the relevant storage pool).
    ArrayList<StorageDomain> list = new ArrayList<StorageDomain>();
    for (StorageDomain a : storageDomains) {
      if (Linq.isDataActiveStorageDomain(a)) {
        list.add(a);
      }
    }

    // Filter according to system tree selection.
    if (getSystemTreeSelectedItem() != null
        && getSystemTreeSelectedItem().getType() == SystemTreeItemType.Storage) {
      StorageDomain selectStorage = (StorageDomain) getSystemTreeSelectedItem().getEntity();
      StorageDomain sd =
          Linq.firstOrDefault(list, new Linq.StoragePredicate(selectStorage.getId()));
      list = new ArrayList<StorageDomain>(Arrays.asList(new StorageDomain[] {sd}));
    }

    return list;
  }