Package org.olat.user.propertyhandlers

Examples of org.olat.user.propertyhandlers.UserPropertyHandler


  /**
   * @see org.olat.core.id.User#getProperty(java.lang.String, java.util.Locale)
   */
  public String getProperty(String propertyName, Locale locale) {
    UserManager um = UserManager.getInstance();
    UserPropertyHandler propertyHandler = um.getUserPropertiesConfig().getPropertyHandler(propertyName);
    if (propertyHandler == null)
      return null;
    return propertyHandler.getUserProperty(this, locale);
  }
View Full Code Here


  /**
   * @see org.olat.core.id.User#setProperty(java.lang.String, java.lang.String)
   */
  public void setProperty(String propertyName, String propertyValue) {
    UserManager um = UserManager.getInstance();
    UserPropertyHandler propertyHandler = um.getUserPropertiesConfig().getPropertyHandler(propertyName);
    propertyHandler.setUserProperty(this, propertyValue);
  }
View Full Code Here

    if (col == 0) {
      return identity.getName();     

    } else if (col > 0 && col < userPropertyHandlers.size()+1 ) {
      // get user property for this column
      UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(col-1);
      String value = userPropertyHandler.getUserProperty(user, getLocale());
      return (value == null ? "n/a" : value);
     
    } else if (col == userPropertyHandlers.size() +1) {
      return addedTo;
View Full Code Here

  public void addColumnDescriptors(TableController tableCtr, String actionCommand) {
    // first column is the username
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.login", 0, actionCommand, getLocale()));
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
      UserPropertyHandler userPropertyHandler  = userPropertyHandlers.get(i);
      boolean visible = UserManager.getInstance().isMandatoryUserProperty(usageIdentifyer , userPropertyHandler);
      tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(i+1, null, getLocale()));           
    }
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.lastlogin", getColumnCount()-2, actionCommand, getLocale()));
  }
View Full Code Here

    Identity identity = (Identity) getObject(row);
    User user = identity.getUser();
    if (col == 0) {
      return identity.getName();   
    } else if (col < userPropertyHandlers.size()+1) {
      UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(col-1);
      String value = userPropertyHandler.getUserProperty(user, getLocale());
      return (value == null ? "n/a" : value);     
    } else if(col == userPropertyHandlers.size()+1) {
      Date lastLogin= identity.getLastLogin();
      return (lastLogin == null ? "n/a" : lastLogin);     
    } else if(col == userPropertyHandlers.size()+2) {
View Full Code Here

      setUserContext(identity, vcContext, isAdministrativeUser);
      // loop for each property configured in
      // src/serviceconfig/org/olat/_spring/olat_userconfig.xml -> Key:
      // org.olat.admin.user.bulkChange.UserBulkChangeStep00
      for (int k = 0; k < userPropertyHandlers.size(); k++) {
        UserPropertyHandler propHandler = userPropertyHandlers.get(k);
        String propertyName = propHandler.getName();
        String userValue = identity.getUser().getProperty(propertyName, null);
        String inputFieldValue = "";
        if (attributeChangeMap.containsKey(propertyName)) {
          inputFieldValue = attributeChangeMap.get(propertyName);
          inputFieldValue = inputFieldValue.replace("$", "$!");
          String evaluatedInputFieldValue = evaluateValueWithUserContext(inputFieldValue, vcContext)
         
          // validate evaluated property-value
          ValidationError validationError = new ValidationError();
          // do validation checks with users current locale!
          Locale locale = transWithFallback.getLocale();
          if (!propHandler.isValidValue(evaluatedInputFieldValue, validationError, locale)) {
            errorDesc = transWithFallback.translate(validationError.getErrorKey()) + " (" + evaluatedInputFieldValue + ")";
            updateError = true;
            break;
          }

          if (!evaluatedInputFieldValue.equals(userValue)) {
            String stringValue = propHandler.getStringValue(evaluatedInputFieldValue, locale);
              propHandler.setUserProperty(user, stringValue);
          }
        }

      } // for (propertyHandlers)
View Full Code Here

      UserManager um = UserManager.getInstance();
      // followed by all properties configured
      // if only mandatory required: check for um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
      userPropertyHandlers = UserManager.getInstance().getUserPropertyHandlersFor(usageIdentifyer, true);
      for (int i = 0; i < userPropertyHandlers.size(); i++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
          tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey()));
          colPos++;
      }


      FlexiTableDataModel tableDataModel = FlexiTableDataModelFactory.createFlexiTableDataModel(new Model(idents, colPos),
View Full Code Here

      // add checkboxes/formitems for userProperties defined in
      // src/serviceconfig/org/olat/_spring/olat_userconfig.xml -> Key:
      // org.olat.admin.user.bulkChange.UserBulkChangeStep00
      userPropertyHandlers = UserManager.getInstance().getUserPropertyHandlersFor(usageIdentifyer, isAdministrativeUser);
      UserPropertyHandler userPropertyHandler;
      for (int i = 0; i < userPropertyHandlers.size(); i++) {
        userPropertyHandler = userPropertyHandlers.get(i);

        checkbox = uifactory.addCheckboxesVertical("checkbox" + i, "form.name." + userPropertyHandler.getName(), innerFormLayout, new String[] { "change" + userPropertyHandler.getName() }, new String[] { "" }, null, 1);
        checkbox.select("change" + userPropertyHandler.getName(), false);
        checkbox.addActionListener(listener, FormEvent.ONCLICK);

        formitem = userPropertyHandler.addFormItem(getLocale(), null, usageIdentifyer, isAdministrativeUser, innerFormLayout);
        formitem.setLabel(null, null);

        targets = new HashSet<FormItem>();
        targets.add(formitem);
       
        RulesFactory.createHideRule(checkbox, null, targets, innerFormLayout);
        RulesFactory.createShowRule(checkbox, "change" + userPropertyHandler.getName(), targets, innerFormLayout);

        checkBoxes.add(checkbox);
        formItems.add(formitem);
      }
View Full Code Here

        return userArray.get(col);
      }
    } else if (col > 3 && col < getColumnCount()) {
      if (userExists) {
        // get user property for this column for an already existing user
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(col - 4);
        String value = userPropertyHandler.getUserProperty(ident.getUser(), getLocale());
        return (value == null ? "n/a" : value);
      } else {
        return userArray.get(col);
      }
    }
View Full Code Here

  public void addColumnDescriptors(TableController tableCtr, String actionCommand) {
    // first column is users login name
    tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.user.login", 0, actionCommand, getLocale()));
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
      UserPropertyHandler userPropertyHandler  = userPropertyHandlers.get(i);
      boolean visible = UserManager.getInstance().isMandatoryUserProperty(usageIdentifyer , userPropertyHandler);
      tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(i+1, null, getLocale()));           
    }
  }
View Full Code Here

TOP

Related Classes of org.olat.user.propertyhandlers.UserPropertyHandler

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.