use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToMeetingPeekViewController method filterMyFutureTrainings.
private void filterMyFutureTrainings(List<GoToMeeting> trainings) {
// only the trainings in the future
Date now = new Date();
for (Iterator<GoToMeeting> it = trainings.iterator(); it.hasNext(); ) {
GoToMeeting training = it.next();
Date end = training.getEndDate();
if (end.before(now)) {
it.remove();
}
}
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToMeetingsController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (upcomingTableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
if ("select-upcoming".equals(se.getCommand())) {
GoToMeeting meeting = upcomingTableModel.getObject(se.getIndex());
fireEvent(ureq, new SelectGoToMeetingEvent(meeting));
}
}
} else if (pastTableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
if ("select-past".equals(se.getCommand())) {
GoToMeeting meeting = pastTableModel.getObject(se.getIndex());
fireEvent(ureq, new SelectGoToMeetingEvent(meeting));
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToMeetingsController method updateModel.
protected void updateModel() {
List<GoToMeeting> meetings = meetingMgr.getMeetings(GoToType.training, entry, subIdent, businessGroup);
List<GoToMeeting> upcomingMeetings = new ArrayList<>();
List<GoToMeeting> pastMeetings = new ArrayList<>();
Date now = new Date();
for (GoToMeeting meeting : meetings) {
Date endDate = meeting.getEndDate();
if (now.after(endDate)) {
pastMeetings.add(meeting);
} else {
upcomingMeetings.add(meeting);
}
}
upcomingTableModel.setObjects(upcomingMeetings);
upcomingTableEl.reloadData();
upcomingTableEl.reset();
pastTableModel.setObjects(pastMeetings);
pastTableEl.reloadData();
pastTableEl.reset();
pastTableEl.setVisible(pastMeetings.size() > 0);
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToMeetingManagerImpl method scheduleTraining.
@Override
public GoToMeeting scheduleTraining(GoToOrganizer organizer, String name, String externalId, String description, Date start, Date end, RepositoryEntry resourceOwner, String subIdentifier, BusinessGroup businessGroup, GoToError error) {
// GoToMeeting scheduledMeeting = meetingDao.createTraining(name, externalId, description, UUID.randomUUID().toString(), start, end, organizer, resourceOwner, subIdentifier, businessGroup);
GoToMeeting scheduledMeeting = null;
try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
String url = gotoTrainingUrl + "/organizers/" + organizer.getOrganizerKey() + "/trainings";
HttpPost post = new HttpPost(url);
post.addHeader("Accept", "application/json");
post.addHeader("Authorization", "OAuth oauth_token=" + organizer.getAccessToken());
post.addHeader("Content-type", "application/json");
String timeZoneId = goToMeetingModule.getGoToTimeZoneId();
JSONObject trainingJson = GoToJsonUtil.training(Long.parseLong(organizer.getOrganizerKey()), name, description, timeZoneId, start, end);
String objectStr = trainingJson.toString();
post.setEntity(new StringEntity(objectStr, ContentType.APPLICATION_JSON));
HttpResponse response = httpClient.execute(post);
int status = response.getStatusLine().getStatusCode();
if (status == 201) {
// created
String trainingKey = EntityUtils.toString(response.getEntity());
trainingKey = trainingKey.replace("\"", "");
scheduledMeeting = meetingDao.createTraining(name, externalId, description, trainingKey, start, end, organizer, resourceOwner, subIdentifier, businessGroup);
dbInstance.commit();
} else {
logGoToError("scheduleTraining", response, error);
}
} catch (Exception e) {
log.error("", e);
}
return scheduledMeeting;
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToMeetingsAdminController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (confirmDelete == source) {
if (DialogBoxUIFactory.isYesEvent(event)) {
GoToMeeting meeting = (GoToMeeting) confirmDelete.getUserObject();
doDelete(meeting);
}
cleanUp();
} else if (cmc == source) {
cleanUp();
}
super.event(ureq, source, event);
}
Aggregations