KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > accesslayer > QueryCustomizer


1 package org.apache.ojb.broker.accesslayer;
2
3 /* Copyright 2003-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import org.apache.ojb.broker.PersistenceBroker;
19 import org.apache.ojb.broker.metadata.AttributeContainer;
20 import org.apache.ojb.broker.metadata.CollectionDescriptor;
21 import org.apache.ojb.broker.query.Query;
22 import org.apache.ojb.broker.query.QueryByCriteria;
23
24 /**
25  * Interface for QueryCustomizer in CollectionDescriptor
26  * <pre>
27  * ...
28  * <query-customizer
29  * class="org.apache.ojb.broker.accesslayer.QueryCustomizerDefaultImpl">
30  * <attribute
31  * attribute-name="attr1"
32  * attribute-value="value1"
33  * />
34  * ...
35  * </pre>
36  *
37  * If the customized Query is null execution of PB retrieveCollection is skipped
38  * and an empty Collection is placed in the relationship attribute.
39  *
40  * @see org.apache.ojb.broker.PersistenceBroker#getCollectionByQuery
41  *
42  * @author <a HREF="mailto:jbraeuchi@hotmail.com">Jakob Braeuchi</a>
43  * @version $Id: QueryCustomizer.java,v 1.7.2.1 2005/12/21 22:22:58 tomdz Exp $
44  */

45 public interface QueryCustomizer extends AttributeContainer
46 {
47     /**
48      * Return a new Query based on the original Query, the originator object and
49      * the additional Attributes.
50      *
51      * @param anObject the originator object
52      * @param aBroker the PersistenceBroker
53      * @param aCod the CollectionDescriptor
54      * @param aQuery the original 1:n-Query
55      * @return Query the customized 1:n-Query, return null to skip execution of the query
56      */

57     public Query customizeQuery(Object JavaDoc anObject, PersistenceBroker aBroker, CollectionDescriptor aCod, QueryByCriteria aQuery);
58 }
59
Popular Tags