Search in sources :

Example 1 with Bookinglist

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

the class ViteroManager method getBookingInFutureByUserId.

protected List<Booking_Type> getBookingInFutureByUserId(int userId) throws VmsNotAvailableException {
    try {
        GetBookingListByUserAndCustomerInFutureRequest request = new GetBookingListByUserAndCustomerInFutureRequest();
        request.setUserid(userId);
        request.setCustomerid(viteroModule.getCustomerId());
        request.setTimezone(viteroModule.getTimeZoneId());
        Bookinglist bookingList = getBookingWebService().getBookingListByUserAndCustomerInFuture(request);
        return bookingList.getBooking();
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case userDoesntExist:
                log.error("The user does not exist!", f);
                break;
            case invalidAttribut:
                log.error("ids <= 0!", f);
                break;
            case invalidTimezone:
                log.error("Invalid time zone!", f);
                break;
            default:
                logAxisError("Cannot get booking in future for user: " + userId, f);
        }
        return null;
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot get booking in future for custom: " + userId, e);
        return null;
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) GetBookingListByUserAndCustomerInFutureRequest(de.vitero.schema.booking.GetBookingListByUserAndCustomerInFutureRequest) Bookinglist(de.vitero.schema.booking.Bookinglist) ConnectException(java.net.ConnectException)

Example 2 with Bookinglist

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

the class ViteroManager method getBookingByDate.

public List<ViteroBooking> getBookingByDate(Date start, Date end) throws VmsNotAvailableException {
    try {
        Booking bookingWs = getBookingWebService();
        GetBookingListByDateRequest dateRequest = new GetBookingListByDateRequest();
        dateRequest.setStart(format(start));
        dateRequest.setEnd(format(end));
        dateRequest.setTimezone(viteroModule.getTimeZoneId());
        dateRequest.setCustomerid(viteroModule.getCustomerId());
        Bookinglist bookingList = bookingWs.getBookingListByDate(dateRequest);
        List<Booking_Type> bookings = bookingList.getBooking();
        return convert(bookings);
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            default:
                logAxisError("Cannot get the list of bookings by date.", f);
        }
        return Collections.emptyList();
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        return Collections.emptyList();
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) GetBookingListByDateRequest(de.vitero.schema.booking.GetBookingListByDateRequest) Booking_Type(de.vitero.schema.booking.Booking_Type) Booking(de.vitero.schema.booking.Booking) ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) Bookinglist(de.vitero.schema.booking.Bookinglist) ConnectException(java.net.ConnectException)

Example 3 with Bookinglist

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

the class ViteroManager method getBookingInFutureByUserId.

protected List<Booking_Type> getBookingInFutureByUserId(int userId) throws VmsNotAvailableException {
    try {
        GetBookingListByUserAndCustomerInFutureRequest request = new GetBookingListByUserAndCustomerInFutureRequest();
        request.setUserid(userId);
        request.setCustomerid(viteroModule.getCustomerId());
        request.setTimezone(viteroModule.getTimeZoneId());
        Bookinglist bookingList = getBookingWebService().getBookingListByUserAndCustomerInFuture(request);
        return bookingList.getBooking();
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case userDoesntExist:
                log.error("The user does not exist!", f);
                break;
            case invalidAttribut:
                log.error("ids <= 0!", f);
                break;
            case invalidTimezone:
                log.error("Invalid time zone!", f);
                break;
            default:
                logAxisError("Cannot get booking in future for user: " + userId, f);
        }
        return null;
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot get booking in future for custom: " + userId, e);
        return null;
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) GetBookingListByUserAndCustomerInFutureRequest(de.vitero.schema.booking.GetBookingListByUserAndCustomerInFutureRequest) Bookinglist(de.vitero.schema.booking.Bookinglist) ConnectException(java.net.ConnectException)

Example 4 with Bookinglist

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

the class ViteroManager method getBookingByDate.

public List<ViteroBooking> getBookingByDate(Date start, Date end) throws VmsNotAvailableException {
    try {
        Booking bookingWs = getBookingWebService();
        GetBookingListByDateRequest dateRequest = new GetBookingListByDateRequest();
        dateRequest.setStart(format(start));
        dateRequest.setEnd(format(end));
        dateRequest.setTimezone(viteroModule.getTimeZoneId());
        dateRequest.setCustomerid(viteroModule.getCustomerId());
        Bookinglist bookingList = bookingWs.getBookingListByDate(dateRequest);
        List<Booking_Type> bookings = bookingList.getBooking();
        return convert(bookings);
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            default:
                logAxisError("Cannot get the list of bookings by date.", f);
        }
        return Collections.emptyList();
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        return Collections.emptyList();
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) GetBookingListByDateRequest(de.vitero.schema.booking.GetBookingListByDateRequest) Booking_Type(de.vitero.schema.booking.Booking_Type) Booking(de.vitero.schema.booking.Booking) ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) Bookinglist(de.vitero.schema.booking.Bookinglist) ConnectException(java.net.ConnectException)

Aggregations

Bookinglist (de.vitero.schema.booking.Bookinglist)4 ConnectException (java.net.ConnectException)4 WebServiceException (javax.xml.ws.WebServiceException)4 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)4 ErrorCode (org.olat.modules.vitero.model.ErrorCode)4 Booking (de.vitero.schema.booking.Booking)2 Booking_Type (de.vitero.schema.booking.Booking_Type)2 GetBookingListByDateRequest (de.vitero.schema.booking.GetBookingListByDateRequest)2 GetBookingListByUserAndCustomerInFutureRequest (de.vitero.schema.booking.GetBookingListByUserAndCustomerInFutureRequest)2 ViteroBooking (org.olat.modules.vitero.model.ViteroBooking)2