use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project OpenOLAT by OpenOLAT.
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;
}
}
use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project openolat by klemens.
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);
}
use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project openolat by klemens.
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;
}
}
Aggregations