use of org.olat.modules.gotomeeting.GoToMeeting in project openolat by klemens.
the class GoToTrainingWebService method getTrainings.
/**
* returns the list of booking of the resource.
*
* @response.representation.200.qname {http://www.example.com}goToTrainingVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc This is the list of all training of a resource
* @response.representation.200.example {@link org.olat.modules.gotomeeting.restapi.Examples#SAMPLE_GoToTrainingVO}
* @return The list of trainings
*/
@GET
@Path("trainings")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getTrainings() {
try {
List<GoToMeeting> meetings = meetingManager.getMeetings(GoToType.training, entry, subIdentifier, null);
GoToTrainingVO[] bookingVos = new GoToTrainingVO[meetings.size()];
int count = 0;
for (GoToMeeting meeting : meetings) {
bookingVos[count++] = new GoToTrainingVO(meeting);
}
return Response.ok(bookingVos).build();
} catch (Exception e) {
log.error("", e);
return handleUnexpectedException();
}
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToRegistrantDAOTest method createRegistrant.
@Test
public void createRegistrant() {
String token = UUID.randomUUID().toString();
Identity trainee = JunitTestHelper.createAndPersistIdentityAsRndUser("trainee-2");
GoToOrganizer organizer = organizerDao.createOrganizer(null, token, token, token, null, null, null, null, 10l, null);
Assert.assertNotNull(organizer);
Date start = new Date();
Date end = new Date();
String trainingKey = Long.toString(CodeHelper.getForeverUniqueID());
GoToMeeting training = meetingDao.createTraining("New training", null, "Very interessant", trainingKey, start, end, organizer, null, null, null);
dbInstance.commit();
// create registrant
String registrantKey = Long.toString(CodeHelper.getForeverUniqueID());
String joinUrl = "http://openolat.com/join/" + registrantKey;
String confirmUrl = "http://openolat.com/confirm/" + registrantKey;
GoToRegistrant registrant = registrantDao.createRegistrant(training, trainee, registrantKey, joinUrl, confirmUrl);
Assert.assertNotNull(registrant);
dbInstance.commit();
// load
GoToRegistrant reloadRegistrant = registrantDao.getRegistrant(training, trainee);
Assert.assertNotNull(reloadRegistrant);
Assert.assertEquals(registrant, reloadRegistrant);
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToTrainingWebService method saveTraining.
private Response saveTraining(GoToTrainingVO training) {
try {
GoToMeeting meeting = null;
GoToError error = new GoToError();
if (training.getKey() == null) {
boolean organizerFound = false;
List<GoToOrganizer> organizers = meetingManager.getSystemOrganizers();
for (GoToOrganizer organizer : organizers) {
boolean available = meetingManager.checkOrganizerAvailability(organizer, training.getStart(), training.getEnd());
if (available) {
meeting = meetingManager.scheduleTraining(organizer, training.getName(), training.getExternalId(), "-", training.getStart(), training.getEnd(), entry, subIdentifier, null, error);
organizerFound = true;
if (!error.hasError()) {
break;
}
}
}
if (!organizerFound) {
error.setError(GoToErrors.OrganizerOverlap);
}
} else {
meeting = meetingManager.getMeetingByExternalId(training.getExternalId());
if (meeting == null) {
List<GoToOrganizer> organizers = meetingManager.getSystemOrganizers();
for (GoToOrganizer organizer : organizers) {
meeting = meetingManager.scheduleTraining(organizer, training.getName(), training.getExternalId(), "-", training.getStart(), training.getEnd(), entry, subIdentifier, null, error);
if (!error.hasError()) {
break;
}
}
} else {
meetingManager.updateTraining(meeting, training.getName(), "-", training.getStart(), training.getEnd(), error);
}
}
Response response;
if (error.hasError()) {
response = handleGoToTrainingError(error);
} else if (meeting == null) {
response = handleUnexpectedException();
} else {
response = Response.ok(new GoToTrainingVO(meeting)).build();
}
return response;
} catch (Exception e) {
log.error("", e);
return handleUnexpectedException();
}
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToTrainingWebService method getTrainings.
/**
* returns the list of booking of the resource.
*
* @response.representation.200.qname {http://www.example.com}goToTrainingVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc This is the list of all training of a resource
* @response.representation.200.example {@link org.olat.modules.gotomeeting.restapi.Examples#SAMPLE_GoToTrainingVO}
* @return The list of trainings
*/
@GET
@Path("trainings")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getTrainings() {
try {
List<GoToMeeting> meetings = meetingManager.getMeetings(GoToType.training, entry, subIdentifier, null);
GoToTrainingVO[] bookingVos = new GoToTrainingVO[meetings.size()];
int count = 0;
for (GoToMeeting meeting : meetings) {
bookingVos[count++] = new GoToTrainingVO(meeting);
}
return Response.ok(bookingVos).build();
} catch (Exception e) {
log.error("", e);
return handleUnexpectedException();
}
}
use of org.olat.modules.gotomeeting.GoToMeeting in project OpenOLAT by OpenOLAT.
the class GoToMeetingsEditController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (addTrainingButton == source) {
doAddTraining(ureq);
} else if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
if ("delete".equals(se.getCommand())) {
GoToMeeting meeting = tableModel.getObject(se.getIndex());
doConfirmDelete(ureq, meeting);
} else if ("edit".equals(se.getCommand())) {
GoToMeeting meeting = tableModel.getObject(se.getIndex());
doEditTraining(ureq, meeting);
}
}
}
super.formInnerEvent(ureq, source, event);
}
Aggregations