Search in sources :

Example 1 with TransferType

use of org.ovirt.engine.core.common.businessentities.storage.TransferType in project ovirt-engine by oVirt.

the class GetImageTicketVDSCommand method parseImageTicketInformationReturn.

private ImageTicketInformation parseImageTicketInformationReturn() {
    ImageTicketInformation ticketInfo = new ImageTicketInformation();
    Map<String, Object> ticketInfoMap = imageTicketInformationReturn.getImageTicketInformation();
    if (ticketInfoMap.containsKey(UUID)) {
        ticketInfo.setId(Guid.createGuidFromString((String) ticketInfoMap.get(UUID)));
    }
    if (ticketInfoMap.containsKey(SIZE)) {
        ticketInfo.setSize(((Number) ticketInfoMap.get(SIZE)).longValue());
    }
    if (ticketInfoMap.containsKey(URL)) {
        ticketInfo.setUrl((String) ticketInfoMap.get(URL));
    }
    if (ticketInfoMap.containsKey(TIMEOUT)) {
        ticketInfo.setTimeout((Integer) ticketInfoMap.get(TIMEOUT));
    }
    if (ticketInfoMap.containsKey(OPS)) {
        List<TransferType> transferTypes = Stream.of((Object[]) ticketInfoMap.get(OPS)).map(String.class::cast).map(TransferType::getTransferType).collect(Collectors.toList());
        ticketInfo.setTransferTypes(transferTypes);
    }
    if (ticketInfoMap.containsKey(FILENAME)) {
        ticketInfo.setFileName((String) ticketInfoMap.get(FILENAME));
    }
    if (ticketInfoMap.containsKey(ACTIVE)) {
        ticketInfo.setActive((Boolean) ticketInfoMap.get(ACTIVE));
    }
    if (ticketInfoMap.containsKey(TRANSFERRED)) {
        ticketInfo.setTransferred(((Number) ticketInfoMap.get(TRANSFERRED)).longValue());
    }
    return ticketInfo;
}
Also used : ImageTicketInformation(org.ovirt.engine.core.common.businessentities.storage.ImageTicketInformation) TransferType(org.ovirt.engine.core.common.businessentities.storage.TransferType)

Aggregations

ImageTicketInformation (org.ovirt.engine.core.common.businessentities.storage.ImageTicketInformation)1 TransferType (org.ovirt.engine.core.common.businessentities.storage.TransferType)1