Java Doc for Query.java in  » 6.0-JDK-Modules » jsr-283 » javax » jcr » query » 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 » 6.0 JDK Modules » jsr 283 » javax.jcr.query 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.jcr.query.Query

Query
public interface Query (Code)
A Query object.


Field Summary
final public static  StringJCR_JQOM
     A string constant representing the JCR-JQOM query language.
final public static  StringJCR_SQL2
     A string constant representing the JCR-SQL2 query language.
final public static  intSEARCH_VERSIONS
     Flag determining the scope of a query.
final public static  intSEARCH_WORKSPACE
     Flag determining the scope of a query.
final public static  intSEARCH_WORKSPACE_NO_SYSTEM
     Flag determining the scope of a query.
final public static  StringSQL
     A string constant representing the SQL query language as defined in JCR 1.0.
final public static  StringXPATH
     A string constant representing the XPath query language as defined in JCR 1.0.


Method Summary
public  QueryResultexecute()
     Executes this query and returns a QueryResult object.
public  QueryResultexecute(int searchSpace)
     Executes this query and returns a QueryResult .

The flag searchSpace determines the scope of the search:

SEARCH_WORKSPACE: Search the current workspace.

public  StringgetLanguage()
     Returns the language set for this query.
public  StringgetStatement()
     Returns the statement defined for this query.

If the language of this query is string-based (like JCR-SQL2), this method will return the statement that was used to create this query.

If the language of this query is JCR-JQOM, this method will return the JCR-SQL2 equivalent of the JCR-JQOM object tree.

This is the standard serialization of JCR-JQOM and is also the string stored in the jcr:statement property if the query is persisted.

public  StringgetStoredQueryPath()
     If this is a Query object that has been stored using Query.storeAsNode (regardless of whether it has been saved yet) or retrieved using QueryManager.getQuery ), then this method returns the path of the nt:query node that stores the query.
public  voidsetLimit(long limit)
     Sets the maximum size of the result set to limit.
public  voidsetOffset(long offset)
     Sets the start offset of the result set to offset.
public  NodestoreAsNode(String absPath)
     Creates a node representing this Query in content.

In a level 1 repository this method throws an UnsupportedRepositoryOperationException.

In a level 2 repository it creates a node of type nt:query at absPath and returns that node.

In order to persist the newly created node, a save must be performed that includes the parent of this new node within its scope.


Field Detail
JCR_JQOM
final public static String JCR_JQOM(Code)
A string constant representing the JCR-JQOM query language.
since:
   JCR 2.0



JCR_SQL2
final public static String JCR_SQL2(Code)
A string constant representing the JCR-SQL2 query language.
since:
   JCR 2.0



SEARCH_VERSIONS
final public static int SEARCH_VERSIONS(Code)
Flag determining the scope of a query. For details, see Query.execute(int) .
since:
   JCR 2.0



SEARCH_WORKSPACE
final public static int SEARCH_WORKSPACE(Code)
Flag determining the scope of a query. For details, see Query.execute(int) .
since:
   JCR 2.0



SEARCH_WORKSPACE_NO_SYSTEM
final public static int SEARCH_WORKSPACE_NO_SYSTEM(Code)
Flag determining the scope of a query. For details, see Query.execute(int) .
since:
   JCR 2.0



SQL
final public static String SQL(Code)
A string constant representing the SQL query language as defined in JCR 1.0.



XPATH
final public static String XPATH(Code)
A string constant representing the XPath query language as defined in JCR 1.0.





Method Detail
execute
public QueryResult execute() throws RepositoryException(Code)
Executes this query and returns a QueryResult object.

Equivalent to execute(SEARCH_CURRENT_WORKSPACE). a QueryResult object
throws:
  RepositoryException - if an error occurs




execute
public QueryResult execute(int searchSpace) throws SearchNotSupportedException, RepositoryException(Code)
Executes this query and returns a QueryResult .

The flag searchSpace determines the scope of the search:

SEARCH_WORKSPACE: Search the current workspace. In repositories that support full versioning, each workspace includes a subtree /jcr:system/jcr:versionStorage which reflects the version information of the repository. In such repositories this option will search the entire workspace including this version storage subtree.

In repositories that support only simple versioning, repository version storage is not reflected in workspace content and so this option will, by definition, not search versions. In that case searching of versions can be done with the SEARCH_VERSIONS option.

In either of the above cases, if a repository supports other features that mandate the storage of data under /jcr:system these substructures will be searched under this option. To prevent search of the system node subtree the option SEARCH_WORKSPACE_NO_SYSTEM can be used.

This option is equivalent to the zero-parameter signature Query.execute() .

SEARCH_WORKSPACE_NO_SYSTEM: Searches the current workspace except for the /jcr:system subtree. If no /jcr:system subtree exists this option is equivalent to SEARCH_WORKSPACE.

SEARCH_VERSIONS: Search all versions of all nodes in the repository. This option will search version storage regardless of whether it is reflected in workspace content (as when full versioning is s upported) or hidden within the implementation (as when only simple versioning is supported). Queries using this option will return results in the form of nt:version nodes even in repositories that do not expose version storage as content in the the workspace.

In repositories that support only simple versioning, using this option is the only way to search version information. In repositories that support full versioning this option is also supported though queries involving features unique to full versioning will still require direct search of the version history structure below /jcr:system/jcr:versionHistory.

A SearchNotSupportedException is thrown if the QueryManager does not support the search mode.

Throws a RepositoryException if an error occurs.
Parameters:
  searchSpace - flag which determines the scope of the search a QueryResult
throws:
  SearchNotSupportedException - if the QueryManagerdoes not support the search mode.
throws:
  RepositoryException - if an error occurs
since:
   JCR 2.0




getLanguage
public String getLanguage()(Code)
Returns the language set for this query. This will be one of the query language constants returned by QueryManager.getSupportedQueryLanguages . the query language.



getStatement
public String getStatement()(Code)
Returns the statement defined for this query.

If the language of this query is string-based (like JCR-SQL2), this method will return the statement that was used to create this query.

If the language of this query is JCR-JQOM, this method will return the JCR-SQL2 equivalent of the JCR-JQOM object tree.

This is the standard serialization of JCR-JQOM and is also the string stored in the jcr:statement property if the query is persisted. See Query.storeAsNode(String) . the query statement.




getStoredQueryPath
public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException(Code)
If this is a Query object that has been stored using Query.storeAsNode (regardless of whether it has been saved yet) or retrieved using QueryManager.getQuery ), then this method returns the path of the nt:query node that stores the query. If this is a transient query (that is, a Query object created with QueryManager.createQuery but not yet stored), then this method throws an ItemNotFoundException. path of the node representing this query.
throws:
  ItemNotFoundException - if this query is not a stored query.
throws:
  RepositoryException - if another error occurs.



setLimit
public void setLimit(long limit)(Code)
Sets the maximum size of the result set to limit.
Parameters:
  limit - a long
since:
   JCR 2.0



setOffset
public void setOffset(long offset)(Code)
Sets the start offset of the result set to offset.
Parameters:
  offset - a long
since:
   JCR 2.0



storeAsNode
public Node storeAsNode(String absPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException(Code)
Creates a node representing this Query in content.

In a level 1 repository this method throws an UnsupportedRepositoryOperationException.

In a level 2 repository it creates a node of type nt:query at absPath and returns that node.

In order to persist the newly created node, a save must be performed that includes the parent of this new node within its scope. In other words, either a Session.save or an Item.save on the parent or higher-degree ancestor of absPath must be performed.

In the context of this method the absPath provided must not have an index on its final element. If it does then a RepositoryException is thrown.

Strictly speaking, the parameter is actually a absolute path to the parent node of the node to be added, appended with the name desired for the new node. It does not specify a position within the child node ordering (if such ordering is supported). If ordering is supported by the node type of the parent node then the new node is appended to the end of the child node list.

An ItemExistsException will be thrown either immediately (by this method), or on save, if an item at the specified path already exists and same-name siblings are not allowed. Implementations may differ on when this validation is performed.

A PathNotFoundException will be thrown either immediately, or on save, if the specified path implies intermediary nodes that do not exist. Implementations may differ on when this validation is performed.

A ConstraintViolationExceptionwill be thrown either immediately or on save, if adding the node would violate a node type or implementation-specific constraint or if an attempt is made to add a node as the child of a property. Implementations may differ on when this validation is performed.

A VersionException will be thrown either immediately (by this method), or on save, if the node to which the new child is being added is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in. Implementations may differ on when this validation is performed.

A LockException will be thrown either immediately (by this method), or on save, if a lock prevents the addition of the node. Implementations may differ on when this validation is performed.
Parameters:
  absPath - absolute path the query should be stored at the newly created node.
throws:
  ItemExistsException - if an item at the specified path already exists,same-name siblings are not allowed and this implementation performs thisvalidation immediately instead of waiting until save.
throws:
  PathNotFoundException - if the specified path implies intermediaryNodes that do not exist or the last element ofrelPath has an index, and this implementation performs thisvalidation immediately instead of waiting until save.
throws:
  ConstraintViolationException - if a node type or implementation-specific constraintis violated or if an attempt is made to add a node as the child of a property and thisimplementation performs this validation immediately instead of waiting until save.
throws:
  VersionException - if the node to which the new child is being added is versionable andchecked-in or is non-versionable but its nearest versionable ancestor is checked-in and thisimplementation performs this validation immediately instead of waiting until save.
throws:
  LockException - if a lock prevents the addition of the node and thisimplementation performs this validation immediately instead of waiting until save.
throws:
  UnsupportedRepositoryOperationException - in a level 1 implementation.
throws:
  RepositoryException - if another error occurs or if the absPath provided hasan index on its final element.




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