Package org.olat.user.propertyhandlers

Examples of org.olat.user.propertyhandlers.UserPropertyHandler


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

    } else if ((col-1) < userPropertyHandlers.size()) {
      UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(col-1);
      String value = userPropertyHandler.getUserProperty(user, getLocale());
      return (value == null ? "n/a" : value);

    } else {
      return "error";     
    }
View Full Code Here


    tableCtr.addColumnDescriptor(cd0);
    colCount++;
    UserManager um = UserManager.getInstance();
    // followed by the users fields
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
      UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
      boolean visible = um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
      tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(i + 1, null, getLocale()));
      colCount++;
    }
    // in the end the last login and creation date
    tableCtr.addColumnDescriptor(false, new DefaultColumnDescriptor("table.identity.lastlogin", colCount, null, getLocale()));
    colCount++;
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 identity.getLastLogin();
    } else if (col == userPropertyHandlers.size() + 2) {
View Full Code Here

            "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
    tableCtr.addColumnDescriptor(cd0);
    int visibleColId = 0;
    // 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, ureq.getLocale()));
      if (visible) {
        visibleColId++;
      }
    }
    listenTo(tableCtr);
View Full Code Here

    cd0.setIsPopUpWindowAction(true,"height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
    tableCtr.addColumnDescriptor(cd0);   
    // followed by the users fields
    int colId = 0;
    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, ureq.getLocale()))
      if(visible) {
        colId++;
      }
    }
    listenTo(tableCtr);
View Full Code Here

      colPos++;
      tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("form.name.language"));
      colPos++;

      for (int j = 0; j < userPropertyHandlers.size(); j++) {
        UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(j);
        tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey()));
        colPos++;
      }

      tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("table.role.useradmin"));
      colPos++;
View Full Code Here

    }
    int colCount = 0;
    userListCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.name", colCount++, editCmd, getLocale()));
   
    for (int i = 0; i < userPropertyHandlers.size(); i++) {
      UserPropertyHandler userPropertyHandler  = userPropertyHandlers.get(i);     
      userListCtr.addColumnDescriptor(userPropertyHandler.getColumnDescriptor(i+1, null, getLocale()))
      colCount++;
    }   
    if ( (courseNode != null) && isNodeOrGroupFocus) {     
      if (courseNode.hasDetails()) {       
        userListCtr.addColumnDescriptor((courseNode.getDetailsListViewHeaderKey() == null ? false : true),
View Full Code Here

            // ignore existing accounts, add info message
            idents.add(ident);
          } else {
            // no identity/user yet, create
            UserManager um = UserManager.getInstance();
            UserPropertyHandler userPropertyHandler;
            String thisKey = "";
            String thisValue = "";
            // check that no user with same login name is already in list
            for (Iterator<List<String>> it_news = newIdents.iterator(); it_news.hasNext();) {
              List<String> singleUser = it_news.next();
              if (singleUser.get(1).equalsIgnoreCase(login)) {
                textAreaElement.setErrorKey("error.login.douplicate", new String[] { String.valueOf(i + 1), login });
                importDataError = true;
                break;
              }
            }

            List<String> ud = new ArrayList<String>();
            // insert fix fields: login, pwd, lang from above
            ud.add("false"); // used for first column in model (user existing)
            ud.add(login);
            ud.add(pwd);
            ud.add(lang);

            for (int j = 0; j < userPropertyHandlers.size(); j++) {
              userPropertyHandler = userPropertyHandlers.get(j);
              thisKey = userPropertyHandler.getName();
              // last columns may be empty if not mandatory
              if (parts.length <= columnId) {
                thisValue = "";
              } else {
                thisValue = parts[columnId].trim();
              }
              boolean isMandatoryField = um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
              if (isMandatoryField && !StringHelper.containsNonWhitespace(thisValue)) {
                textAreaElement.setErrorKey("error.mandatory", new String[] { String.valueOf(i + 1), translate(userPropertyHandler.i18nFormElementLabelKey()) });
                importDataError = true;
                break;
              }
              // used for call-back value depending on PropertyHandler
              ValidationError validationError = new ValidationError();
              if (!userPropertyHandler.isValidValue(thisValue, validationError, getLocale())) {
                textAreaElement.setErrorKey("error.lengthorformat", new String[] { String.valueOf(i + 1), translate(userPropertyHandler.i18nFormElementLabelKey()),
                    translate(validationError.getErrorKey()) });
                importDataError = true;
                break;
              }
              // check that no user with same email is already in list
View Full Code Here

      textContainer.contextPut("mapperURI", mapperURI);

      // get mandatory user-properties and set as text
      setTranslator(UserManager.getInstance().getPropertyHandlerTranslator(getTranslator()));
      UserManager um = UserManager.getInstance();
      UserPropertyHandler userPropertyHandler;
      String mandatoryProperties = "";
      for (int i = 0; i < userPropertyHandlers.size(); i++) {
        userPropertyHandler = userPropertyHandlers.get(i);
        String mandatoryChar = "";
        if (um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler)) {
          mandatoryChar = " *";
        }
        mandatoryProperties += ", " + translate(userPropertyHandler.i18nColumnDescriptorLabelKey()) + mandatoryChar;
      }
      textContainer.contextPut("mandatoryProperties", mandatoryProperties);

      textAreaElement = uifactory.addTextAreaElement("importform", "form.importdata", -1, 10, 100, false, "", formLayout);
      textAreaElement.setMandatory(true);
View Full Code Here

            headerLine += "\t" + translate("table.user.pwd");
            dataLine += "\t" + "olat4you";
          }
          headerLine += "\t" + translate("table.user.lang");
          dataLine += "\t" + I18nManager.getInstance().getLocaleKey(getLocale());
          UserPropertyHandler userPropertyHandler;
          for (int i = 0; i < userPropertyHandlers.size(); i++) {
            userPropertyHandler = userPropertyHandlers.get(i);
            String mandatoryChar = "";
            if (um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler)) {
              mandatoryChar = " *";
            }
            headerLine += "\t" + translate(userPropertyHandler.i18nColumnDescriptorLabelKey()) + mandatoryChar;
            dataLine += "\t" + translate("import.example." + userPropertyHandler.getName());
          }
          String writeToFile = headerLine + "\n" + dataLine;
         
          ExcelMediaResource emr = new ExcelMediaResource(writeToFile, charset);
          emr.setFilename("UserImportExample");
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.