Search in sources :

Example 1 with TeamsErrors

use of org.olat.modules.teams.model.TeamsErrors in project OpenOLAT by OpenOLAT.

the class TeamsConfigurationController method validateConnection.

private boolean validateConnection() {
    boolean allOk = true;
    TeamsErrors errors = new TeamsErrors();
    ConnectionInfos infos = teamsService.checkConnection(clientIdEl.getValue(), secretEl.getValue(), tenantEl.getValue(), producerIdEl.getValue(), errors);
    producerIdEl.clearError();
    if (infos != null) {
        if (StringHelper.containsNonWhitespace(producerIdEl.getValue()) && !StringHelper.containsNonWhitespace(infos.getProducerDisplayName())) {
            producerIdEl.setErrorKey("error.producerNotFound", null);
            allOk &= false;
        }
    }
    if (errors.hasErrors()) {
        clientIdEl.setErrorKey("error.connection", null);
    }
    return allOk;
}
Also used : TeamsErrors(org.olat.modules.teams.model.TeamsErrors) ConnectionInfos(org.olat.modules.teams.model.ConnectionInfos)

Example 2 with TeamsErrors

use of org.olat.modules.teams.model.TeamsErrors in project OpenOLAT by OpenOLAT.

the class TeamsConfigurationController method loadModel.

private void loadModel() {
    TeamsErrors errors = new TeamsErrors();
    ConnectionInfos infos = teamsService.checkConnection(errors);
    updateModel(infos);
}
Also used : TeamsErrors(org.olat.modules.teams.model.TeamsErrors) ConnectionInfos(org.olat.modules.teams.model.ConnectionInfos)

Example 3 with TeamsErrors

use of org.olat.modules.teams.model.TeamsErrors in project OpenOLAT by OpenOLAT.

the class TopicsRunCoachController method doJoinTeamsMeeting.

private void doJoinTeamsMeeting(Appointment appointment) {
    TeamsErrors errors = new TeamsErrors();
    TeamsMeeting meeting = appointmentsService.joinTeamsMeeting(appointment, getIdentity(), errors);
    if (meeting == null) {
        showWarning("warning.no.meeting");
        getWindowControl().getWindowBackOffice().sendCommandTo(CommandFactory.createNewWindowCancelRedirectTo());
        return;
    } else if (errors.hasErrors()) {
        getWindowControl().getWindowBackOffice().sendCommandTo(CommandFactory.createNewWindowCancelRedirectTo());
        getWindowControl().setError(TeamsUIHelper.formatErrors(getTranslator(), errors));
        return;
    }
    String joinUrl = meeting.getOnlineMeetingJoinUrl();
    if (StringHelper.containsNonWhitespace(joinUrl)) {
        TeamsMeetingEvent event = new TeamsMeetingEvent(meeting.getKey(), getIdentity().getKey());
        OLATResourceable meetingOres = OresHelper.createOLATResourceableInstance(TeamsMeeting.class.getSimpleName(), meeting.getKey());
        CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, meetingOres);
        getWindowControl().getWindowBackOffice().sendCommandTo(CommandFactory.createNewWindowRedirectTo(joinUrl));
    } else {
        getWindowControl().getWindowBackOffice().sendCommandTo(CommandFactory.createNewWindowCancelRedirectTo());
        showWarning("warning.no.access");
    }
}
Also used : TeamsMeeting(org.olat.modules.teams.TeamsMeeting) OLATResourceable(org.olat.core.id.OLATResourceable) TeamsErrors(org.olat.modules.teams.model.TeamsErrors) TeamsMeetingEvent(org.olat.modules.teams.ui.TeamsMeetingEvent)

Example 4 with TeamsErrors

use of org.olat.modules.teams.model.TeamsErrors in project OpenOLAT by OpenOLAT.

the class TopicsRunController method doJoinTeamsMeeting.

private void doJoinTeamsMeeting(Appointment appointment) {
    TeamsErrors errors = new TeamsErrors();
    TeamsMeeting meeting = appointmentsService.joinTeamsMeeting(appointment, getIdentity(), errors);
    if (meeting == null) {
        showWarning("warning.no.meeting");
        getWindowControl().getWindowBackOffice().sendCommandTo(CommandFactory.createNewWindowCancelRedirectTo());
        return;
    } else if (errors.hasErrors()) {
        getWindowControl().getWindowBackOffice().sendCommandTo(CommandFactory.createNewWindowCancelRedirectTo());
        getWindowControl().setError(TeamsUIHelper.formatErrors(getTranslator(), errors));
        return;
    }
    String joinUrl = meeting.getOnlineMeetingJoinUrl();
    if (StringHelper.containsNonWhitespace(joinUrl)) {
        TeamsMeetingEvent event = new TeamsMeetingEvent(meeting.getKey(), getIdentity().getKey());
        OLATResourceable meetingOres = OresHelper.createOLATResourceableInstance(TeamsMeeting.class.getSimpleName(), meeting.getKey());
        CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, meetingOres);
        getWindowControl().getWindowBackOffice().sendCommandTo(CommandFactory.createNewWindowRedirectTo(joinUrl));
    } else {
        getWindowControl().getWindowBackOffice().sendCommandTo(CommandFactory.createNewWindowCancelRedirectTo());
        showWarning("warning.no.access");
    }
}
Also used : TeamsMeeting(org.olat.modules.teams.TeamsMeeting) OLATResourceable(org.olat.core.id.OLATResourceable) TeamsErrors(org.olat.modules.teams.model.TeamsErrors) TeamsMeetingEvent(org.olat.modules.teams.ui.TeamsMeetingEvent)

Example 5 with TeamsErrors

use of org.olat.modules.teams.model.TeamsErrors in project OpenOLAT by OpenOLAT.

the class MicrosoftGraphDAOTest method createUpdateDeleteOnBehalf.

@Test
public void createUpdateDeleteOnBehalf() {
    Assume.assumeTrue(StringHelper.containsNonWhitespace(teamsModule.getApiKey()));
    Assume.assumeTrue(StringHelper.containsNonWhitespace(teamsModule.getProducerId()));
    // create an OpenOlat meeting
    RepositoryEntry entry = JunitTestHelper.createAndPersistRepositoryEntry();
    String name = "Real-Online-Meeting - 1";
    Identity creator = JunitTestHelper.createAndPersistIdentityAsRndUser("teams-1");
    Date start = DateUtils.addMinutes(new Date(), 5);
    Date end = DateUtils.addMinutes(start, 5);
    TeamsMeeting meeting = teamsMeetingDao.createMeeting(name, start, end, entry, null, null, creator);
    meeting.setAccessLevel(AccessLevel.EVERYONE.name());
    meeting.setAllowedPresenters(OnlineMeetingPresenters.EVERYONE.name());
    meeting.setLobbyBypassScope(LobbyBypassScope.EVERYONE.name());
    meeting = teamsMeetingDao.updateMeeting(meeting);
    dbInstance.commitAndCloseSession();
    // create the online meeting
    String userId = teamsModule.getProducerId();
    User user = new User();
    user.id = userId;
    TeamsErrors errors = new TeamsErrors();
    OnlineMeeting onlineMeeting = microsoftGraphDao.createMeeting(meeting, user, OnlineMeetingRole.PRESENTER, errors);
    Assert.assertNotNull(onlineMeeting);
    Assert.assertNotNull(onlineMeeting.id);
    Assert.assertNotNull(onlineMeeting.joinUrl);
    Assert.assertEquals(name, onlineMeeting.subject);
    // update the meeting
    String updateName = "Update-Online-Meeting - 1";
    meeting.setSubject(updateName);
    ((TeamsMeetingImpl) meeting).setOnlineMeetingId(onlineMeeting.id);
    ((TeamsMeetingImpl) meeting).setOnlineMeetingJoinUrl(onlineMeeting.joinUrl);
    meeting = teamsMeetingDao.updateMeeting(meeting);
    dbInstance.commitAndCloseSession();
}
Also used : User(com.microsoft.graph.models.User) TeamsMeeting(org.olat.modules.teams.TeamsMeeting) OnlineMeeting(com.microsoft.graph.models.OnlineMeeting) TeamsErrors(org.olat.modules.teams.model.TeamsErrors) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity) Date(java.util.Date) TeamsMeetingImpl(org.olat.modules.teams.model.TeamsMeetingImpl) Test(org.junit.Test)

Aggregations

TeamsErrors (org.olat.modules.teams.model.TeamsErrors)10 TeamsMeeting (org.olat.modules.teams.TeamsMeeting)4 ConnectionInfos (org.olat.modules.teams.model.ConnectionInfos)4 Identity (org.olat.core.id.Identity)3 Test (org.junit.Test)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 TeamsMeetingEvent (org.olat.modules.teams.ui.TeamsMeetingEvent)2 OnlineMeeting (com.microsoft.graph.models.OnlineMeeting)1 User (com.microsoft.graph.models.User)1 Date (java.util.Date)1 MediaResource (org.olat.core.gui.media.MediaResource)1 RedirectMediaResource (org.olat.core.gui.media.RedirectMediaResource)1 UserSession (org.olat.core.util.UserSession)1 InstantMessage (org.olat.instantMessaging.InstantMessage)1 BigBlueButtonAttendeeRoles (org.olat.modules.bigbluebutton.BigBlueButtonAttendeeRoles)1 BigBlueButtonErrors (org.olat.modules.bigbluebutton.model.BigBlueButtonErrors)1 TeamsError (org.olat.modules.teams.model.TeamsError)1 TeamsMeetingImpl (org.olat.modules.teams.model.TeamsMeetingImpl)1 RepositoryEntry (org.olat.repository.RepositoryEntry)1