Search in sources :

Example 1 with UpdateBookingRequest

use of de.vitero.schema.booking.UpdateBookingRequest in project OpenOLAT by OpenOLAT.

the class ViteroManager method updateVmsBooking.

public ViteroStatus updateVmsBooking(ViteroBooking vBooking) throws VmsNotAvailableException {
    try {
        UpdateBookingRequest updateRequest = new UpdateBookingRequest();
        updateRequest.setBookingid(vBooking.getBookingId());
        if (StringHelper.containsNonWhitespace(vBooking.getEventName())) {
            updateRequest.setEventname(vBooking.getEventName());
        }
        updateRequest.setEnd(format(vBooking.getEnd()));
        updateRequest.setEndbuffer(vBooking.getEndBuffer());
        updateRequest.setStart(format(vBooking.getStart()));
        updateRequest.setStartbuffer(vBooking.getStartBuffer());
        updateRequest.setTimezone(viteroModule.getTimeZoneId());
        getBookingWebService().updateBooking(updateRequest);
        return new ViteroStatus();
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case unsufficientRights:
            case bookingCollision:
            case bookingInPast:
            case noRoomsAvailable:
                return new ViteroStatus(code);
            case bookingDoesntExist:
            case bookingDoesntExistPrime:
                {
                    deleteGroup(vBooking);
                    deleteProperty(vBooking);
                    // ok, vms deleted, group deleted...
                    return new ViteroStatus(code);
                }
            default:
                {
                    logAxisError("Cannot update a booking.", f);
                }
        }
        return new ViteroStatus(ErrorCode.unkown);
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot update a booking.", e);
        return new ViteroStatus(ErrorCode.unkown);
    }
}
Also used : UpdateBookingRequest(de.vitero.schema.booking.UpdateBookingRequest) WebServiceException(javax.xml.ws.WebServiceException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) ViteroStatus(org.olat.modules.vitero.model.ViteroStatus) ConnectException(java.net.ConnectException)

Example 2 with UpdateBookingRequest

use of de.vitero.schema.booking.UpdateBookingRequest in project openolat by klemens.

the class ViteroManager method updateVmsBooking.

public ViteroStatus updateVmsBooking(ViteroBooking vBooking) throws VmsNotAvailableException {
    try {
        UpdateBookingRequest updateRequest = new UpdateBookingRequest();
        updateRequest.setBookingid(vBooking.getBookingId());
        if (StringHelper.containsNonWhitespace(vBooking.getEventName())) {
            updateRequest.setEventname(vBooking.getEventName());
        }
        updateRequest.setEnd(format(vBooking.getEnd()));
        updateRequest.setEndbuffer(vBooking.getEndBuffer());
        updateRequest.setStart(format(vBooking.getStart()));
        updateRequest.setStartbuffer(vBooking.getStartBuffer());
        updateRequest.setTimezone(viteroModule.getTimeZoneId());
        getBookingWebService().updateBooking(updateRequest);
        return new ViteroStatus();
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case unsufficientRights:
            case bookingCollision:
            case bookingInPast:
            case noRoomsAvailable:
                return new ViteroStatus(code);
            case bookingDoesntExist:
            case bookingDoesntExistPrime:
                {
                    deleteGroup(vBooking);
                    deleteProperty(vBooking);
                    // ok, vms deleted, group deleted...
                    return new ViteroStatus(code);
                }
            default:
                {
                    logAxisError("Cannot update a booking.", f);
                }
        }
        return new ViteroStatus(ErrorCode.unkown);
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot update a booking.", e);
        return new ViteroStatus(ErrorCode.unkown);
    }
}
Also used : UpdateBookingRequest(de.vitero.schema.booking.UpdateBookingRequest) WebServiceException(javax.xml.ws.WebServiceException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) ViteroStatus(org.olat.modules.vitero.model.ViteroStatus) ConnectException(java.net.ConnectException)

Aggregations

UpdateBookingRequest (de.vitero.schema.booking.UpdateBookingRequest)2 ConnectException (java.net.ConnectException)2 WebServiceException (javax.xml.ws.WebServiceException)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 ErrorCode (org.olat.modules.vitero.model.ErrorCode)2 ViteroStatus (org.olat.modules.vitero.model.ViteroStatus)2