通过java更新Notes文档(updating Notes document(s) via java)

编程入门 行业动态 更新时间:2024-10-23 06:19:21
通过java更新Notes文档(updating Notes document(s) via java)

我正在用XPages重写一个Domino应用程序。 我已经在Java类的帮助下设置了一个基本的CRUD实现。 我现在正在创建/编辑文档。

由于我对这个领域不太熟悉,我现在的代码只能使用文本和日期等格式。

我在哪里可以找到如何使用其他格式的示例,如多值字段,富文本,附件,名称,作者?

我假设我不能通过getItemValue(String)和replaceItemValue覆盖每种类型的字段,或者我可以吗?

I am re-writing a Domino application with XPages. I have setup a basic CRUD implementation with help of Java classes. I am now at the point that I am creating/editing documents.

Since I am not so familiar in this area my code for now only worked with formats like text and date.

Where can I find examples how to work with other formats like multiple value fields, rich text, attachments, names, authors?

I assume I cannot cover every type of field via getItemValue(String) and replaceItemValue, or can I?

最满意答案

我倾向于尽可能使用Views,因为我认为它比获取文档更快。 如果你有很多专栏,它可能有点笨拙。

因此,使用日期需要将Notes DateTime转换为Java Date。

入门

account.setDateExpiry1(((DATETIME)entry.getColumnValues()获得(17))。toJavaDate())

要么

account.setDateExpiry1(((DateTime)entry.getColumnValue(“Column Name”))。toJavaDate());

如果我得到文件,我会使用这样的东西。

item = doc.getFirstItem(“DateApproved”); account.setDateExpiry1(((日期时间)item.getDateTimeValue())toJavaDate());

要么

account.setDateExpiry1(((DATETIME)doc.getItemValueDateTimeArray( “DateApproved”)得到(0))toJavaDate());

设置

使用日期,您必须创建Notes DateTime对象。

所以像

日期tmpDate =(日期)account.getDateCompleted(); doc.replaceItemValue(“dateCompleted”,(DateTime)Session.createDateTime((Date)tmpDate));

类似的概念适用于名称字段等,但是,似乎没有简单的方法或直接'java'替代XPage上传和下载附件控件。 您需要对Java中更先进的技术有深入的了解。 我一直在努力,但我确实需要重温它。 这个论坛上有一些例子。 这同样适用于Rich Text,我的理解是你需要完全熟悉MIME - 我不是。

I tend to use Views wherever I can as I believe it is quicker than getting the document. It can be a little unwieldy though if you have lots of columns.

So using dates you need to convert from Notes DateTime to a Java Date.

Getting

account.setDateExpiry1(((DateTime)entry.getColumnValues().get(17)).toJavaDate())

or

account.setDateExpiry1(((DateTime)entry.getColumnValue("Column Name")).toJavaDate());

If I get the document I would use something like this.

item = doc.getFirstItem("DateApproved"); account.setDateExpiry1(((DateTime)item.getDateTimeValue()).toJavaDate());

or

account.setDateExpiry1(((DateTime)doc.getItemValueDateTimeArray("DateApproved").get(0)).toJavaDate());

Setting

With Dates you have to create a Notes DateTime object.

So something like

Date tmpDate =(Date)account.getDateCompleted(); doc.replaceItemValue("dateCompleted", (DateTime)Session.createDateTime((Date) tmpDate));

Similar concepts apply to Name Fields etc, however, there does not appear to be an easy way or direct 'java' replacement for the XPages upload and download attachment controls. You need a solid understanding of the more advance techniques in Java on this. I have struggled but I do need to revisit it. There are some examples on this forum. The same applies to Rich Text, my understanding is you need to become fully conversant with MIME - which I am not.

更多推荐

本文发布于:2023-07-31 02:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340541.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文档   Notes   java   updating   document

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!