taylor      2004/03/31 11:35:11

  Modified:    
components/registry/src/java/org/apache/jetspeed/components/portletentity
                        PortletEntityImpl.java
                        PortletEntityAccessComponentImpl.java
  Log:
  fix to entitiy component to use the oid as id ifits not set when creating new 
entities

  s

  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.5       +7 -2      
jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
  
  Index: PortletEntityImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PortletEntityImpl.java    15 Mar 2004 19:34:28 -0000      1.4
  +++ PortletEntityImpl.java    31 Mar 2004 19:35:11 -0000      1.5
  @@ -54,6 +54,11 @@
           return id;
       }
   
  +    public long getOid()
  +    {
  +        return oid;
  +    }
  +    
       public void setId(String id)
       {
           this.id = JetspeedObjectID.createFromString(id);
  @@ -70,7 +75,7 @@
       private PortletEntity modifiedObject = null;
   
       private PortletDefinitionComposite portletDefinition = null;
  -     
  +         
        /**
         *  
         * <p>
  
  
  
  1.12      +22 -6     
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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PortletEntityAccessComponentImpl.java     25 Mar 2004 21:40:52 -0000      1.11
  +++ PortletEntityAccessComponentImpl.java     31 Mar 2004 19:35:11 -0000      1.12
  @@ -171,17 +171,33 @@
           try
           {
               prepareTransaction(store);
  -            
                        if (portletEntity instanceof StoreablePortletEntityDelegate)
                        {
  -                         PortletEntity realEntity = 
((StoreablePortletEntityDelegate)portletEntity).getPortletEntity();
  +                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();                        
  +                    }
  +                }                
                        }            
                        else
                        {
                                store.lockForWrite(portletEntity);
  +                store.getTransaction().checkpoint();
  +                portletEntity = 
(PortletEntity)store.getObjectByIdentity(portletEntity);                
                        }
  -            store.getTransaction().checkpoint();
  +            
  +            
  +
           }
           catch (Exception e)
           {
  @@ -215,8 +231,8 @@
       
       protected StoreablePortletEntityDelegate wrapEntity(PortletEntityImpl entity)
       {
  -             List list =(List) 
((PreferenceSetImpl)entity.getPreferenceSet()).getInnerCollection();
  -             return new StoreablePortletEntityDelegate(entity, entity, list, 
getPersistenceStore());
  +        List list =(List) 
((PreferenceSetImpl)entity.getPreferenceSet()).getInnerCollection();
  +        return new StoreablePortletEntityDelegate(entity, entity, list, 
getPersistenceStore());
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to