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++) {