jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Jackrabbit: OCM Search (page edited)
Date Wed, 20 Feb 2008 20:41:00 GMT
OCM Search (JCR) edited by Christophe Lombart
      Page: http://cwiki.apache.org/confluence/display/JCR/OCM+Search
   Changes: http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=75350&originalVersion=1&revisedVersion=2

Comment:
---------------------------------------------------------------------

Replace the PersistenceManager reference by Object Content Manager

Change summary:
---------------------------------------------------------------------

Replace the PersistenceManager reference by Object Content Manager

Change summary:
---------------------------------------------------------------------

Replace the PersistenceManager reference by Object Content Manager

Change summary:
---------------------------------------------------------------------

Replace the PersistenceManager reference by Object Content Manager

Change summary:
---------------------------------------------------------------------

Replace the PersistenceManager reference by Object Content Manager

Content:
---------------------------------------------------------------------


h2. Searching a single object

{code}
QueryManager queryManager = ocm.getQueryManager();

// Build the search filter
Filter filter = queryManager.createFilter(Paragraph.class);
filter.addEqualTo("text", "Para 1");   // Text is an attribute in the class Paragraph

// Build the query
Query query = queryManager.createQuery(filter);
Paragraph paragraph = (Paragraph) ocm.getObject(query);
{code}

h2. Searching a collection

{code}
QueryManager queryManager = ocm.getQueryManager();
Filter filter = queryManager.createFilter(Paragraph.class);
filter.setScope("/test/node1//");
Query query = queryManager.createQuery(filter);
Collection result = ocm.getObjects(query);
{code}

h2. Searching with an iterator

{code}
QueryManager queryManager = ocm.getQueryManager();
Filter filter = queryManager.createFilter(Paragraph.class);
filter.setScope("/test/node1//");
Query query = queryManager.createQuery(filter);
Iterator iterator = ocm.getObjectIterator(query);
{code}

h2. Remove objects based on a query

{code}
QueryManager queryManager = ocm.getQueryManager();
Filter filter = queryManager.createFilter(Paragraph.class);
filter.setScope("/test/node1//");
Query query = queryManager.createQuery(filter);
ocm.remove(query);
{code}


---------------------------------------------------------------------
CONFLUENCE INFORMATION
This message is automatically generated by Confluence

Unsubscribe or edit your notifications preferences
   http://cwiki.apache.org/confluence/users/viewnotifications.action

If you think it was sent incorrectly contact one of the administrators
   http://cwiki.apache.org/confluence/administrators.action

If you want more information on Confluence, or have a bug to report see
   http://www.atlassian.com/software/confluence



Mime
View raw message