Search in sources :

Example 6 with ComputeImageRestRep

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

ComputeImageRestRep (com.emc.storageos.model.compute.ComputeImageRestRep)6 ArrayList (java.util.ArrayList)3 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 Asset (com.emc.sa.asset.annotation.Asset)1 ComputeImageServer (com.emc.storageos.db.client.model.ComputeImageServer)1 FlashException (controllers.util.FlashException)1