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


com.uwyn.rife.cmf.dam.ContentQueryManager

ContentQueryManager
public class ContentQueryManager extends GenericQueryManagerDelegate implements Cloneable(Code)
The ContentQueryManager simplifies working with content a lot. It extends com.uwyn.rife.database.querymanagers.generic.GenericQueryManagerGenericQueryManager and is a drop-in replacement that can be used instead. The ContentQueryManager class works hand-in-hand with CMF-related constraints that are provided via the classes com.uwyn.rife.site.Validation Validation and com.uwyn.rife.site.ConstrainedProperty ConstrainedProperty . The additional constraints allow you to provide CMF-related metadata for bean properties while still having access to all regular constraints.

The most important additional constraint is ' com.uwyn.rife.site.ConstrainedProperty.mimeType(com.uwyn.rife.cmf.MimeType) mimeType '. Setting this constraint directs RIFE to delegate the handling of that property's data to the CMF instead of storing it as a regular column in a database table. The property content location (i.e. its full path) is generated automatically based on the bean class name, the instance's identifier value (i.e. the primary key used by GenericQueryManager), and the property name. So for example, if you have an instance of the NewsItem class whose identifier is 23, then the full path that is generated for a property named text is '/newsitem/23/text'. Note that this always specifies the most recent version of the property, but that older versions are also available from the content store.

Before being able to use the CMF and a ContentQueryManager, you must install both of them, as in this example:

Datasource ds = Datasources.getRepInstance().getDatasource("datasource");
 DatabaseContentFactory.getInstance(ds).install();
 new ContentQueryManager(ds, NewsItem.class).install();

Apart from the handling of content, this query manager also integrates the functionalities of the OrdinalManager class.

The new ' com.uwyn.rife.site.ConstrainedProperty.ordinal(boolean) ordinal ' constraint indicates which bean property will be used to order that table rows. When saving and deleting beans, the ordinal values will be automatically updated in the entire table. The ContentQueryManager also provides the ContentQueryManager.move(Constrained,String,OrdinalManager.Direction) move , ContentQueryManager.up(Constrained,String) up and ContentQueryManager.down(Constrained,String) down methods to easily manipulate the order of existing rows.
author:
   Geert Bevin (gbevin[remove] at uwyn dot com)i
version:
   $Revision: 3848 $
since:
   1.0


Inner Class :class Listener implements GenericQueryManagerListener<T>


Constructor Summary
public  ContentQueryManager(Datasource datasource, Class<T> klass, Class backendClass)
     Creates a new ContentQueryManager instance for a specific class.
public  ContentQueryManager(Datasource datasource, Class<T> klass, String table)
     Creates a new ContentQueryManager instance for a specific class, but with a different table name for the database storage.
public  ContentQueryManager(Datasource datasource, Class<T> klass)
     Creates a new ContentQueryManager instance for a specific class.
public  ContentQueryManager(Datasource datasource, Class<T> klass, ContentManager contentManager)
     Creates a new ContentQueryManager instance for a specific class.

All content will be stored in the provided ContentManager instance.


Method Summary
public  StringbuildCmfPath(T bean, String propertyName)
     Builds the path that is used by the ContentQueryManager for a certain bean and property.
public  StringbuildCmfPath(int objectId, String propertyName)
     Builds the path that is used by the ContentQueryManager for a certain bean ID and property.
public  StringbuildServeContentPath(T bean, String propertyName)
     Builds the path that is used by the ServeContent element for a certain bean and property.
public  StringbuildServeContentPath(int objectId, String propertyName)
     Builds the path that is used by the ServeContent element for a certain bean ID and property.
public  Objectclone()
     Simply clones the instance with the default clone method.
public  GenericQueryManager<OtherBeanType>createNewManager(Class<OtherBeanType> type)
    
public  booleandelete(int objectId)
     Deletes a bean according to its ID.
public  booleandown(Constrained bean, String propertyName)
     Moves the row that corresponds to the provided bean instance downwards according to a property with an ordinal constraint.
public  StringgetContentForHtml(T bean, String propertyName, Element element, String serveContentExitName)
     Retrieves a content data representation for use in html.

This is mainly used to integrate content data inside a html document.

public  StringgetContentForHtml(int objectId, String propertyName, Element element, String serveContentExitName)
     Retrieves a content data representation for use in html.

This is mainly used to integrate content data inside a html document.

public  ContentManagergetContentManager()
     Returns the ContentManager that is used to store and retrieve the content.
public  StringgetRepository()
     Retrieves the default repository that is used by this ContentQueryManager.
public  booleanhasContent(T bean, String propertyName)
     Checks if there's content available for a certain property of a bean.
public  booleanhasContent(int objectId, String propertyName)
     Checks if there's content available for a certain property of a bean.
public  booleanmove(Constrained bean, String propertyName, OrdinalManager.Direction direction)
     Moves the row that corresponds to the provided bean instance according to a property with an ordinal constraint.
public  ContentQueryManager<T>repository(String repository)
     Sets the default repository that will be used by this ContentQueryManager.
public  Trestore(int objectId)
     Restores a bean according to its ID.
public  List<T>restore()
     Restores all beans.
public  List<T>restore(RestoreQuery query)
     Restores all beans from a RestoreQuery.
public  TrestoreFirst(RestoreQuery query)
     Restores the first bean from a RestoreQuery.
public  intsave(T bean)
     Saves a bean.

This augments the regular GenericQueryManager's save method with behaviour that correctly handles content or ordinal properties. When a bean is saved, null content properties are simply ignored when the property hasn't got an autoRetrieved constraint.

public  booleanstoreEmptyContent(T bean, String propertyName)
     Empties the content of a certain bean property.

When a bean is saved, null content properties are simply ignored when the property hasn't got an autoRetrieved constraint.

public  booleanup(Constrained bean, String propertyName)
     Moves the row that corresponds to the provided bean instance upwards according to a property with an ordinal constraint.


Constructor Detail
ContentQueryManager
public ContentQueryManager(Datasource datasource, Class<T> klass, Class backendClass)(Code)
Creates a new ContentQueryManager instance for a specific class.

All content will be stored in a com.uwyn.rife.cmf.dam.contentmanagers.DatabaseContent .
Parameters:
  datasource - the datasource that indicates where the data will bestored
Parameters:
  klass - the class of the bean that will be handled by thisContentQueryManager
Parameters:
  backendClass - the class the will be used by thisContentQueryManager to reference data in the backend
since:
   1.0




ContentQueryManager
public ContentQueryManager(Datasource datasource, Class<T> klass, String table)(Code)
Creates a new ContentQueryManager instance for a specific class, but with a different table name for the database storage.

All content will be stored in a com.uwyn.rife.cmf.dam.contentmanagers.DatabaseContent .
Parameters:
  datasource - the datasource that indicates where the data will bestored
Parameters:
  klass - the class of the bean that will be handled by thisContentQueryManager
Parameters:
  table - the name of the database table in which the non CMF data willbe stored
since:
   1.6




ContentQueryManager
public ContentQueryManager(Datasource datasource, Class<T> klass)(Code)
Creates a new ContentQueryManager instance for a specific class.

All content will be stored in a com.uwyn.rife.cmf.dam.contentmanagers.DatabaseContent .
Parameters:
  datasource - the datasource that indicates where the data will bestored
Parameters:
  klass - the class of the bean that will be handled by thisContentQueryManager
since:
   1.0




ContentQueryManager
public ContentQueryManager(Datasource datasource, Class<T> klass, ContentManager contentManager)(Code)
Creates a new ContentQueryManager instance for a specific class.

All content will be stored in the provided ContentManager instance. This constructor is handy if you want to integrate a custom content manager implementation.
Parameters:
  datasource - the datasource that indicates where the data will bestored
Parameters:
  klass - the class of the bean that will be handled by thisContentQueryManager
Parameters:
  contentManager - a ContentManager instance
since:
   1.0





Method Detail
buildCmfPath
public String buildCmfPath(T bean, String propertyName)(Code)
Builds the path that is used by the ContentQueryManager for a certain bean and property.
Parameters:
  bean - the bean instance that will be used to construct the path
Parameters:
  propertyName - the name of the property that will be used toconstruct the path the requested path
since:
   1.0



buildCmfPath
public String buildCmfPath(int objectId, String propertyName)(Code)
Builds the path that is used by the ContentQueryManager for a certain bean ID and property.
Parameters:
  objectId - the bean ID that will be used to construct the path
Parameters:
  propertyName - the name of the property that will be used toconstruct the path the requested path
since:
   1.0



buildServeContentPath
public String buildServeContentPath(T bean, String propertyName)(Code)
Builds the path that is used by the ServeContent element for a certain bean and property.

Any declaration of the repository name will be ignore, since the ServeContent element doesn't allow you to provide this through the URL for safety reasons.
Parameters:
  bean - the bean instance that will be used to construct the path
Parameters:
  propertyName - the name of the property that will be used toconstruct the path the requested path
since:
   1.4




buildServeContentPath
public String buildServeContentPath(int objectId, String propertyName)(Code)
Builds the path that is used by the ServeContent element for a certain bean ID and property.

Any declaration of the repository name will be ignore, since the ServeContent element doesn't allow you to provide this through the URL for safety reasons.
Parameters:
  objectId - the bean ID that will be used to construct the path
Parameters:
  propertyName - the name of the property that will be used toconstruct the path the requested path
since:
   1.4




clone
public Object clone()(Code)
Simply clones the instance with the default clone method. This creates a shallow copy of all fields and the clone will in fact just be another reference to the same underlying data. The independence of each cloned instance is consciously not respected since they rely on resources that can't be cloned.
since:
   1.0



createNewManager
public GenericQueryManager<OtherBeanType> createNewManager(Class<OtherBeanType> type)(Code)



delete
public boolean delete(int objectId) throws DatabaseException(Code)
Deletes a bean according to its ID.

This augments the regular GenericQueryManager's restore method with behaviour that correctly handles content and ordinal properties.
Parameters:
  objectId - the ID of the bean that has to be restored true if the bean was deleted successfully; or

false if it couldn't be found
since:
   1.0




down
public boolean down(Constrained bean, String propertyName)(Code)
Moves the row that corresponds to the provided bean instance downwards according to a property with an ordinal constraint.
Parameters:
  bean - the bean instance that corresponds to the row that has tobe moved
Parameters:
  propertyName - the name of the property with an ordinal constraint true if the row was moved successfully; or

false otherwise
since:
   1.0




getContentForHtml
public String getContentForHtml(T bean, String propertyName, Element element, String serveContentExitName) throws ContentManagerException(Code)
Retrieves a content data representation for use in html.

This is mainly used to integrate content data inside a html document. For instance, html content will be displayed as-is, while image content will cause an image tag to be generated with the correct source URL to serve the image.
Parameters:
  bean - the bean instance that contains the data
Parameters:
  propertyName - the name of the property whose html representationwill be provided
Parameters:
  element - an active element instance
Parameters:
  serveContentExitName - the exit name that leads to a com.uwyn.rife.cmf.elements.ServeContent ServeContent element. This willbe used to generate URLs for content that can't be directly displayedin-line. the html content representation
exception:
  ContentManagerException - if an unexpected error occurred
since:
   1.0




getContentForHtml
public String getContentForHtml(int objectId, String propertyName, Element element, String serveContentExitName) throws ContentManagerException(Code)
Retrieves a content data representation for use in html.

This is mainly used to integrate content data inside a html document. For instance, html content will be displayed as-is, while image content will cause an image tag to be generated with the correct source URL to serve the image.
Parameters:
  objectId - the ID of the bean that contains the data
Parameters:
  propertyName - the name of the property whose html representationwill be provided
Parameters:
  element - an active element instance
Parameters:
  serveContentExitName - the exit name that leads to a com.uwyn.rife.cmf.elements.ServeContent ServeContent element. This willbe used to generate URLs for content that can't be directly displayedin-line. the html content representation
exception:
  ContentManagerException - if an unexpected error occurred
since:
   1.0




getContentManager
public ContentManager getContentManager()(Code)
Returns the ContentManager that is used to store and retrieve the content. the ContentManager
since:
   1.0



getRepository
public String getRepository()(Code)
Retrieves the default repository that is used by this ContentQueryManager. this ContentQueryManager's repository
See Also:   ContentQueryManager.repository
since:
   1.4



hasContent
public boolean hasContent(T bean, String propertyName) throws DatabaseException(Code)
Checks if there's content available for a certain property of a bean.
Parameters:
  bean - the bean instance that will be checked
Parameters:
  propertyName - the name of the property whose content availabilitywill be checked true if content is available; or

false otherwise
since:
   1.0




hasContent
public boolean hasContent(int objectId, String propertyName) throws DatabaseException(Code)
Checks if there's content available for a certain property of a bean.
Parameters:
  objectId - the ID of the bean instance that will be checked
Parameters:
  propertyName - the name of the property whose content availabilitywill be checked true if content is available; or

false otherwise
since:
   1.0




move
public boolean move(Constrained bean, String propertyName, OrdinalManager.Direction direction)(Code)
Moves the row that corresponds to the provided bean instance according to a property with an ordinal constraint.
Parameters:
  bean - the bean instance that corresponds to the row that has tobe moved
Parameters:
  propertyName - the name of the property with an ordinal constraint
Parameters:
  direction - OrdinalManager.UP or OrdinalManager.DOWN true if the row was moved successfully; or

false otherwise
since:
   1.0




repository
public ContentQueryManager<T> repository(String repository)(Code)
Sets the default repository that will be used by this ContentQueryManager. this ContentQueryManager
See Also:   ContentQueryManager.getRepository
since:
   1.4



restore
public T restore(int objectId) throws DatabaseException(Code)
Restores a bean according to its ID.

This augments the regular GenericQueryManager's restore method with behaviour that correctly handles content properties.
Parameters:
  objectId - the ID of the bean that has to be restored the bean instance if it was restored successfully; or

null if it couldn't be found
since:
   1.0




restore
public List<T> restore() throws DatabaseException(Code)
Restores all beans.

This augments the regular GenericQueryManager's restore method with behaviour that correctly handles content properties. the list of beans; or

null if no beans could be found
since:
   1.0




restore
public List<T> restore(RestoreQuery query) throws DatabaseException(Code)
Restores all beans from a RestoreQuery.

This augments the regular GenericQueryManager's restore method with behaviour that correctly handles content properties.
Parameters:
  query - the query that will be used to restore the beans the list of beans; or

null if no beans could be found
since:
   1.0




restoreFirst
public T restoreFirst(RestoreQuery query) throws DatabaseException(Code)
Restores the first bean from a RestoreQuery.

This augments the regular GenericQueryManager's restore method with behaviour that correctly handles content properties.
Parameters:
  query - the query that will be used to restore the beans the first bean instance that was found; or

null if no beans could be found
since:
   1.0




save
public int save(T bean) throws DatabaseException(Code)
Saves a bean.

This augments the regular GenericQueryManager's save method with behaviour that correctly handles content or ordinal properties. When a bean is saved, null content properties are simply ignored when the property hasn't got an autoRetrieved constraint. This is needed to make it possible to only update a bean's data without having to fetch the content from the back-end and store it together with the other data just to make a simple update.
Parameters:
  bean - the bean instance that has to be saved true if the bean was stored successfully; or

false otherwise
since:
   1.0




storeEmptyContent
public boolean storeEmptyContent(T bean, String propertyName)(Code)
Empties the content of a certain bean property.

When a bean is saved, null content properties are simply ignored when the property hasn't got an autoRetrieved constraint. This is needed to make it possible to only update a bean's data without having to fetch the content from the back-end and store it together with the other data just to make a simple update. However, this makes it impossible to rely on null to indicate empty content. This method has thus been added explicitly for this purpose.
Parameters:
  bean - the bean instance that contains the property
Parameters:
  propertyName - the name of the property whose content has to beemptied in the database true if the empty content was stored successfully;or

false otherwise
since:
   1.0




up
public boolean up(Constrained bean, String propertyName)(Code)
Moves the row that corresponds to the provided bean instance upwards according to a property with an ordinal constraint.
Parameters:
  bean - the bean instance that corresponds to the row that has tobe moved
Parameters:
  propertyName - the name of the property with an ordinal constraint true if the row was moved successfully; or

false otherwise
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.