Search in sources :

Example 1 with RelatedResourceComparator

use of com.emc.vipr.client.core.util.RelatedResourceComparator in project coprhd-controller by CoprHD.

the class StorageSystemUtils method mapProtectionSystemConnectivity.

private static Map<String, Set<NamedRelatedResourceRep>> mapProtectionSystemConnectivity(List<StorageSystemConnectivityRestRep> connectivityList) {
    Map<String, Set<NamedRelatedResourceRep>> results = Maps.newTreeMap();
    for (StorageSystemConnectivityRestRep connectivity : connectivityList) {
        for (String connectionType : connectivity.getConnectionTypes()) {
            if (connectivity.getProtectionSystem() == null) {
                continue;
            }
            Set<NamedRelatedResourceRep> values = results.get(connectionType);
            if (values == null) {
                values = Sets.newTreeSet(new RelatedResourceComparator());
                results.put(connectionType, values);
            }
            values.add(connectivity.getProtectionSystem());
        }
    }
    return results;
}
Also used : StorageSystemConnectivityRestRep(com.emc.storageos.model.systems.StorageSystemConnectivityRestRep) Set(java.util.Set) RelatedResourceComparator(com.emc.vipr.client.core.util.RelatedResourceComparator) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Example 2 with RelatedResourceComparator

use of com.emc.vipr.client.core.util.RelatedResourceComparator in project coprhd-controller by CoprHD.

the class VirtualArrays method findByInitiators.

/**
 * Finds the list of virtual arrays connected to any of the given initiators, optionally filtering the results.
 *
 * @param initiators
 *            the initiators.
 * @param filter
 *            the resource filter to apply to the results as they are returned (optional).
 * @return the list of connected virtual arrays.
 */
public List<VirtualArrayRestRep> findByInitiators(Collection<InitiatorRestRep> initiators, ResourceFilter<VirtualArrayRestRep> filter) {
    // Collect unique virtual array refs before fetching
    Set<RelatedResourceRep> virtualArrayRefs = new TreeSet<RelatedResourceRep>(new RelatedResourceComparator());
    for (InitiatorRestRep initiator : initiators) {
        String port = initiator.getInitiatorPort();
        virtualArrayRefs.addAll(performSearchBy(SearchConstants.INITIATOR_PORT_PARAM, port));
    }
    return getByRefs(virtualArrayRefs, filter);
}
Also used : NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) RelatedResourceComparator(com.emc.vipr.client.core.util.RelatedResourceComparator) TreeSet(java.util.TreeSet) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep)

Aggregations

NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 RelatedResourceComparator (com.emc.vipr.client.core.util.RelatedResourceComparator)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 InitiatorRestRep (com.emc.storageos.model.host.InitiatorRestRep)1 StorageSystemConnectivityRestRep (com.emc.storageos.model.systems.StorageSystemConnectivityRestRep)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1