当前位置: 首页>>代码示例>>Java>>正文


Java Document.save方法代码示例

本文整理汇总了Java中org.openntf.domino.Document.save方法的典型用法代码示例。如果您正苦于以下问题:Java Document.save方法的具体用法?Java Document.save怎么用?Java Document.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openntf.domino.Document的用法示例。


在下文中一共展示了Document.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TestNamedSession

import org.openntf.domino.Document; //导入方法依赖的package包/类
public void TestNamedSession() {
	Session sess = Factory.getNamedSession("CN=The Tester/OU=Test/O=FOCONIS");
	//		assertFalse(sess.isTrustedSession());
	assertFalse(sess.isAnonymous());
	//assertFalse(sess.isRestricted());
	System.out.println("Named Session User name      " + sess.getUserName());
	System.out.println("Named Session Effective name " + sess.getEffectiveUserName());

	Database db = sess.getDatabase(getCurrentId(), "Testdocuments.nsf");

	Document doc = db.createDocument();
	doc.replaceItemValue("Test", "Test");
	doc.replaceItemValue("$Leser", "[AllesLesen]").setReaders(true);
	doc.save();

}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:17,代码来源:XspSessionTestEx.java

示例2: 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();
	}

}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:21,代码来源:IsNewNoteTest.java

示例3: 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");
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:23,代码来源:IndexDatabase.java

示例4: saveNameLocationMap

import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public void saveNameLocationMap(final Object mapKey, final Map<CharSequence, Map<CharSequence, Set<CharSequence>>> fullMap,
		final DocumentScanner scanner) {
	//		Document dbDoc = getDbDocument((String) mapKey);
	//		if (scanner.getCollection() != null) {
	//			dbDoc.replaceItemValue(IndexDatabase.DB_DOC_LIST_NAME, scanner.getCollection());
	//		}
	//
	//		if (scanner.getSorter() != null) {
	//			dbDoc.replaceItemValue(IndexDatabase.DB_DOC_SORTER_NAME, scanner.getSorter());
	//		}
	//		dbDoc.save();
	Set<CharSequence> keySet = fullMap.keySet();
	for (CharSequence cis : keySet) {
		Map<CharSequence, Set<CharSequence>> tlValue = fullMap.get(cis);
		String name = cis.toString();
		Document nameDoc = getNameDocument(name);
		String itemName = TERM_MAP_PREFIX + String.valueOf(mapKey);
		nameDoc.replaceItemValue(itemName, tlValue);
		if (nameDoc.save()) {
			//				System.out.println("Saved term doc for " + term);
		}
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:25,代码来源:IndexDatabase.java

示例5: 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_;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:27,代码来源:ServerConfiguration.java

示例6: 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;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:18,代码来源:Database.java

示例7: run

import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public void run() {
	Document doc = null;
	System.out.println("START Creation of Documents:" + new Date().toString());
	Session s = Factory.getSession(SessionType.CURRENT);
	Set<Document> docset = new HashSet<Document>();
	Database db = s.getDatabase("", "OneMillion.nsf", true);
	if (!db.isOpen()) {
		Database db2 = s.getDatabase("", "billing.ntf", true);
		db = db2.createCopy("", "OneMillion.nsf");
		if (!db.isOpen())
			db.open();
	}

	for (int i = 1; i < 200000; i++) {

		doc = db.createDocument();
		doc.replaceItemValue("form", "doc");
		doc.replaceItemValue("Subject", String.valueOf(System.nanoTime()));
		doc.save();
		if (i % 5000 == 0) {
			// System.gc();
			docset.add(doc);
			System.out.println("Created " + i + " documents so far. Still going...");
		}
	}
	System.out.println("ENDING Creation of Documents: " + new Date().toString());
	System.out.println("START Extra-processing of retained docs");
	for (Document d : docset) {
		DateTime dt = d.getCreated();
		d.replaceItemValue("$Created", dt);
		d.save();
	}
	System.out.println("ENDED Extra-processing of retained docs");
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:36,代码来源:Create200KBenchmark.java

示例8: getDbDocument

import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public Document getDbDocument(final CharSequence dbid) {
	String key = dbid.toString().toUpperCase();
	Document result = getIndexDb().getDocumentWithKey(key, true);
	if (result.isNewNote()) {
		result.replaceItemValue("Form", DB_FORM_NAME);
		result.replaceItemValue(DB_KEY_NAME, dbid);
		result.save();
	}
	return result;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:12,代码来源:IndexDatabase.java

示例9: getTermDocument

import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public Document getTermDocument(final CharSequence token) {
	String key = caseSensitive_ ? token.toString() : token.toString().toLowerCase();

	Document result = getIndexDb().getDocumentWithKey(key, true);
	if (result != null && result.isNewNote()) {
		result.replaceItemValue("Form", TERM_FORM_NAME);
		result.replaceItemValue(TERM_KEY_NAME, token);
		result.save();
	}
	return result;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:13,代码来源:IndexDatabase.java

示例10: getNameDocument

import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public Document getNameDocument(final CharSequence name) {
	String key = caseSensitive_ ? name.toString() : name.toString().toLowerCase();

	Document result = getIndexDb().getDocumentWithKey(key, true);
	if (result != null && result.isNewNote()) {
		result.replaceItemValue("Form", TERM_FORM_NAME);
		result.replaceItemValue("isName", "1");
		result.replaceItemValue(TERM_KEY_NAME, name);
		result.save();
	}
	return result;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:14,代码来源:IndexDatabase.java

示例11: run

import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public void run() {
	Document doc = null;
	System.out.println("START Creation of Documents");
	Session s = Factory.getSession(SessionType.CURRENT);
	Set<Document> docset = new HashSet<Document>();
	Database db = s.getDatabase("", "OneMillion.nsf", true);
	if (!db.isOpen()) {
		Database db2 = s.getDatabase("", "billing.ntf", true);
		db = db2.createCopy("", "OneMillion.nsf");
		if (!db.isOpen())
			db.open();
	}

	for (int i = 1; i < 1000000; i++) {

		doc = db.createDocument();
		doc.replaceItemValue("form", "doc");
		doc.replaceItemValue("Subject", String.valueOf(System.nanoTime()));
		doc.save();

		if (i % 5000 == 0) {
			// System.gc();
			docset.add(doc);
			System.out.println("Created " + i + " documents so far. Still going...");
		}
	}
	System.out.println("ENDING Creation of Documents");
	System.out.println("START Extra-processing of retained docs");
	for (Document d : docset) {
		DateTime dt = d.getCreated();
		d.replaceItemValue("$Created", dt);
		d.save();
	}
	System.out.println("ENDED Extra-processing of retained docs");
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:37,代码来源:Create200K.java

示例12: run

import org.openntf.domino.Document; //导入方法依赖的package包/类
@Test
public void run() {
	Session s = Factory.getSession(SessionType.CURRENT);

	Database db = s.getDatabase("", TARGET, true);

	if (!db.isOpen()) {
		Database db2 = s.getDatabase("", TEMPLATE, true);
		db = db2.createCopy("", TARGET);
		if (!db.isOpen())
			db.open();
	}

	Document doc = null;
	System.out.println("-- START --");
	long start = System.nanoTime();
	for (int i = 1; i < NUMBER_OF_DOCS + 1; i++) {

		doc = db.createDocument();
		doc.replaceItemValue("form", FORM);
		doc.replaceItemValue(ITEM, String.valueOf(System.nanoTime()));
		doc.computeWithForm(false, false);
		doc.save();
		/*
		 * if (i % 5000 == 0) { System.out.println("Created " + i + " documents so far. Still going..."); }
		 */
	}
	long elapsed = System.nanoTime() - start;
	System.out.println("-- STOP --");
	System.out.println("Thread " + Thread.currentThread().getName() + " elapsed time: " + elapsed / 1000000 + "ms");

}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:33,代码来源:MassCreateDocumentsScratchTest.java

示例13: put

import org.openntf.domino.Document; //导入方法依赖的package包/类
public void put(final String key, final Object value) {
	String hashKey = checksum(key, "MD5");
	Database keyDB = getDatabaseForKey(hashKey);

	Document keyDoc = keyDB.getDocumentWithKey(key, true);

	keyDoc.replaceItemValue("Value", value);
	keyDoc.save();
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:10,代码来源:KeyValueStore.java

示例14: wrapProxiedVertex

import org.openntf.domino.Document; //导入方法依赖的package包/类
public DProxyVertex wrapProxiedVertex(final Map<String, Object> delegate) {
	//		System.out.println("Wrapping a proxied vertex...");
	DVertex vertex = new DVertex(getConfiguration().getGraph(), delegate);
	Object pDelegate = getProxyStoreDelegate();
	Serializable pKey = null;
	Map<String, Object> proxyDelegate = null;
	pKey = getKeyProperty(delegate);
	if (pKey == null) {
		if (delegate instanceof Document) {
			pKey = ((Document) delegate).getMetaversalID();
		} else {
			//TODO future implementations...
		}
	}
	if (pDelegate instanceof Database) {
		Database pDb = ((Database) pDelegate);
		//			System.out.println("Creating proxy version in database " + pDb.getApiPath());
		Document pDoc = pDb.getDocumentWithKey(pKey, true);
		if (pDoc != null && pDoc.isNewNote()) {
			pDoc.save();
		}
		proxyDelegate = pDoc;
	} else {
		//TODO future implementations...
	}
	DProxyVertex result = new DProxyVertex(getConfiguration().getGraph(), vertex, proxyDelegate);
	return result;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:29,代码来源:DElementStore.java

示例15: run

import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public void run() {
	Document doc = getLogDocument();
	if (doc != null) {
		for (int i = 0; i < keys.length; i++) {
			System.out.println("Writing " + keys[i] + "=" + values[i]);
			doc.put(keys[i], values[i]);
		}
		doc.save();
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:12,代码来源:XotsConfiguration.java


注:本文中的org.openntf.domino.Document.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。