[jboss-cvs] JBossAS SVN: r81941 - projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 2 04:34:13 EST 2008


Author: ALRubinger
Date: 2008-12-02 04:34:13 -0500 (Tue, 02 Dec 2008)
New Revision: 81941

Modified:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/RolesAllowedProcessor.java
Log:
[JBMETA-152] Do not allow @RolesAllowed to be enhanced by superclasses

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/RolesAllowedProcessor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/RolesAllowedProcessor.java	2008-12-02 09:16:33 UTC (rev 81940)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/RolesAllowedProcessor.java	2008-12-02 09:34:13 UTC (rev 81941)
@@ -66,6 +66,30 @@
 
       String ejbName = EjbNameThreadLocal.ejbName.get();
       MethodMetaData mmd = ProcessorUtils.createMethod(ejbName, method);
+      
+      /*
+       * JBMETA-152
+       * 
+       * Check that we haven't already defined permissions for this method
+       */
+      MethodPermissionsMetaData existingPerms = metaData.getMethodPermissionsByEjbName(ejbName);
+      if (existingPerms != null && !existingPerms.isEmpty())
+      {
+         for (MethodPermissionMetaData existingPerm : existingPerms)
+         {
+            for (MethodMetaData existingMethod : existingPerm.getMethods())
+            {
+               // If this method's already been added
+               if (existingMethod.getMethodName().equals(mmd.getMethodName())
+                     && existingMethod.getMethodParams().equals(mmd.getMethodParams()))
+               {
+                  // Do nothing
+                  return;
+               }
+            }
+         }
+      }
+      
       MethodPermissionMetaData perm = new MethodPermissionMetaData();
       MethodsMetaData methods = perm.getMethods();
       if(methods == null)




More information about the jboss-cvs-commits mailing list