KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.apache.ojb.broker.accesslayer;
2
3 /* Copyright 2002-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.core.PersistenceBrokerImpl;
19 import org.apache.ojb.broker.metadata.ClassDescriptor;
20 import org.apache.ojb.broker.metadata.ObjectReferenceDescriptor;
21
22 /**
23  * Abstract Relationship Prefetchers.
24  * Each Prefetcher handles a single Relationship (1:1 or 1:n)
25  *
26  * @author <a HREF="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi</a>
27  * @version $Id: RelationshipPrefetcherImpl.java,v 1.13.2.1 2005/12/21 22:22:58 tomdz Exp $
28  */

29 public abstract class RelationshipPrefetcherImpl extends BasePrefetcher
30 {
31     private ObjectReferenceDescriptor objectReferenceDescriptor;
32     private boolean cascadeRetrieve;
33
34     /**
35      * Constructor for RelationshipPrefetcherImpl.
36      */

37     public RelationshipPrefetcherImpl(PersistenceBrokerImpl aBroker, ObjectReferenceDescriptor anOrd)
38     {
39         super(aBroker, anOrd.getItemClass());
40         objectReferenceDescriptor = anOrd;
41     }
42
43     /**
44      * @see org.apache.ojb.broker.accesslayer.RelationshipPrefetcher#prepareRelationshipSettings()
45      */

46     public void prepareRelationshipSettings()
47     {
48         setCascadeRetrieve(getObjectReferenceDescriptor().getCascadeRetrieve());
49         
50         // BRJ: do not modify reference-descriptor
51
// getObjectReferenceDescriptor().setCascadeRetrieve(false);
52
}
53
54     /**
55      * Returns the ClassDescriptor of the owner Class
56      * @return ClassDescriptor
57      */

58     protected ClassDescriptor getOwnerClassDescriptor()
59     {
60         return getObjectReferenceDescriptor().getClassDescriptor();
61     }
62
63     /**
64      * @see org.apache.ojb.broker.accesslayer.RelationshipPrefetcher#restoreRelationshipSettings()
65      */

66     public void restoreRelationshipSettings()
67     {
68         // BRJ: do not modify reference-descriptor
69
// getObjectReferenceDescriptor().setCascadeRetrieve(isCascadeRetrieve());
70
}
71
72     /**
73      * Returns the objectReferenceDescriptor.
74      * @return ObjectReferenceDescriptor
75      */

76     protected ObjectReferenceDescriptor getObjectReferenceDescriptor()
77     {
78         return objectReferenceDescriptor;
79     }
80
81     /**
82      * Sets the objectReferenceDescriptor.
83      * @param objectReferenceDescriptor The objectReferenceDescriptor to set
84      */

85     protected void setObjectReferenceDescriptor(ObjectReferenceDescriptor objectReferenceDescriptor)
86     {
87         this.objectReferenceDescriptor = objectReferenceDescriptor;
88     }
89
90     /**
91      * Returns the cascadeRetrieve.
92      * @return boolean
93      */

94     protected boolean isCascadeRetrieve()
95     {
96         return cascadeRetrieve;
97     }
98
99     /**
100      * Sets the cascadeRetrieve.
101      * @param cascadeRetrieve The cascadeRetrieve to set
102      */

103     protected void setCascadeRetrieve(boolean cascadeRetrieve)
104     {
105         this.cascadeRetrieve = cascadeRetrieve;
106     }
107 }
108
Popular Tags