本文整理汇总了Java中lotus.domino.Database.getAgent方法的典型用法代码示例。如果您正苦于以下问题:Java Database.getAgent方法的具体用法?Java Database.getAgent怎么用?Java Database.getAgent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Database
的用法示例。
在下文中一共展示了Database.getAgent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInterval
import lotus.domino.Database; //导入方法依赖的package包/类
/**
* On interval.
*/
private void onInterval(){
Session session = null;
try{
session = this.openSession();
Database db = session.getDatabase(StringCache.EMPTY, dbPath());
Document doc = db.createDocument();
doc.replaceItemValue(FUNCTION, Const.ON_MESSAGE);
doc.replaceItemValue(EVENT, Const.ON_INTERVAL);
Agent agent = db.getAgent(StrUtils.rightBack(this.getSource(), "/"));
agent.runWithDocumentContext(doc);
}catch(NotesException n){
LOG.log(Level.SEVERE, null, n);
}finally{
this.closeSession(session);
}
}
示例2: onOpenOrClose
import lotus.domino.Database; //导入方法依赖的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.Database; //导入方法依赖的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.Database; //导入方法依赖的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);
}
}