Package org.olat.basesecurity.events

Examples of org.olat.basesecurity.events.SingleIdentityChosenEvent


  public void event(UserRequest ureq, Controller source, Event event) {
    if (source == usc) {
      getWindowControl().pop();
      if (event != Event.CANCELLED_EVENT) {
        // we configured usc to either cancel or to only accept single user selection.
        SingleIdentityChosenEvent sce = (SingleIdentityChosenEvent)event;
        Identity ident = sce.getChosenIdentity();
        ClusterLockManager.getInstance().releaseAllLocksFor(ident.getName());
        showInfo("locks.released", ident.getName());
      }
    }
  }
View Full Code Here


   */
  public void event(UserRequest ureq, Controller source, Event event) {
    if (source == resC) {
      // TODO:as:a move to own controller (homepage whatever controller)
      if (event instanceof SingleIdentityChosenEvent) {
        SingleIdentityChosenEvent foundEvent = (SingleIdentityChosenEvent) event;
        Identity chosenIdentity = foundEvent.getChosenIdentity();
        if (chosenIdentity != null) {
          HomePageConfigManager hpcm = HomePageConfigManagerImpl.getInstance();
          OLATResourceable ores = hpcm.loadConfigFor(chosenIdentity.getName());
          DTabs dts = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
          //was brasato:: DTabs dts = getWindowControl().getDTabs();
View Full Code Here

        // single choose event may come from autocompleter user search
        if (!UserDeletionManager.getInstance().isReadyToDelete()) {
          showInfo("info.is.not.ready.to.delete");
          return;
        }
        SingleIdentityChosenEvent uce = (SingleIdentityChosenEvent) event;
        toDelete = new ArrayList<Identity>();
        toDelete.add(uce.getChosenIdentity());
        deleteConfirmController = activateOkCancelDialog(ureq, null, translate("readyToDelete.delete.confirm", uce.getChosenIdentity().getName()), deleteConfirmController);
        return;
      } else {
        throw new AssertException("unknown event ::" + event.getCommand());
      }
    } else if (sourceController == deleteConfirmController) {
View Full Code Here

        String actionid = te.getActionId();
        if (actionid.equals(ExtendedIdentitiesTableControllerFactory.COMMAND_SELECTUSER)) {
          int rowid = te.getRowId();
          foundIdentity = tdm.getIdentityAt(rowid);
          // Tell parentController that a subject has been found
          fireEvent(ureq, new SingleIdentityChosenEvent(foundIdentity));
        } else if (actionid.equals(ExtendedIdentitiesTableControllerFactory.COMMAND_VCARD)) {
          // get identitiy and open new visiting card controller in new window
          int rowid = te.getRowId();
          final Identity identity = tdm.getIdentityAt(rowid);
          ControllerCreator userInfoMainControllerCreator = new ControllerCreator() {
View Full Code Here

      if (event instanceof MultiIdentityChosenEvent) {
        MultiIdentityChosenEvent mice = (MultiIdentityChosenEvent) event;
        owners = mice.getChosenIdentities();
      }
      if (event instanceof SingleIdentityChosenEvent) {
        SingleIdentityChosenEvent  sice = (SingleIdentityChosenEvent) event;
        final Identity choosenIdentity = sice.getChosenIdentity();
        owners.add(sice.getChosenIdentity());
      }
      //add choosen identities as owners
      if ((owners.size() > 0) && (repoEntries.size() > 0)) {
        addOwnersToRepositoryEntry();
        fireEvent(ureq, Event.DONE_EVENT);
View Full Code Here

          //
        } else if (actionid.equals(COMMAND_SELECTUSER)) {
          int rowid = te.getRowId();
          Identity identity = identitiesTableModel.getIdentityAt(rowid);
          // TODO whats this??
          fireEvent(ureq, new SingleIdentityChosenEvent(identity));
        }

      } else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
        // Multiselect events
        TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
        if (tmse.getAction().equals(COMMAND_REMOVEUSER)) {
          if(tmse.getSelection().isEmpty()){
            //empty selection
            content.setDirty(true);
            showWarning("msg.selectionempty");
            return;
          }
          int size = identitiesTableModel.getObjects().size();
          toRemove = identitiesTableModel.getIdentities(tmse.getSelection());
          // list is never null, but can be empty
          if (keepAtLeastOne && (size == 1 || size - toRemove.size() == 0)) {
            //at least one must be kept
            //do not delete the last one => ==1
            //do not allow to delete all => size - selectedCnt == 0
            content.setDirty(true);
            showError("msg.atleastone");
          } else {
            //valid selection to be deleted.
            if (removeUserMailDefaultTempl == null) {
              doBuildConfirmDeleteDialog(ureq);
            } else {
              if (addUserMailCtr != null) addUserMailCtr.dispose();
              removeUserMailCtr = new MailNotificationEditController(getWindowControl(), ureq, removeUserMailDefaultTempl, true);             
              this.listenTo(removeUserMailCtr);
              cmc = new CloseableModalController(getWindowControl(), translate("close"), removeUserMailCtr.getInitialComponent());
              cmc.activate();
            }
          }
        }
      }
    } else if (sourceController == removeUserMailCtr) {
      if (event == Event.DONE_EVENT) {
        removeUserMailCustomTempl = removeUserMailCtr.getMailTemplate();
        cmc.deactivate();
        doBuildConfirmDeleteDialog(ureq);
      } else if (event == Event.CANCELLED_EVENT) {
        cmc.deactivate();
      } else {
        throw new RuntimeException("unknown event ::" + event.getCommand());
      }

    } else if (sourceController == usc) {
      if (event == Event.CANCELLED_EVENT) {
        cmc.deactivate();
      } else {
        if (event instanceof SingleIdentityChosenEvent) {
          SingleIdentityChosenEvent singleEvent = (SingleIdentityChosenEvent) event;
          Identity choosenIdentity = singleEvent.getChosenIdentity();
          if (choosenIdentity == null) {
            showError("msg.selectionempty");
            return;
          }
          toAdd = new ArrayList<Identity>();
View Full Code Here

  public Identity getChosenUser(Event event) {
    if (event == Event.CANCELLED_EVENT) {
      return null;
    } else {
      SingleIdentityChosenEvent sice = (SingleIdentityChosenEvent)event;
      return sice.getChosenIdentity();
    }
  }
View Full Code Here

  protected void formOK(UserRequest ureq) {
    // Create user on database
    Identity s = doCreateAndPersistIdentity();
    if (s != null) {     
      log.audit(USER_CREATE_SUCCESS + s.getName());       
      fireEvent(ureq, new SingleIdentityChosenEvent(s));
    } else {
      // Could not save form, display error
      getWindowControl().setError(translate("new.user.unsuccessful"));
      fireEvent(ureq, Event.FAILED_EVENT);
    }   
View Full Code Here

        if (te.getActionId().equals(ACTION_SINGLESELECT_CHOOSE)) {
          int rowid = te.getRowId();
          Identity foundIdentity = (Identity)tdm.getObject(rowid);
          foundIdentities.add(foundIdentity);
          // Tell parentController that a subject has been found
          fireEvent(ureq, new SingleIdentityChosenEvent(foundIdentity));
        }
      } else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
        TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
        if (tmse.getAction().equals(ACTION_MULTISELECT_CHOOSE)) {
          foundIdentities = tdm.getObjects(tmse.getSelection());
          fireEvent(ureq, new MultiIdentityChosenEvent(foundIdentities));
        }
      }
    } else if (source == autocompleterC) {
      EntriesChosenEvent ece = (EntriesChosenEvent)event;
      List res = ece.getEntries();
      // if we get the event, we have a result
      String mySel = res.isEmpty() ? null : (String) res.get(0);
      if (( mySel == null) || mySel.trim().equals("")) {
        getWindowControl().setWarning(pT.translate("error.search.form.notempty"));
        return;
      }
      if(!mySel.startsWith(".....")){
        List identities = searchUsers(mySel, null, false);
        if (identities.size() == 0) {
          getWindowControl().setWarning(pT.translate("error.no.user.found"));
          return;         
        }
        Identity chosenIdent = (Identity) identities.get(0);
        // tell that an identity has been chosen
        fireEvent(ureq, new SingleIdentityChosenEvent(chosenIdent));
      }
    }
  }
View Full Code Here

        userSearchCMC.deactivate();
      } else {
        List<Identity> toAdd = null;
        added = new ArrayList<Identity>();
        if (event instanceof SingleIdentityChosenEvent) {
          SingleIdentityChosenEvent singleEvent = (SingleIdentityChosenEvent) event;
          Identity choosenIdentity = singleEvent.getChosenIdentity();
          toAdd = new ArrayList<Identity>();
          toAdd.add(choosenIdentity);
        } else if (event instanceof MultiIdentityChosenEvent) {
          MultiIdentityChosenEvent multiEvent = (MultiIdentityChosenEvent) event;
          toAdd = multiEvent.getChosenIdentities();
View Full Code Here

TOP

Related Classes of org.olat.basesecurity.events.SingleIdentityChosenEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.