Hi Everyone,
I'm using the Apache chemistry opencmis library to interact with Alfresco. To query documents there is a method called queryObjects, which takes in an OperationContext as an argument. On this context, I can set a boolean flag, called setLoadSecondaryTypeProperties. However, even if I set it to true, it won't return the secondary type properties. I can only reach those properties if i use a SELECT query and join the two "tables" together on cmisbjectId.
The problem is, that the select query doesn't return cmis Document types, it returns QueryResult types, and it can't be casted, and I really need the Document.
Am I missing something here?
Thanks in advance!
Bence
You can try
operationContext.setFilter(null);
It means select all properties from query type
Sadly, it doesn't seem to work
queryObjects(String typeId, String where, boolean searchAllVersions, OperationContext context);Have you tried to pass typeId your specified type instead of cmis:document/cmis:folder?
Yes, we have a custom type derived from cmis:document, lets call it invoiceScan
final OperationContext ctx = OperationContextUtils.createMaximumOperationContext(); ctx.setLoadSecondaryTypeProperties(true); ctx.setFilter(null); final ItemIterable<CmisObject> result = session.queryObjects( "invoiceScan", "cmis:name = 'testName'", false, ctx);
This way i get back the desired document and all the properties from our specified custom type, i can see the "SecondaryTypeIds" property too, but i dont't get the properties OF the secondary type.
I've tried creating the minimum operation context, the maximum, the default from the OperationContextUtils aswell.
Now i use cmis:name in the where clause, but I'll want to use secondary type properties there if i somehow manage to get them.
I have tested it ,you are right,it did not work.The only opiton you can choose is to use session.query which returns QueryResult.
then you can iterate the query result and load the document one by one , or you can use session.queryObjects to batch query documents by uuids
If you want to use aspect properties ,you can get from QueryResult
Thanks for your help! Currently I use session.query, then iterate over the result. Didn't wanted to use this method as I have to make severaly trips to the repository, but i have to, as I need to query these result by a secondary type property.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.