[seam-commits] Seam SVN: r14298 - in branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam: util and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Feb 3 07:03:50 EST 2012


Author: manaRH
Date: 2012-02-03 07:03:48 -0500 (Fri, 03 Feb 2012)
New Revision: 14298

Modified:
   branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java
   branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
   branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java
   branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/PermissionMetadata.java
   branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util/AnnotatedBeanProperty.java
Log:
JBPAPP-6924 backed port one-off patch

Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java	2012-02-03 11:56:12 UTC (rev 14297)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/ClassIdentifierStrategy.java	2012-02-03 12:03:48 UTC (rev 14298)
@@ -11,7 +11,7 @@
  * 
  * @author Shane Bryzak
  */
-public class ClassIdentifierStrategy implements IdentifierStrategy
+public class ClassIdentifierStrategy implements IdentifierStrategy, java.io.Serializable
 {
    private Map<Class,String> identifierNames = new ConcurrentHashMap<Class,String>();   
    

Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java	2012-02-03 11:56:12 UTC (rev 14297)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/EntityIdentifierStrategy.java	2012-02-03 12:03:48 UTC (rev 14298)
@@ -19,23 +19,31 @@
  * 
  * @author Shane Bryzak
  */
-public class EntityIdentifierStrategy implements IdentifierStrategy
+public class EntityIdentifierStrategy implements IdentifierStrategy, java.io.Serializable
 {
-   private ValueExpression<EntityManager> entityManager;   
+   private transient ValueExpression<EntityManager> entityManager;   
    
-   private PersistenceProvider persistenceProvider;
+   private transient PersistenceProvider persistenceProvider;
    
    private Map<Class,String> identifierNames = new ConcurrentHashMap<Class,String>();
    
+	public void init()
+	{
+		if (persistenceProvider == null)
+		{
+			persistenceProvider = (PersistenceProvider) Component.getInstance(PersistenceProvider.class, true);
+		}
+
+	    if (entityManager == null)
+	    {
+	    	entityManager = Expressions.instance().createValueExpression("#{entityManager}", EntityManager.class);
+	    }
+		
+	}
+
    public EntityIdentifierStrategy()
    {
-      persistenceProvider = (PersistenceProvider) Component.getInstance(PersistenceProvider.class, true);
-      
-      if (entityManager == null)
-      {
-         entityManager = Expressions.instance().createValueExpression("#{entityManager}", 
-               EntityManager.class);
-      }         
+      init();  
    }
    
    public boolean canIdentify(Class targetClass)
@@ -45,6 +53,7 @@
 
    public String getIdentifier(Object target)
    {
+	  if(persistenceProvider == null) init();
       Object persProviderId = persistenceProvider.getId(target, lookupEntityManager());
       return String.format("%s:%s", getIdentifierName(target.getClass()), persProviderId);
    }
@@ -83,6 +92,7 @@
 
    private EntityManager lookupEntityManager()
    {
+	  if(entityManager == null) init();
       return entityManager.getValue();
    }
 }

Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java	2012-02-03 11:56:12 UTC (rev 14297)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/IdentifierPolicy.java	2012-02-03 12:03:48 UTC (rev 14298)
@@ -25,7 +25,7 @@
 @Scope(APPLICATION)
 @BypassInterceptors
 @Install(precedence = Install.BUILT_IN)
-public class IdentifierPolicy
+public class IdentifierPolicy implements java.io.Serializable
 {
    private Map<Class,IdentifierStrategy> strategies = new ConcurrentHashMap<Class,IdentifierStrategy>();
    

Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/PermissionMetadata.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/PermissionMetadata.java	2012-02-03 11:56:12 UTC (rev 14297)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/security/permission/PermissionMetadata.java	2012-02-03 12:03:48 UTC (rev 14298)
@@ -17,7 +17,7 @@
  *  
  * @author Shane Bryzak
  */
-public class PermissionMetadata
+public class PermissionMetadata implements java.io.Serializable
 {
    private Map<Class,Boolean> usesActionMask = new HashMap<Class,Boolean>();
    private Map<Class,Map<String,Long>> classActions = new HashMap<Class,Map<String,Long>>();

Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util/AnnotatedBeanProperty.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util/AnnotatedBeanProperty.java	2012-02-03 11:56:12 UTC (rev 14297)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/util/AnnotatedBeanProperty.java	2012-02-03 12:03:48 UTC (rev 14298)
@@ -39,7 +39,7 @@
             return;
          }
       }      
-      
+
       // Then check public fields, in case it's inherited
       for (Field f : cls.getFields())
       {
@@ -51,7 +51,7 @@
             return;
          }
       }
-      
+
       // Then check public methods (we ignore private methods)
       for (Method m : cls.getMethods())
       {
@@ -59,7 +59,7 @@
          {
             this.annotation = m.getAnnotation(annotationClass);
             String methodName = m.getName();
-            
+
             if ( m.getName().startsWith("get") )
             {
                this.name = Introspector.decapitalize( m.getName().substring(3) );
@@ -68,7 +68,7 @@
             {
                this.name = Introspector.decapitalize( m.getName().substring(2) );
             }            
-            
+
             if (this.name != null)
             {
                this.propertyGetter = Reflections.getGetterMethod(cls, this.name);
@@ -83,9 +83,30 @@
                      "Method: " + m + " in class: " + cls);
             }
          }
-      }      
+      }
    }
 
+   public Field getPropertyField() 
+   { 
+      if (propertyField == null) 
+         init(); 
+      return propertyField; 
+   }
+
+   public Method getPropertyGetter() 
+   { 
+      if (propertyGetter == null) 
+         init(); 
+      return propertyGetter; 
+   }
+
+   public Method getPropertySetter() 
+   { 
+      if (propertySetter == null) 
+         init(); 
+      return propertySetter; 
+   }
+
    private void setupFieldProperty(Field propertyField)
    {
       this.propertyField = propertyField;
@@ -98,11 +119,11 @@
    {
       if (isFieldProperty)
       {
-         Reflections.setAndWrap(propertyField, bean, value);         
+         Reflections.setAndWrap(getPropertyField(), bean, value);         
       }
       else
       {
-         Reflections.invokeAndWrap(propertySetter, bean, value);
+         Reflections.invokeAndWrap(getPropertySetter(), bean, value);
       }
    }
    
@@ -110,11 +131,11 @@
    {
       if (isFieldProperty)
       {
-         return Reflections.getAndWrap(propertyField, bean);  
+         return Reflections.getAndWrap(getPropertyField(), bean);  
       }
       else
       {
-         return Reflections.invokeAndWrap(propertyGetter, bean);
+         return Reflections.invokeAndWrap(getPropertyGetter(), bean);
       }
    }
    



More information about the seam-commits mailing list