portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity PortletEntityAccessComponentImpl.java
Date Wed, 31 Mar 2004 19:41:54 GMT
taylor      2004/03/31 11:41:54

  Modified:    components/registry/src/java/org/apache/jetspeed/components/portletentity
                        PortletEntityAccessComponentImpl.java
  Log:
  refactoring the code a bit to make common a primitive function or creating entity ids
  
  PR:
  Obtained from:
  Submitted by:	
  Reviewed by:	
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.13      +22 -18    jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityAccessComponentImpl.java
  
  Index: PortletEntityAccessComponentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityAccessComponentImpl.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PortletEntityAccessComponentImpl.java	31 Mar 2004 19:35:11 -0000	1.12
  +++ PortletEntityAccessComponentImpl.java	31 Mar 2004 19:41:54 -0000	1.13
  @@ -175,29 +175,16 @@
   			{
                   PortletEntity realEntity = ((StoreablePortletEntityDelegate)portletEntity).getPortletEntity();
   				store.lockForWrite(realEntity);
  -                store.getTransaction().checkpoint();
  -                
  -                if (realEntity instanceof PortletEntityImpl)
  -                {
  -                    PortletEntityImpl impl = (PortletEntityImpl)realEntity;
  -                    if (impl.getId() == null)
  -                    {
  -                        System.out.println("setting oid = " + impl.getOid());         
          
  -                        impl.setId(new Long(impl.getOid()).toString());
  -                        store.lockForWrite(realEntity);
  -                        store.getTransaction().checkpoint();                        
  -                    }
  -                }                
  +                store.getTransaction().checkpoint();                
  +                autoCreateEntityId(realEntity, store);
   			}            
   			else
   			{
   				store.lockForWrite(portletEntity);
                   store.getTransaction().checkpoint();
  -                portletEntity = (PortletEntity)store.getObjectByIdentity(portletEntity);
               
  +                autoCreateEntityId(portletEntity, store);                
   			}
  -            
  -            
  -
  +                        
           }
           catch (Exception e)
           {
  @@ -210,6 +197,23 @@
   
       }
   
  +    
  +    private void autoCreateEntityId(PortletEntity realEntity, PersistenceStore store)
  +        throws Exception
  +    {
  +        if (realEntity instanceof PortletEntityImpl)
  +        {
  +            PortletEntityImpl impl = (PortletEntityImpl)realEntity;
  +            if (impl.getId() == null)
  +            {
  +                System.out.println("setting oid = " + impl.getOid());                 
  
  +                impl.setId(new Long(impl.getOid()).toString());
  +                store.lockForWrite(realEntity);
  +                store.getTransaction().checkpoint();                        
  +            }
  +        }                        
  +    }
  +    
       /**
        * Checks to see if the <code>store</code>'s current transaction
        * needs to be started or not.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message