Source Code Cross Referenced for JPCayenneService.java in  » Web-Framework » jpublish » org » jpublish » module » cayenne » 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 » Web Framework » jpublish » org.jpublish.module.cayenne 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         *
016:         */
017:
018:        package org.jpublish.module.cayenne;
019:
020:        import org.apache.cayenne.DataObject;
021:        import org.apache.cayenne.DeleteDenyException;
022:        import org.apache.cayenne.Persistent;
023:        import org.apache.cayenne.access.DataContext;
024:        import org.apache.cayenne.query.Query;
025:
026:        import java.util.List;
027:        import java.util.Map;
028:
029:        /**
030:         * Just publishing the methods of the CayenneTemplate
031:         *
032:         * @author <a href="mailto:florin.patrascu@gmail.com">Florin T.PATRASCU</a>
033:         * @since $Revision$ (created: Sep 23, 2007 3:28:28 PM)
034:         */
035:        public class JPCayenneService extends CayenneTemplate {
036:            /**
037:             * Instantiates new object and registers it with itself. Object class must
038:             * have a default constructor.
039:             *
040:             * @param dataObjectClass the data object class to create and register
041:             * @return the new registered data object
042:             */
043:            public Persistent createAndRegisterNewObject(Class dataObjectClass) {
044:                return super .createAndRegisterNewObject(dataObjectClass);
045:            }
046:
047:            /**
048:             * Commit any changes in the thread local DataContext.
049:             */
050:            public void commitChanges() {
051:                super .commitChanges();
052:            }
053:
054:            /**
055:             * Schedules an object for deletion on the next commit of this DataContext. Object's
056:             * persistence state is changed to PersistenceState.DELETED; objects related to this
057:             * object are processed according to delete rules, i.e. relationships can be unset
058:             * ("nullify" rule), deletion operation is cascaded (cascade rule).
059:             *
060:             * @param dataObject a persistent data object that we want to delete
061:             * @throws org.apache.cayenne.DeleteDenyException
062:             *          if a DENY delete rule
063:             *          is applicable for object deletion
064:             */
065:            public void deleteObject(DataObject dataObject)
066:                    throws DeleteDenyException {
067:                super .deleteObject(dataObject);
068:            }
069:
070:            /**
071:             * Find the data object for the specified class, property name and property
072:             * value, or null if no data object was found.
073:             *
074:             * @param dataObjectClass the data object class to find
075:             * @param property        the name of the property
076:             * @param value           the value of the property
077:             * @return the data object for the specified class, property name and property value
078:             * @throws RuntimeException if more than one data object was identified for the
079:             *                          given property name and value
080:             */
081:            public DataObject findObject(Class dataObjectClass,
082:                    String property, Object value) {
083:
084:                return super .findObject(dataObjectClass, property, value);
085:            }
086:
087:            /**
088:             * Return the thread local DataContext.
089:             *
090:             * @return the thread local DataContext
091:             * @throws IllegalStateException if there is no DataContext bound to the current thread
092:             */
093:            public DataContext getDataContext() {
094:                return super .getDataContext();
095:            }
096:
097:            /**
098:             * Perform a database query returning the data object specified by the
099:             * class and the primary key. This method will perform a database query
100:             * and refresh the object cache.
101:             *
102:             * @param doClass the data object class to retrieve
103:             * @param id      the data object primary key
104:             * @return the data object for the given class and id
105:             */
106:            public DataObject getObjectForPK(Class doClass, Object id) {
107:                return super .getObjectForPK(doClass, id);
108:            }
109:
110:            /**
111:             * Perform a query returning the data object specified by the
112:             * class and the primary key value. If the refresh parameter is true a
113:             * database query will be performed, otherwise the a query against the
114:             * object cache will be performed first.
115:             *
116:             * @param dataObjectClass the data object class to retrieve
117:             * @param id              the data object primary key
118:             * @param refresh         the refresh the object cache mode
119:             * @return the data object for the given class and id
120:             */
121:            public DataObject getObjectForPK(Class dataObjectClass, Object id,
122:                    boolean refresh) {
123:                return super .getObjectForPK(dataObjectClass, id, refresh);
124:            }
125:
126:            /**
127:             * Return the database primary key column name for the given data object.
128:             *
129:             * @param dataObjectClass the class of the data object
130:             * @return the primary key column name
131:             */
132:            public String getPkName(Class dataObjectClass) {
133:                return super .getPkName(dataObjectClass);
134:            }
135:
136:            /**
137:             * Performs a single selecting query. Various query setting control the behavior of
138:             * this method and the results returned:
139:             * <ul>
140:             * <li>Query caching policy defines whether the results are retrieved from cache or
141:             * fetched from the database. Note that queries that use caching must have a name that
142:             * is used as a caching key.
143:             * </li>
144:             * <li>Query refreshing policy controls whether to refresh existing data objects and
145:             * ignore any cached values.
146:             * </li>
147:             * <li>Query data rows policy defines whether the result should be returned as
148:             * DataObjects or DataRows.
149:             * </li>
150:             * </ul>
151:             *
152:             * @param query the query to perform
153:             * @return a list of DataObjects or a DataRows for the query
154:             */
155:            public List performQuery(Query query) {
156:                return super .performQuery(query);
157:            }
158:
159:            /**
160:             * Returns a list of objects or DataRows for a named query stored in one of the
161:             * DataMaps. Internally Cayenne uses a caching policy defined in the named query. If
162:             * refresh flag is true, a refresh is forced no matter what the caching policy is.
163:             *
164:             * @param queryName a name of a GenericSelectQuery defined in one of the DataMaps. If
165:             *                  no such query is defined, this method will throw a CayenneRuntimeException
166:             * @param refresh   A flag that determines whether refresh of <b>cached lists</b>
167:             *                  is required in case a query uses caching.
168:             * @return the list of data object or DataRows for the named query
169:             */
170:            public List performQuery(String queryName, boolean refresh) {
171:                return super .performQuery(queryName, refresh);
172:            }
173:
174:            /**
175:             * Returns a list of objects or DataRows for a named query stored in one of the
176:             * DataMaps. Internally Cayenne uses a caching policy defined in the named query. If
177:             * refresh flag is true, a refresh is forced no matter what the caching policy is.
178:             *
179:             * @param queryName  a name of a GenericSelectQuery defined in one of the DataMaps. If
180:             *                   no such query is defined, this method will throw a CayenneRuntimeException
181:             * @param parameters A map of parameters to use with stored query
182:             * @param refresh    A flag that determines whether refresh of <b>cached lists</b>
183:             *                   is required in case a query uses caching.
184:             * @return the list of data object or DataRows for the named query
185:             */
186:            public List performQuery(String queryName, Map parameters,
187:                    boolean refresh) {
188:
189:                return super .performQuery(queryName, parameters, refresh);
190:            }
191:
192:            /**
193:             * Return a list of data object of the specified class for the given property
194:             * and value.
195:             *
196:             * @param dataObjectClass the data object class to return
197:             * @param property        the name of the property to select
198:             * @param value           the property value to select
199:             * @return a list of data objects for the given class and property name and value
200:             */
201:            public List performQuery(Class dataObjectClass, String property,
202:                    Object value) {
203:
204:                return super .performQuery(dataObjectClass, property, value);
205:            }
206:
207:            /**
208:             * Performs a single database query that does not select rows. Returns an
209:             * array of update counts.
210:             *
211:             * @param query the query to perform
212:             * @return the array of update counts
213:             */
214:            public int[] performNonSelectingQuery(Query query) {
215:                return super .performNonSelectingQuery(query);
216:            }
217:
218:            /**
219:             * Performs a named mapped query that does not select rows. Returns an array
220:             * of update counts.
221:             *
222:             * @param queryName the name of the query to perform
223:             * @return the array of update counts
224:             */
225:            public int[] performNonSelectingQuery(String queryName) {
226:                return super .performNonSelectingQuery(queryName);
227:            }
228:
229:            /**
230:             * Performs a named mapped non-selecting query using a map of parameters.
231:             * Returns an array of update counts.
232:             *
233:             * @param queryName  the name of the query to perform
234:             * @param parameters the Map of query paramater names and values
235:             * @return the array of update counts
236:             */
237:            public int[] performNonSelectingQuery(String queryName,
238:                    Map parameters) {
239:                return super .performNonSelectingQuery(queryName, parameters);
240:            }
241:
242:            /**
243:             * Registers a transient object with the context, recursively registering all
244:             * transient DataObjects attached to this object via relationships.
245:             *
246:             * @param dataObject new object that needs to be made persistent
247:             */
248:            public void registerNewObject(DataObject dataObject) {
249:                super .registerNewObject(dataObject);
250:            }
251:
252:            /**
253:             * Reverts any changes that have occurred to objects registered in the
254:             * thread local DataContext.
255:             */
256:            public void rollbackChanges() {
257:                super .rollbackChanges();
258:            }
259:
260:            /**
261:             * Return a Map containing the given key name and value.
262:             *
263:             * @param key   the map key name
264:             * @param value the map key value
265:             * @return a Map containing the given key name and value
266:             */
267:            public Map toMap(String key, Object value) {
268:                return super.toMap(key, value);
269:            }
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.