遍历Lotus Domino中的每个文档(Iterating over every document in Lotus Domino)
我想迭代(可能是大的)Lotus Domino数据库中的每个文档,并且如果处理中断(网络连接错误,应用程序重新启动等),能够从最后一个文档继续执行。 我没有对数据库的写入权限。
我正在寻找一种方法,我不必从服务器上下载那些已处理的文档。 所以,我必须将一些起始信息传递给服务器,该文档应该是(可能重新启动的)处理中的第一个。
我已经检查了
AllDocuments
属性和DocumentColletion.getNthDocument
方法,但是这个属性是未排序的,所以我猜这个订单可以在两次调用之间改变。另一个想法是使用公式查询,但似乎并没有这些查询可能的顺序。
第三个想法是具有相应
Document.getLastModified
的Database.getModifiedDocuments
方法。 它看起来不错,但是在我看来,返回的集合的顺序没有记录,并且基于创建时间而不是最后修改时间。以下是基于官方示例的示例代码:
System.out.println("startDate: " + startDate); final DocumentCollection documentCollection = database.getModifiedDocuments(startDate, Database.DBMOD_DOC_DATA); Document doc = documentCollection.getFirstDocument(); while (doc != null) { System.out.println("#lastmod: " + doc.getLastModified() + " #created: " + doc.getCreated()); doc = documentCollection.getNextDocument(doc); }
它打印以下内容:
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)
调用。)有什么方法可以用Lotus Domino Java API可靠地做到这一点?
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.
I've checked the
AllDocuments
property and theDocumentColletion.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.
The third idea was the
Database.getModifiedDocuments
method with a correspondingDocument.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.Here is a sample code based on the official example:
System.out.println("startDate: " + startDate); final DocumentCollection documentCollection = database.getModifiedDocuments(startDate, Database.DBMOD_DOC_DATA); Document doc = documentCollection.getFirstDocument(); while (doc != null) { System.out.println("#lastmod: " + doc.getLastModified() + " #created: " + doc.getCreated()); doc = documentCollection.getNextDocument(doc); }
It prints the following:
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
(I don't use any
AgentContext
here to access the database. The database object comes from asession.getDatabase(null, databaseName)
call.)Is there any way to reliably do this with the Lotus Domino Java API?
原文:https://stackoverflow.com/questions/13020620
最满意答案
这个功能?
x=linspace(0,600,1000); y=Iapp(x); plot(x,y) function y=Iapp(t) r=mod(t,120); c=floor(t/120); VAL1=0; VAL2=0.5 + 0.2*c; y=VAL1.*(r<=100) + VAL2.*(r>100); end
相关问答
更多-
RGB到最接近的预定义颜色(RGB to closest predefined color)[2022-12-10]
你必须计算到每种颜色的距离,并选择最小的。 有几种方法可以做到这一点。 一个简单的方法是计算距离将是: sqrt((r-r1)^2+(g-g1)^2+(b-b1)^2) 更好的方法可能是加入加权值来计算距离,例如转换RGB-> YUV时使用的值: Y = 0.299 * R + 0.587 * G + 0.114 * B 在这种情况下,你会使用 sqrt(((r - r1) * .299)^2 + ((g - g1) * .587)^2 + ((b - b1) * .114)^2) 当然,由于您不需要 ... -
您正在寻找functools.partial : >>> import functools >>> def foo(number): ... print number ... >>> bar = functools.partial(foo, 1) >>> bar() 1 You're looking for functools.partial: >>> import functools >>> def foo(number): ... print number ... >>> bar ...
-
如果你在呼叫外部定义你的功能,你可以多次使用它。 var bigfunction = function(big) { ... }; $('#element').click(bigfunction); $('#another_element').click(bigfunction); 你也可以用通常的方式声明它: function bigfunction(big) { ... }; If you define your function external to the call you can use ...
-
函数中的预定义参数(predefined parameters in function)[2022-04-28]
我建议一个enum public enum ErrorType { error, warning, info } public void ShowMe(ErrorType errorType) { switch (errorType) { case ErrorType.error: //do stuff break; case ErrorType.warning: //do stuff ... -
这个功能? x=linspace(0,600,1000); y=Iapp(x); plot(x,y) function y=Iapp(t) r=mod(t,120); c=floor(t/120); VAL1=0; VAL2=0.5 + 0.2*c; y=VAL1.*(r<=100) + VAL2.*(r>100); end This function? x=linspace(0,600,1000); y=Iapp(x); plot(x,y) function ...
-
使用预定义参数委派(Delegate with predefined parameter)[2023-04-10]
正如@ Spo1ler评论的那样,传递一个Action而不是Action: void f(Action a) { a(); } ... f(() => _delegate("string")); As @Spo1ler commented, pass an Action instead of Action : void f(Action a) { a(); } ... f(() => _delegate("string")); -
如果要调用函数值,则需要使用call 。 引用文档 (参见函数): 因此,在Go表示法中,“call .XY 1 2”是dot.XY(1,2),其中Y是函数值字段,映射条目等。 在这个例子中, X看起来像这样: type X struct { Y func(a int, b int) int } You need to use call if you want to call a function value. To quote the docs (See under Functions): Th ...
-
方法名称的预定义宏(Predefined macros for method names)[2021-08-22]
您可以使用StackTrace和StackFrame来获取当前方法的名称 StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(1); string method = sf.GetMethod().ToString(); 对于属性,返回的方法名称将包含magic get_或set_前缀。 但是,我不认为您可以将其重构为内联宏或函数,就像在C ++中一样。 但是如果你重构一个实用程序方法来干掉它,你可能只需要向StackTrace返回一 ... -
如果您要使用与默认MM / DD / YYYY不同的日期格式,则需要在选项中指定。 更新小提琴: http : //jsfiddle.net/cuxm50k2/2/ 更新的选项: $('#rental-range').daterangepicker({ autoApply: true, startDate: start, endDate: end, locale: { format: 'YYYY/MM/DD' } }, cb); If you're going to use a ...
-
将“state”存储在文件,共享prefs或sqlite数据库中。 然后你只需要在应用程序唤醒时进行一系列工作,然后你可以选择一个警报和广播接收器。 我在这里有一个简单的SharedPreferences示例: Android共享偏好设置 Store "state" in a file, in shared prefs or in a sqlite database. Then you just need to do a bundle of work when your app wakes up and y ...