Search in sources :

Example 21 with RestLinkRep

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

the class SystemsMapper method mapStorageProviderToSMISRep.

@Deprecated
public static SMISProviderRestRep mapStorageProviderToSMISRep(StorageProvider from) {
    if (from == null) {
        return null;
    }
    SMISProviderRestRep to = new SMISProviderRestRep();
    mapDataObjectFields(from, to);
    // of type base URI generation.
    try {
        to.setLink(new RestLinkRep("self", RestLinkFactory.simpleServiceLink(ResourceTypeEnum.SMIS_PROVIDER, from.getId())));
    } catch (URISyntaxException e) {
    // impossible to get exception here.
    }
    to.setIPAddress(from.getIPAddress());
    to.setPortNumber(from.getPortNumber());
    if (from.getStorageSystems() != null) {
        for (String system : from.getStorageSystems()) {
            to.getStorageSystems().add(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, URI.create(system)));
        }
    }
    to.setDescription(from.getDescription());
    to.setManufacturer(from.getManufacturer());
    to.setVersionString(from.getVersionString());
    to.setProviderID(from.getProviderID());
    to.setConnectionStatus(from.getConnectionStatus());
    to.setUserName(from.getUserName());
    to.setUseSSL(from.getUseSSL());
    to.setScanStatus(from.getScanStatus());
    to.setLastScanStatusMessage(from.getLastScanStatusMessage());
    to.setLastScanTime(from.getLastScanTime());
    to.setNextScanTime(from.getNextScanTime());
    to.setSuccessScanTime(from.getSuccessScanTime());
    to.setCompatibilityStatus(from.getCompatibilityStatus());
    to.setRegistrationStatus(from.getRegistrationStatus());
    return to;
}
Also used : SMISProviderRestRep(com.emc.storageos.model.smis.SMISProviderRestRep) RestLinkRep(com.emc.storageos.model.RestLinkRep) URISyntaxException(java.net.URISyntaxException)

Example 22 with RestLinkRep

use of com.emc.storageos.model.RestLinkRep 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

RestLinkRep (com.emc.storageos.model.RestLinkRep)22 URI (java.net.URI)9 SearchResultResourceRep (com.emc.storageos.model.search.SearchResultResourceRep)8 SearchResults (com.emc.storageos.model.search.SearchResults)6 ArrayList (java.util.ArrayList)6 NamedURI (com.emc.storageos.db.client.model.NamedURI)5 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)5 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)4 StringMap (com.emc.storageos.db.client.model.StringMap)4 URISyntaxException (java.net.URISyntaxException)4 List (java.util.List)4 BulkList (com.emc.storageos.api.service.impl.response.BulkList)3 ResRepFilter (com.emc.storageos.api.service.impl.response.ResRepFilter)3 SearchedResRepList (com.emc.storageos.api.service.impl.response.SearchedResRepList)2 TimestampedURIQueryResult (com.emc.storageos.db.client.TimestampedURIQueryResult)2 AggregatedConstraint (com.emc.storageos.db.client.constraint.AggregatedConstraint)2 Constraint (com.emc.storageos.db.client.constraint.Constraint)2 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)2 NamedElementQueryResultList (com.emc.storageos.db.client.constraint.NamedElementQueryResultList)2 StringSet (com.emc.storageos.db.client.model.StringSet)2