Search in sources :

Example 1 with ImageTransfer

use of org.ovirt.engine.api.model.ImageTransfer in project ovirt-engine by oVirt.

the class ImageTransferMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.storage.ImageTransfer.class, to = ImageTransfer.class)
public static ImageTransfer map(org.ovirt.engine.core.common.businessentities.storage.ImageTransfer entity, ImageTransfer template) {
    ImageTransfer model = template != null ? template : new ImageTransfer();
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    if (entity.getVdsId() != null) {
        model.setHost(new Host());
        model.getHost().setId(entity.getVdsId().toString());
    }
    if (entity.getDiskId() != null) {
        model.setImage(new Image());
        model.getImage().setId(entity.getDiskId().toString());
    }
    if (entity.getProxyUri() != null && entity.getImagedTicketId() != null) {
        model.setProxyUrl(entity.getProxyURLForTransfer());
    }
    if (entity.getDaemonUri() != null && entity.getImagedTicketId() != null) {
        model.setTransferUrl(entity.getDaemonURLForTransfer());
    }
    if (entity.getSignedTicket() != null) {
        model.setSignedTicket(entity.getSignedTicket());
    }
    if (entity.getPhase() != null) {
        model.setPhase(mapPhase(entity.getPhase()));
    }
    if (entity.getActive() != null) {
        model.setActive(entity.getActive());
    }
    if (entity.getType() != null) {
        model.setDirection(mapDirection(entity.getType()));
    }
    if (entity.getBytesSent() != null) {
        model.setTransferred(entity.getBytesSent());
    }
    return model;
}
Also used : ImageTransfer(org.ovirt.engine.api.model.ImageTransfer) Host(org.ovirt.engine.api.model.Host) Image(org.ovirt.engine.api.model.Image)

Aggregations

Host (org.ovirt.engine.api.model.Host)1 Image (org.ovirt.engine.api.model.Image)1 ImageTransfer (org.ovirt.engine.api.model.ImageTransfer)1