Search in sources :

Example 16 with VmsNotAvailableException

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

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 17 with VmsNotAvailableException

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

the class ViteroUserToGroupController method loadModel.

private void loadModel() {
    try {
        ViteroGroupRoles groupRoles = viteroManager.getGroupRoles(booking.getGroupId());
        ResourceMembers members = getIdentitiesInResource(groupRoles);
        tableCtr.setTableDataModel(new UserToGroupDataModel(members, groupRoles));
        int numOfFreePlaces = booking.getRoomSize() - groupRoles.size();
        mainVC.contextPut("freePlaces", new String[] { Integer.toString(numOfFreePlaces) });
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : ViteroGroupRoles(org.olat.modules.vitero.model.ViteroGroupRoles) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException)

Example 18 with VmsNotAvailableException

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

the class ViteroBookingsAdminController method openInfoBox.

protected void openInfoBox(UserRequest ureq, ViteroBooking booking) {
    removeAsListenerAndDispose(infoController);
    removeAsListenerAndDispose(cmc);
    try {
        ViteroGroup group = viteroManager.getGroup(booking.getGroupId());
        infoController = new ViteroAdminBookingInfosController(ureq, getWindowControl(), booking, group);
        listenTo(infoController);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), infoController.getInitialComponent(), true, translate("booking.raw.title"));
        listenTo(cmc);
        cmc.activate();
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : ViteroGroup(org.olat.modules.vitero.model.ViteroGroup) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException)

Example 19 with VmsNotAvailableException

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

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

the class ViteroBookingsEditController method occupiedRooms.

protected void occupiedRooms(UserRequest ureq) {
    removeAsListenerAndDispose(bookingController);
    try {
        roomsOverviewController = new ViteroRoomsOverviewController(ureq, getWindowControl());
        listenTo(roomsOverviewController);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), roomsOverviewController.getInitialComponent(), true, translate("roomsOverview"));
        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