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;
}
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);
}
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");
}
}
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");
}
}
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();
}
Aggregations