db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: jakarta-ojb/src/java/org/apache/ojb/broker/metadata CollectionDescriptor.java
Date Mon, 16 Dec 2002 18:18:57 GMT
brj         2002/12/16 10:18:57

  Modified:    src/java/org/apache/ojb/broker/metadata
                        CollectionDescriptor.java
  Log:
  multiple orderby for CollectionDescriptor
  
  Revision  Changes    Path
  1.13      +25 -43    jakarta-ojb/src/java/org/apache/ojb/broker/metadata/CollectionDescriptor.java
  
  Index: CollectionDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/java/org/apache/ojb/broker/metadata/CollectionDescriptor.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CollectionDescriptor.java	8 Nov 2002 13:47:38 -0000	1.12
  +++ CollectionDescriptor.java	16 Dec 2002 18:18:57 -0000	1.13
  @@ -54,9 +54,12 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.ArrayList;
  +import java.util.Collection;
   import java.util.Vector;
   
   
  +
   /**
    * mapping Description for member fields that are Collections
    * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
  @@ -77,6 +80,11 @@
        */
       private String collectionClassName = null;
   
  +    /**
  +     * the Collection of orderby Fields 
  +     */
  +    private Collection m_orderby = new ArrayList();
  +
   
       /**
        * For m:n related Classes this is the indirection table.
  @@ -226,41 +234,27 @@
       }
   
       /**
  -     * Gets the orderBy.
  -     * @return Returns a String
  -     */
  -    public String getOrderBy()
  -    {
  -        return orderBy;
  -    }
  -
  -    /**
  -     * Sets the orderBy.
  -     * @param orderBy The orderBy to set
  -     */
  -    public void setOrderBy(String orderBy)
  -    {
  -        this.orderBy = orderBy;
  -    }
  -
  -    /**
  -     * Gets the orderAscending.
  -     * @return Returns a boolean
  -     */
  -    public boolean isAscending()
  -    {
  -        return ascending;
  +     * Adds a field for orderBy
  +     * @param  fieldName    The field name to be used
  +     * @param  sortAscending    true for ASCENDING, false for DESCENDING
  +     */
  +    public void addOrderBy(String fieldName, boolean sortAscending)
  +    {
  +        if (fieldName != null)
  +        {
  +            m_orderby.add(new FieldHelper(fieldName, sortAscending));
  +        }
       }
  -
  +    
       /**
  -     * Sets the ascending.
  -     * @param ascending The ascending to set
  +     * Returns the orderby Collection of Fields.
  +     * @return Collection
        */
  -    public void setAscending(boolean ascending)
  +    public Collection getOrderBy()
       {
  -        this.ascending = ascending;
  +        return m_orderby;
       }
  -
  +        
   	/**
   	 * returns true if this is a lazy Collection.
   	 * @return Returns a boolean
  @@ -321,18 +315,6 @@
   		// element-class-ref
    		result       += "        " + tags.getAttribute(ITEMS_CLASS,this.getItemClassName())
+ eol;
    		
  -		// orderby is optional
  -		if (getOrderBy() != null)
  -		{
  -			result += "        " + tags.getAttribute(RepositoryTags.ORDERBY, getOrderBy()) + eol;

  -		}
  -		
  -		// sort is optional
  -		if (! isAscending())
  -		{
  -			result += "        " + tags.getAttribute(RepositoryTags.SORT, "DESC") + eol;
  -		}
  -
   		// indirection-table is optional
   		if (isMtoNRelation())
   		{
  
  
  

Mime
View raw message