Search in sources :

Example 6 with Booking_Type

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

the class ViteroManager method getBookingById.

public ViteroBooking getBookingById(BusinessGroup group, OLATResourceable ores, String subIdentifier, int bookingId) throws VmsNotAvailableException {
    ViteroBooking booking = null;
    List<Property> properties = propertyManager.listProperties(null, group, ores, VMS_CATEGORY, Integer.toString(bookingId));
    if (properties.size() > 0) {
        Property property = properties.get(0);
        String propIdentifier = property.getStringValue();
        if ((propIdentifier == null || subIdentifier == null) || (subIdentifier != null && (propIdentifier == null || subIdentifier.equals(propIdentifier)))) {
            String bookingStr = property.getTextValue();
            booking = deserializeViteroBooking(bookingStr);
            Bookingtype bookingType = getVmsBookingById(booking.getBookingId());
            if (bookingType != null) {
                Booking_Type vmsBooking = bookingType.getBooking();
                booking.setProperty(property);
                update(booking, vmsBooking);
            }
        }
    }
    return booking;
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) Booking_Type(de.vitero.schema.booking.Booking_Type) Property(org.olat.properties.Property) Bookingtype(de.vitero.schema.booking.Bookingtype)

Example 7 with Booking_Type

use of de.vitero.schema.booking.Booking_Type 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)

Example 8 with Booking_Type

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

the class ViteroManager method getBookingInFutures.

public List<ViteroBooking> getBookingInFutures(Identity identity) throws VmsNotAvailableException {
    GetUserInfo userInfo = getVmsUserId(identity, false);
    int userId = userInfo.getUserId();
    if (userId > 0) {
        List<Booking_Type> bookings = getBookingInFutureByUserId(userId);
        return convert(bookings);
    }
    return Collections.emptyList();
}
Also used : GetUserInfo(org.olat.modules.vitero.model.GetUserInfo) Booking_Type(de.vitero.schema.booking.Booking_Type)

Example 9 with Booking_Type

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

the class ViteroManager method getBookings.

/**
 * Return the
 * @param group The group (optional)
 * @param ores The OLAT resourceable (of the course) (optional)
 * @return
 */
public List<ViteroBooking> getBookings(BusinessGroup group, OLATResourceable ores, String subIdentifier) throws VmsNotAvailableException {
    List<Property> properties = propertyManager.listProperties(null, group, ores, VMS_CATEGORY, null);
    List<ViteroBooking> bookings = new ArrayList<ViteroBooking>();
    for (Property property : properties) {
        String propIdentifier = property.getStringValue();
        if ((propIdentifier == null || subIdentifier == null) || (subIdentifier != null && (propIdentifier == null || subIdentifier.equals(propIdentifier)))) {
            String bookingStr = property.getTextValue();
            ViteroBooking booking = deserializeViteroBooking(bookingStr);
            Bookingtype bookingType = getVmsBookingById(booking.getBookingId());
            if (bookingType != null) {
                Booking_Type vmsBooking = bookingType.getBooking();
                booking.setProperty(property);
                update(booking, vmsBooking);
                bookings.add(booking);
            }
        }
    }
    return bookings;
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) Booking_Type(de.vitero.schema.booking.Booking_Type) ArrayList(java.util.ArrayList) Property(org.olat.properties.Property) Bookingtype(de.vitero.schema.booking.Bookingtype)

Example 10 with Booking_Type

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

the class ViteroManager method updateBooking.

/**
 * There is not update on vms. We can only update some OLAT specific options.
 * @param group
 * @param ores
 * @param vBooking
 * @return
 * @throws VmsNotAvailableException
 */
public ViteroBooking updateBooking(BusinessGroup group, OLATResourceable ores, String subIdentifier, ViteroBooking vBooking) throws VmsNotAvailableException {
    Bookingtype bookingType = getVmsBookingById(vBooking.getBookingId());
    if (bookingType == null) {
        log.info("Booking doesn't exist: " + vBooking.getBookingId());
        return null;
    }
    Booking_Type booking = bookingType.getBooking();
    // set the vms values
    update(vBooking, booking);
    // update the property
    updateProperty(group, ores, subIdentifier, vBooking);
    return vBooking;
}
Also used : Booking_Type(de.vitero.schema.booking.Booking_Type) Bookingtype(de.vitero.schema.booking.Bookingtype)

Aggregations

Booking_Type (de.vitero.schema.booking.Booking_Type)10 Bookingtype (de.vitero.schema.booking.Bookingtype)6 ViteroBooking (org.olat.modules.vitero.model.ViteroBooking)6 Property (org.olat.properties.Property)4 Booking (de.vitero.schema.booking.Booking)2 Bookinglist (de.vitero.schema.booking.Bookinglist)2 GetBookingListByDateRequest (de.vitero.schema.booking.GetBookingListByDateRequest)2 ConnectException (java.net.ConnectException)2 ArrayList (java.util.ArrayList)2 WebServiceException (javax.xml.ws.WebServiceException)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 ErrorCode (org.olat.modules.vitero.model.ErrorCode)2 GetUserInfo (org.olat.modules.vitero.model.GetUserInfo)2