Search in sources :

Example 1 with GoToMeeting

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();
        }
    }
}
Also used : GoToMeeting(org.olat.modules.gotomeeting.GoToMeeting) Date(java.util.Date)

Example 2 with GoToMeeting

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);
}
Also used : GoToMeeting(org.olat.modules.gotomeeting.GoToMeeting) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)

Example 3 with GoToMeeting

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);
}
Also used : GoToMeeting(org.olat.modules.gotomeeting.GoToMeeting) ArrayList(java.util.ArrayList) Date(java.util.Date)

Example 4 with GoToMeeting

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;
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) HttpPost(org.apache.http.client.methods.HttpPost) StringEntity(org.apache.http.entity.StringEntity) GoToMeeting(org.olat.modules.gotomeeting.GoToMeeting) JSONObject(org.json.JSONObject) HttpResponse(org.apache.http.HttpResponse) IOException(java.io.IOException)

Example 5 with GoToMeeting

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);
}
Also used : GoToMeeting(org.olat.modules.gotomeeting.GoToMeeting)

Aggregations

GoToMeeting (org.olat.modules.gotomeeting.GoToMeeting)34 Date (java.util.Date)20 GoToOrganizer (org.olat.modules.gotomeeting.GoToOrganizer)18 Test (org.junit.Test)16 RepositoryEntry (org.olat.repository.RepositoryEntry)10 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)6 Identity (org.olat.core.id.Identity)4 GoToRegistrant (org.olat.modules.gotomeeting.GoToRegistrant)4 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Calendar (java.util.Calendar)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 Response (javax.ws.rs.core.Response)2 HttpResponse (org.apache.http.HttpResponse)2 HttpPost (org.apache.http.client.methods.HttpPost)2 StringEntity (org.apache.http.entity.StringEntity)2 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)2 JSONObject (org.json.JSONObject)2