使用Java API读取Lotus Notes文档

发布于 2024-07-15 00:36:13 字数 216 浏览 5 评论 0原文

我正在使用 Lotus Notes 6.5.1 Java API 读取 .nsf 文件。 .nsf 文件中的每个文档都有多个文档历史记录。 在使用 Lotus Notes Java API 遍历 .nsf 文件中的文档时,我将所有文档版本作为单独的文档获取。

如何确保 Lotus Notes 仅检索每个文档的最新版本? 有没有一种方法可以唯一地将文档及其所有版本历史记录作为其子文档?

I am using the Lotus Notes 6.5.1 Java API to read an .nsf file. Every document in the .nsf file has multiple document history. While traversing through the documents in the .nsf file using the Lotus Notes Java API I am getting all the document versions as separate documents.

How do I ensure only the latest version of each document is retrieved by Lotus Notes? Is there a way to uniquely identify a document and all its version history as its children?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

软的没边 2024-07-22 00:36:13

Notes Domino 中有一个内置的文档版本控制功能。 根据数据库设计中的配置方式(假设数据库开发人员没有推出自己的版本),版本要么响应原始父版本,要么相反,新版本成为父版本,旧版本成为父版本。回应。

然而,这一切都是在您编辑文档时自动在数据库中设置响应层次结构。 数据库设计的其余部分如何与此层次结构交互取决于开发人员。

您可能想要做的是创建一个仅显示响应层次结构顶部的文档的视图。 然后您可以遍历该视图并知道从中获取的文档是最新版本。

因此,如果您使用“文章”表单创建文档,则视图选择公式将是。

SELECT form*="Article" & !@IsAvailable($ref)

这将选择所有不是回复的文章文档。 现在,在代码中,您可以简单地打开视图并遍历它。

一旦您掌握了文档,您就可以通过

doc.getResponses()

这返回一个 DocumentCollection 来获取其直接子响应,您可以递归向下查找对响应的响应。 您无法直接获取父文档。 您首先需要使用 doc.getParentDocumentUNID() 获取其 id,然后调用 db.getDocumentByUNID()。 当然,您可以将其结合起来:

db.getDocumentByUNID(doc.getParentDocumentUNID())

在任何情况下,您都必须查看您的数据库实际上在做什么,它最初是如何设计的并与之相适应。

There is a built in feature for versioning documents in Notes Domino. Depending on hows it's configured in the database design (and assuming the database developer didn't roll their own) the versions will either be responses to an original parent, or the other way round, where new versions become the parent, with older versions being responses.

All this does however is to set up a response hierarchy in the database for you automatically when you edit the documents. How the rest of the database design interacts with this hierarchy is up to the developer.

What you probably want to do is create a view that only shows documents at the top of the response hierarchy. You can then traverse that view and know that the documents you get from it are the latest versions.

So if you have documents created with a form "Article" the view selection formula would be.

SELECT form*="Article" & !@IsAvailable($ref)

This selects all Article documents that are not responses. Now in code you can simply open the view and traverse it.

Once you have a handle on a document you can get its immediate child responses through

doc.getResponses()

This returns a DocumentCollection that you can recurse down finding responses to responses. You can't get a parent document directly. You first need to get its id with doc.getParentDocumentUNID() and then call db.getDocumentByUNID(). Of course you can combine that:

db.getDocumentByUNID(doc.getParentDocumentUNID())

In any case, you will have to look at what your database is actually doing, how it was originally designed and fit in with that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文