Search in sources :

Example 16 with MultiIdentityChosenEvent

use of org.olat.basesecurity.events.MultiIdentityChosenEvent in project OpenOLAT by OpenOLAT.

the class ImportMemberBySearchController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (event instanceof SingleIdentityChosenEvent) {
        SingleIdentityChosenEvent e = (SingleIdentityChosenEvent) event;
        addToRunContext("keyIdentities", Collections.singletonList(e.getChosenIdentity()));
        fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
    } else if (event instanceof MultiIdentityChosenEvent) {
        MultiIdentityChosenEvent e = (MultiIdentityChosenEvent) event;
        addToRunContext("keyIdentities", e.getChosenIdentities());
        fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
    } else {
        super.event(ureq, source, event);
    }
}
Also used : SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent)

Example 17 with MultiIdentityChosenEvent

use of org.olat.basesecurity.events.MultiIdentityChosenEvent in project openolat by klemens.

the class TaxonomyLevelCompetenceController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (userSearchCtrl == source) {
        if (event instanceof SingleIdentityChosenEvent) {
            SingleIdentityChosenEvent singleEvent = (SingleIdentityChosenEvent) event;
            Identity choosenIdentity = singleEvent.getChosenIdentity();
            if (choosenIdentity != null) {
                List<Identity> toAdd = Collections.singletonList(choosenIdentity);
                doAddCompetence(toAdd, (TaxonomyCompetenceTypes) userSearchCtrl.getUserObject());
                loadModel();
            }
        } else if (event instanceof MultiIdentityChosenEvent) {
            MultiIdentityChosenEvent multiEvent = (MultiIdentityChosenEvent) event;
            List<Identity> toAdd = multiEvent.getChosenIdentities();
            if (toAdd.size() > 0) {
                doAddCompetence(toAdd, (TaxonomyCompetenceTypes) userSearchCtrl.getUserObject());
                loadModel();
            }
        }
        cmc.deactivate();
        cleanUp();
    } else if (confirmDeleteDialog == source) {
        if (DialogBoxUIFactory.isOkEvent(event) || DialogBoxUIFactory.isYesEvent(event)) {
            @SuppressWarnings("unchecked") List<TaxonomyLevelCompetenceRow> selectedRows = (List<TaxonomyLevelCompetenceRow>) confirmDeleteDialog.getUserObject();
            doRemoveCompetences(selectedRows);
        }
    } else if (editCompetenceCtrl == source) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            loadModel();
            tableEl.reset(false, false, true);
        }
        cmc.deactivate();
        cleanUp();
    } else if (addCompetencesCallout == source) {
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) List(java.util.List) ArrayList(java.util.ArrayList) TaxonomyCompetenceTypes(org.olat.modules.taxonomy.TaxonomyCompetenceTypes) Identity(org.olat.core.id.Identity) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent)

Example 18 with MultiIdentityChosenEvent

use of org.olat.basesecurity.events.MultiIdentityChosenEvent in project openolat by klemens.

the class ImportAuthorBySearchController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (event instanceof SingleIdentityChosenEvent) {
        SingleIdentityChosenEvent e = (SingleIdentityChosenEvent) event;
        String key = e.getChosenIdentity().getKey().toString();
        addToRunContext("keys", Collections.singletonList(key));
        fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
    } else if (event instanceof MultiIdentityChosenEvent) {
        MultiIdentityChosenEvent e = (MultiIdentityChosenEvent) event;
        Collection<String> keys = new ArrayList<String>();
        for (Identity identity : e.getChosenIdentities()) {
            keys.add(identity.getKey().toString());
        }
        addToRunContext("keys", keys);
        fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
    } else {
        super.event(ureq, source, event);
    }
}
Also used : SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) Collection(java.util.Collection) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent) Identity(org.olat.core.id.Identity)

Example 19 with MultiIdentityChosenEvent

use of org.olat.basesecurity.events.MultiIdentityChosenEvent in project openolat by klemens.

the class AuthorListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (cmc == source) {
        cleanUp();
    } else if (createCtrl == source) {
        cmc.deactivate();
        if (Event.DONE_EVENT.equals(event)) {
            launchEditDescription(ureq, createCtrl.getAddedEntry());
            reloadRows();
            cleanUp();
        } else if (CreateRepositoryEntryController.CREATION_WIZARD.equals(event)) {
            doPostCreateWizard(ureq, createCtrl.getAddedEntry(), createCtrl.getHandler());
        } else {
            cleanUp();
        }
    } else if (copyCtrl == source) {
        cmc.deactivate();
        if (event == Event.DONE_EVENT) {
            reloadRows();
            launchEditDescription(ureq, copyCtrl.getCopiedEntry());
        }
        cleanUp();
    } else if (importCtrl == source) {
        cmc.deactivate();
        if (Event.DONE_EVENT.equals(event)) {
            reloadRows();
            launchEditDescription(ureq, importCtrl.getImportedEntry());
        }
        cleanUp();
    } else if (wizardCtrl == source) {
        if (event.equals(Event.CHANGED_EVENT) || event.equals(Event.CANCELLED_EVENT)) {
            getWindowControl().pop();
            RepositoryEntry newEntry = (RepositoryEntry) wizardCtrl.getRunContext().get("authoringNewEntry");
            reloadRows();
            cleanUp();
            launchEditDescription(ureq, newEntry);
        }
    } else if (searchCtrl == source) {
        if (event instanceof SearchEvent) {
            SearchEvent se = (SearchEvent) event;
            doSearch(ureq, se);
        } else if (event == Event.CANCELLED_EVENT) {
            searchParams.setResourceTypes(null);
            searchParams.setIdAndRefs(null);
            searchParams.setAuthor(null);
            searchParams.setDisplayname(null);
            searchParams.setDescription(null);
            searchParams.setOwnedResourcesOnly(false);
            searchParams.setResourceUsage(ResourceUsage.all);
            searchParams.setLicneseTypeKeys(null);
        }
    } else if (userSearchCtr == source) {
        @SuppressWarnings("unchecked") List<AuthoringEntryRow> rows = (List<AuthoringEntryRow>) userSearchCtr.getUserObject();
        if (event instanceof MultiIdentityChosenEvent) {
            MultiIdentityChosenEvent mice = (MultiIdentityChosenEvent) event;
            doAddOwners(mice.getChosenIdentities(), rows);
        } else if (event instanceof SingleIdentityChosenEvent) {
            SingleIdentityChosenEvent sice = (SingleIdentityChosenEvent) event;
            List<Identity> futureOwners = Collections.singletonList(sice.getChosenIdentity());
            doAddOwners(futureOwners, rows);
        }
        cmc.deactivate();
        cleanUp();
    } else if (sendMailCtrl == source) {
        cmc.deactivate();
        cleanUp();
    } else if (toolsCtrl == source) {
        if (event == Event.DONE_EVENT) {
            toolsCalloutCtrl.deactivate();
            cleanUp();
        }
    } else if (referencesCtrl == source) {
        if (event == Event.DONE_EVENT) {
            toolsCalloutCtrl.deactivate();
            cleanUp();
        }
    } else if (closeCtrl == source) {
        if (event == Event.CANCELLED_EVENT) {
            cmc.deactivate();
            cleanUp();
        } else if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            cmc.deactivate();
            reloadRows();
            cleanUp();
        }
    } else if (confirmDeleteCtrl == source) {
        if (event == Event.CANCELLED_EVENT) {
            cmc.deactivate();
            cleanUp();
        } else if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            cmc.deactivate();
            reloadRows();
            cleanUp();
        }
    } else if (copyDialogCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            @SuppressWarnings("unchecked") List<AuthoringEntryRow> rows = (List<AuthoringEntryRow>) copyDialogCtrl.getUserObject();
            doCompleteCopy(rows);
            reloadRows();
        }
    }
    super.event(ureq, source, event);
}
Also used : SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) List(java.util.List) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent)

Example 20 with MultiIdentityChosenEvent

use of org.olat.basesecurity.events.MultiIdentityChosenEvent in project openolat by klemens.

the class EPShareListController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == selectGroupCtrl) {
        cmc.deactivate();
        secureListBox();
        if (event instanceof BusinessGroupSelectionEvent) {
            BusinessGroupSelectionEvent bge = (BusinessGroupSelectionEvent) event;
            List<BusinessGroup> groups = bge.getGroups();
            if (groups.size() > 0) {
                EPSharePolicyWrapper policyWrapper = (EPSharePolicyWrapper) selectGroupCtrl.getUserObject();
                policyWrapper.getGroups().addAll(groups);
                initPolicyUI();
            }
        }
    } else if (source.equals(selectUserCtrl)) {
        cmc.deactivate();
        secureListBox();
        EPSharePolicyWrapper policyWrapper = (EPSharePolicyWrapper) selectUserCtrl.getUserObject();
        if (event instanceof SingleIdentityChosenEvent) {
            SingleIdentityChosenEvent foundEvent = (SingleIdentityChosenEvent) event;
            Identity chosenIdentity = foundEvent.getChosenIdentity();
            if (chosenIdentity != null) {
                policyWrapper.getIdentities().add(chosenIdentity);
            }
        } else if (event instanceof MultiIdentityChosenEvent) {
            MultiIdentityChosenEvent foundEvent = (MultiIdentityChosenEvent) event;
            List<Identity> chosenIdentities = foundEvent.getChosenIdentities();
            if (chosenIdentities != null && !chosenIdentities.isEmpty()) {
                policyWrapper.getIdentities().addAll(chosenIdentities);
            }
        }
        initPolicyUI();
    } else if (source == cmc) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) BusinessGroupSelectionEvent(org.olat.group.model.BusinessGroupSelectionEvent) SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) Identity(org.olat.core.id.Identity) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent)

Aggregations

MultiIdentityChosenEvent (org.olat.basesecurity.events.MultiIdentityChosenEvent)24 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)24 Identity (org.olat.core.id.Identity)20 ArrayList (java.util.ArrayList)12 List (java.util.List)12 TableEvent (org.olat.core.gui.components.table.TableEvent)8 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 AssertException (org.olat.core.logging.AssertException)6 Collection (java.util.Collection)4 UserRequest (org.olat.core.gui.UserRequest)4 WindowControl (org.olat.core.gui.control.WindowControl)4 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)4 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)4 MailNotificationEditController (org.olat.core.util.mail.MailNotificationEditController)4 MailTemplate (org.olat.core.util.mail.MailTemplate)4 UserInfoMainController (org.olat.user.UserInfoMainController)4 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 BitSet (java.util.BitSet)2