use of com.emc.storageos.model.adapters.StringMapAdapter in project coprhd-controller by CoprHD.
the class BlockMapper method map.
public static UnManagedVolumeRestRep map(UnManagedVolume from) {
if (from == null) {
return null;
}
UnManagedVolumeRestRep to = new UnManagedVolumeRestRep();
mapDataObjectFields(from, to);
to.setNativeGuid(from.getNativeGuid());
try {
to.setVolumeInformation(new StringSetMapAdapter().marshal(from.getVolumeInformation()));
} catch (Exception e) {
// Intentionally ignored
}
to.setVolumeCharacteristics(new StringMapAdapter().marshal(from.getVolumeCharacterstics()));
to.setStorageSystem(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, from.getStorageSystemUri()));
to.setStoragePool(toRelatedResource(ResourceTypeEnum.STORAGE_POOL, from.getStoragePoolUri()));
List<String> uems = new ArrayList<String>();
for (String uem : from.getUnmanagedExportMasks()) {
uems.add(uem);
}
to.setUnManagedExportMasks(uems);
List<String> initiatorUris = new ArrayList<String>();
for (String uri : from.getInitiatorUris()) {
initiatorUris.add(uri);
}
to.setInitiatorUris(initiatorUris);
List<String> initiatorNetworkIds = new ArrayList<String>();
for (String id : from.getInitiatorNetworkIds()) {
initiatorNetworkIds.add(id);
}
to.setInitiatorNetworkIds(initiatorNetworkIds);
List<String> storagePortUris = new ArrayList<String>();
for (String uri : from.getStoragePortUris()) {
storagePortUris.add(uri);
}
to.setStoragePortUris(storagePortUris);
List<String> supportedVPoolUris = new ArrayList<String>();
for (String uri : from.getSupportedVpoolUris()) {
supportedVPoolUris.add(uri);
}
to.setSupportedVPoolUris(supportedVPoolUris);
to.setWWN(from.getWwn());
return to;
}
use of com.emc.storageos.model.adapters.StringMapAdapter in project coprhd-controller by CoprHD.
the class VirtualArrayMapper method map.
public static NetworkRestRep map(Network from) {
if (from == null) {
return null;
}
NetworkRestRep to = new NetworkRestRep();
mapDiscoveredDataObjectFields(from, to);
StringSet assignedVirtualArrays = from.getAssignedVirtualArrays();
if ((assignedVirtualArrays != null) && (assignedVirtualArrays.size() == 1)) {
to.setVirtualArray(toRelatedResource(ResourceTypeEnum.VARRAY, URI.create(assignedVirtualArrays.iterator().next())));
}
to.setTransportType(from.getTransportType());
to.setEndpoints(from.retrieveEndpoints());
List<StringHashMapEntry> endpointsMap = new StringMapAdapter().marshal(from.getEndpointsMap());
/*
* Translated network endpoint to its corresponded EndpointAliasRestRep. At this point, only
* "name" and "value" attribute are filled. "alias" attribute will filled by the caller.
*/
to.setEndpointsDiscovered(new ArrayList<EndpointAliasRestRep>());
for (StringHashMapEntry endpointEntry : endpointsMap) {
to.getEndpointsDiscovered().add(new EndpointAliasRestRep(endpointEntry.getName(), endpointEntry.getValue()));
}
to.setFabricId(from.getNativeId());
to.setDiscovered(from.getDiscovered());
to.setNetworkSystems(from.getNetworkSystems());
to.setRegistrationStatus(from.getRegistrationStatus());
to.setAssignedVirtualArrays(assignedVirtualArrays);
to.setConnectedVirtualArrays(from.getConnectedVirtualArrays());
to.setRoutedNetworks(from.getRoutedNetworks());
return to;
}
use of com.emc.storageos.model.adapters.StringMapAdapter in project coprhd-controller by CoprHD.
the class FileMapper method map.
public static UnManagedFileSystemRestRep map(UnManagedFileSystem from) {
if (from == null) {
return null;
}
UnManagedFileSystemRestRep to = new UnManagedFileSystemRestRep();
mapDataObjectFields(from, to);
to.setNativeGuid(from.getNativeGuid());
try {
to.setFileSystemInformation(new StringSetMapAdapter().marshal(from.getFileSystemInformation()));
} catch (Exception e) {
_log.error("Exception while setting FileSystem information ", e);
}
to.setFileSystemCharacteristics(new StringMapAdapter().marshal(from.getFileSystemCharacterstics()));
to.setStorageSystem(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, from.getStorageSystemUri()));
to.setStoragePool(toRelatedResource(ResourceTypeEnum.STORAGE_POOL, from.getStoragePoolUri()));
if (null != from.getSupportedVpoolUris() && !from.getSupportedVpoolUris().isEmpty()) {
List<String> supportedVPoolList = new ArrayList<String>(from.getSupportedVpoolUris());
to.setSupportedVPoolUris(supportedVPoolList);
}
return to;
}
use of com.emc.storageos.model.adapters.StringMapAdapter in project coprhd-controller by CoprHD.
the class SystemsMapper method map.
public static StoragePoolRestRep map(StoragePool from, Map<String, Long> capacityMetrics, boolean isBlockStoragePool, CoordinatorClient coordinatorClient) {
if (from == null) {
return null;
}
StoragePoolRestRep to = new StoragePoolRestRep();
mapDiscoveredDataObjectFields(from, to);
to.setProtocols(from.getProtocols());
to.setControllerParams(new StringMapAdapter().marshal(from.getControllerParams()));
to.setOperationalStatus(from.getOperationalStatus());
to.setTotalCapacity(capacityMetrics.get(CapacityUtils.StorageMetrics.USABLE.toString()));
to.setFreeCapacity(capacityMetrics.get(CapacityUtils.StorageMetrics.FREE.toString()));
to.setUsedCapacity(capacityMetrics.get(CapacityUtils.StorageMetrics.USED.toString()));
to.setPercentUsed(capacityMetrics.get(CapacityUtils.StorageMetrics.PERCENT_USED.toString()));
if ((null != capacityMetrics.get(CapacityUtils.StorageMetrics.SUBSCRIBED.toString()) && !(capacityMetrics.get(CapacityUtils.StorageMetrics.SUBSCRIBED.toString()).toString().equals(MINUS_ONE_LONG)))) {
to.setSubscribedCapacity(capacityMetrics.get(CapacityUtils.StorageMetrics.SUBSCRIBED.toString()));
to.setPercentSubscribed(capacityMetrics.get(CapacityUtils.StorageMetrics.PERCENT_SUBSCRIBED.toString()));
}
to.setMaximumThinVolumeSize(CapacityUtils.convertKBToGB(from.getMaximumThinVolumeSize()));
to.setMinimumThinVolumeSize(CapacityUtils.convertKBToGB(from.getMinimumThinVolumeSize()));
to.setMaximumThickVolumeSize(CapacityUtils.convertKBToGB(from.getMaximumThickVolumeSize()));
to.setMinimumThickVolumeSize(CapacityUtils.convertKBToGB(from.getMinimumThickVolumeSize()));
to.setMaxResources(from.getMaxResources());
to.setAssignedVirtualArrays(from.getAssignedVirtualArrays());
to.setConnectedVirtualArrays(from.getConnectedVirtualArrays());
to.setTaggedVirtualArrays(from.getTaggedVirtualArrays());
to.setRaidLevels(from.getSupportedRaidLevels());
to.setThinVolumePreAllocationSupported(from.getThinVolumePreAllocationSupported());
to.setAutoTieringSupported(from.getAutoTieringEnabled());
to.setDriveTypes(from.getSupportedDriveTypes());
to.setCopyTypes(from.getSupportedCopyTypes());
to.setTierUtilizationPercentage(new StringMapAdapter().marshal(from.getTierUtilizationPercentage()));
to.setPoolName(from.getPoolName());
to.setPoolServiceType(from.getPoolServiceType());
to.setLongTermRetention(from.getLongTermRetention());
to.setSupportedResourceTypes(from.getSupportedResourceTypes());
to.setStorageSystem(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, from.getStorageDevice()));
to.setRegistrationStatus(from.getRegistrationStatus());
to.setCompatibilityStatus(from.getCompatibilityStatus());
to.setDiscoveryStatus(from.getDiscoveryStatus());
to.setDataCenters(from.getDataCenters());
to.setCompressionEnabled(from.getCompressionEnabled());
to.setMaxPoolUtilizationPercentage((from.getMaxPoolUtilizationPercentage() != null) ? from.getMaxPoolUtilizationPercentage() : Integer.valueOf(ControllerUtils.getPropertyValueFromCoordinator(coordinatorClient, CapacityMatcher.MAX_POOL_UTILIZATION_PERCENTAGE)));
if (null != from.getSupportedResourceTypes() && !from.getSupportedResourceTypes().equals(StoragePool.SupportedResourceTypes.THICK_ONLY.name())) {
to.setMaxThinPoolSubscriptionPercentage((from.getMaxThinPoolSubscriptionPercentage() != null) ? from.getMaxThinPoolSubscriptionPercentage() : Integer.valueOf(ControllerUtils.getPropertyValueFromCoordinator(coordinatorClient, CapacityMatcher.MAX_THIN_POOL_SUBSCRIPTION_PERCENTAGE)));
}
return to;
}
use of com.emc.storageos.model.adapters.StringMapAdapter in project coprhd-controller by CoprHD.
the class SystemsMapper method map.
public static StorageSystemRestRep map(StorageSystem from) {
if (from == null) {
return null;
}
StorageSystemRestRep to = new StorageSystemRestRep();
mapDiscoveredSystemObjectFields(from, to);
to.setSerialNumber(from.getSerialNumber());
to.setMajorVersion(from.getMajorVersion());
to.setMinorVersion(from.getMinorVersion());
to.setIpAddress(from.getIpAddress());
to.setSecondaryIPs(from.getSecondaryIPs());
to.setPortNumber(from.getPortNumber());
to.setSmisProviderIP(from.getSmisProviderIP());
to.setSmisPortNumber(from.getSmisPortNumber());
to.setSmisUseSSL(from.getSmisUseSSL());
to.setSmisUserName(from.getSmisUserName());
to.setExportMasks(new StringMapAdapter().marshal(from.getExportMasks()));
to.setProtocols(from.getProtocols());
to.setReachableStatus(from.getReachableStatus());
to.setFirmwareVersion(from.getFirmwareVersion());
to.setSupportsSoftLimit(from.getSupportSoftLimit());
to.setSupportsNotificationLimit(from.getSupportNotificationLimit());
to.setActiveProvider(toRelatedResource(ResourceTypeEnum.SMIS_PROVIDER, from.getActiveProviderURI()));
if (from.getProviders() != null) {
for (String provider : from.getProviders()) {
to.getProviders().add(toRelatedResource(ResourceTypeEnum.SMIS_PROVIDER, URI.create(provider)));
}
}
to.setUsername(from.getUsername());
to.setModel(from.getModel());
to.setSupportedProvisioningType(from.getSupportedProvisioningType());
to.setSupportedAsynchronousActions(from.getSupportedAsynchronousActions());
to.setMaxResources(from.getMaxResources());
to.setRemotelyConnectedTo(from.getRemotelyConnectedTo());
to.setSupportedReplicationTypes(from.getSupportedReplicationTypes());
to.setAveragePortMetrics(from.getAveragePortMetrics());
to.setArrayAffinityJobStatus(from.getArrayAffinityStatus());
to.setLastArrayAffinityStatusMessage(from.getLastArrayAffinityStatusMessage());
to.setLastArrayAffinityRunTime(from.getLastArrayAffinityRunTime());
to.setNextArrayAffinityRunTime(from.getNextArrayAffinityRunTime());
to.setSuccessArrayAffinityTime(from.getSuccessArrayAffinityTime());
return to;
}
Aggregations