01: package org.apache.ojb.broker.accesslayer;
02:
03: /* Copyright 2003-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * 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: * Return a new Query based on the original Query, the originator object and
48: * the additional Attributes.
49: *
50: * @param anObject the originator object
51: * @param aBroker the PersistenceBroker
52: * @param aCod the CollectionDescriptor
53: * @param aQuery the original 1:n-Query
54: * @return Query the customized 1:n-Query, return null to skip execution of the query
55: */
56: public Query customizeQuery(Object anObject,
57: PersistenceBroker aBroker, CollectionDescriptor aCod,
58: QueryByCriteria aQuery);
59: }
|