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;
}
Aggregations