Search in sources :

Example 21 with GoToOrganizer

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);
}
Also used : GoToOrganizer(org.olat.modules.gotomeeting.GoToOrganizer) GoToMeeting(org.olat.modules.gotomeeting.GoToMeeting) GoToRegistrant(org.olat.modules.gotomeeting.GoToRegistrant) Identity(org.olat.core.id.Identity) Date(java.util.Date) Test(org.junit.Test)

Example 22 with GoToOrganizer

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));
}
Also used : GoToOrganizer(org.olat.modules.gotomeeting.GoToOrganizer) GoToMeeting(org.olat.modules.gotomeeting.GoToMeeting) GoToRegistrant(org.olat.modules.gotomeeting.GoToRegistrant) Identity(org.olat.core.id.Identity) Date(java.util.Date) Test(org.junit.Test)

Example 23 with GoToOrganizer

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

Example 24 with GoToOrganizer

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

Example 25 with GoToOrganizer

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

Aggregations

GoToOrganizer (org.olat.modules.gotomeeting.GoToOrganizer)60 Test (org.junit.Test)28 Date (java.util.Date)22 GoToMeeting (org.olat.modules.gotomeeting.GoToMeeting)18 IOException (java.io.IOException)16 HttpResponse (org.apache.http.HttpResponse)16 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)16 RepositoryEntry (org.olat.repository.RepositoryEntry)10 HttpGet (org.apache.http.client.methods.HttpGet)8 Identity (org.olat.core.id.Identity)8 StringEntity (org.apache.http.entity.StringEntity)6 GoToRegistrant (org.olat.modules.gotomeeting.GoToRegistrant)6 HttpPut (org.apache.http.client.methods.HttpPut)4 GoToError (org.olat.modules.gotomeeting.model.GoToError)4 GoToErrorG2T (org.olat.modules.gotomeeting.model.GoToErrorG2T)4 GoToRegistrantG2T (org.olat.modules.gotomeeting.model.GoToRegistrantG2T)4 Calendar (java.util.Calendar)2 Response (javax.ws.rs.core.Response)2 HttpDelete (org.apache.http.client.methods.HttpDelete)2 HttpPost (org.apache.http.client.methods.HttpPost)2