3

By using CMIS Query i am only able to fetch 1000 documents. But i want to fetch all the documents available in the repository.

I read some solution regarding this, that we can make some configuration in repository.properties file and get the documents.

But here my question is, can we do it through our Code in CMIS, because i am accessing production repository. and to make the change in repository.properties file i need some down time from business users. that is not possible in my case.

So i am looking for some programmatic solution.

Can anyone please help me?

Thanks in Advance..

Deepak Talape
  • 997
  • 1
  • 9
  • 35
  • 2
    Why not use paging, and fetch in blocks of 1000? It'll put a lot less stress on the repository – Gagravarr Apr 20 '17 at 06:07
  • 1
    @Gagravarr I Don't have much idea about paging. will it give me all the results from repository. And If Possible, can you please provide any sample code and some steps to use it with CMIS.. Thanks – Deepak Talape Apr 20 '17 at 06:18
  • 2
    Without knowing how you're using CMIS, there's not a lot we can do. We'll need to see some code! The way you do it for .Net with PortCMIS is rather different to with Python and cmislib, for example – Gagravarr Apr 20 '17 at 06:27
  • 1
    @Gagravarr I am using Java CMIS. Can i provide source code. If you want, i can modify the question and i will add the code that i am using. – Deepak Talape Apr 20 '17 at 06:49
  • I've faced the same problem, i ve solved it in an other why, are you interested ?!? – Yagami Light Apr 21 '17 at 09:22
  • @YagamiLight, yes. Please provide the solution. Thanks... – Deepak Talape Apr 21 '17 at 09:26
  • to give you more informations about this solution what i 've done : I created a table holder that hold all the informations about all the documents + folders after that i browse all this table one after one and migrate it, are you still interested – Yagami Light Apr 21 '17 at 09:28
  • @YagamiLight Can you please post your answer. I would like to have a look. and it also might be helpful to someone else. Thanks – Deepak Talape Apr 21 '17 at 11:25

2 Answers2

4

I think this is due to the configuration of your repository.

Try to add this in /shared/classes/alfresco-global.properties and restart:

  • system.acl.maxPermissionCheckTimeMillis=25000
  • system.acl.maxPermissionChecks=3500

If you are using solr you can add this one too:

  • solr.query.maximumResultsFromUnlimitedQuery=3500

You might find help here:

Community
  • 1
  • 1
prignony
  • 121
  • 6
  • Actually I found this answer at multiple places, but the same thing I wanted to do through my cmis code without touching alfresco. Is it possible??? – Deepak Talape Apr 22 '17 at 16:36
  • No, it's not possible. You can either change the values, or look into some kind of paging, batching and so on. – Lista Apr 24 '17 at 06:15
  • There is a new property for solr that you have to add: solr.query.maximumResultsFromUnlimitedQuery=3500 And as Lista said no you can't control this with a cmis qry. You could change theses config via JMX but then they would be set in database and would take the precedence over your configuration file – prignony Apr 24 '17 at 13:55
2

The solution that i give to you is not linked with a query or page size, you can follow this steps (I faced the same problem once and this one worked for me )

Create a saver class

A saver class is a Java class that hold the most important informations about your repository ( when i speak about repository i mean Folder + File)

The informations that you have to use in your saver class

1 - Name

2 - Path ( You will build it)

3 - Alfresco ID

Use a recursive function

This function parcour all the tree and save every element in you saver class, it will look like this

public void getTree(Tree<FileableCmisObject> tree, SaverClass father, String serverURL, String login, String password) {

    SaverClass enr = new SaverClass ();
    enr.setName(tree.getItem().getName());

    if ((father.getPath()).equals("/")) /// IN CASE IT'S THE ROOT
    {
        enr.setPath("/" + tree.getItem().getName());

    } else {
        enr.setPath(father.getPath() + "/" + tree.getItem().getName());
    }        
    enr.setFather(father.getNom());
    for (Tree<FileableCmisObject> t : tree.getChildren()) {
        getTree(t, enr, serverURL, login, password);
    }

}

Once you save all the elements in a list you only have to use the migration method for every element of the list (if you want to use the Alfresco ID it's OK , if you want to use the Path it's OK)

Hope that helped you.

Yagami Light
  • 1,756
  • 4
  • 19
  • 39