Search in sources :

Example 1 with GoToRecordingsG2T

use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project OpenOLAT by OpenOLAT.

the class GoToRecordingsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // add the table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.name.i18nHeaderKey(), RecordingsCols.name.ordinal(), true, RecordingsCols.name.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.start.i18nHeaderKey(), RecordingsCols.start.ordinal(), true, RecordingsCols.start.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.end.i18nHeaderKey(), RecordingsCols.end.ordinal(), true, RecordingsCols.end.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
    tableModel = new GoToRecordingsTableModel(columnsModel);
    GoToError error = new GoToError();
    List<GoToRecordingsG2T> recordings = meetingMgr.getRecordings(meeting, error);
    if (recordings == null) {
        recordings = new ArrayList<>(1);
    }
    tableModel.setObjects(recordings);
    tableEl = uifactory.addTableElement(getWindowControl(), "recordings", tableModel, getTranslator(), formLayout);
    tableEl.setEmtpyTableMessageKey("recordings.empty");
    tableEl.setCustomizeColumns(false);
}
Also used : GoToError(org.olat.modules.gotomeeting.model.GoToError) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) GoToRecordingsG2T(org.olat.modules.gotomeeting.model.GoToRecordingsG2T) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 2 with GoToRecordingsG2T

use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project OpenOLAT by OpenOLAT.

the class GoToRecordingsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            if ("select".equals(se.getCommand())) {
                GoToRecordingsG2T recording = tableModel.getObject(se.getIndex());
                doView(ureq, recording);
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) GoToRecordingsG2T(org.olat.modules.gotomeeting.model.GoToRecordingsG2T)

Example 3 with GoToRecordingsG2T

use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project OpenOLAT by OpenOLAT.

the class GoToMeetingManagerImpl method getRecordings.

@Override
public List<GoToRecordingsG2T> getRecordings(GoToMeeting meeting, GoToError error) {
    try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
        GoToOrganizer organizer = meeting.getOrganizer();
        String url = gotoTrainingUrl + "/trainings/" + meeting.getMeetingKey() + "/recordings";
        HttpGet get = new HttpGet(url);
        get.addHeader("Accept", "application/json");
        get.addHeader("Authorization", "OAuth oauth_token=" + organizer.getAccessToken());
        get.addHeader("Content-type", "application/json");
        HttpResponse response = httpClient.execute(get);
        int status = response.getStatusLine().getStatusCode();
        if (status == 200) {
            // deleted
            String content = EntityUtils.toString(response.getEntity());
            List<GoToRecordingsG2T> recordings = GoToJsonUtil.parseRecordings(content);
            return recordings;
        } else {
            logGoToError("getRecordings", response, error);
            return null;
        }
    } catch (Exception e) {
        log.error("", e);
        return null;
    }
}
Also used : GoToOrganizer(org.olat.modules.gotomeeting.GoToOrganizer) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) HttpGet(org.apache.http.client.methods.HttpGet) HttpResponse(org.apache.http.HttpResponse) GoToRecordingsG2T(org.olat.modules.gotomeeting.model.GoToRecordingsG2T) IOException(java.io.IOException)

Example 4 with GoToRecordingsG2T

use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project openolat by klemens.

the class GoToRecordingsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // add the table
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.name.i18nHeaderKey(), RecordingsCols.name.ordinal(), true, RecordingsCols.name.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.start.i18nHeaderKey(), RecordingsCols.start.ordinal(), true, RecordingsCols.start.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.end.i18nHeaderKey(), RecordingsCols.end.ordinal(), true, RecordingsCols.end.name()));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
    tableModel = new GoToRecordingsTableModel(columnsModel);
    GoToError error = new GoToError();
    List<GoToRecordingsG2T> recordings = meetingMgr.getRecordings(meeting, error);
    if (recordings == null) {
        recordings = new ArrayList<>(1);
    }
    tableModel.setObjects(recordings);
    tableEl = uifactory.addTableElement(getWindowControl(), "recordings", tableModel, getTranslator(), formLayout);
    tableEl.setEmtpyTableMessageKey("recordings.empty");
    tableEl.setCustomizeColumns(false);
}
Also used : GoToError(org.olat.modules.gotomeeting.model.GoToError) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) GoToRecordingsG2T(org.olat.modules.gotomeeting.model.GoToRecordingsG2T) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 5 with GoToRecordingsG2T

use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project openolat by klemens.

the class GoToJsonUtil method parseRecordings.

/*
{
  "recordingList": [
    {
      "recordingId": 0,
      "name": "string",
      "description": "string",
      "registrationUrl": "string",
      "downloadUrl": "string",
      "startDate": "2016-03-31T14:00:00Z",
      "endDate": "2016-03-31T15:00:00Z"
    }
  ],
  "trainingKey": 0
}
*/
protected static final List<GoToRecordingsG2T> parseRecordings(String content) {
    try {
        List<GoToRecordingsG2T> recordings = new ArrayList<>();
        JSONObject jsonObj = new JSONObject(content);
        JSONArray jsonArr = jsonObj.getJSONArray("recordingList");
        for (int i = jsonArr.length(); i-- > 0; ) {
            JSONObject recordingJson = jsonArr.getJSONObject(i);
            GoToRecordingsG2T recording = new GoToRecordingsG2T();
            recording.setRecordingId(recordingJson.optString("recordingId", null));
            recording.setName(recordingJson.optString("name", null));
            recording.setDescription(recordingJson.optString("description", null));
            recording.setRegistrationUrl(recordingJson.optString("registrationUrl", null));
            recording.setDownloadUrl(recordingJson.optString("downloadUrl", null));
            String startDate = recordingJson.optString("startDate", null);
            Date start = parseRecordingDateTime(startDate);
            recording.setStartDate(start);
            String endDate = recordingJson.optString("endDate", null);
            Date end = parseRecordingDateTime(endDate);
            recording.setEndDate(end);
            recordings.add(recording);
        }
        return recordings;
    } catch (Exception e) {
        log.error("", e);
        return null;
    }
}
Also used : JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) JSONArray(org.json.JSONArray) GoToRecordingsG2T(org.olat.modules.gotomeeting.model.GoToRecordingsG2T) Date(java.util.Date) ParseException(java.text.ParseException)

Aggregations

GoToRecordingsG2T (org.olat.modules.gotomeeting.model.GoToRecordingsG2T)8 IOException (java.io.IOException)2 ParseException (java.text.ParseException)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 HttpResponse (org.apache.http.HttpResponse)2 HttpGet (org.apache.http.client.methods.HttpGet)2 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)2 JSONArray (org.json.JSONArray)2 JSONObject (org.json.JSONObject)2 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)2 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)2 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)2 GoToOrganizer (org.olat.modules.gotomeeting.GoToOrganizer)2 GoToError (org.olat.modules.gotomeeting.model.GoToError)2