Search query builder
beCPG provides an utility class to build safe and fast FTS or Alfresco Lucene query. This class will try as much as possible to build transactionnal query. See http://docs.alfresco.com/4.2/topic/com.alfresco.enterprise.doc/concepts/intrans-metadata.html for more information
Here are some use cases :
<code class="java">
//Getting some search results
List<NodeRef> ret = BeCPGQueryBuilder.createQuery()
.ofType(ContentModel.TYPE_FOLDER)
.isNotNull(ContentModel.PROP_MODIFIED)
.excludeAspect(ContentModel.ASPECT_WORKING_COPY)
.withAspect(ContentModel.ASPECT_TITLED)
.addSort(ContentModel.PROP_MODIFIED,true).list();
// Getting unlimited results, it will do an internal pagination based on date modified
List<NodeRef> ret = BeCPGQueryBuilder.createQuery()
.ofType(ContentModel.TYPE_FOLDER).maxResults(RepoConsts.MAX_RESULTS_UNLIMITED).list();
//Getting single result or null
NodeRef nodeRef = BeCPGQueryBuilder.createQuery()
.ofType(ContentModel.TYPE_FOLDER)
.andPropEquals(ContentModel.PROP_NAME, "Test").singleValue();
</code>