KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > query > DefaultQueryMetadata


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

19
20 package org.apache.cayenne.query;
21
22 import org.apache.cayenne.map.DataMap;
23 import org.apache.cayenne.map.DbEntity;
24 import org.apache.cayenne.map.ObjEntity;
25 import org.apache.cayenne.map.Procedure;
26 import org.apache.cayenne.reflect.ClassDescriptor;
27
28 /**
29  * A QueryMetadata implementation that returns all the defaults.
30  *
31  * @since 1.2
32  * @author Andrus Adamchik
33  */

34 class DefaultQueryMetadata implements QueryMetadata {
35
36     static final QueryMetadata defaultMetadata = new DefaultQueryMetadata();
37
38     /**
39      * To simplify overriding this implementation checks whether there is a non-null
40      * entity or procedure, and uses its DataMap.
41      */

42     public DataMap getDataMap() {
43         if (getObjEntity() != null) {
44             return getObjEntity().getDataMap();
45         }
46
47         if (getDbEntity() != null) {
48             return getDbEntity().getDataMap();
49         }
50
51         if (getProcedure() != null) {
52             return getProcedure().getDataMap();
53         }
54
55         return null;
56     }
57     
58     /**
59      * @since 3.0
60      */

61     public SQLResultSetMapping getResultSetMapping() {
62         return null;
63     }
64
65     public DbEntity getDbEntity() {
66         return null;
67     }
68
69     public ObjEntity getObjEntity() {
70         return null;
71     }
72     
73     public ClassDescriptor getClassDescriptor() {
74         return null;
75     }
76
77     public Procedure getProcedure() {
78         return null;
79     }
80
81     public String JavaDoc getCacheKey() {
82         return null;
83     }
84     
85     public String JavaDoc[] getCacheGroups() {
86         return null;
87     }
88
89     public String JavaDoc getCachePolicy() {
90         return QueryMetadata.CACHE_POLICY_DEFAULT;
91     }
92
93     public boolean isFetchingDataRows() {
94         return QueryMetadata.FETCHING_DATA_ROWS_DEFAULT;
95     }
96
97     public boolean isRefreshingObjects() {
98         return QueryMetadata.REFRESHING_OBJECTS_DEFAULT;
99     }
100
101     public boolean isResolvingInherited() {
102         return QueryMetadata.RESOLVING_INHERITED_DEFAULT;
103     }
104
105     public int getPageSize() {
106         return QueryMetadata.PAGE_SIZE_DEFAULT;
107     }
108     
109     public int getFetchStartIndex() {
110         return -1;
111     }
112
113     public int getFetchLimit() {
114         return QueryMetadata.FETCH_LIMIT_DEFAULT;
115     }
116
117     public PrefetchTreeNode getPrefetchTree() {
118         return null;
119     }
120 }
121
Popular Tags