Java Doc for GenericQueryManager.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » database » querymanagers » generic » 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 » rife 1.6.1 » com.uwyn.rife.database.querymanagers.generic 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.uwyn.rife.database.querymanagers.generic.GenericQueryManager

GenericQueryManager
public interface GenericQueryManager extends ValidationContext(Code)
A GenericQueryManager provides features that make it easy to persist and retrieve beans in a database with single method calls. An instance of the manager can by obtained by using the GenericQueryManagerFactory class.

Callbacks are also supported to make it possible to interact with the persistence actions in a bean-centric way. More information can be found in the Callbacks interface.
author:
   Geert Bevin (gbevin[remove] at uwyn dot com)
version:
   $Revision: 3634 $
See Also:   com.uwyn.rife.database.querymanagers.generic.GenericQueryManagerFactory
See Also:   com.uwyn.rife.database.querymanagers.generic.Callbacks
since:
   1.0





Method Summary
 voidaddListener(GenericQueryManagerListener listener)
     Add the listener to the manager to get notifications when actions were successful.
 intcount()
     Count the number of beans persisted.
 intcount(CountQuery query)
     Count the number of beans persisted with a custom CountQuery .
 GenericQueryManager<OtherBeanType>createNewManager(Class<OtherBeanType> beanClass)
     Create a new generic query manager of the same kind but for another bean class.
 booleandelete(int objectId)
     Delete a single identified bean

This method will delete the bean identifed by the passed in identifier.

 booleandelete(DeleteQuery query)
     Delete beans selected by the passed in DeleteQuery

This method will delete all beans identified by the passed in DeleteQuery .

 ClassgetBaseClass()
    
 CountQuerygetCountQuery()
    
 DeleteQuerygetDeleteQuery()
    
 DeleteQuerygetDeleteQuery(int objectId)
    
 StringgetIdentifierName()
     Get the name of the property defined as the identifier.
 intgetIdentifierValue(BeanType bean)
     Get the value of the property defined as the identifier.
 CreateTablegetInstallTableQuery()
     Get the query that would be used to install the table.

This method will return the query that would be used to install the database structure.

 RestoreQuerygetRestoreQuery()
     Get the base query used to restore beans.

This method will return the base query that would be used to restore beans with GenericQueryManager.restore() .

 RestoreQuerygetRestoreQuery(int objectId)
     Get the base query used to restore a single identifed bean.

This method will return the base query that would be used to restore a single bean with GenericQueryManager.restore(int) .

 StringgetTable()
    
 intinsert(BeanType bean)
     Insert a bean in the database.

This method specifically forces insertion of the bean into the database.

 voidinstall()
     Install the database structure into the database.

This method will cause the structure needed to persist the bean to be installed into the database.

 voidinstall(CreateTable query)
     Install the database structure into the database using a custom query.

This method will cause the structure needed to persist the bean to be installed into the database using the provided custom query.

 voidremove()
     Remove the database structure

This method will cause the database structure to be removed from the database deleting all saved beans in the process.

 voidremoveListeners()
     Remove all the listeners that are registered to the manager.
 List<BeanType>restore()
     Restore all the beans persisted under this manager.
 BeanTyperestore(int objectId)
     Restore a single bean using the identifier.

This method will return a single bean having the provided identifier.

 booleanrestore(DbRowProcessor rowProcessor)
     Restore all beans using the row processor provided.
 List<BeanType>restore(RestoreQuery query)
     Restore a list of beans that match the provided RestoreQuery .

This method will return a list of beans that match the provided RestoreQuery .

 booleanrestore(RestoreQuery query, DbRowProcessor rowProcessor)
     Restore a list of beans that match the provided RestoreQuery and process with the DbRowProcessor .

This method will return a list of beans that match the provided RestoreQuery and process these matches with the provided DbRowProcessor .

 BeanTyperestoreFirst(RestoreQuery query)
     Restore the first bean that matches the RestoreQuery .

This method will return the first bean that matches the RestoreQuery .

 intsave(BeanType bean)
     Persist a bean.

This method allows a person to persist a bean to a DB to be later restored.

 intupdate(BeanType bean)
     Update an existing bean in the database.

This method specifically forces the updating of the bean into the database.




Method Detail
addListener
void addListener(GenericQueryManagerListener listener)(Code)
Add the listener to the manager to get notifications when actions were successful.
Parameters:
  listener - the listener that has to be added
since:
   1.5



count
int count() throws DatabaseException(Code)
Count the number of beans persisted.

This method will count the total number of beans persisted under this manager.
since:
   1.0 the number of beans persisted under this manager
since:
   1.0




count
int count(CountQuery query) throws DatabaseException(Code)
Count the number of beans persisted with a custom CountQuery .

This method will count the total number of beans persisted under this manager that match the provided CountQuery .
Parameters:
  query - the query that will be used to determine which beans tocount the number of beans persisted under this manager that match theprovided query
since:
   1.0




createNewManager
GenericQueryManager<OtherBeanType> createNewManager(Class<OtherBeanType> beanClass)(Code)
Create a new generic query manager of the same kind but for another bean class.
Parameters:
  beanClass - the class of the bean for which the new generic querymanager has to be created a new generic query manager instance
since:
   1.6



delete
boolean delete(int objectId) throws DatabaseException(Code)
Delete a single identified bean

This method will delete the bean identifed by the passed in identifier.
Parameters:
  objectId - the identifier of the bean true if the deletion suceeded, false if it did not
since:
   1.0




delete
boolean delete(DeleteQuery query) throws DatabaseException(Code)
Delete beans selected by the passed in DeleteQuery

This method will delete all beans identified by the passed in DeleteQuery .
Parameters:
  query - the query to select the beans true if the deletion suceeded, false if it did not
since:
   1.0




getBaseClass
Class getBaseClass()(Code)
Get the handled class the handled class
since:
   1.0



getCountQuery
CountQuery getCountQuery()(Code)
Get the base CountQuery used to count the number of beans persisted under this manager the query that would be used to count the total number of beanspersisted under this managerù
since:
   1.0



getDeleteQuery
DeleteQuery getDeleteQuery()(Code)
Return the base DeleteQuery that would be used to delete beans the base DeleteQuery
since:
   1.0



getDeleteQuery
DeleteQuery getDeleteQuery(int objectId)(Code)
Return the base DeleteQuery that would be used to delete a single bean
Parameters:
  objectId - the identifier to fill into the base DeleteQuery the base DeleteQuery
since:
   1.0



getIdentifierName
String getIdentifierName()(Code)
Get the name of the property defined as the identifier.

Defaults to "id". the name of the property defined as the identifier
since:
   1.0




getIdentifierValue
int getIdentifierValue(BeanType bean) throws DatabaseException(Code)
Get the value of the property defined as the identifier.

The property defaults to "id".
Parameters:
  bean - the bean to retrieve the identifier value for the value of the property defined as the identifier
since:
   1.0




getInstallTableQuery
CreateTable getInstallTableQuery() throws DatabaseException(Code)
Get the query that would be used to install the table.

This method will return the query that would be used to install the database structure. Can be used to modify the structure if i custom structure is needed. Mostly likely to be passed into GenericQueryManager.install(CreateTable) the query that would be used to install the database structure
since:
   1.0




getRestoreQuery
RestoreQuery getRestoreQuery()(Code)
Get the base query used to restore beans.

This method will return the base query that would be used to restore beans with GenericQueryManager.restore() . This can be used to restrict the query so that less beans are returned or certain beans are returned. the query that would be used to restore a number of beans
since:
   1.0




getRestoreQuery
RestoreQuery getRestoreQuery(int objectId)(Code)
Get the base query used to restore a single identifed bean.

This method will return the base query that would be used to restore a single bean with GenericQueryManager.restore(int) . This can be used to restrict the query so that a bean not matching the query will not be returned. the query that would be used to restore a single identifiedbean
since:
   1.0




getTable
String getTable()(Code)
Get the managed database table name the table name
since:
   1.0



insert
int insert(BeanType bean) throws DatabaseException(Code)
Insert a bean in the database.

This method specifically forces insertion of the bean into the database. This method is only recommended for use when you know what you are doing. The GenericQueryManager.save(Object bean) method is safer because it can detect whether to insert or update the bean in that database, leading to safer, simpler code. Bean restrictions mirror GenericQueryManager.save(Object bean) .
Parameters:
  bean - the bean to be inserted the indentier assigned to the new bean
See Also:   GenericQueryManager.save(Object bean)
since:
   1.0




install
void install() throws DatabaseException(Code)
Install the database structure into the database.

This method will cause the structure needed to persist the bean to be installed into the database. This includes any validatity checks that the database supports and that have already been defined. Including (but not limited to): length, notNull, notEmpty, etc. etc. This method will fail semi-gracefully if the installation fails. Generally it's best to catch the DatabaseException and assume that the database is already installed.
See Also:   GenericQueryManager.remove()
since:
   1.0




install
void install(CreateTable query) throws DatabaseException(Code)
Install the database structure into the database using a custom query.

This method will cause the structure needed to persist the bean to be installed into the database using the provided custom query. The custom query is usually obtained by using GenericQueryManager.getInstallTableQuery() . This includes any validatity checks that the database supports and that have already been defined. Including (but not limited to): length, notNull, notEmpty, etc. etc. This method will fail semi-gracefully if the installation fails. Generally it's best to catch the DatabaseException and assume that the database is already installed.
Parameters:
  query - the CreateTable query to use to create the table
See Also:   GenericQueryManager.install()
See Also:   GenericQueryManager.remove()
since:
   1.0




remove
void remove() throws DatabaseException(Code)
Remove the database structure

This method will cause the database structure to be removed from the database deleting all saved beans in the process. No new beans of this type can be persisted until the database structure is reinstalled.
See Also:   GenericQueryManager.install()
since:
   1.0




removeListeners
void removeListeners()(Code)
Remove all the listeners that are registered to the manager.
since:
   1.5



restore
List<BeanType> restore() throws DatabaseException(Code)
Restore all the beans persisted under this manager.

This method will return a List of all the beans persisted under this manager. a List of all the persisted beans
since:
   1.0




restore
BeanType restore(int objectId) throws DatabaseException(Code)
Restore a single bean using the identifier.

This method will return a single bean having the provided identifier. Since the identifier is unique, you can be assured of a single bean with a persistent id. This id is never changed under normal circumstances.
Parameters:
  objectId - the identifier to identify the bean to restore the bean that matches the identifier provided
since:
   1.0




restore
boolean restore(DbRowProcessor rowProcessor) throws DatabaseException(Code)
Restore all beans using the row processor provided.

This method will return all beans using a DbRowProcessor for reduced memory requirements as opposed to the full List version of GenericQueryManager.restore() .
Parameters:
  rowProcessor - the DbRowProcessor each row should be passed to true if beans were restored, false if not
See Also:   GenericQueryManager.restore()
since:
   1.0




restore
List<BeanType> restore(RestoreQuery query) throws DatabaseException(Code)
Restore a list of beans that match the provided RestoreQuery .

This method will return a list of beans that match the provided RestoreQuery . This can be used for more complex queries, or for exclusion of certain beans from the results.
Parameters:
  query - the query the beans should be restored from a list containing all the restored beans
See Also:   GenericQueryManager.restore()
since:
   1.0




restore
boolean restore(RestoreQuery query, DbRowProcessor rowProcessor) throws DatabaseException(Code)
Restore a list of beans that match the provided RestoreQuery and process with the DbRowProcessor .

This method will return a list of beans that match the provided RestoreQuery and process these matches with the provided DbRowProcessor . This can be used for more memory-intensive (or larger result sets) complex queries or for the exclusion of certain beans from the results.
Parameters:
  query - the query the beans should be restored from
Parameters:
  rowProcessor - the row processor that should be used to processeach matched bean row true if beans were processed, false if not
since:
   1.0




restoreFirst
BeanType restoreFirst(RestoreQuery query) throws DatabaseException(Code)
Restore the first bean that matches the RestoreQuery .

This method will return the first bean that matches the RestoreQuery . Especially useful for selecting the first returned bean from a complex query.
Parameters:
  query - the query the bean should be restored from the first bean that matches the RestoreQuery
See Also:   GenericQueryManager.restore(RestoreQuery)
since:
   1.0




save
int save(BeanType bean) throws DatabaseException(Code)
Persist a bean.

This method allows a person to persist a bean to a DB to be later restored. A bean to be persisted must have at least one integer identifier and one bean property both with accessors. If the identifier value is greater than or equal to 0, the bean is attempted to be updated first, if this fails (or the identifier is -1) the bean is assumed to be a new bean and a new sequential identifier is generated by the database.
Parameters:
  bean - the bean to be saved the identifier assigned to the new/updated bean
since:
   1.0




update
int update(BeanType bean) throws DatabaseException(Code)
Update an existing bean in the database.

This method specifically forces the updating of the bean into the database. This method is only recommended for use when you know what you are doing. The GenericQueryManager.save(Object bean) method is safer because it can detect whether to insert or update the bean in that database, leading to safer, simpler code. Bean restrictions mirror GenericQueryManager.save(Object bean) .
Parameters:
  bean - the bean to be updated the indentier assigned to the new bean
See Also:   GenericQueryManager.save(Object bean)
since:
   1.0




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