use of org.olat.modules.gotomeeting.GoToOrganizer in project openolat by klemens.
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.GoToOrganizer in project openolat by klemens.
the class GoToRegistrantDAOTest method getRegistrants.
@Test
public void getRegistrants() {
String token = UUID.randomUUID().toString();
Identity trainee = JunitTestHelper.createAndPersistIdentityAsRndUser("trainee-3");
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
List<GoToRegistrant> reloadRegistrants = registrantDao.getRegistrants(trainee, null, null, null);
Assert.assertNotNull(reloadRegistrants);
Assert.assertEquals(1, reloadRegistrants.size());
Assert.assertEquals(registrant, reloadRegistrants.get(0));
}
use of org.olat.modules.gotomeeting.GoToOrganizer in project openolat by klemens.
the class GoToOrganizerListAdminController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (addOrganizerButton == source) {
doAddOrganizer(ureq);
} else if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
if ("renew".equals(se.getCommand())) {
GoToOrganizer organizer = tableModel.getObject(se.getIndex());
doRenewOrganizer(ureq, organizer);
} else if ("remove".equals(se.getCommand())) {
GoToOrganizer organizer = tableModel.getObject(se.getIndex());
doConfirmRemove(ureq, organizer);
} else if ("owner".equals(se.getCommand())) {
GoToOrganizer organizer = tableModel.getObject(se.getIndex());
doOpenOwner(ureq, organizer);
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.gotomeeting.GoToOrganizer in project openolat by klemens.
the class EditTrainingController method validateFormLogic.
@Override
protected boolean validateFormLogic(UserRequest ureq) {
boolean allOk = true;
if (meeting == null || meeting.getOrganizer() == null) {
organizersEl.clearError();
if (!organizersEl.isOneSelected()) {
organizersEl.setErrorKey("form.mandatory.hover", null);
allOk &= false;
} else {
Date start = startDateEl.getDate();
Date end = endDateEl.getDate();
String selectedKeyStr = organizersEl.getSelectedKey();
int selectedIndex = Integer.parseInt(selectedKeyStr);
GoToOrganizer organizer = availablesOrganizers.get(selectedIndex);
if (start != null && end != null && organizer != null) {
if (!meetingManager.checkOrganizerAvailability(organizer, start, end)) {
organizersEl.setErrorKey("error.organizer.overbooked", null);
allOk &= false;
}
}
}
}
nameEl.clearError();
if (!StringHelper.containsNonWhitespace(nameEl.getValue())) {
nameEl.setErrorKey("form.mandatory.hover", null);
allOk &= false;
}
startDateEl.clearError();
if (startDateEl.getDate() == null) {
startDateEl.setErrorKey("form.mandatory.hover", null);
allOk &= false;
}
endDateEl.clearError();
if (endDateEl.getDate() == null) {
endDateEl.setErrorKey("form.mandatory.hover", null);
allOk &= false;
}
if (startDateEl.getDate() != null && endDateEl.getDate() != null) {
Date start = startDateEl.getDate();
Date end = endDateEl.getDate();
if (start.compareTo(end) >= 0) {
startDateEl.setErrorKey("error.start.after.end", null);
}
}
return allOk & super.validateFormLogic(ureq);
}
use of org.olat.modules.gotomeeting.GoToOrganizer in project openolat by klemens.
the class EditTrainingController method doSetPersonalAccount.
private void doSetPersonalAccount() {
availablesOrganizers = meetingManager.getOrganizersFor(getIdentity());
String selectedKey = null;
String[] organizerKeys = new String[availablesOrganizers.size()];
String[] organizerValues = new String[availablesOrganizers.size()];
for (int i = availablesOrganizers.size(); i-- > 0; ) {
GoToOrganizer organizer = availablesOrganizers.get(i);
organizerKeys[i] = Integer.toString(i);
organizerValues[i] = organizer.getUsername();
if (organizer.getOwner() != null) {
selectedKey = organizerKeys[i];
}
}
organizersEl.setKeysAndValues(organizerKeys, organizerValues, null);
if (selectedKey != null) {
organizersEl.select(selectedKey, true);
addMeAsOrganizerButton.setVisible(false);
}
}
Aggregations