Search in sources :

Example 1 with ProtectionSystemRPClusterRestRep

use of com.emc.storageos.model.protection.ProtectionSystemRPClusterRestRep in project coprhd-controller by CoprHD.

the class ProtectionMapper method map.

public static ProtectionSystemRestRep map(ProtectionSystem from) {
    if (from == null) {
        return null;
    }
    ProtectionSystemRestRep to = new ProtectionSystemRestRep();
    mapDiscoveredSystemObjectFields(from, to);
    to.setInstallationId(from.getInstallationId());
    to.setMajorVersion(from.getMajorVersion());
    to.setMinorVersion(from.getMinorVersion());
    to.setIpAddress(from.getIpAddress());
    to.setPortNumber(from.getPortNumber());
    to.setReachableStatus(from.getReachableStatus());
    to.setUsername(from.getUsername());
    to.setNativeGuid(from.getNativeGuid());
    if (from.getRpSiteNames() != null) {
        List<ProtectionSystemRPClusterRestRep> clusterReps = new ArrayList<>();
        for (Map.Entry<String, String> clusterEntry : from.getRpSiteNames().entrySet()) {
            ProtectionSystemRPClusterRestRep clusterRep = new ProtectionSystemRPClusterRestRep();
            clusterRep.setClusterId(clusterEntry.getKey());
            clusterRep.setClusterName(clusterEntry.getValue());
            // See if there are assigned virtual arrays for clusters
            if (from.getSiteAssignedVirtualArrays() != null && from.getSiteAssignedVirtualArrays().get(clusterEntry.getKey()) != null) {
                List<String> assignedVarrays = new ArrayList<>();
                assignedVarrays.addAll(from.getSiteAssignedVirtualArrays().get(clusterEntry.getKey()));
                clusterRep.setAssignedVarrays(assignedVarrays);
            }
            clusterReps.add(clusterRep);
        }
        to.setRpClusters(clusterReps);
    }
    return to;
}
Also used : ProtectionSystemRPClusterRestRep(com.emc.storageos.model.protection.ProtectionSystemRPClusterRestRep) ArrayList(java.util.ArrayList) ProtectionSystemRestRep(com.emc.storageos.model.protection.ProtectionSystemRestRep) Map(java.util.Map)

Aggregations

ProtectionSystemRPClusterRestRep (com.emc.storageos.model.protection.ProtectionSystemRPClusterRestRep)1 ProtectionSystemRestRep (com.emc.storageos.model.protection.ProtectionSystemRestRep)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1