I Want to retrieve All document content from alfresco repository. So can anyone help me that how can i traverse the repository using CMIS. And while traversing i also want to separate the documents based on its type.
At this moment i am able to get any one document by specifying the path. but now my requirement is to traverse whole repository and get all the documents.
So can any one help me with this. Also suggest me that "Traversal of all folders and later separate by specific type" will be the good approach OR "Search specific type of document using CMIS query" will be the good approach.
Thanks in Advance.
Yagami's answer is a good start, but there are a few things to add.
First, do not do "select *" unless you actually need every single property the repository has. That is a potential performance problem. Only ask for what you need.
Second, one of your comments talks about segmenting results by type. In CMIS, a type is kind of like a SQL table. So in your case, you would do three different queries using each of your three custom types as a different type in the from clause:
Finally, unless you have just a handful of documents in your repository, you are almost certainly going to want to use a paged result set. Otherwise, you will only get back the maximum number of results the server is configured to return. That may not be large enough to get the entire set.
For an example showing paging the result set, see Apache CMIS: Paging query result
To perform an action like this (getting all the document content) you need to follow this steps
Step 1 : Create a saver Class
What i mean with sever class, it will hold two information (for me it's the most valuable informations) the two of them most be character varying
1 - The document ID
2 - The document Name
Step 2 : Get all the document
To get all the document we have to use a query
You will get all the document that you have in your repository.
You can add some condition to make your research more easier like in this example :
In this example you will get document of a particular folder.
and finally
You can read more about query in CMIS query.
Step 3 : Save every time the information in the saver class
I think it's clear that you have to save every time you use the loop (in step 2) in an occurence of saver class.
I hope that helped you.