Package org.jayasoft.woj.server.servlet.ee.util

Examples of org.jayasoft.woj.server.servlet.ee.util.CSVImport$CSVObjectConstructor


    String sep = (String) parameterMap.get("separator"); //$NON-NLS-1$
    File fileToImport = (File) parameterMap.get("fileToImport"); //$NON-NLS-1$
    if(fileToImport == null || !fileToImport.exists()) {
      addWarning("user.file.not.found"); //$NON-NLS-1$
    } else {
      CSVImport imp = new CSVImport(new CSVImport.CSVObjectConstructor() {
        public Object getObjectFromLine(String[] line) {
          if(line.length < 3 || StringUtils.isEmpty(line[0])) {
            return null;
          }
          return new User(line[0],ChecksumUtil.encodeAsString(ChecksumUtil.SHA_1, line[1]), line[2]);
        }
      }, fileToImport.getAbsolutePath());
      Object o []= imp.importEntity(sep != null?sep.charAt(0):';');
      if(ArrayUtils.isEmpty(o)) {
        addWarning("user.nothing.toimport"); //$NON-NLS-1$
      } else {
        User[] users = new User[1];
        for (int i = 0; i < o.length; i++) {
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.server.servlet.ee.util.CSVImport$CSVObjectConstructor

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.