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


Java Document.setUniversalID方法代码示例

本文整理汇总了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_;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:27,代码来源:ServerConfiguration.java

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

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

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


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