本文整理汇总了Java中org.openntf.domino.Document.setUniversalID方法的典型用法代码示例。如果您正苦于以下问题:Java Document.setUniversalID方法的具体用法?Java Document.setUniversalID怎么用?Java Document.setUniversalID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openntf.domino.Document
的用法示例。
在下文中一共展示了Document.setUniversalID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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_;
}
示例2: 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;
}
示例3: 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();
}
示例4: 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;
Database db = null;
String unid;
boolean dirty = false;
if (isDatabase_) {
db = odaDb_.getAncestorSession().getDatabase(apiPath_);
unid = Configuration.computeUNID(taskletName_, db);
} else {
unid = Configuration.computeUNID(bundle_ + ":" + taskletName_, odaDb_); // use a valid ReplicaID
}
Document currentConfig = odaDb_.getDocumentByUNID(unid);
if (currentConfig == null) {
if (!create)
return null;
currentConfig = odaDb_.createDocument();
currentConfig.setUniversalID(unid);
currentConfig.replaceItemValue("Form", "XotsTasklet");
currentConfig.replaceItemValue("TaskletName", taskletName_);
currentConfig.replaceItemValue("ApiPaths", apiPath_); // APIPath is just for UI - internally we always use replica ID
currentConfig.replaceItemValue("Enabled", true);
if (isDatabase_) {
if (db != null) {
// Java's wrong about this potentially being null
currentConfig.replaceItemValue("ReplicaId", db.getReplicaID());
}
currentConfig.replaceItemValue("Location", "NSF");
} else {
currentConfig.replaceItemValue("Bundle", bundle_);
currentConfig.replaceItemValue("Location", "BUNDLE");
}
currentConfig.replaceItemValue("$ConflictAction", "3"); // merge - no conflicts
dirty = true;
}
// update the DB-Title in document
if (db != null && !db.getTitle().equals(currentConfig.getItemValueString("ApplicationName"))) {
currentConfig.replaceItemValue("ApplicationName", db.getTitle());
dirty = true;
}
// add all api-paths of all servers
boolean found = false;
List<String> paths = currentConfig.getItemValues("ApiPaths", String.class);
for (String apiPath : paths) {
if (apiPath.equalsIgnoreCase(apiPath_)) {
found = true;
break;
}
}
if (!found) {
paths.add(apiPath_);
currentConfig.replaceItemValue("ApiPaths", paths);
dirty = true;
}
if (dirty) {
currentConfig.save();
}
return currentConfig;
}