Search in sources :

Example 1 with UnManagedExportMaskRestRep

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

the class BlockMapper method map.

public static UnManagedExportMaskRestRep map(UnManagedExportMask from) {
    if (from == null) {
        return null;
    }
    UnManagedExportMaskRestRep to = new UnManagedExportMaskRestRep();
    mapDataObjectFields(from, to);
    to.setNativeId(from.getNativeId());
    to.setMaskName(from.getMaskName());
    to.setStorageSystem(toRelatedResource(ResourceTypeEnum.STORAGE_SYSTEM, from.getStorageSystemUri()));
    if ((from.getKnownInitiatorUris() != null) && (!from.getKnownInitiatorUris().isEmpty())) {
        List<RelatedResourceRep> reps = new ArrayList<RelatedResourceRep>();
        for (String uri : from.getKnownInitiatorUris()) {
            reps.add(toRelatedResource(ResourceTypeEnum.INITIATOR, URI.create(uri)));
        }
        to.setKnownInitiatorUris(reps);
    }
    if ((from.getKnownStoragePortUris() != null) && (!from.getKnownStoragePortUris().isEmpty())) {
        List<RelatedResourceRep> reps = new ArrayList<RelatedResourceRep>();
        for (String uri : from.getKnownStoragePortUris()) {
            reps.add(toRelatedResource(ResourceTypeEnum.STORAGE_PORT, URI.create(uri)));
        }
        to.setKnownStoragePortUris(reps);
    }
    if ((from.getKnownVolumeUris() != null) && (!from.getKnownVolumeUris().isEmpty())) {
        List<RelatedResourceRep> reps = new ArrayList<RelatedResourceRep>();
        for (String uri : from.getKnownVolumeUris()) {
            reps.add(toRelatedResource(ResourceTypeEnum.VOLUME, URI.create(uri)));
        }
        to.setKnownStorageVolumeUris(reps);
    }
    if ((from.getUnmanagedVolumeUris() != null) && (!from.getUnmanagedVolumeUris().isEmpty())) {
        List<RelatedResourceRep> reps = new ArrayList<RelatedResourceRep>();
        for (String uri : from.getUnmanagedVolumeUris()) {
            reps.add(toRelatedResource(ResourceTypeEnum.UNMANAGED_VOLUMES, URI.create(uri)));
        }
        to.setUnmanagedVolumeUris(reps);
    }
    to.setUnmanagedInitiatorNetworkIds(from.getUnmanagedInitiatorNetworkIds());
    to.setUnmanagedStoragePortNetworkIds(from.getUnmanagedStoragePortNetworkIds());
    return to;
}
Also used : RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep) ArrayList(java.util.ArrayList) UnManagedExportMaskRestRep(com.emc.storageos.model.block.UnManagedExportMaskRestRep)

Aggregations

RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)1 UnManagedExportMaskRestRep (com.emc.storageos.model.block.UnManagedExportMaskRestRep)1 ArrayList (java.util.ArrayList)1