}
} else {
final SyncopeUser found;
List<SyncopeUser> users;
final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource()
.getMappings());
switch (accountIdMap.getIntMappingType()) {
case Username:
found = userDAO.find(uid);
if (found != null) {
result.add(found.getId());
}
break;
case SyncopeUserId:
found = userDAO.find(Long.parseLong(uid));
if (found != null) {
result.add(found.getId());
}
break;
case UserSchema:
final UAttrValue value = new UAttrValue();
USchema schema = schemaDAO.find(accountIdMap.getIntAttrName(), USchema.class);
if (schema == null) {
value.setStringValue(uid);
} else {
try {
value.parseValue(schema, uid);
} catch (ParsingValidationException e) {
LOG.error("While parsing provided __UID__ {}", uid, e);
value.setStringValue(uid);
}
}
users = userDAO.findByAttrValue(accountIdMap.getIntAttrName(), value);
for (SyncopeUser user : users) {
result.add(user.getId());
}
break;
case UserDerivedSchema:
try {
users = userDAO.findByDerAttrValue(accountIdMap.getIntAttrName(), uid);
for (SyncopeUser user : users) {
result.add(user.getId());
}
} catch (InvalidSearchConditionException e) {
LOG.error("Could not search for matching users", e);
}
break;
default:
LOG.error("Invalid accountId type '{}'", accountIdMap.getIntMappingType());
}
}
return result;
}