本文整理汇总了Java中org.openntf.domino.Document类的典型用法代码示例。如果您正苦于以下问题:Java Document类的具体用法?Java Document怎么用?Java Document使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Document类属于org.openntf.domino包,在下文中一共展示了Document类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetNoRecycle
import org.openntf.domino.Document; //导入依赖的package包/类
@Test
public void testSetNoRecycle() {
System.out.println("Test: setNoRecyle");
Session sess = Factory.getSession(SessionType.CURRENT);
Database db = sess.getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
int sz = dc.size();
System.out.println(" getAllDocuments=" + sz);
if (sz == 0)
return;
int i = sz >>> 3;
Document found = null;
for (Document doc : dc)
if (i-- == 0) {
found = doc;
break;
}
BackendBridge.setNoRecycle(sess, found, true);
System.out.println(" Done.");
}
示例2: testForceRecycle
import org.openntf.domino.Document; //导入依赖的package包/类
@Test
public void testForceRecycle() {
System.out.println("Test: forceRecyle");
Session sess = Factory.getSession(SessionType.CURRENT);
Database db = sess.getCurrentDatabase();
DocumentCollection dc = db.getAllDocuments();
int sz = dc.size();
System.out.println(" getAllDocuments=" + sz);
if (sz == 0)
return;
int i = sz >>> 4;
Document found = null;
for (Document doc : dc)
if (i-- == 0) {
found = doc;
break;
}
BackendBridge.forceRecycle(sess, found);
System.out.println(" Done.");
}
示例3: runWithDocumentContext
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public void runWithDocumentContext(final lotus.domino.Document doc, final String noteid) {
boolean go = true;
Object[] payload = new Object[2];
payload[0] = doc;
payload[1] = noteid;
go = getAncestorDatabase().fireListener(generateEvent(Events.BEFORE_RUN_AGENT, payload));
if (go) {
try {
getDelegate().runWithDocumentContext(toLotus(doc), noteid);
} catch (NotesException e) {
DominoUtils.handleException(e);
}
getAncestorDatabase().fireListener(generateEvent(Events.AFTER_RUN_AGENT, payload));
}
}
示例4: put
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public org.openntf.domino.Document put(final Serializable key, final org.openntf.domino.Document value) {
// Ignore the value for now
if (key != null) {
Document doc = getDocumentWithKey(key);
if (doc == null) {
Map<String, Object> valueMap = value;
doc = createDocument(valueMap);
doc.setUniversalID(DominoUtils.toUnid(key));
doc.save();
return null;
} else {
return doc;
}
}
return null;
}
示例5: validateDocument
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public boolean validateDocument(final Document doc) {
String doctype = doc.getItemValueString("$$SchemaType");
DocumentDefinition def = getDocumentDefinitions().get(doctype);
if (def == null)
return true;
boolean result = true;
Map<String, IItemDefinition> itemDefs = def.getItemDefinitions();
for (String key : itemDefs.keySet()) {
@SuppressWarnings("unused")
IItemDefinition itemDef = itemDefs.get(key);
// TODO NTF
}
return result;
}
示例6: getDocument
import org.openntf.domino.Document; //导入依赖的package包/类
/**
* Returns the document for this server
*
* @return
*/
@Override
protected Document getDocument(final boolean create) {
Database odaDb = Configuration.getOdaDb();
if (odaDb == null)
return null;
String unid = Configuration.computeUNID("ServerConfig:".concat(serverName_), odaDb);
Document currentConfig_ = odaDb.getDocumentByUNID(unid);
if (currentConfig_ == null) {
if (!create)
return null;
currentConfig_ = odaDb.createDocument();
currentConfig_.setUniversalID(unid);
currentConfig_.replaceItemValue("Form", "Configuration");
currentConfig_.replaceItemValue("ServerName", serverName_).setNames(true);
currentConfig_.replaceItemValue("$ConflictAction", "3"); // merge - no conflicts
currentConfig_.save();
}
return currentConfig_;
}
示例7: isView
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public boolean isView() {
if (isView_ == null) {
Document doc = getDocument();
if (!doc.isNewNote()) {
try {
isView_ = DesignFactory.isView(doc);
} catch (Exception e) {
isView_ = false;
// System.err.println("Exception thrown while checking isView for a document: " + e.getMessage() + " on notecoordinate "
// + toString());
}
} else {
isView_ = false;
}
}
return isView_;
}
示例8: getTermUnidInDbids
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public Set<String> getTermUnidInDbids(final CharSequence term, final Collection<String> dbids) {
Set<String> unids = new HashSet<String>();
Document doc = getTermDocument(term);
for (String dbid : dbids) {
String itemName = TERM_MAP_PREFIX + dbid;
if (doc.hasItem(itemName)) {
Map termMap = doc.getItemValue(itemName, Map.class);
for (Object key : termMap.keySet()) {
Object termObj = termMap.get(key);
if (termObj != null) {
if (termObj instanceof Collection) {
unids.addAll((Collection) termObj);
} else if (termObj instanceof CharSequence) {
unids.add(((CharSequence) termObj).toString());
} else {
unids.add(String.valueOf(termObj));
}
}
}
}
}
return unids;
}
示例9: saveTokenLocationMap
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public void saveTokenLocationMap(final Object mapKey, final Map<CharSequence, Map<CharSequence, Set<CharSequence>>> fullMap,
final DocumentScanner scanner) {
setLastIndexDate(mapKey, scanner.getLastDocModDate());
Set<CharSequence> keySet = fullMap.keySet();
if (keySet.size() > 0) {
for (CharSequence cis : keySet) {
Map<CharSequence, Set<CharSequence>> tlValue = fullMap.get(cis);
String term = cis.toString();
Document termDoc = getTermDocument(term);
String itemName = TERM_MAP_PREFIX + String.valueOf(mapKey);
termDoc.replaceItemValue(itemName, tlValue);
if (termDoc.save()) {
// System.out.println("DEBUG: Saved term doc for " + term);
} else {
System.out.println("DEBUG: Did not save term doc for " + term);
}
}
} else {
// System.out.println("DEBUG: keyset was empty for index tokens");
}
}
示例10: atSetDocField
import org.openntf.domino.Document; //导入依赖的package包/类
@ParamCount(3)
public static ValueHolder atSetDocField(final FormulaContextNotes ctx, final ValueHolder[] params) {
Database db = ctx.getDatabase();
if (db == null)
throw new UnsupportedOperationException("No database set: Can't execute @SetDocField");
String unid = params[0].getString(0);
Map<String, Object> doc;
if (unid.equals(ctx.getDocument().getUniversalID())) {
doc = ctx.getDocument();
} else if ((doc = db.getDocumentByUNID(unid)) == null) {
throw new NoSuchElementException("Document with UNID '" + unid + "' not found");
}
doc.put(params[1].getString(0), params[2]);
if (doc != ctx.getDocument())
((Document) doc).save();
return params[2];
}
示例11: checkUnique
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public boolean checkUnique(final Object key, final Document srcDoc) {
boolean retVal_ = false;
try {
DocumentCollection dc = this.getAllDocumentsByKey(key, true);
for (Document checkDoc : dc) {
if (null == srcDoc) {
return false;
} else {
if (!checkDoc.getUniversalID().equals(srcDoc.getUniversalID())) {
return retVal_;
}
}
}
retVal_ = true;
} catch (Exception e) {
DominoUtils.handleException(e);
}
return retVal_;
}
示例12: iterateForms
import org.openntf.domino.Document; //导入依赖的package包/类
private void iterateForms(final Database db) {
System.out.println("Thread " + Thread.currentThread().getName() + " BEGINNING ITERATION of Forms");
Vector<Form> forms = db.getForms();
for (Form form : forms) {
// System.out.println("Form : " + form.getName() + " (" + DominoUtils.getUnidFromNotesUrl(form.getNotesURL()) + ")");
Document d = form.getDocument();
Vector<?> v = d.getItemValue("$UpdatedBy");
Name n = db.getParent().createName((String) v.get(0));
String cn = n.getCommon();
if (cn != null) {
nameCount++;
docCount++;
}
// System.out.println("Last Editor: " + n);
}
System.out.println("ENDING ITERATION of Forms");
}
示例13: run
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public void run() {
Session session = Factory.getSession(SessionType.CURRENT);
Database db = session.getDatabase("", "log.nsf");
int i = 0;
try {
for (i = 0; i < 5; i++) {
Document doc = db.createDocument();
System.out
.println("doc " + i + " " + doc.getUniversalID() + ": " + doc.getNoteID() + " " + String.valueOf(doc.isNewNote()));
// doc.replaceItemValue("form", "junk");
doc.save();
System.out
.println("doc " + i + " " + doc.getUniversalID() + ": " + doc.getNoteID() + " " + String.valueOf(doc.isNewNote()));
}
} catch (Throwable t) {
t.printStackTrace();
}
}
示例14: run
import org.openntf.domino.Document; //导入依赖的package包/类
@Override
public void run() {
try {
System.out.println("Starting...");
Session session = Factory.getSession(SessionType.NATIVE);
DominoEmail myEmail = new DominoEmail(session);
myEmail.addToAddress("[email protected]");
myEmail.addToAddress("[email protected]");
myEmail.setSubject("Multi email test");
myEmail.addText("This is a test email");
Document email = myEmail.send();
System.out.println(email.getUniversalID());
} catch (Exception e) {
e.printStackTrace();
}
}
示例15: testXpgBEProfiler
import org.openntf.domino.Document; //导入依赖的package包/类
@Test
public void testXpgBEProfiler() throws NotesException {
Session sess = Factory.getSession(SessionType.CURRENT);
XSPNative.startXpgBEProfiler(sess);
testIsDocEditable();
XSPNative.stopXpgBEProfiler(sess);
System.out.println("BEProfiler was run");
Database db = sess.getCurrentDatabase();
Document doc = db.createDocument();
XSPNative.getXpgBEProfilerResults(sess, doc, "XSPNative");
System.out.println("BEProfiler results were fetched:");
for (Item i : doc.getItems())
System.out.println(" " + i.getName() + "=" + i.getValueString());
}