Search in sources :

Example 26 with VmsNotAvailableException

use of org.olat.modules.vitero.manager.VmsNotAvailableException 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)

Example 27 with VmsNotAvailableException

use of org.olat.modules.vitero.manager.VmsNotAvailableException 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 28 with VmsNotAvailableException

use of org.olat.modules.vitero.manager.VmsNotAvailableException in project openolat by klemens.

the class ViteroBookingsController method openVitero.

protected void openVitero(UserRequest ureq, ViteroBooking booking) {
    try {
        String url = viteroManager.getURLToBooking(ureq.getIdentity(), booking);
        RedirectMediaResource redirect = new RedirectMediaResource(url);
        ureq.getDispatchResult().setResultingMediaResource(redirect);
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource)

Example 29 with VmsNotAvailableException

use of org.olat.modules.vitero.manager.VmsNotAvailableException in project openolat by klemens.

the class ViteroBookingsController method signInVitero.

protected void signInVitero(UserRequest ureq, ViteroBooking booking) {
    try {
        ViteroStatus status = viteroManager.addToRoom(booking, ureq.getIdentity(), null);
        if (status.isOk()) {
            showInfo("signin.ok");
        } else {
            showError("signin.nok");
        }
        loadModel();
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException) ViteroStatus(org.olat.modules.vitero.model.ViteroStatus)

Example 30 with VmsNotAvailableException

use of org.olat.modules.vitero.manager.VmsNotAvailableException in project openolat by klemens.

the class ViteroBookingsController method openGroup.

protected void openGroup(UserRequest ureq, ViteroBooking booking) {
    try {
        String url = viteroManager.getURLToGroup(ureq.getIdentity(), booking);
        viteroGroupVC = createVelocityContainer("opengroup");
        viteroGroupVC.contextPut("groupUrl", url);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), viteroGroupVC);
        listenTo(cmc);
        cmc.activate();
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException)

Aggregations

VmsNotAvailableException (org.olat.modules.vitero.manager.VmsNotAvailableException)36 ViteroBooking (org.olat.modules.vitero.model.ViteroBooking)16 ViteroStatus (org.olat.modules.vitero.model.ViteroStatus)12 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 Produces (javax.ws.rs.Produces)6 Identity (org.olat.core.id.Identity)6 GroupRole (org.olat.modules.vitero.model.GroupRole)6 ViteroGroupRoles (org.olat.modules.vitero.model.ViteroGroupRoles)6 ArrayList (java.util.ArrayList)4 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 SearchIdentityParams (org.olat.basesecurity.SearchIdentityParams)4 Date (java.util.Date)2 Consumes (javax.ws.rs.Consumes)2 POST (javax.ws.rs.POST)2 Response (javax.ws.rs.core.Response)2 TableDataModel (org.olat.core.gui.components.table.TableDataModel)2 RedirectMediaResource (org.olat.core.gui.media.RedirectMediaResource)2 CheckUserInfo (org.olat.modules.vitero.model.CheckUserInfo)2 StartBookingComparator (org.olat.modules.vitero.model.StartBookingComparator)2