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/plugin/src/java/org/apache/jetspeed/persistence/impl AbstractOJBPersistencePlugin.java OjbLookupCriteria.java
Date Mon, 08 Dec 2003 18:39:16 GMT
taylor      2003/12/08 10:39:16

  Modified:    plugin/src/java/org/apache/jetspeed/persistence
                        LookupCriteria.java PersistencePlugin.java
               plugin/src/java/org/apache/jetspeed/persistence/impl
                        AbstractOJBPersistencePlugin.java
                        OjbLookupCriteria.java
  Log:
  Enhancements to the Persistence Plugin needed for User Prefs implementation
  
  Revision  Changes    Path
  1.2       +8 -1      jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/LookupCriteria.java
  
  Index: LookupCriteria.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/LookupCriteria.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LookupCriteria.java	13 Aug 2003 21:21:28 -0000	1.1
  +++ LookupCriteria.java	8 Dec 2003 18:39:16 -0000	1.2
  @@ -53,6 +53,8 @@
    */
   package org.apache.jetspeed.persistence;
   
  +import java.util.Collection;
  +
   import org.apache.ojb.broker.query.Criteria;
   
   /**
  @@ -83,6 +85,10 @@
        */
       public abstract void addGreaterThan(String arg0, Object arg1);
       /**
  +     * @see org.apache.ojb.broker.query.Criteria#addIn(java.lang.String, java.util.Collection)
  +     */      
  +    public abstract void addIn(String attribute, Collection values);
  +    /**
        * @see org.apache.ojb.broker.query.Criteria#addLessOrEqualThan(java.lang.String, java.lang.Object)
        */
       public abstract void addLessOrEqualThan(String arg0, Object arg1);
  @@ -118,4 +124,5 @@
        * @see org.apache.ojb.broker.query.Criteria#addOrderByDescending(java.lang.String)
        */
       public abstract void addOrderByDescending(String arg0);
  +
   }
  
  
  
  1.5       +24 -17    jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/PersistencePlugin.java
  
  Index: PersistencePlugin.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/PersistencePlugin.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PersistencePlugin.java	26 Nov 2003 20:53:35 -0000	1.4
  +++ PersistencePlugin.java	8 Dec 2003 18:39:16 -0000	1.5
  @@ -88,27 +88,34 @@
       /** Constant that specifies a transaction lock level of read */
       int LOCK_LEVEL_READ = 1;
       
  -	void beginTransaction() throws TransactionStateException;
  +    void beginTransaction() throws TransactionStateException;
   	
  -	void commitTransaction() throws TransactionStateException;
  +    void commitTransaction() throws TransactionStateException;
   	
  -	void prepareForDelete(Object obj) throws TransactionStateException;
  +    void prepareForDelete(Object obj) throws TransactionStateException;
   	
  -	void prepareForUpdate(Object obj) throws TransactionStateException;
  +    void prepareForUpdate(Object obj) throws TransactionStateException;
   	
  -	void rollbackTransaction() throws TransactionStateException;
  +    void rollbackTransaction() throws TransactionStateException;
   	
  -	/**
  -	 * Takes an object that was modified outside of the current transaction
  -	 * and makes it so that it appears to have been modified within the 
  -	 * current transaction.
  -	 * @param obj Object modified outside of a transaction
  -	 * @return An object the same type, whose object graph match those
  -	 * of the <code>obj</code> argument but is consistent within the
  -	 * current transaction.
  -	 * @throws TransactionStateException
  -	 */
  -	Object markDirty(Object obj) throws TransactionStateException;
  +    /**
  +     * Takes an object that was modified outside of the current transaction
  +     * and makes it so that it appears to have been modified within the 
  +     * current transaction.
  +     * @param obj Object modified outside of a transaction
  +     * @return An object the same type, whose object graph match those
  +     * of the <code>obj</code> argument but is consistent within the
  +     * current transaction.
  +     * @throws TransactionStateException
  +     */
  +    Object markDirty(Object obj) throws TransactionStateException;
  +    
  +    /**
  +     * Deletes all objects matching the query from the underlying persistence system.
  +     * 
  +     * @param query Query object used to identify the object to be removed from persistence.
  +     */
  +    void deleteByQuery(Object query);
   
       Collection getCollectionByQuery(Class clazz, Object query);
       
  
  
  
  1.8       +24 -0     jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/AbstractOJBPersistencePlugin.java
  
  Index: AbstractOJBPersistencePlugin.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/AbstractOJBPersistencePlugin.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractOJBPersistencePlugin.java	26 Nov 2003 20:53:35 -0000	1.7
  +++ AbstractOJBPersistencePlugin.java	8 Dec 2003 18:39:16 -0000	1.8
  @@ -106,6 +106,30 @@
       private String overrideDefaultJcd;
   
       /**
  +     * @see org.apache.jetspeed.services.perisistence.PersistencePlugin#deleteByQuery(java.lang.Object)
  +     */
  +    public void deleteByQuery(Object query)
  +    {
  +        PersistenceBroker pb = null;
  +        try
  +        {
  +            Query useQuery = (Query) query;
  +            pb = getBroker();
  +            
  +            pb.deleteByQuery(useQuery);
  +        }
  +        catch (Throwable e)
  +        {
  +            throw failure("Failed to delete by query.", e);
  +        }
  +        finally
  +        {
  +            // always release the broker
  +            releaseBroker(pb);
  +        }
  +    }
  +
  +    /**
        * @return <code>true</code> if the <code>obj</code> is
        * of type AbstractOJBPersistencePlugin and the name defined
        * within the plugin configuration for <code>obj</code> is the
  
  
  
  1.2       +11 -1     jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/OjbLookupCriteria.java
  
  Index: OjbLookupCriteria.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/plugin/src/java/org/apache/jetspeed/persistence/impl/OjbLookupCriteria.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OjbLookupCriteria.java	13 Aug 2003 21:21:29 -0000	1.1
  +++ OjbLookupCriteria.java	8 Dec 2003 18:39:16 -0000	1.2
  @@ -53,6 +53,8 @@
    */
   package org.apache.jetspeed.persistence.impl;
   
  +import java.util.Collection;
  +
   import org.apache.jetspeed.persistence.LookupCriteria;
   import org.apache.ojb.broker.query.Criteria;
   
  @@ -104,7 +106,15 @@
       {
           ojbCriteria.addGreaterThan(arg0, arg1);
       }
  -
  +    
  +    /**
  +     * @see org.apache.ojb.broker.query.Criteria#addIn(java.lang.String, java.util.Collection)
  +     */      
  +    public void addIn(String arg0, Collection arg1)
  +    {
  +        ojbCriteria.addIn(arg0, arg1);
  +    }
  +    
       /**
        * @see org.apache.ojb.broker.query.Criteria#addLessOrEqualThan(java.lang.String, java.lang.Object)
        */
  
  
  

---------------------------------------------------------------------
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