db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/odmg NarrowTransaction.java
Date Sat, 19 Jun 2004 09:21:38 GMT
arminw      2004/06/19 02:21:38

  Modified:    src/java/org/apache/ojb/broker/core/proxy
                        IndirectionHandler.java
                        IndirectionHandlerDefaultImpl.java
                        ProxyConfiguration.java
               src/java/org/apache/ojb/broker/metadata
                        ArgumentDescriptor.java
               src/java/org/apache/ojb/broker/query LikeCriteria.java
                        OJBSearchFilter.java QueryFactory.java
                        SearchFilter.java UserAlias.java
               src/java/org/apache/ojb/broker/util BrokerHelper.java
               src/java/org/apache/ojb/odmg NarrowTransaction.java
  Log:
  fix javadoc
  
  Revision  Changes    Path
  1.2       +5 -5      db-ojb/src/java/org/apache/ojb/broker/core/proxy/IndirectionHandler.java
  
  Index: IndirectionHandler.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/IndirectionHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IndirectionHandler.java	9 Apr 2004 13:22:29 -0000	1.1
  +++ IndirectionHandler.java	19 Jun 2004 09:21:37 -0000	1.2
  @@ -99,11 +99,11 @@
        * thrown by this method that is not assignable to any of the
        * exception types declared in the <code>throws</code> clause of
        * the interface method, then an
  -     * {@link UndeclaredThrowableException} containing the
  +     * {@link java.lang.reflect.UndeclaredThrowableException} containing the
        * exception that was thrown by this method will be thrown by the
        * method invocation on the proxy instance.
        *
  -     * @see UndeclaredThrowableException
  +     * @see java.lang.reflect.UndeclaredThrowableException
        */
       Object invoke(Object proxy, Method method, Object[] args);
   
  @@ -133,14 +133,14 @@
       /**
        * Adds a materialization listener.
        * 
  -     * @param listener The listener to add
  +     * @param l The listener to add
        */
       void addListener(MaterializationListener l);
   
       /**
        * Removes a materialization listener.
        * 
  -     * @param listener The listener to remove
  +     * @param l The listener to remove
        */
       void removeListener(MaterializationListener l);
   }
  
  
  
  1.6       +3 -3      db-ojb/src/java/org/apache/ojb/broker/core/proxy/IndirectionHandlerDefaultImpl.java
  
  Index: IndirectionHandlerDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/IndirectionHandlerDefaultImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- IndirectionHandlerDefaultImpl.java	10 Jun 2004 22:49:53 -0000	1.5
  +++ IndirectionHandlerDefaultImpl.java	19 Jun 2004 09:21:37 -0000	1.6
  @@ -268,11 +268,11 @@
        * thrown by this method that is not assignable to any of the
        * exception types declared in the <code>throws</code> clause of
        * the interface method, then an
  -     * {@link UndeclaredThrowableException} containing the
  +     * {@link java.lang.reflect.UndeclaredThrowableException} containing the
        * exception that was thrown by this method will be thrown by the
        * method invocation on the proxy instance.
        *
  -     * @see UndeclaredThrowableException
  +     * @see java.lang.reflect.UndeclaredThrowableException
        */
       public Object invoke(Object proxy, Method method, Object[] args)
       {
  
  
  
  1.2       +3 -3      db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyConfiguration.java
  
  Index: ProxyConfiguration.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/proxy/ProxyConfiguration.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProxyConfiguration.java	9 Apr 2004 13:22:29 -0000	1.1
  +++ ProxyConfiguration.java	19 Jun 2004 09:21:37 -0000	1.2
  @@ -32,7 +32,7 @@
       Class getIndirectionHandlerClass();
   
       /**
  -     * Returns the collection proxy class for collection classes that implement the {@link java.util.List)
  +     * Returns the collection proxy class for collection classes that implement the {@link java.util.List}
        * interface.
        * 
        * @return The proxy class
  @@ -41,7 +41,7 @@
       Class getListProxyClass();
   
       /**
  -     * Returns the collection proxy class for collection classes that implement the {@link java.util.Set)
  +     * Returns the collection proxy class for collection classes that implement the {@link java.util.Set}
        * interface.
        * 
        * @return The proxy class
  @@ -51,7 +51,7 @@
   
       /**
        * Returns the collection proxy class for generic collection classes that implement the
  -     * {@link java.util.Collection) interface.
  +     * {@link java.util.Collection} interface.
        * 
        * @return The proxy class
        * @see org.apache.ojb.broker.core.proxy.ProxyFactory#setCollectionProxyClass(Class)
  
  
  
  1.8       +1 -1      db-ojb/src/java/org/apache/ojb/broker/metadata/ArgumentDescriptor.java
  
  Index: ArgumentDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ArgumentDescriptor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  
  
  
  1.10      +2 -2      db-ojb/src/java/org/apache/ojb/broker/query/LikeCriteria.java
  
  Index: LikeCriteria.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/LikeCriteria.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- LikeCriteria.java	22 May 2004 08:37:23 -0000	1.9
  +++ LikeCriteria.java	19 Jun 2004 09:21:37 -0000	1.10
  @@ -49,7 +49,7 @@
   	 * @param anAttribute
   	 * @param aValue
   	 * @param aClause
  -	 * @param aUserAlias
  +	 * @param anAlias
   	 */
   	public LikeCriteria(Object anAttribute, Object aValue, String aClause, UserAlias anAlias)
   	{
  
  
  
  1.5       +587 -587  db-ojb/src/java/org/apache/ojb/broker/query/OJBSearchFilter.java
  
  Index: OJBSearchFilter.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/OJBSearchFilter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- OJBSearchFilter.java	4 Apr 2004 23:53:36 -0000	1.4
  +++ OJBSearchFilter.java	19 Jun 2004 09:21:37 -0000	1.5
  @@ -1,5 +1,5 @@
  -// David Forslund agreed to put this stuff under APache licence !
  -package org.apache.ojb.broker.query;
  +// David Forslund agreed to put this stuff under APache licence !
  +package org.apache.ojb.broker.query;
   
   /* Copyright 2002-2004 The Apache Software Foundation
    *
  @@ -15,588 +15,588 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -
  -import java.util.Enumeration;
  -import java.util.Hashtable;
  -import java.util.Vector;
  -
  -/**
  - * OJB Search Filter Class for ObJectRelationalBridge O/R mapping tool
  - *
  - * This class builds a search filter tree, specifing how names and
  - * values are to be compared when searching a database.
  - * This extends SearchFilter and implements the Convert method
  - * that produces the search filter string for the SQL database
  - *
  - * @author koenig
  - * @version $Revision$ $Date$
  - */
  -public class OJBSearchFilter extends SearchFilter
  -{
  -    Criteria criteria = new Criteria();
  -
  -    /**
  -     * Constructors are not needed, as the base class has a default constructor.
  -     *
  -     */
  -
  -    /**
  -     * Change the search filter to one that specifies an element to
  -     * match or not match one of a list of values.
  -     * The old search filter is deleted.
  -     *
  -     * @param ElementName is the name of the element to be matched
  -     * @param values is a vector of possible matches
  -     * @param oper is the IN or NOT_IN operator to indicate how to matche
  -     */
  -    public void matchList(String elementName, Vector values, int oper)
  -    {
  -
  -        // Delete the old search criteria
  -        criteria = new Criteria();
  -
  -        if (oper != NOT_IN)
  -        {
  -            for (int i = 0; i < values.size(); i++)
  -            {
  -                Criteria tempCrit = new Criteria();
  -
  -                tempCrit.addEqualTo(elementName, values.elementAt(i));
  -                criteria.addOrCriteria(tempCrit);
  -            }
  -        }
  -        else
  -        {
  -            for (int i = 0; i < values.size(); i++)
  -            {
  -                criteria.addNotEqualTo(elementName, values.elementAt(i));
  -            }
  -        }
  -    }
  -
  -    /**
  -     * Change the search filter to one that specifies an element to not
  -     * match one of a list of values.
  -     * The old search filter is deleted.
  -     *
  -     * @param ElementName is the name of the element to be matched
  -     * @param values is an array of possible matches
  -     * @param oper is the IN or NOT_IN operator to indicate how to matche
  -     */
  -    public void matchList(String elementName, String[] values, int oper)
  -    {
  -
  -        // see also matchList(String elementName, Vector values, int oper)
  -        // Delete the old search criteria
  -        criteria = new Criteria();
  -
  -        if (oper != NOT_IN)
  -        {
  -            for (int i = 0; i < values.length; i++)
  -            {
  -                Criteria tempCrit = new Criteria();
  -
  -                tempCrit.addEqualTo(elementName, values[i]);
  -                criteria.addOrCriteria(tempCrit);
  -            }
  -        }
  -        else
  -        {
  -            for (int i = 0; i < values.length; i++)
  -            {
  -                criteria.addNotEqualTo(elementName, values[i]);
  -            }
  -        }
  -    }
  -
  -    /**
  -     * Change the search filter to one that specifies an element to not
  -     * match one of a list of integer values.
  -     * The old search filter is deleted.
  -     *
  -     * @param ElementName is the name of the element to be matched
  -     * @param values is an array of possible integer matches
  -     * @param oper is the IN or NOT_IN operator to indicate how to matche
  -     */
  -    public void matchList(String elementName, int[] values, int oper)
  -    {
  -
  -        // see also matchList(String elementName, Vector values, int oper)
  -        // Delete the old search criteria
  -        criteria = new Criteria();
  -
  -        if (oper != NOT_IN)
  -        {
  -            for (int i = 0; i < values.length; i++)
  -            {
  -                Criteria tempCrit = new Criteria();
  -
  -                tempCrit.addEqualTo(elementName, new Integer(values[i]));
  -                criteria.addOrCriteria(tempCrit);
  -            }
  -        }
  -        else
  -        {
  -            for (int i = 0; i < values.length; i++)
  -            {
  -                criteria.addNotEqualTo(elementName, new Integer(values[i]));
  -            }
  -        }
  -    }
  -
  -    /**
  -     * Change the search filter to one that specifies an element to not
  -     * match one single value.
  -     * The old search filter is deleted.
  -     *
  -     * @param ElementName is the name of the element to be matched
  -     * @param value is the value to not be matched
  -     * @param oper is the IN or NOT_IN operator to indicate how to matche
  -     */
  -    public void matchValue(String elementName, String value, int oper)
  -    {
  -
  -        // Delete the old search criteria
  -        criteria = new Criteria();
  -
  -        if (oper != NOT_IN)
  -        {
  -            criteria.addEqualTo(elementName, value);
  -        }
  -        else
  -        {
  -            criteria.addNotEqualTo(elementName, value);
  -        }
  -    }
  -
  -    /**
  -     * -----------------------------------------------------------
  -     * @param ElementName
  -     * @param value
  -     * @param oper
  -     */
  -    public void matchValue(String elementName, int value, int oper)
  -    {
  -
  -        // Delete the old search criteria
  -        criteria = new Criteria();
  -
  -        if (oper != NOT_IN)
  -        {
  -            criteria.addEqualTo(elementName, new Integer(value));
  -        }
  -        else
  -        {
  -            criteria.addNotEqualTo(elementName, new Integer(value));
  -        }
  -    }
  -
  -    /**
  -     * Change the search filter to one that compares an element name to a value.
  -     * The old search filter is deleted.
  -     *
  -     * @param ElementName is the name of the element to be tested
  -     * @param value is the value to be compared against
  -     * @param oper is the binary comparison operator to be used
  -     * @exception gov.lanl.Database.DBException
  -     */
  -    public void compareFilter(String elementName, String value,
  -                              int oper) throws DBException
  -    {
  -
  -        // Delete the old search criteria
  -        criteria = new Criteria();
  -
  -        // If this is not a binary operator, throw an exception
  -        if ((oper & BINARY_OPER_MASK) == 0)
  -        {
  -            throw new DBException();
  -        }
  -
  -        switch (oper)
  -        {
  -
  -            case LIKE:
  -                {
  -                    criteria.addLike(elementName, value);
  -
  -                    break;
  -                }
  -
  -            case EQUAL:
  -                {
  -                    criteria.addEqualTo(elementName, value);
  -
  -                    break;
  -                }
  -
  -            case NOT_EQUAL:
  -                {
  -                    criteria.addNotEqualTo(elementName, value);
  -
  -                    break;
  -                }
  -
  -            case LESS_THAN:
  -                {
  -                    criteria.addLessThan(elementName, value);
  -
  -                    break;
  -                }
  -
  -            case GREATER_THAN:
  -                {
  -                    criteria.addGreaterThan(elementName, value);
  -
  -                    break;
  -                }
  -
  -            case GREATER_EQUAL:
  -                {
  -                    criteria.addGreaterOrEqualThan(elementName, value);
  -
  -                    break;
  -                }
  -
  -            case LESS_EQUAL:
  -                {
  -                    criteria.addLessOrEqualThan(elementName, value);
  -
  -                    break;
  -                }
  -
  -            default:
  -                {
  -                    throw new DBException("Unsupported binary operation in OJBSearchFilter!");
  -                }
  -        }
  -    }
  -
  -    /**
  -     * Change the search filter to one that specifies a set of elements and their values
  -     * that must match, and the operator to use to combine the elements.
  -     * Each key is compared for an equal match to the value, and all
  -     * comparisons are combined by the specified logical operator (OR or AND).
  -     * The old search filter is deleted.
  -     *
  -     * @param Elements is a hashtable holding key-value pairs
  -     * @param combine_op is the logical operator to be used to combine the comparisons
  -     * @param compare_op is the binary operator to be used for the comparisons
  -     * @exception gov.lanl.Utilty.DBException
  -     */
  -    public void matchSet(Hashtable elements, int combine_op,
  -                         int compare_op) throws DBException
  -    {
  -
  -        // Delete the old search criteria
  -        criteria = new Criteria();
  -
  -        // If compare_op is not a binary operator, throw an exception
  -        if ((compare_op & BINARY_OPER_MASK) == 0)
  -        {
  -            throw new DBException();
  -        }
  -
  -        if (combine_op == AND)
  -        {
  -            // combine all value pairs by an AND
  -
  -            // For each of the elements in the hashtable, create a comparison node for the match
  -            for (Enumeration e = elements.keys(); e.hasMoreElements();)
  -            {
  -
  -                // Get the element name from the enumerator
  -                // and its value
  -                String elementName = (String) e.nextElement();
  -                String elementValue = (String) elements.get(elementName);
  -
  -                switch (compare_op)
  -                {
  -
  -                    case LIKE:
  -                        {
  -                            criteria.addLike(elementName, elementValue);
  -
  -                            break;
  -                        }
  -
  -                    case EQUAL:
  -                        {
  -                            criteria.addEqualTo(elementName, elementValue);
  -
  -                            break;
  -                        }
  -
  -                    case NOT_EQUAL:
  -                        {
  -                            criteria.addNotEqualTo(elementName, elementValue);
  -
  -                            break;
  -                        }
  -
  -                    case LESS_THAN:
  -                        {
  -                            criteria.addLessThan(elementName, elementValue);
  -
  -                            break;
  -                        }
  -
  -                    case GREATER_THAN:
  -                        {
  -                            criteria.addGreaterThan(elementName, elementValue);
  -
  -                            break;
  -                        }
  -
  -                    case GREATER_EQUAL:
  -                        {
  -                            criteria.addGreaterOrEqualThan(elementName, elementValue);
  -
  -                            break;
  -                        }
  -
  -                    case LESS_EQUAL:
  -                        {
  -                            criteria.addLessOrEqualThan(elementName, elementValue);
  -
  -                            break;
  -                        }
  -
  -                    default:
  -                        {
  -                            throw new DBException("Unsupported binary operation in OJBSearchFilter!");
  -                        }
  -                }						   // end of switch
  -            }							   // end of for
  -        }
  -        else if (combine_op == OR)
  -        {
  -            // combine all value pairs by an OR
  -            // For each of the elements in the hashtable, create a comparison node for the match
  -            for (Enumeration e = elements.keys(); e.hasMoreElements();)
  -            {
  -
  -                // Get the element name from the enumerator
  -                // and its value
  -                String elementName = (String) e.nextElement();
  -                String elementValue = (String) elements.get(elementName);
  -
  -                switch (compare_op)
  -                {
  -
  -                    case LIKE:
  -                        {
  -                            Criteria tempCrit = new Criteria();
  -
  -                            tempCrit.addLike(elementName, elementValue);
  -                            criteria.addOrCriteria(tempCrit);
  -
  -                            break;
  -                        }
  -
  -                    case EQUAL:
  -                        {
  -                            Criteria tempCrit = new Criteria();
  -
  -                            tempCrit.addEqualTo(elementName, elementValue);
  -                            criteria.addOrCriteria(tempCrit);
  -
  -                            break;
  -                        }
  -
  -                    case NOT_EQUAL:
  -                        {
  -                            Criteria tempCrit = new Criteria();
  -
  -                            tempCrit.addNotEqualTo(elementName, elementValue);
  -                            criteria.addOrCriteria(tempCrit);
  -
  -                            break;
  -                        }
  -
  -                    case LESS_THAN:
  -                        {
  -                            Criteria tempCrit = new Criteria();
  -
  -                            tempCrit.addLessThan(elementName, elementValue);
  -                            criteria.addOrCriteria(tempCrit);
  -
  -                            break;
  -                        }
  -
  -                    case GREATER_THAN:
  -                        {
  -                            Criteria tempCrit = new Criteria();
  -
  -                            tempCrit.addGreaterThan(elementName, elementValue);
  -                            criteria.addOrCriteria(tempCrit);
  -
  -                            break;
  -                        }
  -
  -                    case GREATER_EQUAL:
  -                        {
  -                            Criteria tempCrit = new Criteria();
  -
  -                            tempCrit.addGreaterOrEqualThan(elementName, elementValue);
  -                            criteria.addOrCriteria(tempCrit);
  -
  -                            break;
  -                        }
  -
  -                    case LESS_EQUAL:
  -                        {
  -                            Criteria tempCrit = new Criteria();
  -
  -                            tempCrit.addLessOrEqualThan(elementName, elementValue);
  -                            criteria.addOrCriteria(tempCrit);
  -
  -                            break;
  -                        }
  -
  -                    default:
  -                        {
  -                            throw new DBException("Unsupported binary operation in OJBSearchFilter!");
  -                        }
  -                }					   // end of switch
  -            }						   // end of for
  -
  -        }
  -        else
  -        {
  -
  -            // combine_op is not a logical operator, throw an exception
  -            throw new DBException();
  -        }
  -    }
  -
  -    /**
  -     * Change the search filter to one that specifies a set of elements and their values
  -     * that must match, and the operator to use to combine the elements.
  -     * Each element name is compared for an equal match to the value, and all
  -     * comparisons are combined by the specified logical operator (OR or AND).
  -     * The old search filter is deleted.
  -     *
  -     * @param elementNames is an array of names of elements to be tested
  -     * @param elementValues is an array of values for the corresponding element
  -     * @param oper is the logical operator to be used to combine the comparisons
  -     * @exception gov.lanl.Database.DBException
  -     */
  -    public void matchSet(String[] elementNames, String[] elementValues,
  -                         int op) throws DBException
  -    {
  -
  -        // Delete the old search criteria
  -        criteria = new Criteria();
  -
  -        if (op == OR)
  -        {
  -            // For each of the elements in the array, create a leaf node for the match
  -            for (int i = 0; i < elementNames.length; i++)
  -            {
  -                Criteria tempCrit = new Criteria();
  -
  -                tempCrit.addEqualTo(elementNames[i], elementValues[i]);
  -                criteria.addOrCriteria(tempCrit);
  -            }
  -        }
  -        else if (op == AND)
  -        {
  -            for (int i = 0; i < elementNames.length; i++)
  -            {
  -                criteria.addEqualTo(elementNames[i], elementValues[i]);
  -            }
  -        }
  -        else
  -        {
  -            throw new DBException();
  -        }
  -    }
  -
  -    /**
  -     * Combine other search filters with this one, using the specific operator.
  -     *
  -     * @param new_filters is a vector of SearchFilter classes to be combined
  -     * @param op is the logical operator to be used to combine the filters
  -     * @exception gov.lanl.Database.DBException
  -     */
  -    public void combine(Vector new_filters, int op) throws DBException
  -    {
  -        for (Enumeration elems = new_filters.elements(); elems.hasMoreElements();)
  -        {
  -            SearchFilter filter = (SearchFilter) elems.nextElement();
  -
  -            combine(filter, op);
  -        }
  -    }
  -
  -    /**
  -     * Combine one other search filters with this one, using the specific operator.
  -     *
  -     * @param new_filter is the SearchFilter class to be combined
  -     * @param op is the logical operator to be used to combine the filters
  -     * @exception gov.lanl.Database.DBException
  -     */
  -    public void combine(SearchFilter new_filter, int op) throws DBException
  -    {
  -
  -        // cast down to OJBSearchFilter
  -        OJBSearchFilter ojbFilter = (OJBSearchFilter) new_filter;
  -
  -        switch (op)
  -        {
  -
  -            case OR:
  -                {
  -                    criteria.addOrCriteria(ojbFilter.getCriteria());
  -                    break;
  -                }
  -
  -            case AND:
  -                {
  -                    criteria.addAndCriteria(ojbFilter.getCriteria());
  -                    break;
  -                }
  -
  -            default:
  -                {
  -                    throw new DBException();
  -                }
  -        }
  -    }
  -
  -    /**
  -     * Converts this search filter into a search string
  -     * Note:
  -     * ObJectRelationalBridge can't parse a SQL string yet, the functionality
  -     * is therefor not implemented!
  -     */
  -
  -    /**
  -     * -----------------------------------------------------------
  -     * @return
  -     */
  -    public String toString()
  -    {
  -
  -        // return "";
  -        return criteria.toString();
  -    }
  -
  -    /**
  -     * Returns the search critera
  -     *
  -     */
  -
  -    /**
  -     * -----------------------------------------------------------
  -     * @return
  -     */
  -    protected Criteria getCriteria()
  -    {
  -
  -        // return the search criteria
  -        return criteria;
  -    }
  -
  -}
  +
  +import java.util.Enumeration;
  +import java.util.Hashtable;
  +import java.util.Vector;
  +
  +/**
  + * OJB Search Filter Class for ObJectRelationalBridge O/R mapping tool
  + *
  + * This class builds a search filter tree, specifing how names and
  + * values are to be compared when searching a database.
  + * This extends SearchFilter and implements the Convert method
  + * that produces the search filter string for the SQL database
  + *
  + * @author koenig
  + * @version $Revision$ $Date$
  + */
  +public class OJBSearchFilter extends SearchFilter
  +{
  +    Criteria criteria = new Criteria();
  +
  +    /**
  +     * Constructors are not needed, as the base class has a default constructor.
  +     *
  +     */
  +
  +    /**
  +     * Change the search filter to one that specifies an element to
  +     * match or not match one of a list of values.
  +     * The old search filter is deleted.
  +     *
  +     * @param elementName is the name of the element to be matched
  +     * @param values is a vector of possible matches
  +     * @param oper is the IN or NOT_IN operator to indicate how to matche
  +     */
  +    public void matchList(String elementName, Vector values, int oper)
  +    {
  +
  +        // Delete the old search criteria
  +        criteria = new Criteria();
  +
  +        if (oper != NOT_IN)
  +        {
  +            for (int i = 0; i < values.size(); i++)
  +            {
  +                Criteria tempCrit = new Criteria();
  +
  +                tempCrit.addEqualTo(elementName, values.elementAt(i));
  +                criteria.addOrCriteria(tempCrit);
  +            }
  +        }
  +        else
  +        {
  +            for (int i = 0; i < values.size(); i++)
  +            {
  +                criteria.addNotEqualTo(elementName, values.elementAt(i));
  +            }
  +        }
  +    }
  +
  +    /**
  +     * Change the search filter to one that specifies an element to not
  +     * match one of a list of values.
  +     * The old search filter is deleted.
  +     *
  +     * @param elementName is the name of the element to be matched
  +     * @param values is an array of possible matches
  +     * @param oper is the IN or NOT_IN operator to indicate how to matche
  +     */
  +    public void matchList(String elementName, String[] values, int oper)
  +    {
  +
  +        // see also matchList(String elementName, Vector values, int oper)
  +        // Delete the old search criteria
  +        criteria = new Criteria();
  +
  +        if (oper != NOT_IN)
  +        {
  +            for (int i = 0; i < values.length; i++)
  +            {
  +                Criteria tempCrit = new Criteria();
  +
  +                tempCrit.addEqualTo(elementName, values[i]);
  +                criteria.addOrCriteria(tempCrit);
  +            }
  +        }
  +        else
  +        {
  +            for (int i = 0; i < values.length; i++)
  +            {
  +                criteria.addNotEqualTo(elementName, values[i]);
  +            }
  +        }
  +    }
  +
  +    /**
  +     * Change the search filter to one that specifies an element to not
  +     * match one of a list of integer values.
  +     * The old search filter is deleted.
  +     *
  +     * @param elementName is the name of the element to be matched
  +     * @param values is an array of possible integer matches
  +     * @param oper is the IN or NOT_IN operator to indicate how to matche
  +     */
  +    public void matchList(String elementName, int[] values, int oper)
  +    {
  +
  +        // see also matchList(String elementName, Vector values, int oper)
  +        // Delete the old search criteria
  +        criteria = new Criteria();
  +
  +        if (oper != NOT_IN)
  +        {
  +            for (int i = 0; i < values.length; i++)
  +            {
  +                Criteria tempCrit = new Criteria();
  +
  +                tempCrit.addEqualTo(elementName, new Integer(values[i]));
  +                criteria.addOrCriteria(tempCrit);
  +            }
  +        }
  +        else
  +        {
  +            for (int i = 0; i < values.length; i++)
  +            {
  +                criteria.addNotEqualTo(elementName, new Integer(values[i]));
  +            }
  +        }
  +    }
  +
  +    /**
  +     * Change the search filter to one that specifies an element to not
  +     * match one single value.
  +     * The old search filter is deleted.
  +     *
  +     * @param elementName is the name of the element to be matched
  +     * @param value is the value to not be matched
  +     * @param oper is the IN or NOT_IN operator to indicate how to matche
  +     */
  +    public void matchValue(String elementName, String value, int oper)
  +    {
  +
  +        // Delete the old search criteria
  +        criteria = new Criteria();
  +
  +        if (oper != NOT_IN)
  +        {
  +            criteria.addEqualTo(elementName, value);
  +        }
  +        else
  +        {
  +            criteria.addNotEqualTo(elementName, value);
  +        }
  +    }
  +
  +    /**
  +     * -----------------------------------------------------------
  +     * @param elementName
  +     * @param value
  +     * @param oper
  +     */
  +    public void matchValue(String elementName, int value, int oper)
  +    {
  +
  +        // Delete the old search criteria
  +        criteria = new Criteria();
  +
  +        if (oper != NOT_IN)
  +        {
  +            criteria.addEqualTo(elementName, new Integer(value));
  +        }
  +        else
  +        {
  +            criteria.addNotEqualTo(elementName, new Integer(value));
  +        }
  +    }
  +
  +    /**
  +     * Change the search filter to one that compares an element name to a value.
  +     * The old search filter is deleted.
  +     *
  +     * @param elementName is the name of the element to be tested
  +     * @param value is the value to be compared against
  +     * @param oper is the binary comparison operator to be used
  +     * @exception DBException
  +     */
  +    public void compareFilter(String elementName, String value,
  +                              int oper) throws DBException
  +    {
  +
  +        // Delete the old search criteria
  +        criteria = new Criteria();
  +
  +        // If this is not a binary operator, throw an exception
  +        if ((oper & BINARY_OPER_MASK) == 0)
  +        {
  +            throw new DBException();
  +        }
  +
  +        switch (oper)
  +        {
  +
  +            case LIKE:
  +                {
  +                    criteria.addLike(elementName, value);
  +
  +                    break;
  +                }
  +
  +            case EQUAL:
  +                {
  +                    criteria.addEqualTo(elementName, value);
  +
  +                    break;
  +                }
  +
  +            case NOT_EQUAL:
  +                {
  +                    criteria.addNotEqualTo(elementName, value);
  +
  +                    break;
  +                }
  +
  +            case LESS_THAN:
  +                {
  +                    criteria.addLessThan(elementName, value);
  +
  +                    break;
  +                }
  +
  +            case GREATER_THAN:
  +                {
  +                    criteria.addGreaterThan(elementName, value);
  +
  +                    break;
  +                }
  +
  +            case GREATER_EQUAL:
  +                {
  +                    criteria.addGreaterOrEqualThan(elementName, value);
  +
  +                    break;
  +                }
  +
  +            case LESS_EQUAL:
  +                {
  +                    criteria.addLessOrEqualThan(elementName, value);
  +
  +                    break;
  +                }
  +
  +            default:
  +                {
  +                    throw new DBException("Unsupported binary operation in OJBSearchFilter!");
  +                }
  +        }
  +    }
  +
  +    /**
  +     * Change the search filter to one that specifies a set of elements and their values
  +     * that must match, and the operator to use to combine the elements.
  +     * Each key is compared for an equal match to the value, and all
  +     * comparisons are combined by the specified logical operator (OR or AND).
  +     * The old search filter is deleted.
  +     *
  +     * @param elements is a hashtable holding key-value pairs
  +     * @param combine_op is the logical operator to be used to combine the comparisons
  +     * @param compare_op is the binary operator to be used for the comparisons
  +     * @exception DBException
  +     */
  +    public void matchSet(Hashtable elements, int combine_op,
  +                         int compare_op) throws DBException
  +    {
  +
  +        // Delete the old search criteria
  +        criteria = new Criteria();
  +
  +        // If compare_op is not a binary operator, throw an exception
  +        if ((compare_op & BINARY_OPER_MASK) == 0)
  +        {
  +            throw new DBException();
  +        }
  +
  +        if (combine_op == AND)
  +        {
  +            // combine all value pairs by an AND
  +
  +            // For each of the elements in the hashtable, create a comparison node for the match
  +            for (Enumeration e = elements.keys(); e.hasMoreElements();)
  +            {
  +
  +                // Get the element name from the enumerator
  +                // and its value
  +                String elementName = (String) e.nextElement();
  +                String elementValue = (String) elements.get(elementName);
  +
  +                switch (compare_op)
  +                {
  +
  +                    case LIKE:
  +                        {
  +                            criteria.addLike(elementName, elementValue);
  +
  +                            break;
  +                        }
  +
  +                    case EQUAL:
  +                        {
  +                            criteria.addEqualTo(elementName, elementValue);
  +
  +                            break;
  +                        }
  +
  +                    case NOT_EQUAL:
  +                        {
  +                            criteria.addNotEqualTo(elementName, elementValue);
  +
  +                            break;
  +                        }
  +
  +                    case LESS_THAN:
  +                        {
  +                            criteria.addLessThan(elementName, elementValue);
  +
  +                            break;
  +                        }
  +
  +                    case GREATER_THAN:
  +                        {
  +                            criteria.addGreaterThan(elementName, elementValue);
  +
  +                            break;
  +                        }
  +
  +                    case GREATER_EQUAL:
  +                        {
  +                            criteria.addGreaterOrEqualThan(elementName, elementValue);
  +
  +                            break;
  +                        }
  +
  +                    case LESS_EQUAL:
  +                        {
  +                            criteria.addLessOrEqualThan(elementName, elementValue);
  +
  +                            break;
  +                        }
  +
  +                    default:
  +                        {
  +                            throw new DBException("Unsupported binary operation in OJBSearchFilter!");
  +                        }
  +                }						   // end of switch
  +            }							   // end of for
  +        }
  +        else if (combine_op == OR)
  +        {
  +            // combine all value pairs by an OR
  +            // For each of the elements in the hashtable, create a comparison node for the match
  +            for (Enumeration e = elements.keys(); e.hasMoreElements();)
  +            {
  +
  +                // Get the element name from the enumerator
  +                // and its value
  +                String elementName = (String) e.nextElement();
  +                String elementValue = (String) elements.get(elementName);
  +
  +                switch (compare_op)
  +                {
  +
  +                    case LIKE:
  +                        {
  +                            Criteria tempCrit = new Criteria();
  +
  +                            tempCrit.addLike(elementName, elementValue);
  +                            criteria.addOrCriteria(tempCrit);
  +
  +                            break;
  +                        }
  +
  +                    case EQUAL:
  +                        {
  +                            Criteria tempCrit = new Criteria();
  +
  +                            tempCrit.addEqualTo(elementName, elementValue);
  +                            criteria.addOrCriteria(tempCrit);
  +
  +                            break;
  +                        }
  +
  +                    case NOT_EQUAL:
  +                        {
  +                            Criteria tempCrit = new Criteria();
  +
  +                            tempCrit.addNotEqualTo(elementName, elementValue);
  +                            criteria.addOrCriteria(tempCrit);
  +
  +                            break;
  +                        }
  +
  +                    case LESS_THAN:
  +                        {
  +                            Criteria tempCrit = new Criteria();
  +
  +                            tempCrit.addLessThan(elementName, elementValue);
  +                            criteria.addOrCriteria(tempCrit);
  +
  +                            break;
  +                        }
  +
  +                    case GREATER_THAN:
  +                        {
  +                            Criteria tempCrit = new Criteria();
  +
  +                            tempCrit.addGreaterThan(elementName, elementValue);
  +                            criteria.addOrCriteria(tempCrit);
  +
  +                            break;
  +                        }
  +
  +                    case GREATER_EQUAL:
  +                        {
  +                            Criteria tempCrit = new Criteria();
  +
  +                            tempCrit.addGreaterOrEqualThan(elementName, elementValue);
  +                            criteria.addOrCriteria(tempCrit);
  +
  +                            break;
  +                        }
  +
  +                    case LESS_EQUAL:
  +                        {
  +                            Criteria tempCrit = new Criteria();
  +
  +                            tempCrit.addLessOrEqualThan(elementName, elementValue);
  +                            criteria.addOrCriteria(tempCrit);
  +
  +                            break;
  +                        }
  +
  +                    default:
  +                        {
  +                            throw new DBException("Unsupported binary operation in OJBSearchFilter!");
  +                        }
  +                }					   // end of switch
  +            }						   // end of for
  +
  +        }
  +        else
  +        {
  +
  +            // combine_op is not a logical operator, throw an exception
  +            throw new DBException();
  +        }
  +    }
  +
  +    /**
  +     * Change the search filter to one that specifies a set of elements and their values
  +     * that must match, and the operator to use to combine the elements.
  +     * Each element name is compared for an equal match to the value, and all
  +     * comparisons are combined by the specified logical operator (OR or AND).
  +     * The old search filter is deleted.
  +     *
  +     * @param elementNames is an array of names of elements to be tested
  +     * @param elementValues is an array of values for the corresponding element
  +     * @param op is the logical operator to be used to combine the comparisons
  +     * @exception DBException
  +     */
  +    public void matchSet(String[] elementNames, String[] elementValues,
  +                         int op) throws DBException
  +    {
  +
  +        // Delete the old search criteria
  +        criteria = new Criteria();
  +
  +        if (op == OR)
  +        {
  +            // For each of the elements in the array, create a leaf node for the match
  +            for (int i = 0; i < elementNames.length; i++)
  +            {
  +                Criteria tempCrit = new Criteria();
  +
  +                tempCrit.addEqualTo(elementNames[i], elementValues[i]);
  +                criteria.addOrCriteria(tempCrit);
  +            }
  +        }
  +        else if (op == AND)
  +        {
  +            for (int i = 0; i < elementNames.length; i++)
  +            {
  +                criteria.addEqualTo(elementNames[i], elementValues[i]);
  +            }
  +        }
  +        else
  +        {
  +            throw new DBException();
  +        }
  +    }
  +
  +    /**
  +     * Combine other search filters with this one, using the specific operator.
  +     *
  +     * @param new_filters is a vector of SearchFilter classes to be combined
  +     * @param op is the logical operator to be used to combine the filters
  +     * @exception DBException
  +     */
  +    public void combine(Vector new_filters, int op) throws DBException
  +    {
  +        for (Enumeration elems = new_filters.elements(); elems.hasMoreElements();)
  +        {
  +            SearchFilter filter = (SearchFilter) elems.nextElement();
  +
  +            combine(filter, op);
  +        }
  +    }
  +
  +    /**
  +     * Combine one other search filters with this one, using the specific operator.
  +     *
  +     * @param new_filter is the SearchFilter class to be combined
  +     * @param op is the logical operator to be used to combine the filters
  +     * @exception DBException
  +     */
  +    public void combine(SearchFilter new_filter, int op) throws DBException
  +    {
  +
  +        // cast down to OJBSearchFilter
  +        OJBSearchFilter ojbFilter = (OJBSearchFilter) new_filter;
  +
  +        switch (op)
  +        {
  +
  +            case OR:
  +                {
  +                    criteria.addOrCriteria(ojbFilter.getCriteria());
  +                    break;
  +                }
  +
  +            case AND:
  +                {
  +                    criteria.addAndCriteria(ojbFilter.getCriteria());
  +                    break;
  +                }
  +
  +            default:
  +                {
  +                    throw new DBException();
  +                }
  +        }
  +    }
  +
  +    /**
  +     * Converts this search filter into a search string
  +     * Note:
  +     * ObJectRelationalBridge can't parse a SQL string yet, the functionality
  +     * is therefor not implemented!
  +     */
  +
  +    /**
  +     * -----------------------------------------------------------
  +     * @return
  +     */
  +    public String toString()
  +    {
  +
  +        // return "";
  +        return criteria.toString();
  +    }
  +
  +    /**
  +     * Returns the search critera
  +     *
  +     */
  +
  +    /**
  +     * -----------------------------------------------------------
  +     * @return
  +     */
  +    protected Criteria getCriteria()
  +    {
  +
  +        // return the search criteria
  +        return criteria;
  +    }
  +
  +}
  
  
  
  1.17      +10 -11    db-ojb/src/java/org/apache/ojb/broker/query/QueryFactory.java
  
  Index: QueryFactory.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/QueryFactory.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- QueryFactory.java	4 Apr 2004 23:53:36 -0000	1.16
  +++ QueryFactory.java	19 Jun 2004 09:21:37 -0000	1.17
  @@ -41,7 +41,7 @@
        * @param classToSearchFrom
        * @param criteria
        * @param distinct
  -     * @return
  +     * @return ReportQueryByCriteria
        */
       public static ReportQueryByCriteria newReportQuery(Class classToSearchFrom, String[] columns, Criteria criteria, boolean distinct)
       {
  @@ -54,7 +54,7 @@
        * @param classToSearchFrom
        * @param criteria
        * @param distinct
  -     * @return
  +     * @return ReportQueryByCriteria
        */
       public static ReportQueryByCriteria newReportQuery(Class classToSearchFrom, Criteria criteria, boolean distinct)
       {
  @@ -66,8 +66,7 @@
        * create a new ReportQueryByCriteria
        * @param classToSearchFrom
        * @param criteria
  -     * @param distinct
  -     * @return
  +     * @return ReportQueryByCriteria
        */
       public static ReportQueryByCriteria newReportQuery(Class classToSearchFrom, Criteria criteria)
       {
  @@ -101,7 +100,7 @@
       /**
        * Return a QueryByIdentity for example_or_identity
        * @param example_or_identity
  -     * @return
  +     * @return QueryByIdentity
        */
       public static QueryByIdentity newQuery(Object example_or_identity)
       {
  @@ -111,7 +110,7 @@
       /**
        * Return a QueryByIdentity for example_or_identity
        * @param example_or_identity
  -     * @return
  +     * @return QueryByIdentity
        */
       public static QueryByIdentity newQueryByIdentity(Object example_or_identity)
       {
  @@ -122,7 +121,7 @@
        * Return a QueryByCriteria for example
        * <br>Use with care because building of Query is not foolproof !!!
        * @param example
  -     * @return
  +     * @return QueryByCriteria
        */
       public static QueryByCriteria newQueryByExample(Object example)
       {
  @@ -131,7 +130,7 @@
   
       /**
        * @param classToSearchFrom
  -     * @param tables
  +     * @param indirectionTable
        * @param criteria
        * @param distinct
        * @return QueryByMtoNCriteria
  @@ -144,7 +143,7 @@
   
       /**
        * @param classToSearchFrom
  -     * @param tables
  +     * @param indirectionTable
        * @param criteria
        * @return QueryByCriteria
        */
  @@ -157,7 +156,7 @@
       /**
        * Factory method for QueryBySQL
        * @param classToSearchFrom
  -     * @param the SQL Statement
  +     * @param anSqlStatement
        * @return QueryBySQL
        */
       public static QueryBySQL newQuery(Class classToSearchFrom, String anSqlStatement)
  
  
  
  1.8       +7 -7      db-ojb/src/java/org/apache/ojb/broker/query/SearchFilter.java
  
  Index: SearchFilter.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/SearchFilter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SearchFilter.java	4 Apr 2004 23:53:36 -0000	1.7
  +++ SearchFilter.java	19 Jun 2004 09:21:37 -0000	1.8
  @@ -191,7 +191,7 @@
        * @param ElementName is the name of the element to be tested
        * @param value is the value to be compared against
        * @param oper is the binary comparison operator to be used
  -     * @exception gov.lanl.Database.DBException
  +     * @exception DBException
        */
       public void compareFilter(String ElementName, String value, int oper) throws DBException
       {
  @@ -213,10 +213,10 @@
        * comparisons are combined by the specified logical operator (OR or AND).
        * The old search filter is deleted.
        *
  -     * @param Elements is a hashtable holding key-value pairs
  +     * @param elements is a hashtable holding key-value pairs
        * @param combine_op is the logical operator to be used to combine the comparisons
        * @param compare_op is the binary operator to be used for the comparisons
  -     * @exception gov.lanl.Utilty.DBException
  +     * @exception DBException
        */
       public void matchSet(Hashtable elements, int combine_op, int compare_op) throws DBException
       {
  @@ -260,8 +260,8 @@
        *
        * @param ElementNames is an array of names of elements to be tested
        * @param ElementValues is an array of values for the corresponding element
  -     * @param oper is the logical operator to be used to combine the comparisons
  -     * @exception gov.lanl.Database.DBException
  +     * @param op is the logical operator to be used to combine the comparisons
  +     * @exception DBException
        */
       public void matchSet(String[] ElementNames, String[] ElementValues, int op) throws DBException
       {
  @@ -292,7 +292,7 @@
        *
        * @param new_filters is a vector of SearchFilter classes to be combined
        * @param op is the logical operator to be used to combine the filters
  -     * @exception gov.lanl.Database.DBException
  +     * @exception DBException
        */
       public void combine(Vector new_filters, int op) throws DBException
       {
  @@ -320,7 +320,7 @@
        *
        * @param new_filter is the SearchFilter class to be combined
        * @param op is the logical operator to be used to combine the filters
  -     * @exception gov.lanl.Database.DBException
  +     * @exception DBException
        */
       public void combine(SearchFilter new_filter, int op) throws DBException
       {
  
  
  
  1.2       +0 -1      db-ojb/src/java/org/apache/ojb/broker/query/UserAlias.java
  
  Index: UserAlias.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/UserAlias.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UserAlias.java	22 May 2004 08:37:23 -0000	1.1
  +++ UserAlias.java	19 Jun 2004 09:21:37 -0000	1.2
  @@ -42,7 +42,6 @@
        * Constructor declaration
        *
        * @param name the name of the alias
  -     * @param attributePath the full path of the SelectionCriteria attribute
        */
       public UserAlias(String name)
       {
  
  
  
  1.55      +11 -5     db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java
  
  Index: BrokerHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- BrokerHelper.java	17 Jun 2004 20:30:12 -0000	1.54
  +++ BrokerHelper.java	19 Jun 2004 09:21:38 -0000	1.55
  @@ -677,14 +677,17 @@
        * objects (1:1, 1:n and m:n) by hand. This method is needed when
        * in the reference metadata definitions the auto-xxx setting was disabled.
        * More info see OJB doc.
  -     *
  -     * @see #link(java.lang.Object, java.lang.String, boolean)java.lang.Object, java.lang.String)
        */
       public void link(Object obj, boolean insert)
       {
           linkOrUnlink(true, obj, insert);
       }
   
  +    /**
  +     * Unlink all references from this object.
  +     * More info see OJB doc.
  +     * @param obj
  +     */
       public void unlink(Object obj)
       {
           linkOrUnlink(false, obj, false);
  @@ -751,14 +754,17 @@
        * @param attributeName field name of the reference
        * @param insert flag signals insert operation
        * @return true if the specified reference was found and linking was successful
  -     *
  -     * @see #link(java.lang.Object, boolean)java.lang.Object)
        */
       public boolean link(Object obj, String attributeName, boolean insert)
       {
          return linkOrUnlink(true, obj, attributeName, insert);
       }
   
  +    /**
  +     * Unlink the specified reference from this object.
  +     * More info see OJB doc.
  +     * @param obj
  +     */
       public boolean unlink(Object obj, String attributeName)
       {
           return linkOrUnlink(false, obj, attributeName, false);
  
  
  
  1.10      +2 -2      db-ojb/src/java/org/apache/ojb/odmg/NarrowTransaction.java
  
  Index: NarrowTransaction.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/NarrowTransaction.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NarrowTransaction.java	4 Apr 2004 23:53:38 -0000	1.9
  +++ NarrowTransaction.java	19 Jun 2004 09:21:38 -0000	1.10
  @@ -110,7 +110,7 @@
   
       /**
        * lock the given object
  -     * @see Transaction#lock
  +     * @see org.odmg.Transaction#lock
        */
       public void lock(Object obj, int lockMode)
               throws LockNotGrantedException
  @@ -120,7 +120,7 @@
   
       /**
        * lock the given object if possible
  -     * @see Transaction#tryLock
  +     * @see org.odmg.Transaction#tryLock
        */
       public boolean tryLock(Object obj, int lockMode)
       {
  
  
  

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


Mime
View raw message