Search in sources :

Example 36 with ViteroBooking

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

the class ViteroManager method slayZombies.

public void slayZombies() {
    List<Property> properties = propertyManager.listProperties(null, null, null, VMS_CATEGORY_ZOMBIE, null);
    for (Property property : properties) {
        try {
            String bookingStr = property.getTextValue();
            ViteroBooking booking = deserializeViteroBooking(bookingStr);
            deleteBooking(booking);
        } catch (VmsNotAvailableException e) {
            // try later
            log.debug("Cannot clean-up vitero room, vms not available");
        } catch (Exception e) {
            log.error("", e);
        }
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) Property(org.olat.properties.Property) ConnectException(java.net.ConnectException) WebServiceException(javax.xml.ws.WebServiceException) ConnectTimeoutException(org.apache.commons.httpclient.ConnectTimeoutException) ParseException(java.text.ParseException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException)

Example 37 with ViteroBooking

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

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 38 with ViteroBooking

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

the class ViteroBookingsAdminController 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 ("delete".equals(e.getActionId())) {
                confirmDeleteVitero(ureq, booking);
            } else if ("infos".equals(e.getActionId())) {
                openInfoBox(ureq, booking);
            } else if ("resource".equals(e.getActionId())) {
                openResource(ureq, booking);
            }
        }
    } else if (source == dialogCtr) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            ViteroBooking booking = (ViteroBooking) dialogCtr.getUserObject();
            deleteBooking(booking);
        }
    } else if (source == cmc) {
        removeAsListenerAndDispose(infoController);
        removeAsListenerAndDispose(cmc);
    } else if (source == infoController) {
        cmc.deactivate();
        removeAsListenerAndDispose(infoController);
        removeAsListenerAndDispose(cmc);
        reloadModel();
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) TableEvent(org.olat.core.gui.components.table.TableEvent)

Example 39 with ViteroBooking

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

the class ViteroBookingsEditController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == cmc) {
        removeAsListenerAndDispose(bookingController);
        removeAsListenerAndDispose(cmc);
    } else if (source == bookingController) {
        if (Event.DONE_EVENT.equals(event)) {
            fireEvent(ureq, event);
        }
        cmc.deactivate();
        removeAsListenerAndDispose(bookingController);
        removeAsListenerAndDispose(cmc);
        reloadModel();
    } else if (source == dialogCtr) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            ViteroBooking booking = (ViteroBooking) dialogCtr.getUserObject();
            deleteBooking(booking);
        }
    } else if (source == warningGroupCtr) {
        removeAsListenerAndDispose(warningGroupCtr);
        warningGroupCtr = null;
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking)

Example 40 with ViteroBooking

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

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)

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