db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattba...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer RsIterator.java
Date Tue, 01 Jul 2003 17:41:28 GMT
mattbaird    2003/07/01 10:41:28

  Modified:    src/java/org/apache/ojb/broker/core
                        PersistenceBrokerImpl.java
               src/java/org/apache/ojb/odmg/oql oql-ojb.g
               src/java/org/apache/ojb/broker/query QueryByCriteria.java
               src/java/org/apache/ojb/broker/accesslayer RsIterator.java
  Log:
  make this dynamic, not fixed, whoops.
  
  Revision  Changes    Path
  1.21      +2 -2      db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- PersistenceBrokerImpl.java	1 Jul 2003 04:41:19 -0000	1.20
  +++ PersistenceBrokerImpl.java	1 Jul 2003 17:41:26 -0000	1.21
  @@ -1373,7 +1373,7 @@
                       }
                       else if (query instanceof QueryByCriteria)
                       {
  -	                    if (((QueryByCriteria)query).getProjectionAttributeClass().isAssignableFrom(candidate.getClass()))
  +	                    if (((QueryByCriteria)query).getObjectProjectionAttribute()!=null)
   	                    {
   		                    result.ojbAdd(candidate);
   		                    retrievedCount++;
  
  
  
  1.16      +9 -11     db-ojb/src/java/org/apache/ojb/odmg/oql/oql-ojb.g
  
  Index: oql-ojb.g
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/oql/oql-ojb.g,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- oql-ojb.g	1 Jul 2003 04:33:04 -0000	1.15
  +++ oql-ojb.g	1 Jul 2003 17:41:26 -0000	1.16
  @@ -390,23 +390,21 @@
                   } 
                   else 
                   { 
  -                        ClassDescriptor cld = PersistenceBrokerFactory.defaultPersistenceBroker().getClassDescriptor(clazz);
  -
  -                        ObjectReferenceDescriptor ord = null; 
  +                    ClassDescriptor cld = PersistenceBrokerFactory.defaultPersistenceBroker().getClassDescriptor(clazz);
  +					String objectProjectionAttribute = null;
                       for (int i = 0; i < projectionAttrs.length; i++) 
                       { 
                           projectionAttrs[i] = projectionAttrs[i].substring(projectionAttrs[i].indexOf('.')
+ 1); 
  -                                                ord = cld.getObjectReferenceDescriptorByName(projectionAttrs[i]);

  -                                                if (ord != null) 
  -                                                { 
  -                                                        break; 
  -                                                } 
  +                        if (cld.getObjectReferenceDescriptorByName(projectionAttrs[i])
!= null)
  +                        { 
  +								objectProjectionAttribute = projectionAttrs[i];
  +                                break; 
  +                        } 
                       } 
  -                    if (ord != null) 
  +                    if (objectProjectionAttribute != null) 
                       { 
                               query = QueryFactory.newQuery(clazz, criteria, distinct);
  -	       		    query.setProjectionAttributeClass(ord.getItemClass());
  -
  +	       		    		query.setObjectProjectionAttribute(objectProjectionAttribute);
                       } 
                       else 
                       { 
  
  
  
  1.18      +33 -33    db-ojb/src/java/org/apache/ojb/broker/query/QueryByCriteria.java
  
  Index: QueryByCriteria.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/QueryByCriteria.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- QueryByCriteria.java	1 Jul 2003 04:33:05 -0000	1.17
  +++ QueryByCriteria.java	1 Jul 2003 17:41:26 -0000	1.18
  @@ -84,25 +84,25 @@
    * @author Thomas Mahler
    * @version $Id$
    */
  -public class QueryByCriteria extends AbstractQueryImpl 
  +public class QueryByCriteria extends AbstractQueryImpl
   {
       private Criteria m_criteria;
       private boolean m_distinct = false;
       private Map m_pathClasses;
       private Criteria m_havingCriteria;
  -	private Class m_projectionAttributeClass;
  +	private String m_objectProjectionAttribute;
   
       // holding FieldHelper for orderBy and groupBy
       private List m_orderby = null;
       private List m_groupby = null;
  -    
  +
       // list of names of prefetchable relationships
       private List m_prefetchedRelationships = null;
  -    
  +
       private Map m_pathOuterJoin;
  -    
  +
       /**
  -     * handy criteria that can be used to select all instances of 
  +     * handy criteria that can be used to select all instances of
        * a class.
        */
       public static final Criteria CRITERIA_SELECT_ALL = null;
  @@ -114,7 +114,7 @@
       public QueryByCriteria(Class targetClass, Criteria whereCriteria, Criteria havingCriteria,
boolean distinct)
       {
           super (targetClass);
  -        
  +
           setCriteria(whereCriteria);
           setHavingCriteria(havingCriteria);
   
  @@ -250,7 +250,7 @@
        * SqlStatment will use this class when resolving the path.
        * Without this hint SqlStatment will use the base class the
        * relationship points to ie: Article instead of CdArticle.
  -     * Using this method is the same as adding just one hint 
  +     * Using this method is the same as adding just one hint
        *
        * @param the path segment ie: allArticlesInGroup
        * @param the Class ie: CdArticle
  @@ -263,7 +263,7 @@
           pathClasses.add(aClass);
           m_pathClasses.put(aPath, pathClasses);
       }
  -  
  +
       /**
        * Get the a List of Class objects used as hints for a path
        *
  @@ -285,7 +285,7 @@
       public boolean isPathOuterJoin(String aPath)
       {
           Boolean result = (Boolean)getPathOuterJoin().get(aPath);
  -        
  +
           if (result != null)
           {
               return result.booleanValue();
  @@ -321,7 +321,7 @@
       {
           return m_havingCriteria;
       }
  -    
  +
       /**
        * Insert the method's description here.
        * Creation date: (07.02.2001 22:01:55)
  @@ -427,16 +427,16 @@
   	 */
   	public List getGroupBy()
   	{
  -        // BRJ: 
  +        // BRJ:
           // combine data from query and criteria
  -        // TODO: to be removed when Criteria#addGroupBy is removed 
  -        ArrayList temp = new ArrayList();     
  +        // TODO: to be removed when Criteria#addGroupBy is removed
  +        ArrayList temp = new ArrayList();
           temp.addAll(m_groupby);
  -        
  +
           if (getCriteria() != null)
           {
               temp.addAll(getCriteria().getGroupby());
  -        }    
  +        }
   
           return temp;
   	}
  @@ -499,17 +499,17 @@
   	 */
   	public List getOrderBy()
   	{
  -        // BRJ: 
  +        // BRJ:
           // combine data from query and criteria
  -        // TODO: to be removed when Criteria#addOrderBy is removed 
  -        ArrayList temp = new ArrayList();     
  +        // TODO: to be removed when Criteria#addOrderBy is removed
  +        ArrayList temp = new ArrayList();
           temp.addAll(m_orderby);
  -        
  +
           if (getCriteria() != null)
           {
               temp.addAll(getCriteria().getOrderby());
  -        }    
  -        
  +        }
  +
           return temp;
   	}
   
  @@ -526,17 +526,17 @@
   	 */
   	public List getPrefetchedRelationships()
   	{
  -        // BRJ: 
  +        // BRJ:
           // combine data from query and criteria
  -        // TODO: to be removed when Criteria#addPrefetchedRelationship is removed 
  -        ArrayList temp = new ArrayList();     
  +        // TODO: to be removed when Criteria#addPrefetchedRelationship is removed
  +        ArrayList temp = new ArrayList();
           temp.addAll(m_prefetchedRelationships);
  -        
  +
           if (getCriteria() != null)
           {
               temp.addAll(getCriteria().getPrefetchedRelationships());
  -        }    
  -        
  +        }
  +
           return temp;
   	}
   
  @@ -545,13 +545,13 @@
   		return m_pathOuterJoin;
   	}
   
  -	public Class getProjectionAttributeClass()
  +	public String getObjectProjectionAttribute()
   	{
  -		return m_projectionAttributeClass;
  +		return m_objectProjectionAttribute;
   	}
   
  -	public void setProjectionAttributeClass(Class projectionAttributeClass)
  +	public void setObjectProjectionAttribute(String objectProjectionAttribute)
   	{
  -		m_projectionAttributeClass = projectionAttributeClass;
  +		m_objectProjectionAttribute = objectProjectionAttribute;
   	}
   }
  
  
  
  1.38      +3 -3      db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
  
  Index: RsIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- RsIterator.java	1 Jul 2003 04:33:06 -0000	1.37
  +++ RsIterator.java	1 Jul 2003 17:41:27 -0000	1.38
  @@ -254,9 +254,9 @@
                   Object obj = getObjectFromResultSet();
   	            if (m_query instanceof QueryByCriteria)
   	            {
  -		            if (((QueryByCriteria)m_query).getProjectionAttributeClass() != null)
  +		            if (((QueryByCriteria)m_query).getObjectProjectionAttribute() != null)
   		            {
  -			            obj = m_cld.getObjectReferenceDescriptorByName("version").getPersistentField().get(obj);
  +			            obj = m_cld.getObjectReferenceDescriptorByName(((QueryByCriteria)m_query).getObjectProjectionAttribute()).getPersistentField().get(obj);
   		            }
   
   	            }
  
  
  

Mime
View raw message