public Collection getSecurityRoles(Collection metadata) {
Collection roleTags = new ArrayList();
Collection ejbBeans = getBeans(metadata);
for (Iterator iter = ejbBeans.iterator(); iter.hasNext();) {
JavaClass javaClass = (JavaClass) iter.next();
roleTags.addAll(Arrays.asList(javaClass.getTagsByName(TagLibrary.EJB_PERMISSION)));
JavaMethod[] methods = javaClass.getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getTagByName(TagLibrary.EJB_PERMISSION) != null) {
int methodType = getMethodType(methods[i]);
if ((methodType != IFACE_METHOD_CREATE) && (methodType != IFACE_METHOD_COMPONENT)) {
throw getErrorWithTagLocation(methods[i].getTagByName(TagLibrary.EJB_PERMISSION),
"Can't mark a method permission on a non interface or create method");
}
}
roleTags.addAll(Arrays.asList(methods[i].getTagsByName(TagLibrary.EJB_PERMISSION)));
}
if (isEntityBean(javaClass)) {
// get roles from finders
roleTags.addAll(Arrays.asList(javaClass.getTagsByName(TagLibrary.EJB_FINDER)));
// and from pk field ( if any )
roleTags.addAll(Arrays.asList(javaClass.getTagsByName(TagLibrary.EJB_PK)));
}
// and from extra security roles
roleTags.addAll(Arrays.asList(javaClass.getTagsByName(TagLibrary.EJB_SECURITY_ROLES)));
}
Collection roles = new TreeSet();
for (Iterator iter = roleTags.iterator(); iter.hasNext();) {