Package org.olat.admin.user.bulkChange

Examples of org.olat.admin.user.bulkChange.UserBulkChangeManager


            // empty selection
            showWarning("msg.selectionempty");
            return;
          }
          selectedIdentities = tdm.getIdentities(tmse.getSelection());
          final UserBulkChangeManager ubcMan = UserBulkChangeManager.getInstance();
          // valid selection: load in wizard
          Step start = new UserBulkChangeStep00(ureq, selectedIdentities);
          Roles roles = ureq.getUserSession().getRoles();
          isAdministrativeUser = (roles.isAuthor() || roles.isGroupManager() || roles.isUserManager() || roles.isOLATAdmin());

          // callback executed in case wizard is finished.
          StepRunnerCallback finish = new StepRunnerCallback() {
            public Step execute(UserRequest ureq1, WindowControl wControl1, StepsRunContext runContext) {
              // all information to do now is within the runContext saved
              boolean hasChanges = false;
              try {
                if (runContext.containsKey("validChange") && ((Boolean) runContext.get("validChange")).booleanValue()) {
                  HashMap<String, String> attributeChangeMap = (HashMap<String, String>) runContext.get("attributeChangeMap");
                  HashMap<String, String> roleChangeMap = (HashMap<String, String>) runContext.get("roleChangeMap");
                  if (!(attributeChangeMap.size()==0 && roleChangeMap.size()==0)){
                    ubcMan.changeSelectedIdentities(selectedIdentities, attributeChangeMap, roleChangeMap, notUpdatedIdentities,
                      isAdministrativeUser, getTranslator());
                    hasChanges = true;
                  }
                }
              } catch (Exception any) {
View Full Code Here


    //special validator in case of bulkChange, wizard in first step allows entry of ${userProperty} (velocity-style)
    //to validate the input a special isValidValue is used.
    if (usageIdentifyer.equals(UserBulkChangeStep00.class.getCanonicalName())){
      tElem.setItemValidatorProvider(new ItemValidatorProvider(){
        public boolean isValidValue(String value, ValidationError validationError, Locale locale2) {
          UserBulkChangeManager ubcMan = UserBulkChangeManager.getInstance();
          Context vcContext = new VelocityContext();
          if (user==null){
            vcContext = ubcMan.getDemoContext(locale2, isAdministrativeUser);
          }
          //should be used if user-argument !=null --> move to right place
          else {
            Long userKey = user.getKey();
            Identity identity = ManagerFactory.getManager().loadIdentityByKey(userKey);
            ubcMan.setUserContext(identity, vcContext, isAdministrativeUser);
          }
          value = value.replace("$", "$!");
          String evaluatedValue = ubcMan.evaluateValueWithUserContext(value, vcContext);
          return EmailProperty.this.isValidValue(evaluatedValue, validationError, locale2);
        }
      });
    }
    return tElem;
View Full Code Here

TOP

Related Classes of org.olat.admin.user.bulkChange.UserBulkChangeManager

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.