i am using CMIS javascript api to pull data from an alfresco repository,
i'm trying to get document in a specific folder (i have the folder object )
but the only query that seems to work is
"SELECT * FROM cmis:document WHERE IN_TREE('" + f_id + "') "
but this query search recursively, i want the search to be specific the that folder.
thank you
Just try to use IN_FOLDER.
Reference: http://docs.alfresco.com/community5.1/pra/1/concepts/cmis-query.html
Related
I need to query a particular folder in the repository using a java based scheduler in alfresco.
I need to check whether the custom aspect's property is present or not.
Below query works for me when I don't use the path query.
select * from myType:caseDoc as d join myAspect:caseId as s on d.cmis:objectId = s.cmis:objectId
The problem with the above query is it searches all the contents in the repository but I want to target a particular folder.
When I try to put the CONTAINS in the above query it fails.
select * from cch:caseDoc as d
join cch:caseId as s on d.cmis:objectId = s.cmis:objectId WHERE CONTAINS('PATH:"//app:company_home/cm:FWED/cm:CDO/cm:CAB-DROP-FOLDER/*"')
It gives below exception
A selector must be specified when there are two or more selectors
Thank you
It looks like you may be missing one argument in CONTAINS(). Did you try something like this?
select *
from cch:caseDoc as d
join cch:caseId as s
on d.cmis:objectId = s.cmis:objectId
WHERE CONTAINS(d,'PATH:"//app:company_home/cm:FDLE/cm:CCH/cm:CCH-DROP-FOLDER/*"')
(I'm just putting my comment as an answer)
Well, if you are worrying about the path, then you should put
CONTAINS('PATH:"/app:company_home/cm:FWED/cm:CDO/cm:CAB-DROP-FOLDER/*"')
With one single / at the start of the path, if you which to only search in direct children to that path or :
CONTAINS('PATH:"/app:company_home/cm:FWED/cm:CDO/cm:CAB-DROP-FOLDER//*"')
to perform the lookup in the whole underlying hierarchy!
However, I do think that the query you provided and the behaviour you described does not match each other !
I need to get the nodeRef of the document knowing the file on the disk.
Example:
I have a file 2016/6/1/8/0/087dabc7-6b5b-4840-8f3a-d45a55735fac.bin on the disk.
I want to get to the nodeRef of the document inside this file.
I know the path of this file is saved in the cm:content property of the node, but I do not want to get all documents and then iterate over them until I get to right one. Is there an unexpensive way (from the performance perspective) to do this ?
Thank you !
The nodeRef and name of the .bin file is not the same string. So you cannot just get name of the file and put it as nodeRef, AFAIK.
One thing you can do is to query the database (unfortunately I don't have alfresco right now, so I cannot test the query, but it should be something like this):
with tt as(
select node_id
from alf_node_properties
where string_value like '%file-name.bin%')
select * from tt, alf_node
where tt.node_id = alf_node.node_id
In the result you'd have uuid which is nodeRef.
Another thing you can do is to query with CMIS for documents created at the same time, in your case it's ~ 1st of June 2016 8am.
I tried to search documnet with its property and document name
i used following query.
I used cmis API to search records
select * from my:content where my:customnode Like '%Test' or cmis:name
Like '%Test%'
Its not working..I didn't search my record by document name..
I search record from my custom model.
If i search record by only property like my:customnode,my:address then it gives output successfully.
But When I used cmis:name then it didn't work.
How can I search document by its name??
Thanks
A common mistake is not adding a where clause for each aspect you are searching on.
If the property my:customnode (I'm guessing this is a property otherwise this is the problem) is part of an aspect you need to do a join like this:
... from my:content JOIN my:aspect as ma where ma.my:customprop like ...
Your query should work the problem is not the cmis:name column.
I just tried the following query on my repository and it worked as expected:
select * from my:DocumentDetails
where my:DocumentTitle like '%Test%'
or cmis:name like '%23%'
Unless I am missing something, this seems a problem with lucene or solr indexes.
Have you tested your query in the "Node Browser"? You can execute the same search with CMIS and with a lucene query. If it does not work with the lucene query, check your indexes.
I'm not familiar with Documentum, so my question is likely to be dummy, but I was wondering if somebody told me how can I pull out the latest version of a document from Documentum.
For example, if I have i_chronicle_id or a list of i_chronicle_id and I want to export latest version of that doc/docs to my local machine, how can I do that?
Also I'd be happy, If somebody pointed me out to good reference/guide of DQL and Documentum Java API.
When you have i_chronicle_id you can get latest object by this query:
SELECT * FROM dm_document
WHERE i_chronicle_id = '<i_chronicle_id>'
When you have r_object_id's from non current version of documents you can have current version of document using this query:
SELECT * FROM dm_document
WHERE i_chronicle_id
IN (SELECT i_chronicle_id FROM dm_document (ALL)
WHERE r_object_id = '<r_object_id>' )
Keep in mind that every query return the latest version, i.e. CURRENT version of the object/document. If you want to retrieve all versions of object/document you need to add the (ALL) keyword just after the WHERE clause. For example:
SELECT * FROM dm_document (ALL)
Of course, you want to add something in your WHERE clause since this query will return lots of rows.
As for the DQL reference guide, you can always download it from ECM support site or find some version around the network, for example here (very old one though, but good enough for starter).
Same for the Documentum Java API.
We are trying to build an web application that allows users to select appropriate columns for given database table.
I wonder if there is any API for these - I've googled it a while in vain. Otherwise, if you can give some clues (patterns or sample codes) how to build such a component, that will be great and appreciated.
You could base your application on INFORMATION_SCHEMA views/table. This is documentation for SQL Server, but you can easily find it for other databases too:
http://msdn.microsoft.com/en-us/library/ms186778.aspx
Sample SQLs:
select * from INFORMATION_SCHEMA.TABLES
select * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'users'
if you want to use this solution with many databases, to separate your application from db engine, you can create about defining IMetadataProvider interface and create implementations for different databases:
interface IMetadataProvider {
...GetTables();
...GetTableColumns();
...GetTableRelations();
//Other functions required by your project
}
You can also create your own query builder interface:
interface IQueryBuilder {
...From(string tableName);
...Top(int numberOfRows); //TOP for SQL SERVER, LIMIT for MySQL
}