本文整理汇总了Java中lotus.domino.Document.createRichTextItem方法的典型用法代码示例。如果您正苦于以下问题:Java Document.createRichTextItem方法的具体用法?Java Document.createRichTextItem怎么用?Java Document.createRichTextItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Document
的用法示例。
在下文中一共展示了Document.createRichTextItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attach
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* Attach.
*
* @param doc the doc
* @param msg the msg
*/
private void attach(Document doc, SocketMessage msg){
File file = JSONUtils.write(msg);
try{
RichTextItem rtitem = doc.createRichTextItem("json");
EmbeddedObject eo = rtitem.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null, file.getAbsolutePath(), Const.ATTACH_NAME);
doc.save();
//cleanup.
eo.recycle();
rtitem.recycle();
}catch(Exception e){
LOG.log(Level.SEVERE,null,e);
}finally{
if(file!=null && file.exists()){
file.delete();
}
}
}
示例2: onOpenOrClose
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* On open or close.
*
* @param fun the fun
*/
private void onOpenOrClose(String fun){
Session session = null;
try{
session = this.openSession();
Database db = session.getDatabase(StringCache.EMPTY, dbPath());
Document doc = db.createDocument();
IUser user = (IUser) this.args[0];
doc.replaceItemValue("userId",user.getUserId());
doc.replaceItemValue("sessionId",user.getSessionId());
doc.replaceItemValue("host",user.getHost());
doc.replaceItemValue("status",user.getStatus());
doc.replaceItemValue("uris",ColUtils.toVector(user.getUris()));
doc.replaceItemValue(FUNCTION, fun);
RichTextItem item = doc.createRichTextItem("Body");
item.appendText(JSONUtils.toJson(user));
doc.replaceItemValue("Form", user.getClass().getName());
Agent agent = db.getAgent(StrUtils.rightBack(this.getSource(), "/"));
agent.runWithDocumentContext(doc);
}catch(NotesException n){
LOG.log(Level.SEVERE, null, n);
}finally{
this.closeSession(session);
}
}
示例3: onMessage
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* On message.
*/
private void onMessage(){
Session session = null;
try{
session = this.openSession();
Database db = session.getDatabase(StringCache.EMPTY, dbPath());
Document doc = db.createDocument();
SocketMessage msg = (SocketMessage) this.args[0];
doc.replaceItemValue(FUNCTION, Const.ON_MESSAGE);
doc.replaceItemValue("from", msg.getFrom());
doc.replaceItemValue("to", msg.getTo());
doc.replaceItemValue("text", msg.getText());
doc.replaceItemValue(EVENT, Const.ON_MESSAGE);
doc.replaceItemValue("targets", ColUtils.toVector(msg.getTargets()));
RichTextItem item = doc.createRichTextItem("Body");
item.appendText(msg.toJson());
doc.replaceItemValue("Form", SocketMessage.class.getName());
Agent agent = db.getAgent(StrUtils.rightBack(this.getSource(), "/"));
agent.runWithDocumentContext(doc);
}catch(NotesException n){
LOG.log(Level.SEVERE, null, n);
}finally{
this.closeSession(session);
}
}
示例4: onError
import lotus.domino.Document; //导入方法依赖的package包/类
/**
* On error.
*/
private void onError(){
Session session = null;
try{
session = this.openSession();
Database db = session.getDatabase(StringCache.EMPTY, dbPath());
Document doc = db.createDocument();
IUser user = (IUser) this.args[0];
Exception e = (Exception) args[0];
e.printStackTrace();
doc.replaceItemValue("error", e.getMessage() );
doc.replaceItemValue(FUNCTION, Const.ON_ERROR);
RichTextItem item = doc.createRichTextItem("Body");
item.appendText(JSONUtils.toJson(user));
doc.replaceItemValue("Form", user.getClass().getName());
Agent agent = db.getAgent(StrUtils.rightBack(this.getSource(), "/"));
agent.runWithDocumentContext(doc);
}catch(NotesException n){
LOG.log(Level.SEVERE, null, n);
}finally{
this.closeSession(session);
}
}