chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Streit <mcs...@gmail.com>
Subject OperationContext and the Session.query() method
Date Sat, 04 May 2013 22:05:32 GMT
Hello,

I know I must be missing something so perhaps someone can help clarify.


   1. We are currently using Apache Chemistry 0.8.0 (OpenCmis) quite
   successfully thus far, building an application that uses Alfresco 4.1.3
   Enterprise as the repository solution.
   2. Our content model is the OOTB CMIS model with a handful of String and
   date properties added using the appropriate xzy_model.xml and extensions
   mechanism specific to Alfresco.
   3. We are able to use the CMIS SQL language to retrieve lists of
   documents from cmis:Folder objects without any problems.  Syntax, for
   example, of of one of the queries looks like this:


String queryString = "SELECT * FROM acme:document WHERE
IN_FOLDER('workspace://SpacesStore/ad1kjhd5-01fc-43ad-af31-0d7dada9ec57')
ORDER BY acme:category DESC";


The Java code (used for current testing) that sends the query to the
repository looks like this:


ItemIterable<QueryResult> queryResult;

try {

    queryResult = this.cmisSession.*query*(queryString, false, this.*
minimalOperationContext*).getPage(cmisQueryPageLimit);

}


...

...


 // below is similar to output lines found in Chemistry GettingStarted
samples...


 if (queryResult != null) { *LOGGER.info*("***queryResult.getTotalNumItems()
" +

    queryResult.getTotalNumItems());
    int byteCount = 0;
    int i = 1;
    for (QueryResult qr : queryResult) {
    LOGGER.info("--------------------------------------------\n" + i + " ,
" +

    qr.getPropertyByQueryName("cmis:objectTypeId").getFirstValue() + " , " +

    qr.getPropertyByQueryName("cmis:name").getFirstValue() + " , " +

    qr.getPropertyByQueryName("cmis:creationDate").getFirstValue() + " , " +

    qr.getPropertyByQueryName("cmis:objectId").getFirstValue() + " , " +

    qr.getPropertyByQueryName("acme:category").getFirstValue() + " , " +

    qr.getPropertyByQueryName("acme:subCategory").getFirstValue() + " , " +

    qr.getPropertyByQueryName("cmis:contentStreamFileName").getFirstValue()
+ " , " +

    qr.getPropertyByQueryName("cmis:contentStreamMimeType").getFirstValue()
+ " , " +

    qr.getPropertyByQueryName("cmis:contentStreamLength").getFirstValue());
}

 }


It was suggested that we might see a performance improvement in searches by
using the OperationContext to reduce the set of properties pulled back on
each cmis:Document instance.

The OperationContext *minimalOperationContext *was set like this below,
 where I  am specifying only these few properties of the model to retrieve:

         cmisSession = sessionFactory.createSession(parameters);


         // only setting a few properties to retrieve for a test...

         Set<String> filterSet = new HashSet<String>();
         filterSet.add("cmis:objectId");
         filterSet.add("cmis:name");
         filterSet.add("cmis:creationDate");
         filterSet.add("cmis:contentStreamLength");


         OperationContext *minimalOperationContext *=
cmisSession.createOperationContext();
         minimalOperationContext.setFilter(filterSet);
         minimalOperationContext.setIncludeAcls(false);
         minimalOperationContext.setIncludeAllowableActions(false);
         minimalOperationContext.setIncludePolicies(false);

 minimalOperationContext.setIncludeRelationships(IncludeRelationships.NONE);
         minimalOperationContext.setRenditionFilterString("cmis:none");
         minimalOperationContext.setIncludePathSegments(false);
         minimalOperationContext.setOrderBy(null);
         minimalOperationContext.setCacheEnabled(false);


Now here is the puzzle.  I would actually *not expect *the lines that are
output from the LOGGER.info() to have included any of the properties that
were NOT included in the OperationContext specified.  However, the output
is showing EVERY property specified in the LOGGER.info() above ... as
though the OperationContext is getting ignored.  Or... am I totally missing
how this is supposed to work?

Thanks

Mark
*
*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message