JAVA/CORBA クラス


例:LastModified プロパティ、Name プロパティ、Text プロパティ、Type プロパティ、ValueLength プロパティ
次のエージェントは、文書の各アイテムの名前、文字列値、種類、長さ、および最新変更日付を取得します。

import lotus.domino.*;
import java.util.Vector;
import java.util.Enumeration;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
Document doc = dc.getFirstDocument();
if (doc != null) {
Enumeration items = doc.getItems().elements();
while (items.hasMoreElements()) {
Item item = (Item)items.nextElement();
String type;
switch (item.getType()) {
case Item.ACTIONCD :type = "Action CD"; break;
case Item.ASSISTANTINFO :type = "Assistant
information"; break;
case Item.ATTACHMENT :type = "File attachment";
break;
case Item.AUTHORS :type = "Authors"; break;
case Item.COLLATION :type = "Collation"; break;
case Item.DATETIMES :
type = "Date-time or range of date-times"; break;
case Item.EMBEDDEDOBJECT :type = "Embedded
object"; break;
case Item.ERRORITEM :type = "Error while accessing
type"; break;
case Item.FORMULA :type = "Formula"; break;
case Item.HTML :type = "HTML source text"; break;
case Item.ICON :type = "Icon"; break;
case Item.LSOBJECT :type = "LotusScript object";
break;
case Item.NAMES :type = "Names"; break;
case Item.NOTELINKS :
type = "Link to database, view, or document";
break;
case Item.NOTEREFS :
type = "Reference to the parent document"; break;
case Item.NUMBERS :type = "Number or number list";
break;
case Item.OTHEROBJECT :type = "Other object";
break;
case Item.QUERYCD :type = "Query CD"; break;
case Item.RICHTEXT :type = "Rich text"; break;
case Item.READERS :type = "Readers"; break;
case Item.SIGNATURE :type = "Signature"; break;
case Item.TEXT :type = "Text or text list"; break;
case Item.UNAVAILABLE :type = "Unavailable type";
break;
case Item.UNKNOWN :type = "Unknown typet"; break;
case Item.USERDATA :type = "User data"; break;
case Item.USERID :type = "User ID name"; break;
case Item.VIEWMAPDATA :type = "View map data";
break;
case Item.VIEWMAPLAYOUT :type = "View map layout";
break;
default :type = "Other";
}
System.out.println(item.getName());
System.out.println(type);
System.out.println(item.getValueLength() + " bytes");
System.out.println("Last modified " +
item.getLastModified().getLocalTime());
if (item.getText().length() == 0)
System.out.println("[no text]\n");
else
System.out.println(item.getText(80) + "\n");
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
}

関連項目