Source Code Cross Referenced for FetchPlanImpl.java in  » Database-ORM » openjpa » org » apache » openjpa » persistence » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » openjpa » org.apache.openjpa.persistence 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements.  See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership.  The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License.  You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied.  See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.    
018:         */
019:        package org.apache.openjpa.persistence;
020:
021:        import java.util.ArrayList;
022:        import java.util.Arrays;
023:        import java.util.Collection;
024:        import java.util.Iterator;
025:        import javax.persistence.LockModeType;
026:
027:        import org.apache.openjpa.kernel.DelegatingFetchConfiguration;
028:        import org.apache.openjpa.kernel.FetchConfiguration;
029:
030:        /**
031:         * Implements FetchPlan via delegation to FetchConfiguration.
032:         *
033:         * @author Abe White
034:         * @author Pinaki Poddar
035:         * @since 0.4.1
036:         * @nojavadoc
037:         */
038:        public class FetchPlanImpl implements  FetchPlan {
039:
040:            private final DelegatingFetchConfiguration _fetch;
041:
042:            /**
043:             * Constructor; supply delegate.
044:             */
045:            public FetchPlanImpl(FetchConfiguration fetch) {
046:                _fetch = newDelegatingFetchConfiguration(fetch);
047:            }
048:
049:            /**
050:             * Create a new exception-translating delegating fetch configuration.
051:             */
052:            protected DelegatingFetchConfiguration newDelegatingFetchConfiguration(
053:                    FetchConfiguration fetch) {
054:                return new DelegatingFetchConfiguration(fetch,
055:                        PersistenceExceptions.TRANSLATOR);
056:            }
057:
058:            /**
059:             * Delegate.
060:             */
061:            public FetchConfiguration getDelegate() {
062:                return _fetch.getDelegate();
063:            }
064:
065:            public int getMaxFetchDepth() {
066:                return _fetch.getMaxFetchDepth();
067:            }
068:
069:            public FetchPlan setMaxFetchDepth(int depth) {
070:                _fetch.setMaxFetchDepth(depth);
071:                return this ;
072:            }
073:
074:            public int getFetchBatchSize() {
075:                return _fetch.getFetchBatchSize();
076:            }
077:
078:            public FetchPlan setFetchBatchSize(int fetchBatchSize) {
079:                _fetch.setFetchBatchSize(fetchBatchSize);
080:                return this ;
081:            }
082:
083:            public boolean getQueryResultCacheEnabled() {
084:                return _fetch.getQueryCacheEnabled();
085:            }
086:
087:            public FetchPlan setQueryResultCacheEnabled(boolean cache) {
088:                _fetch.setQueryCacheEnabled(cache);
089:                return this ;
090:            }
091:
092:            public boolean getQueryResultCache() {
093:                return getQueryResultCacheEnabled();
094:            }
095:
096:            public FetchPlan setQueryResultCache(boolean cache) {
097:                return setQueryResultCacheEnabled(cache);
098:            }
099:
100:            public Collection<String> getFetchGroups() {
101:                return _fetch.getFetchGroups();
102:            }
103:
104:            public FetchPlan addFetchGroup(String group) {
105:                _fetch.addFetchGroup(group);
106:                return this ;
107:            }
108:
109:            public FetchPlan addFetchGroups(String... groups) {
110:                return addFetchGroups(Arrays.asList(groups));
111:            }
112:
113:            public FetchPlan addFetchGroups(Collection groups) {
114:                _fetch.addFetchGroups(groups);
115:                return this ;
116:            }
117:
118:            public FetchPlan removeFetchGroup(String group) {
119:                _fetch.removeFetchGroup(group);
120:                return this ;
121:            }
122:
123:            public FetchPlan removeFetchGroups(String... groups) {
124:                return removeFetchGroups(Arrays.asList(groups));
125:            }
126:
127:            public FetchPlan removeFetchGroups(Collection groups) {
128:                _fetch.removeFetchGroups(groups);
129:                return this ;
130:            }
131:
132:            public FetchPlan clearFetchGroups() {
133:                _fetch.clearFetchGroups();
134:                return this ;
135:            }
136:
137:            public FetchPlan resetFetchGroups() {
138:                _fetch.resetFetchGroups();
139:                return this ;
140:            }
141:
142:            public Collection<String> getFields() {
143:                return (Collection<String>) _fetch.getFields();
144:            }
145:
146:            public boolean hasField(String field) {
147:                return _fetch.hasField(field);
148:            }
149:
150:            public boolean hasField(Class cls, String field) {
151:                return hasField(toFieldName(cls, field));
152:            }
153:
154:            public FetchPlan addField(String field) {
155:                _fetch.addField(field);
156:                return this ;
157:            }
158:
159:            public FetchPlan addField(Class cls, String field) {
160:                return addField(toFieldName(cls, field));
161:            }
162:
163:            public FetchPlan addFields(String... fields) {
164:                return addFields(Arrays.asList(fields));
165:            }
166:
167:            public FetchPlan addFields(Class cls, String... fields) {
168:                return addFields(cls, Arrays.asList(fields));
169:            }
170:
171:            public FetchPlan addFields(Collection fields) {
172:                _fetch.addFields(fields);
173:                return this ;
174:            }
175:
176:            public FetchPlan addFields(Class cls, Collection fields) {
177:                return addFields(toFieldNames(cls, fields));
178:            }
179:
180:            public FetchPlan removeField(String field) {
181:                _fetch.removeField(field);
182:                return this ;
183:            }
184:
185:            public FetchPlan removeField(Class cls, String field) {
186:                return removeField(toFieldName(cls, field));
187:            }
188:
189:            public FetchPlan removeFields(String... fields) {
190:                return removeFields(Arrays.asList(fields));
191:            }
192:
193:            public FetchPlan removeFields(Class cls, String... fields) {
194:                return removeFields(cls, Arrays.asList(fields));
195:            }
196:
197:            public FetchPlan removeFields(Collection fields) {
198:                _fetch.removeFields(fields);
199:                return this ;
200:            }
201:
202:            public FetchPlan removeFields(Class cls, Collection fields) {
203:                return removeFields(toFieldNames(cls, fields));
204:            }
205:
206:            public FetchPlan clearFields() {
207:                _fetch.clearFields();
208:                return this ;
209:            }
210:
211:            private static String toFieldName(Class cls, String field) {
212:                return cls.getName() + "." + field;
213:            }
214:
215:            private static Collection toFieldNames(Class cls, Collection fields) {
216:                if (fields.isEmpty())
217:                    return fields;
218:                Collection names = new ArrayList(fields);
219:                for (Iterator itr = fields.iterator(); itr.hasNext();)
220:                    names.add(toFieldName(cls, (String) itr.next()));
221:                return names;
222:            }
223:
224:            public int getLockTimeout() {
225:                return _fetch.getLockTimeout();
226:            }
227:
228:            public FetchPlan setLockTimeout(int timeout) {
229:                _fetch.setLockTimeout(timeout);
230:                return this ;
231:            }
232:
233:            public LockModeType getReadLockMode() {
234:                return EntityManagerImpl.fromLockLevel(_fetch
235:                        .getReadLockLevel());
236:            }
237:
238:            public FetchPlan setReadLockMode(LockModeType mode) {
239:                _fetch.setReadLockLevel(EntityManagerImpl.toLockLevel(mode));
240:                return this ;
241:            }
242:
243:            public LockModeType getWriteLockMode() {
244:                return EntityManagerImpl.fromLockLevel(_fetch
245:                        .getWriteLockLevel());
246:            }
247:
248:            public FetchPlan setWriteLockMode(LockModeType mode) {
249:                _fetch.setWriteLockLevel(EntityManagerImpl.toLockLevel(mode));
250:                return this ;
251:            }
252:
253:            public int hashCode() {
254:                return _fetch.hashCode();
255:            }
256:
257:            public boolean equals(Object other) {
258:                if (other == this )
259:                    return true;
260:                if (!(other instanceof  FetchPlanImpl))
261:                    return false;
262:                return _fetch.equals(((FetchPlanImpl) other)._fetch);
263:            }
264:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.