本文整理汇总了Java中org.openntf.domino.Document.replaceItemValue方法的典型用法代码示例。如果您正苦于以下问题:Java Document.replaceItemValue方法的具体用法?Java Document.replaceItemValue怎么用?Java Document.replaceItemValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openntf.domino.Document
的用法示例。
在下文中一共展示了Document.replaceItemValue方法的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();
}
示例2: save
import org.openntf.domino.Document; //导入方法依赖的package包/类
public boolean save() {
Database destDB;
if (doc_.isNewNote() && hashingStrategy_ != null) {
String hash = hashingStrategy_.getHashForMap(doc_);
doc_.setUniversalID(hash);
doc_.replaceItemValue("$Created", new Date());
destDB = getDatabaseForHash(hash);
} else {
destDB = getDatabaseForHash(doc_.getUniversalID());
}
Database currentDB = doc_.getParentDatabase();
if (!(currentDB.getFilePath().equalsIgnoreCase(destDB.getFilePath()) && currentDB.getServer().equalsIgnoreCase(
destDB.getServer()))) {
Document destDoc = destDB.createDocument();
doc_.copyAllItems(destDoc, true);
destDoc.replaceItemValue("$Created", doc_.getCreated());
destDoc.setUniversalID(doc_.getUniversalID());
doc_ = destDoc;
}
return doc_.save();
}
示例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");
}
}
示例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);
}
}
}
示例5: saveValueLocationMap
import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public void saveValueLocationMap(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 = getValueDocument(term);
String itemName = VALUE_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");
}
}
示例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: addVertex
import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public Vertex addVertex(final Object id) {
startTransaction(null);
Document d = null;
if (id == null) {
d = getDocument(null, true);
} else {
String vid = DominoUtils.toUnid((Serializable) id);
d = getDocument(vid, true);
}
d.replaceItemValue(DominoElement.TYPE_FIELD, DominoVertex.GRAPH_TYPE_VALUE);
DominoVertex result = new DominoVertex(this, d);
putCache(result);
return result;
}
示例8: queueTransaction
import org.openntf.domino.Document; //导入方法依赖的package包/类
private void queueTransaction(final Database db, final String state) {
boolean toggle = true;
int count = 0;
View contacts = db.getView("AllContactsByState");
DocumentCollection dc = contacts.getAllDocumentsByKey(state, true);
for (Document doc : dc) {
if (toggle) {
doc.replaceItemValue("txnTest", new Date());
count += 1;
}
toggle = !toggle;
}
System.out.println("...Updated " + Integer.toString(count) + " Contacts pending committal.");
}
示例9: resetDoc
import org.openntf.domino.Document; //导入方法依赖的package包/类
public void resetDoc(final Document doc) {
doc.replaceItemValue("State", doc.getItemValue("State").get(0));
doc.replaceItemValue("DateTimeField", null);
doc.removeItem("MVField");
doc.removeItem("DocAsJson");
doc.removeItem("MapField");
doc.removeItem("DateTimeField");
doc.removeItem("DateOnlyField");
doc.removeItem("TimeOnlyField");
doc.removeItem("BigDecimalField");
doc.removeItem("EnumField");
doc.save();
}
示例10: 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");
}
示例11: 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;
}
示例12: 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;
}
示例13: getValueDocument
import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
public Document getValueDocument(final CharSequence value) {
String key = caseSensitive_ ? value.toString() : value.toString().toLowerCase();
Document result = getIndexDb().getDocumentWithKey(key, true);
if (result != null && result.isNewNote()) {
result.replaceItemValue("Form", VALUE_FORM_NAME);
result.replaceItemValue(VALUE_KEY_NAME, value);
result.save();
}
return result;
}
示例14: 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;
}
示例15: scanDatabase
import org.openntf.domino.Document; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unused")
public DocumentScanner scanDatabase(final Database db) {
Document dbDoc = getDbDocument(db.getReplicaID());
DocumentScanner scanner = new DocumentScanner();
scanner.setTrackFieldTokens(false);
scanner.setTrackFieldTypes(false);
scanner.setTrackFieldValues(false);
scanner.setTrackTokenFreq(false);
scanner.setTrackTokenLocation(true);
scanner.setTrackNameLocation(true);
scanner.setStopTokenList(getStopList());
scanner.setIgnoreDollar(true);
scanner.setStateManager(this, db.getReplicaID());
scanner.setCaseSensitive(getCaseSensitive());
dbDoc.replaceItemValue(IndexDatabase.DB_TITLE_NAME, db.getTitle());
if (dbDoc.hasItem(DB_LAST_INDEX_NAME)) {
scanner.setLastScanDate(dbDoc.getItemValue(DB_LAST_INDEX_NAME, Date.class));
// scanner.setStopTokenList(getStopList());
// scanner.setIgnoreDollar(true);
// Object tokenLocationObject = dbDoc.getItemValue(DB_TOKEN_LOCATION_NAME, Map.class);
// if (tokenLocationObject != null && !((Map) tokenLocationObject).isEmpty()) {
// scanner.setTokenLocationMap(tokenLocationObject);
// }
}
if (dbDoc.hasItem(IndexDatabase.DB_DOC_LIST_NAME)) {
scanner.setCollection(dbDoc.getItemValue(IndexDatabase.DB_DOC_LIST_NAME, org.openntf.domino.DocumentCollection.class));
}
Date scanDate = new Date();
scanDatabase(db, scanner);
String dbid = db.getReplicaID();
// writeResults(dbid, scanner);
dbDoc.replaceItemValue(DB_LAST_INDEX_NAME, scanDate);
// dbDoc.replaceItemValue(DB_FIELD_TOKEN_NAME, scanner.getFieldTokenMap());
// dbDoc.replaceItemValue(DB_TOKEN_LOCATION_NAME, scanner.getTokenLocationMap());
dbDoc.save();
return scanner;
}