Search in sources :

Example 1 with VmsNotAvailableException

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

the class ViteroBookingsEditController method newBooking.

protected void newBooking(UserRequest ureq) {
    try {
        ViteroBooking viteroBooking = viteroManager.createBooking(resourceName);
        editBooking(ureq, viteroBooking);
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException)

Example 2 with VmsNotAvailableException

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

the class ViteroBookingsEditController method openGroup.

protected void openGroup(UserRequest ureq, ViteroBooking booking) {
    try {
        if (viteroManager.isUserOf(booking, getIdentity())) {
            String url = viteroManager.getURLToGroup(ureq.getIdentity(), booking);
            if (url == null) {
                showError("error.sessionCodeNull");
            } else {
                viteroGroupVC = createVelocityContainer("opengroup");
                viteroGroupVC.contextPut("groupUrl", url);
                removeAsListenerAndDispose(cmc);
                cmc = new CloseableModalController(getWindowControl(), translate("close"), viteroGroupVC);
                listenTo(cmc);
                cmc.activate();
            }
        } else {
            String title = translate("booking.group");
            String text = translate("booking.group.warning");
            List<String> buttonLabels = Collections.singletonList(translate("ok"));
            warningGroupCtr = activateGenericDialog(ureq, title, text, buttonLabels, warningGroupCtr);
        }
    } 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)

Example 3 with VmsNotAvailableException

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

the class ViteroConfigurationController method checkUsers.

private void checkUsers() {
    try {
        CheckUserInfo infos = viteroManager.checkUsers();
        if (infos.getAuthenticationCreated() == 0 && infos.getAuthenticationDeleted() == 0) {
            showInfo("check.users.ok");
        } else {
            String[] args = new String[] { Integer.toString(infos.getAuthenticationCreated()), Integer.toString(infos.getAuthenticationDeleted()), Integer.toString(infos.getAuthenticationCreated() + infos.getAuthenticationDeleted()) };
            getWindowControl().setInfo(translate("check.users.nok", args));
        }
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : CheckUserInfo(org.olat.modules.vitero.model.CheckUserInfo) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException)

Example 4 with VmsNotAvailableException

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

the class ViteroUserToGroupController method signIn.

private void signIn(List<Identity> identities) {
    try {
        ResourceMembers members = ((UserToGroupDataModel) tableCtr.getTableDataModel()).getMembers();
        for (Identity identity : identities) {
            boolean upgrade = members.getCoaches().contains(identity) || members.getOwners().contains(identity);
            GroupRole role = upgrade ? GroupRole.teamleader : null;
            ViteroStatus status = viteroManager.addToRoom(booking, identity, role);
            if (status.isOk()) {
                showInfo("signin.ok");
            } else {
                showInfo("signin.nok");
                break;
            }
        }
        loadModel();
    } catch (VmsNotAvailableException e) {
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException) GroupRole(org.olat.modules.vitero.model.GroupRole) Identity(org.olat.core.id.Identity) ViteroStatus(org.olat.modules.vitero.model.ViteroStatus)

Example 5 with VmsNotAvailableException

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

the class ViteroBookingsController method loadModel.

protected void loadModel() {
    try {
        List<ViteroBooking> bookings = viteroManager.getBookings(group, ores, subIdentifier);
        List<ViteroBooking> myBookings = viteroManager.getBookingInFutures(getIdentity());
        FilterBookings.filterMyFutureBookings(bookings, myBookings);
        Collections.sort(bookings, new StartBookingComparator());
        TableDataModel<ViteroBooking> tableData = new ViteroBookingDataModel(bookings, myBookings);
        tableCtr.setTableDataModel(tableData);
    } catch (VmsNotAvailableException e) {
        TableDataModel<ViteroBooking> tableData = new ViteroBookingDataModel();
        tableCtr.setTableDataModel(tableData);
        showError(VmsNotAvailableException.I18N_KEY);
    }
}
Also used : ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) VmsNotAvailableException(org.olat.modules.vitero.manager.VmsNotAvailableException) StartBookingComparator(org.olat.modules.vitero.model.StartBookingComparator) TableDataModel(org.olat.core.gui.components.table.TableDataModel)

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