nmalloul
nmalloul

Reputation: 83

Get Alfresco folder NodeRef using SearchService, LANGUAGE_CMIS

I have a java backed webscript. I use SearchService method to get the NodeRef of a folder stored in the Alfresco repository in this PATH:

/app:company_home/app:dictionary/app:models\

I used the LANGUAGE_CMIS_STRICT in the searchService method like this:

NodeRef activeModelRepositoryNodeRef=searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, 
                    SearchService.LANGUAGE_CMIS_STRICT, "select * cmis:objectId where contains ('PATH:\"/app:company_home/app:dictionary/app:models\"')").getNodeRef(0);

to get the nodeRef of models folder but i still getting this error in my log when i execute my query:

ERROR [extensions.webscripts.AbstractRuntime] [http-bio-8080-exec-19] Exception from executeScript: line 1:9 mismatched input 'cmis:objectId' expecting FROM ([@4,9:21='cmis:objectId',<37>,1:9]) in fromClause

Can anybody tell me what i made wrong, or telle me how to get a folder NodeRef by using LANGUAGE_CMIS_STRICT in SearchService query (I don't want to use the LANGUAGE_LUCENE). Thanks for any help.

Upvotes: 1

Views: 1049

Answers (2)

Jeff Potts
Jeff Potts

Reputation: 10538

This is not correct:

select * from cmis:objectId

The from clause should contain a valid type, like cmis:document or a custom type.

Maybe you meant something like:

select cmis:objectId from cmis:document

But I should also add that will return the CMIS Object ID, not the Alfresco node reference. Those are two different things, although they may look similar.

If you really want the Alfresco node ref look for a property called alfcmis:nodeRef.

Upvotes: 3

Lista
Lista

Reputation: 2246

You're simply missing FROM keyword.

select * FROM cmis:objectId

Upvotes: 2

Related Questions