创建具有特定创建/修改/上次访问日期的 Lotus Notes 文档以进行测试

发布于 2024-09-03 03:44:17 字数 380 浏览 4 评论 0原文

我目前正在编写一个应用程序,该应用程序根据从创建/修改/上次访问日期起经过的天数在数据库之间移动 Notes 文档。我只是想了解一种简单方便的方法来创建具有特定日期的文档,而无需更改 Domino 服务器上的时间,以便我可以测试我的应用程序。

到目前为止,我发现的最好方法是创建本地副本并将系统时钟更改为我想要的日期。不幸的是,这种方法存在一些问题。它不适用于修改日期 - 我不确定当位置设置为岛屿(已断开连接)时它如何获取修改日期信息 - 并且它还会更改修改日期和上次访问日期当文档复制到服务器副本时。

有人建议尝试创建文档的 DXL,修改 DXL 文件中的日期时间,然后将其作为 Notes 文档导入回数据库;但这不起作用。它只采用创建它的日期时间。

有人可以提供其他建议吗?

I'm currently writing an application that moves Notes documents between databases based on the amount of days that have elapsed from the creation/modified/last accessed dates. I would just like to get ideas on a simple and convenient way to create documents with specific dates, without having to change the time on the Domino server, so that I could test out my application.

The best way I found so far was to create a local replica and change the system clock to the date I want. Unfortunately there are problems associated with this method. It does not work on the modified date - I'm not sure how it is getting the modified date information when the location is set to Island (Disconnected) - and it also changes the modified and last accessed dates when the documents are replicated to the server replica.

Someone suggested trying to create a DXL of the document, modify the date time in the DXL file, then import it back into the database as a Notes document; but that does not work. It just takes on the date-time that it was created.

Can anyone offer any other suggestions?

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

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

发布评论

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

评论(3

心欲静而疯不止 2024-09-10 03:44:17

您可以通过设置 UNID(本质上是时间戳结构,尽管实际实现在最近版本中发生了变化)来设置文档的创建日期。不过,访问和修改时间在 Notes/Domino 环境中是不可设置的,因为您所做的更改将被保存更改的过程覆盖。如果您有冒险天赋并且需要使用剪刀运行,则可以通过外部应用程序以编程方式或使用十六进制编辑器手动对数据库文件本身进行更改。 (编辑二进制文件是可行的——多年来,人们一直在使用十六进制编辑器来安全地清除“隐藏设计”标志。请记住,签名的文档会严重崩溃,并且您需要确保本地加密已关闭数据库文件。)

You can set the created date for a document by setting the UNID (which is fundamentally a struct of timestamps, although the actual implementation has changed in recent versions). Accessed and modified times, though, would be unsettable from within the Notes/Domino environment, since the changes you make would be overwritten by the process of saving the changes. If you have a flair for adventure and a need to run with scissors, you could make the changes in the database file itself either programmatically from an external application, or manually with a hex editor. (Editing the binary will work -- folks have been using hex editors to clear the "hide design" flag safely for years. Keep in mind that signed docs will blow up badly, and that you need to ensure that local encryption is off for the database file.)

陪你搞怪i 2024-09-10 03:44:17

实际上有一种非常简单的方法来欺骗创建日期/时间:只需添加一个名为 $Created 的字段,其中包含您想要的任何日期/时间。 Notes C API 头文件 nsfdata.h 中提到了这一点:

与笔记相关的时间/日期:
OID.Note 可以是创建注释时的时间日期
(但不保证是 - 寻找 $CREATED
第一项为笔记创建时间)
通过 NSFNoteGetInfo(_NOTE_OID) 或
SEARCH_MATCH 中的 OID。

不幸的是,没有类似的技术可以欺骗模组或访问日期。据我所知,至少没有任何记录。

There's actually a very simple way to spoof the creation date/time: just add a field called $Created with whatever date/time you want. This is alluded to in the Notes C API header file nsfdata.h:

Time/dates associated with notes:
OID.Note Can be Timedate when the note was created
(but not guaranteed to be - look for $CREATED
item first for note creation time)
Obtained by NSFNoteGetInfo(_NOTE_OID) or
OID in SEARCH_MATCH.

Unfortunately, there's no analogous technique for spoofing the mod or access dates. At least none that's ever been documented, as far as I know.

是伱的 2024-09-10 03:44:17

我想,考虑到 Lotus Notes 对时间戳的依赖程度(主要用于复制),没有 API 调用允许您更改注释的修改、创建或上次访问日期。 (有关 Lotus Notes 内部结构的更多信息,请参见 此处。)

我仔细研究了 Notes C API 文档,发现只有一处提到如何获取/设置注释标题中的信息,包括修改日期。但是,文档指出,当您尝试更新该注释(即将其写入磁盘)时,最后修改的日期将被写入磁盘的日期/时间覆盖。

作为替代方案,我建议在只有您控制的文档中创建您自己的日期项目集,例如 MyCreated、MyModified 和 MyAccessed,并在代码中引用那些根据日期移动文档的项目。然后,您将能够像更改任何其他文档项一样轻松地更改这些日期(通过代理、表单等)。

对于 MyCreated,使用 @CREATED 或 @NOW 的公式创建一个隐藏的计算表单字段。组合时将类型设置为计算。

对于 MyModified,使用公式 @NOW 创建一个隐藏的计算表单字段,并将类型设置为计算。

MyAccessed 变得有点棘手。如果您可以不用它,我建议您仅使用 MyCreated 和 MyModified 进行实时工作。如果您需要它,您应该能够通过在 QueryOpen 或 PostOpen 事件中设置字段值来管理它。如果您的用户只有文档的读取访问权限,就会出现问题 - 更新 MyAccessed 字段的代码将无法存储该值。

希望这有帮助!

I imagine given how dependent Lotus Notes is on timestamps (for replication, mainly), there isn't an API call that allows you to change the modified, created, or last access dates of a note. (More on the internals of Lotus Notes can be found here.)

I dug around the Notes C API documentation, and found only one mention on how to get/set information in the note's header, including the modified date. However, the documentation states that when you try to update that note (i.e. write it to disk), the last modified date will be overwritten with the date/time it is written to disk.

As an alternative, I would suggest creating your own set of date items within the documents that only you control, for example MyCreated, MyModified, and MyAccessed, and reference those in your code that moves documents based on dates. You would then be able to change these dates as easily as changing any other document item (via agents, forms, etc.)

For MyCreated, create a hidden calculated form field with the formula of @CREATED or @NOW. Set the type to computed when composed.

For MyModified, create a hidden calculated form field with the formula @NOW, and set the type to computed.

MyAccessed gets a bit tricky. If you can do without it, I suggest you live work with just the MyCreated and MyModified. If you need it, you should be able to manage it by setting a field value within the QueryOpen or PostOpen events. Problems occur if your users have only read access to a document - the code to update the MyAccessed field won't be able to store that value.

Hope this helps!

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