Search in sources :

Example 26 with ViteroBooking

use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.

the class ViteroBookingsEditController method reloadModel.

protected void reloadModel() {
    try {
        bookingDisplays.clear();
        List<ViteroBooking> bookings = viteroManager.getBookings(group, ores, subIdentifier);
        int i = 0;
        for (ViteroBooking booking : bookings) {
            BookingDisplay display = new BookingDisplay(booking);
            if (!readOnly) {
                display.setDeleteButton(uifactory.addFormLink("delete_" + i++, "delete", "delete", flc, Link.BUTTON));
                display.setEditButton(uifactory.addFormLink("edit_" + i++, "edit", "edit", flc, Link.BUTTON));
            }
            display.setUsersButton(uifactory.addFormLink("users_" + i++, "users", "users", flc, Link.BUTTON));
            display.setGroupButton(uifactory.addFormLink("group_" + i++, "group.open", "group.open", flc, Link.BUTTON));
            bookingDisplays.add(display);
        }
        flc.contextPut("bookingDisplays", bookingDisplays);
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException)

Example 27 with ViteroBooking

use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.

the class ViteroBookingsEditController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == newButton) {
        newBooking(ureq);
    } else if (source == occupiedRoomsLink) {
        occupiedRooms(ureq);
    } else if (source instanceof FormLink) {
        for (BookingDisplay display : bookingDisplays) {
            if (display.getDeleteButton() == source) {
                confirmDeleteBooking(ureq, display);
                break;
            } else if (display.getEditButton() == source) {
                ViteroBooking viteroBooking = display.getMeeting();
                editBooking(ureq, viteroBooking);
                break;
            } else if (display.getUsersButton() == source) {
                ViteroBooking viteroBooking = display.getMeeting();
                usersBooking(ureq, viteroBooking);
                break;
            } else if (display.getGroupButton() == source) {
                ViteroBooking viteroBooking = display.getMeeting();
                openGroup(ureq, viteroBooking);
                break;
            }
        }
        reloadModel();
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 28 with ViteroBooking

use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.

the class ViteroBookingEditController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    String name = groupName.getValue();
    booking.setGroupName(name);
    Date begin = beginChooser.getDate();
    booking.setStart(begin);
    int beginBuffer = 0;
    if (beginBufferEl.isOneSelected()) {
        beginBuffer = Integer.parseInt(beginBufferEl.getSelectedKey());
    }
    booking.setStartBuffer(beginBuffer);
    Date end = endChooser.getDate();
    booking.setEnd(end);
    int endBuffer = 0;
    if (endBufferEl.isOneSelected()) {
        endBuffer = Integer.parseInt(endBufferEl.getSelectedKey());
    }
    booking.setEndBuffer(endBuffer);
    int roomSize = -1;
    if (roomSizeEl.isOneSelected()) {
        roomSize = Integer.parseInt(roomSizeEl.getSelectedKey());
    }
    booking.setRoomSize(roomSize);
    boolean auto = autoSignIn.isMultiselect() && autoSignIn.isSelected(0);
    booking.setAutoSignIn(auto);
    try {
        if (booking.getBookingId() >= 0) {
            ViteroBooking updatedBooking = viteroManager.updateBooking(group, ores, subIdentifier, booking);
            if (updatedBooking != null) {
                showInfo("booking.ok");
                fireEvent(ureq, Event.DONE_EVENT);
            } else {
                showError("error.unkown");
            }
        } else {
            ViteroStatus status = viteroManager.createBooking(group, ores, subIdentifier, booking);
            if (status.isOk()) {
                showInfo("booking.ok");
                fireEvent(ureq, Event.DONE_EVENT);
            } else {
                showError(status.getError().i18nKey());
            }
        }
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException) ViteroStatus(org.olat.modules.vitero.model.ViteroStatus) Date(java.util.Date)

Example 29 with ViteroBooking

use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.

the class ViteroBookingsController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) {
        if (event instanceof TableEvent) {
            TableEvent e = (TableEvent) event;
            int row = e.getRowId();
            ViteroBooking booking = (ViteroBooking) tableCtr.getTableDataModel().getObject(row);
            if ("start".equals(e.getActionId())) {
                openVitero(ureq, booking);
            } else if ("signin".equals(e.getActionId())) {
                signInVitero(ureq, booking);
            } else if ("signout".equals(e.getActionId())) {
                signOutVitero(ureq, booking);
            } else if ("opengroup".equals(e.getActionId())) {
                openGroup(ureq, booking);
            }
        }
    } else if (source == cmc) {
        removeAsListenerAndDispose(cmc);
        viteroGroupVC = null;
        cmc = null;
    }
    super.event(ureq, source, event);
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) TableEvent(org.olat.core.gui.components.table.TableEvent)

Example 30 with ViteroBooking

use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.

the class ViteroBookingWebService method getRooms.

/**
 * returns the list of booking of the resource.
 *
 * @response.representation.200.qname {http://www.example.com}viteroBookingVO
 * @response.representation.200.mediaType application/xml, application/json
 * @response.representation.200.doc This is the list of all bookings of a resource
 * @response.representation.200.example {@link org.olat.modules.vitero.restapi.Examples#SAMPLE_ViteroBookingVO}
 * @return The list of vitero booking
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getRooms() {
    try {
        List<ViteroBooking> bookings = viteroManager.getBookings(null, ores, subIdentifier);
        ViteroBookingVO[] bookingVos = new ViteroBookingVO[bookings.size()];
        int count = 0;
        for (ViteroBooking booking : bookings) {
            bookingVos[count++] = new ViteroBookingVO(booking);
        }
        return Response.ok(bookingVos).build();
    } catch (VmsNotAvailableException e) {
        log.error("", e);
        return handleNotAvailableException();
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ViteroBooking (org.olat.modules.vitero.model.ViteroBooking)44 VmsNotAvailableException (org.olat.modules.vitero.manager.VmsNotAvailableException)16 ViteroStatus (org.olat.modules.vitero.model.ViteroStatus)8 Property (org.olat.properties.Property)8 Booking_Type (de.vitero.schema.booking.Booking_Type)6 Bookingtype (de.vitero.schema.booking.Bookingtype)6 ConnectException (java.net.ConnectException)6 ArrayList (java.util.ArrayList)6 Produces (javax.ws.rs.Produces)6 WebServiceException (javax.xml.ws.WebServiceException)6 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)6 Booking (de.vitero.schema.booking.Booking)4 Date (java.util.Date)4 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 SearchIdentityParams (org.olat.basesecurity.SearchIdentityParams)4 TableEvent (org.olat.core.gui.components.table.TableEvent)4 Identity (org.olat.core.id.Identity)4 ErrorCode (org.olat.modules.vitero.model.ErrorCode)4 GroupRole (org.olat.modules.vitero.model.GroupRole)4