Search in sources :

Example 26 with ComputeImageServer

use of com.emc.storageos.db.client.model.ComputeImageServer in project coprhd-controller by CoprHD.

the class ComputeMapper method map.

public static ComputeImageRestRep map(ComputeImage from, List<ComputeImageServer> availableServers, List<ComputeImageServer> failedServers) {
    if (from == null) {
        return null;
    }
    ComputeImageRestRep to = new ComputeImageRestRep();
    mapDataObjectFields(from, to);
    to.setImageName(from.getImageName());
    to.setImageUrl(ImageServerControllerImpl.maskImageURLPassword(from.getImageUrl()));
    to.setImageType(from.getImageType());
    to.setComputeImageStatus(from.getComputeImageStatus());
    to.setLastImportStatusMessage(from.getLastImportStatusMessage());
    List<NamedRelatedResourceRep> availableServersList = new ArrayList<NamedRelatedResourceRep>();
    List<NamedRelatedResourceRep> failedServersList = new ArrayList<NamedRelatedResourceRep>();
    for (ComputeImageServer server : availableServers) {
        NamedRelatedResourceRep serverRep = new NamedRelatedResourceRep();
        serverRep.setId(server.getId());
        serverRep.setName(server.getLabel());
        availableServersList.add(serverRep);
    }
    for (ComputeImageServer server : failedServers) {
        NamedRelatedResourceRep serverRep = new NamedRelatedResourceRep();
        serverRep.setId(server.getId());
        serverRep.setName(server.getLabel());
        failedServersList.add(serverRep);
    }
    to.setAvailableImageServers(availableServersList);
    to.setFailedImageServers(failedServersList);
    return to;
}
Also used : ComputeImageRestRep(com.emc.storageos.model.compute.ComputeImageRestRep) ComputeImageServer(com.emc.storageos.db.client.model.ComputeImageServer) ArrayList(java.util.ArrayList) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

ComputeImageServer (com.emc.storageos.db.client.model.ComputeImageServer)26 URI (java.net.URI)13 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)9 ImageServerControllerException (com.emc.storageos.imageservercontroller.exceptions.ImageServerControllerException)9 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)9 UnsupportedEncodingException (java.io.UnsupportedEncodingException)9 MalformedURLException (java.net.MalformedURLException)9 ComputeImage (com.emc.storageos.db.client.model.ComputeImage)8 Produces (javax.ws.rs.Produces)6 SSHSession (com.emc.storageos.networkcontroller.SSHSession)5 ArrayList (java.util.ArrayList)5 ComputeImageJob (com.emc.storageos.db.client.model.ComputeImageJob)4 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 TaskCompleter (com.emc.storageos.volumecontroller.TaskCompleter)4 Workflow (com.emc.storageos.workflow.Workflow)4 Path (javax.ws.rs.Path)4 StringSet (com.emc.storageos.db.client.model.StringSet)3 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)3 Consumes (javax.ws.rs.Consumes)3 GET (javax.ws.rs.GET)3