Java Doc for CayenneTemplate.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 Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jpublish.module.cayenne.CayenneTemplate

All known Subclasses:   org.jpublish.module.cayenne.JPCayenneService,
CayenneTemplate
public class CayenneTemplate (Code)
Provides base Cayenne data access object or service class to extend, following the Spring DAO template pattern. This class uses thread bound DataContext for all data access operations.

This class is designed to be extended by custom DAO or Service subclasses which provide their own public interface. All methods on CayenneTemplate have protected visibility so they are not publicly visible on the custom subclasses.

CayenneTemplate provides many convience DataContext methods using the DataContext object bound to the current thread.
author:
   Malcolm Edgar
author:
   Andrei Adamchik
author:
   Florin T.PATRASCU
since:
   $Revision$ (created: Sep 22, 2007 11:45:03 PM)





Method Summary
protected  voidcommitChanges()
     Commit any changes in the thread local DataContext.
protected  PersistentcreateAndRegisterNewObject(Class dataObjectClass)
     Instantiates new object and registers it with itself.
protected  voiddeleteObject(DataObject dataObject)
     Schedules an object for deletion on the next commit of this DataContext.
protected  DataObjectfindObject(Class dataObjectClass, String property, Object value)
     Find the data object for the specified class, property name and property value, or null if no data object was found.
protected  DataContextgetDataContext()
     Return the thread local DataContext.
protected  DataObjectgetObjectForPK(Class doClass, Object id)
     Perform a database query returning the data object specified by the class and the primary key.
protected  DataObjectgetObjectForPK(Class dataObjectClass, Object id, boolean refresh)
     Perform a query returning the data object specified by the class and the primary key value.
protected  StringgetPkName(Class dataObjectClass)
     Return the database primary key column name for the given data object.
protected  int[]performNonSelectingQuery(Query query)
     Performs a single database query that does not select rows.
protected  int[]performNonSelectingQuery(String queryName)
     Performs a named mapped query that does not select rows.
protected  int[]performNonSelectingQuery(String queryName, Map parameters)
     Performs a named mapped non-selecting query using a map of parameters.
protected  ListperformQuery(Query query)
     Performs a single selecting query.
protected  ListperformQuery(String queryName, boolean refresh)
     Returns a list of objects or DataRows for a named query stored in one of the DataMaps.
protected  ListperformQuery(String queryName, Map parameters, boolean refresh)
     Returns a list of objects or DataRows for a named query stored in one of the DataMaps.
protected  ListperformQuery(Class dataObjectClass, String property, Object value)
     Return a list of data object of the specified class for the given property and value.
protected  voidregisterNewObject(DataObject dataObject)
     Registers a transient object with the context, recursively registering all transient DataObjects attached to this object via relationships.
protected  voidrollbackChanges()
     Reverts any changes that have occurred to objects registered in the thread local DataContext.
protected  MaptoMap(String key, Object value)
     Return a Map containing the given key name and value.



Method Detail
commitChanges
protected void commitChanges()(Code)
Commit any changes in the thread local DataContext.



createAndRegisterNewObject
protected Persistent createAndRegisterNewObject(Class dataObjectClass)(Code)
Instantiates new object and registers it with itself. Object class must have a default constructor.
Parameters:
  dataObjectClass - the data object class to create and register the new registered data object



deleteObject
protected void deleteObject(DataObject dataObject) throws DeleteDenyException(Code)
Schedules an object for deletion on the next commit of this DataContext. Object's persistence state is changed to PersistenceState.DELETED; objects related to this object are processed according to delete rules, i.e. relationships can be unset ("nullify" rule), deletion operation is cascaded (cascade rule).
Parameters:
  dataObject - a persistent data object that we want to delete
throws:
  org.apache.cayenne.DeleteDenyException - if a DENY delete ruleis applicable for object deletion



findObject
protected DataObject findObject(Class dataObjectClass, String property, Object value)(Code)
Find the data object for the specified class, property name and property value, or null if no data object was found.
Parameters:
  dataObjectClass - the data object class to find
Parameters:
  property - the name of the property
Parameters:
  value - the value of the property the data object for the specified class, property name and property value
throws:
  RuntimeException - if more than one data object was identified for thegiven property name and value



getDataContext
protected DataContext getDataContext()(Code)
Return the thread local DataContext. the thread local DataContext
throws:
  IllegalStateException - if there is no DataContext bound to the current thread



getObjectForPK
protected DataObject getObjectForPK(Class doClass, Object id)(Code)
Perform a database query returning the data object specified by the class and the primary key. This method will perform a database query and refresh the object cache.
Parameters:
  doClass - the data object class to retrieve
Parameters:
  id - the data object primary key the data object for the given class and id



getObjectForPK
protected DataObject getObjectForPK(Class dataObjectClass, Object id, boolean refresh)(Code)
Perform a query returning the data object specified by the class and the primary key value. If the refresh parameter is true a database query will be performed, otherwise the a query against the object cache will be performed first.
Parameters:
  dataObjectClass - the data object class to retrieve
Parameters:
  id - the data object primary key
Parameters:
  refresh - the refresh the object cache mode the data object for the given class and id



getPkName
protected String getPkName(Class dataObjectClass)(Code)
Return the database primary key column name for the given data object.
Parameters:
  dataObjectClass - the class of the data object the primary key column name



performNonSelectingQuery
protected int[] performNonSelectingQuery(Query query)(Code)
Performs a single database query that does not select rows. Returns an array of update counts.
Parameters:
  query - the query to perform the array of update counts



performNonSelectingQuery
protected int[] performNonSelectingQuery(String queryName)(Code)
Performs a named mapped query that does not select rows. Returns an array of update counts.
Parameters:
  queryName - the name of the query to perform the array of update counts



performNonSelectingQuery
protected int[] performNonSelectingQuery(String queryName, Map parameters)(Code)
Performs a named mapped non-selecting query using a map of parameters. Returns an array of update counts.
Parameters:
  queryName - the name of the query to perform
Parameters:
  parameters - the Map of query paramater names and values the array of update counts



performQuery
protected List performQuery(Query query)(Code)
Performs a single selecting query. Various query setting control the behavior of this method and the results returned:
  • Query caching policy defines whether the results are retrieved from cache or fetched from the database. Note that queries that use caching must have a name that is used as a caching key.
  • Query refreshing policy controls whether to refresh existing data objects and ignore any cached values.
  • Query data rows policy defines whether the result should be returned as DataObjects or DataRows.

Parameters:
  query - the query to perform a list of DataObjects or a DataRows for the query



performQuery
protected List performQuery(String queryName, boolean refresh)(Code)
Returns a list of objects or DataRows for a named query stored in one of the DataMaps. Internally Cayenne uses a caching policy defined in the named query. If refresh flag is true, a refresh is forced no matter what the caching policy is.
Parameters:
  queryName - a name of a GenericSelectQuery defined in one of the DataMaps. Ifno such query is defined, this method will throw a CayenneRuntimeException
Parameters:
  refresh - A flag that determines whether refresh of cached listsis required in case a query uses caching. the list of data object or DataRows for the named query



performQuery
protected List performQuery(String queryName, Map parameters, boolean refresh)(Code)
Returns a list of objects or DataRows for a named query stored in one of the DataMaps. Internally Cayenne uses a caching policy defined in the named query. If refresh flag is true, a refresh is forced no matter what the caching policy is.
Parameters:
  queryName - a name of a GenericSelectQuery defined in one of the DataMaps. Ifno such query is defined, this method will throw a CayenneRuntimeException
Parameters:
  parameters - A map of parameters to use with stored query
Parameters:
  refresh - A flag that determines whether refresh of cached listsis required in case a query uses caching. the list of data object or DataRows for the named query



performQuery
protected List performQuery(Class dataObjectClass, String property, Object value)(Code)
Return a list of data object of the specified class for the given property and value.
Parameters:
  dataObjectClass - the data object class to return
Parameters:
  property - the name of the property to select
Parameters:
  value - the property value to select a list of data objects for the given class and property name and value



registerNewObject
protected void registerNewObject(DataObject dataObject)(Code)
Registers a transient object with the context, recursively registering all transient DataObjects attached to this object via relationships.
Parameters:
  dataObject - new object that needs to be made persistent



rollbackChanges
protected void rollbackChanges()(Code)
Reverts any changes that have occurred to objects registered in the thread local DataContext.



toMap
protected Map toMap(String key, Object value)(Code)
Return a Map containing the given key name and value.
Parameters:
  key - the map key name
Parameters:
  value - the map key value a Map containing the given key name and value



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.