遍历Lotus Domino中的每个文档 [英] Iterating over every document in Lotus Domino

查看:89
本文介绍了遍历Lotus Domino中的每个文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想遍历(可能很大)Lotus Domino数据库中的每个文档,并且如果处理中断(网络连接错误,应用程序重新启动等),能够从上一个文档继续.我没有对该数据库的写权限.

I'd like iterate over every document in a (probably big) Lotus Domino database and be able to continue it from the last one if the processing breaks (network connection error, application restart etc.). I don't have write access to the database.

我正在寻找一种不必从服务器上下载已经处理过的文档的方法.因此,我必须将一些启动信息传递给服务器,哪个文件应该是(可能是重新启动的)处理中的第一个文件.

I'm looking for a way where I don't have to download those documents from the server which were already processed. So, I have to pass some starting information to the server which document should be the first in the (possibly restarted) processing.

  1. 我已经检查了AllDocuments属性和DocumentColletion.getNthDocument方法,但是此属性未排序,因此我想顺序可以在两个调用之间改变.

  1. I've checked the AllDocuments property and the DocumentColletion.getNthDocument method but this property is unsorted so I guess the order can change between two calls.

另一个想法是使用公式查询,但似乎无法对这些查询进行排序.

Another idea was using a formula query but it does not seem that ordering is possible with these queries.

第三个想法是Database.getModifiedDocuments方法和相应的Document.getLastModified方法.看起来不错,但是 在我看来,未记录返回的集合的顺序,而是基于创建时间而不是上次修改时间.

The third idea was the Database.getModifiedDocuments method with a corresponding Document.getLastModified one. It seemed good but it looks to me that the ordering of the returned collection is not documented and based on creation time instead of last modification time.

以下是基于

它打印以下内容:

startDate: 2012.07.03 08:51:11 CEDT
#lastmod: 2012.07.03 08:51:11 CEDT #created: 2012.02.23 10:35:31 CET
#lastmod: 2012.08.03 12:20:33 CEDT #created: 2012.06.01 16:26:35 CEDT
#lastmod: 2012.07.03 09:20:53 CEDT #created: 2012.07.03 09:20:03 CEDT
#lastmod: 2012.07.21 23:17:35 CEDT #created: 2012.07.03 09:24:44 CEDT
#lastmod: 2012.07.03 10:10:53 CEDT #created: 2012.07.03 10:10:41 CEDT
#lastmod: 2012.07.23 16:26:22 CEDT #created: 2012.07.23 16:26:22 CEDT

(我在这里不使用任何AgentContext来访问数据库.数据库对象来自session.getDatabase(null, databaseName)调用.)

(I don't use any AgentContext here to access the database. The database object comes from a session.getDatabase(null, databaseName) call.)

是否可以使用Lotus Domino Java API可靠地做到这一点?

Is there any way to reliably do this with the Lotus Domino Java API?

推荐答案

如果您有权更改数据库,或者可以要求某人这样做,那么您应该创建一个按唯一键排序或修改的视图.日期,然后将指针"存储到最后处理的文档.

If you have access to change the database, or could ask someone to do so, then you should create a view that is sorted on a unique key, or modified date, and then just store the "pointer" to the last document processed.

除非如此,否则您必须自己维护以前处理过的文档的列表.在这种情况下,您可以使用AllDocuments属性并对其进行迭代.使用GetFirstDocument和GetNextDocument,因为据说它们比GetNthDocument快.

Barring that, you'll have to maintain a list of previously processed documents yourself. In that case you can use the AllDocuments property and just iterate through them. Use the GetFirstDocument and GetNextDocument as they are reportedly faster than GetNthDocument.

或者,您可以进行两次通过,一次通过收集要存储的所有文档的UNID列表,然后进行第二次通过以从拥有的UNID列表中处理每个文档(使用GetDocumentByUNID方法).

Alternatively you could make two passes, one to gather a list of UNIDs for all documents, which you'll store, and then make a second pass to process each document from the list of UNIDs you have (using GetDocumentByUNID method).

这篇关于遍历Lotus Domino中的每个文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆