if (permissionsString == null || permissionsString.trim().equals("")) {
return Collections.emptyList();
}
PermissionFactory permissionFactory = getBeanOfType(applicationContext, PermissionFactory.class);
if (permissionFactory == null) {
permissionFactory = new DefaultPermissionFactory();
}
final Set<Permission> permissions = new HashSet<Permission>();
final StringTokenizer tokenizer = new StringTokenizer(permissionsString, ",", false);
while (tokenizer.hasMoreTokens()) {
String permission = tokenizer.nextToken();
try {
permissions.add(permissionFactory.buildFromMask(Integer.valueOf(permission).intValue()));
} catch (final NumberFormatException nfe) {
// Not an integer mask. Try using a name
permissions.add(permissionFactory.buildFromName(permission));
}
}
return new ArrayList<Permission>(permissions);