use of com.emc.storageos.model.host.PreferredPoolParam in project coprhd-controller by CoprHD.
the class HostMapper method map.
public static HostRestRep map(Host from) {
if (from == null) {
return null;
}
HostRestRep to = new HostRestRep();
mapDiscoveredSystemObjectFields(from, to);
to.setHostName(from.getHostName());
to.setType(from.getType());
to.setUsername(from.getUsername());
to.setPortNumber(from.getPortNumber());
to.setOsVersion(from.getOsVersion());
to.setUseSsl(from.getUseSSL());
to.setCluster(toRelatedResource(ResourceTypeEnum.CLUSTER, from.getCluster()));
to.setProject(toRelatedResource(ResourceTypeEnum.PROJECT, from.getProject()));
to.setComputeElement(toRelatedResource(ResourceTypeEnum.COMPUTE_ELEMENT, from.getComputeElement()));
to.setvCenterDataCenter(toRelatedResource(ResourceTypeEnum.VCENTERDATACENTER, from.getVcenterDataCenter()));
if ((from.getVolumeGroupIds() != null) && (!from.getVolumeGroupIds().isEmpty())) {
List<RelatedResourceRep> volumeGroups = new ArrayList<RelatedResourceRep>();
for (String volumeGroup : from.getVolumeGroupIds()) {
volumeGroups.add(toRelatedResource(ResourceTypeEnum.VOLUME_GROUP, URI.create(volumeGroup)));
}
to.setVolumeGroups(volumeGroups);
}
StringMap pools = from.getPreferredPools();
if (pools != null && !pools.isEmpty()) {
for (Map.Entry<String, String> entry : pools.entrySet()) {
RelatedResourceRep poolRep = toRelatedResource(ResourceTypeEnum.STORAGE_POOL, URI.create(entry.getKey()));
PreferredPoolParam pool = new PreferredPoolParam(poolRep, entry.getValue());
to.getPreferredPools().add(pool);
}
}
to.setTenant(toRelatedResource(ResourceTypeEnum.TENANT, from.getTenant()));
to.setDiscoverable(from.getDiscoverable());
to.setBootVolume(toRelatedResource(ResourceTypeEnum.VOLUME, from.getBootVolumeId()));
if (from.getDiscoverable() != null && from.getDiscoverable() == false) {
to.setProvisioningJobStatus(from.getProvisioningStatus());
}
return to;
}
Aggregations