Search in sources :

Example 6 with StoragePortGroupRestRep

use of com.emc.storageos.model.portgroup.StoragePortGroupRestRep in project coprhd-controller by CoprHD.

the class SystemsMapper method map.

/**
 * Map a StoragePortGroup instance to StoragePortGroupRestRep
 *
 * @param from
 *            The StoragePortGroup instance
 * @return StoragePortGroupRestRep
 */
public static StoragePortGroupRestRep map(StoragePortGroup from) {
    if (from == null) {
        return null;
    }
    StoragePortGroupRestRep to = new StoragePortGroupRestRep();
    to.setName(from.getLabel());
    to.setId(from.getId());
    to.setStorageDevice(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, from.getStorageDevice()));
    to.setRegistrationStatus(from.getRegistrationStatus());
    to.setNativeGuid(from.getNativeGuid());
    to.setLink(new RestLinkRep("self", RestLinkFactory.newLink(from)));
    to.setMutable(from.getMutable());
    StringMap metrics = from.getMetrics();
    if (metrics != null && !metrics.isEmpty()) {
        Double portMetric = MetricsKeys.getDoubleOrNull(MetricsKeys.portMetric, metrics);
        if (portMetric != null) {
            to.setPortMetric(portMetric);
        }
        Long volumeCount = MetricsKeys.getLong(MetricsKeys.volumeCount, metrics);
        if (volumeCount != null) {
            to.setVolumeCount(volumeCount);
        }
    }
    mapDiscoveredDataObjectFields(from, to);
    return to;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) StoragePortGroupRestRep(com.emc.storageos.model.portgroup.StoragePortGroupRestRep) RestLinkRep(com.emc.storageos.model.RestLinkRep)

Aggregations

StoragePortGroupRestRep (com.emc.storageos.model.portgroup.StoragePortGroupRestRep)6 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)3 AssetOption (com.emc.vipr.model.catalog.AssetOption)3 Asset (com.emc.sa.asset.annotation.Asset)2 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)2 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)2 URI (java.net.URI)2 ArrayList (java.util.ArrayList)2 MapStoragePortGroup (com.emc.storageos.api.mapper.functions.MapStoragePortGroup)1 MapVirtualArray (com.emc.storageos.api.mapper.functions.MapVirtualArray)1 StoragePortGroupComparator (com.emc.storageos.api.service.impl.resource.utils.StoragePortGroupComparator)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)1 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)1 ExportMask (com.emc.storageos.db.client.model.ExportMask)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 StoragePort (com.emc.storageos.db.client.model.StoragePort)1 StoragePortGroup (com.emc.storageos.db.client.model.StoragePortGroup)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 StringMap (com.emc.storageos.db.client.model.StringMap)1