Search in sources :

Example 1 with DeleteBookingResponse

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

the class ViteroManager method deleteBooking.

public boolean deleteBooking(ViteroBooking vBooking) throws VmsNotAvailableException {
    try {
        DeleteBookingRequest deleteRequest = new DeleteBookingRequest();
        deleteRequest.setBookingid(vBooking.getBookingId());
        DeleteBookingResponse response = getBookingWebService().deleteBooking(deleteRequest);
        BigInteger state = response.getDeletestate();
        deleteGroup(vBooking);
        deleteProperty(vBooking);
        return state != null;
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case bookingDoesntExist:
            case bookingDoesntExistPrime:
                {
                    deleteGroup(vBooking);
                    deleteProperty(vBooking);
                    // ok, vms deleted, group deleted...
                    return true;
                }
            default:
                {
                    logAxisError("Cannot delete a booking.", f);
                }
        }
        return false;
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot delete a booking.", e);
        return false;
    }
}
Also used : DeleteBookingRequest(de.vitero.schema.booking.DeleteBookingRequest) WebServiceException(javax.xml.ws.WebServiceException) BigInteger(java.math.BigInteger) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) DeleteBookingResponse(de.vitero.schema.booking.DeleteBookingResponse) ConnectException(java.net.ConnectException)

Example 2 with DeleteBookingResponse

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

the class ViteroManager method deleteBooking.

public boolean deleteBooking(ViteroBooking vBooking) throws VmsNotAvailableException {
    try {
        DeleteBookingRequest deleteRequest = new DeleteBookingRequest();
        deleteRequest.setBookingid(vBooking.getBookingId());
        DeleteBookingResponse response = getBookingWebService().deleteBooking(deleteRequest);
        BigInteger state = response.getDeletestate();
        deleteGroup(vBooking);
        deleteProperty(vBooking);
        return state != null;
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case bookingDoesntExist:
            case bookingDoesntExistPrime:
                {
                    deleteGroup(vBooking);
                    deleteProperty(vBooking);
                    // ok, vms deleted, group deleted...
                    return true;
                }
            default:
                {
                    logAxisError("Cannot delete a booking.", f);
                }
        }
        return false;
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot delete a booking.", e);
        return false;
    }
}
Also used : DeleteBookingRequest(de.vitero.schema.booking.DeleteBookingRequest) WebServiceException(javax.xml.ws.WebServiceException) BigInteger(java.math.BigInteger) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) DeleteBookingResponse(de.vitero.schema.booking.DeleteBookingResponse) ConnectException(java.net.ConnectException)

Aggregations

DeleteBookingRequest (de.vitero.schema.booking.DeleteBookingRequest)2 DeleteBookingResponse (de.vitero.schema.booking.DeleteBookingResponse)2 BigInteger (java.math.BigInteger)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