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


Java Document.save方法代码示例

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


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

示例1: getLatestMessage

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
public Response getLatestMessage() throws NotesException {

	if(this.hasWebSocketConnection()){
		throw new RuntimeException("This RESTful API can only be used when no websocket connection is open.");
	}

	SocketMessage msg = null;
	Database db = XSPUtils.session().getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
	View view = db.getView(Const.VIEW_MESSAGES_BY_USER);
	ViewEntry entry = view.getEntryByKey(XSPUtils.session().getEffectiveUserName(),true);

	if(entry!=null){
		Document doc = entry.getDocument();
		if(doc.isValid()){
			msg = msgFactory.buildMessage(entry.getDocument());

			//mark as sent.
			doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_SENT);
			doc.save();
		}
	}

	//cleanup db should cleanup view, entry, and doc.
	db.recycle();

	return this.buildResponse(msg);

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:30,代码来源:RestWebSocket.java

示例2: attach

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Attach.
 *
 * @param doc the doc
 * @param msg the msg
 */
private void attach(Document doc, SocketMessage msg){
	File file = JSONUtils.write(msg);
	try{
		RichTextItem rtitem = doc.createRichTextItem("json");
		EmbeddedObject eo = rtitem.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null, file.getAbsolutePath(), Const.ATTACH_NAME);
		doc.save();

		//cleanup.
		eo.recycle();
		rtitem.recycle();
	}catch(Exception e){
		LOG.log(Level.SEVERE,null,e);

	}finally{
		if(file!=null && file.exists()){
			file.delete();
		}
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:26,代码来源:QueueMessage.java

示例3: processConflict

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Process conflict.
 *
 * @param doc the doc
 * @throws NotesException the notes exception
 */
//latest one in wins.
protected void processConflict(Document doc) throws NotesException{

	Document parent = doc.getParentDatabase().getDocumentByUNID(doc.getParentDocumentUNID());
	Document winner = null;

	if(parent.getCreated().toJavaDate().before(doc.getCreated().toJavaDate())){
		winner = doc;
		this.flagForDeletion(parent);
	}else{
		winner = parent;
		this.flagForDeletion(doc);
	}


	winner.removeItem(StringCache.FIELD_CONFLICT);
	winner.removeItem(StringCache.FIELD_REF);
	winner.save();

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:27,代码来源:AbstractQueueProcessor.java

示例4: removeAll

import lotus.domino.Document; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static void removeAll(Document doc) throws NotesException{
	boolean save = false;
	
	Vector<String> attachments = doc.getParentDatabase().getParent().evaluate("@AttachmentNames", doc);
	
	
	for(String attach : attachments){
		EmbeddedObject eo = doc.getAttachment(attach);
		if(eo!=null && eo.getType() == EmbeddedObject.EMBED_ATTACHMENT){
			eo.remove();
			save = true;
		}//end if
	}//end for
	
	//only save if we need to.
	if(save) {
		doc.save();
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:21,代码来源:AttachUtils.java

示例5: saveToDb

import lotus.domino.Document; //导入方法依赖的package包/类
public void saveToDb(Database db) throws NotesException {
	Document pDoc=null;
	
	if(isNew()) {
		pDoc=db.createDocument();
		pDoc.replaceItemValue("Form", "Participant");
	} else {
		pDoc=db.getDocumentByID(getNoteId());
	}
	
	if(isDeleted()) {
		// Might not be able to delete it. So change the form.
		pDoc.replaceItemValue("Form", "Participant_DELETED");
	} else { 
	
		pDoc.replaceItemValue("MainDocId", getMainDocId());
		pDoc.replaceItemValue("Name", getName());
		pDoc.replaceItemValue("LCVFlag", isLcvProvided()?"1":"");
	}
	
	pDoc.computeWithForm(false, false);
	pDoc.save();
	noteId=pDoc.getNoteID();
}
 
开发者ID:sbasegmez,项目名称:Blogged,代码行数:25,代码来源:Participant.java

示例6: createSampleDbDirProfile

import lotus.domino.Document; //导入方法依赖的package包/类
private void createSampleDbDirProfile(Database db) throws NotesException {
	Document docProfile = db.getProfileDocument("DirectoryProfile", null);
	docProfile.replaceItemValue("Form", "DirectoryProfile");
	docProfile.replaceItemValue("Domain", db.getParent().evaluate("@Domain", docProfile));
	docProfile.replaceItemValue("GroupSortDefault", "1");
	docProfile.replaceItemValue("AutoPopulateMembersInterval", "30");
	docProfile.replaceItemValue("SecureInetPasswords", "1");
	docProfile.replaceItemValue("AltLanguageInfoAllowed", "1");
	docProfile.computeWithForm(false, false);
	docProfile.save(true, false);
	docProfile.recycle();
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:13,代码来源:BaseJNATestClass.java

示例7: buildMessage

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch(time=50)
public SocketMessage buildMessage(Document doc){
	SocketMessage msg = null;
	try{
		RichTextItem rtitem = (RichTextItem) doc.getFirstItem(Const.FIELD_JSON);
		String json = null;

		if(doc.hasEmbedded()){
			json = this.scanForAttachedJson(rtitem);
		}else{
			json = rtitem.getUnformattedText();
		}

		msg = JSONUtils.toObject(json, SocketMessage.class);

		if(msg==null){
			return new SocketMessage();//return empty invalid message.
		}

	}catch(Exception e){
		LOG.log(Level.SEVERE,null, e);
		try{
			doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_ERROR);
			doc.replaceItemValue(Const.FIELD_ERROR, e.getMessage());
			doc.save();
		}catch(NotesException n){
			LOG.log(Level.SEVERE,null, n);
		}
	}
	return msg;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:33,代码来源:SocketMessageFactory.java

示例8: buildDirectMessages

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Builds the direct messages.
 *
 * @param doc the doc
 */
@Stopwatch
private void buildDirectMessages(Document doc) {
	Document directMessage=null;
	try{
		for(String server : this.getClusterMates(doc.getParentDatabase().getParent())){
			directMessage = doc.copyToDatabase(doc.getParentDatabase());
			directMessage.replaceItemValue(Const.FIELD_TO, server);
			directMessage.save();
			directMessage.recycle();
		}
	}catch(Exception e){
		LOG.log(Level.SEVERE,null, e);

		try {
			doc.replaceItemValue(Const.FIELD_ERROR, e.getLocalizedMessage());
			doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_ERROR);
			doc.save();

			directMessage.replaceItemValue(Const.FIELD_ERROR, e.getLocalizedMessage());
			directMessage.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_ERROR);
			directMessage.save();

		} catch (NotesException e1) {
			LOG.log(Level.SEVERE,null, e);
		}


	}


}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:37,代码来源:BroadcastQueueProcessor.java

示例9: processDoc

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Process doc.
 *
 * @param doc the doc
 */
//@Stopwatch(time=50)
protected void processDoc(Document doc){
	try{
		ServerInfo info = ServerInfo.getInstance();
		String to = doc.getItemValueString(Const.FIELD_TO);

		IUser user = server.resolveUser(to);

		//only process if we're on the correct host, and that the user has an open connection.
		if((to.startsWith(StringCache.FORWARD_SLASH) 
				|| info.isCurrentServer(to) 
				|| (user!=null && user.isOpen() 
				&& user.isOnServer()))){

			//validate the fields
			SocketMessage msg = msgFactory.buildMessage(doc);

			//validate the data was bound correctly.
			if(msg.isValid()){
				boolean b = server.onMessage(to, msg.toJson());
				if(b){
					doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_SENT);
					doc.save();
				}
			}else{
				doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_ERROR);
				doc.replaceItemValue(Const.FIELD_ERROR, "Invalid message.  Please check field data.");
				doc.save();
			}
		}

	}catch(Exception e){
		LOG.log(Level.SEVERE,null, e);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:41,代码来源:AbstractQueueProcessor.java

示例10: flagForDeletion

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Flag for deletion.
 *
 * @param doc the doc
 * @throws NotesException the notes exception
 */
private void flagForDeletion(Document doc) throws NotesException{
	doc.removeItem(StringCache.FIELD_REF);
	doc.removeItem(StringCache.FIELD_CONFLICT);
	doc.replaceItemValue(StringCache.FIELD_FORM, Const.FIELD_VALUE_DELETE);
	doc.save();
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:13,代码来源:AbstractQueueProcessor.java

示例11: setClustermateUsersOffline

import lotus.domino.Document; //导入方法依赖的package包/类
/**
 * Sets the clustermate users offline.
 *
 * @param db the db
 * @param clustermate the clustermate
 */
@Stopwatch
private void setClustermateUsersOffline(Database db, String clustermate) {

	try {
		View view = db.getView(Const.VIEW_USERS);
		view.setAutoUpdate(false);
		Document doc = view.getFirstDocument();
		Document temp = null;
		while(doc!=null){

			if(doc.isValid()){
				String host = doc.getItemValueString(Const.FIELD_HOST);

				//if hosts are the same
				if(host!=null && host.equals(clustermate)){
					doc.replaceItemValue(Const.FIELD_STATUS, Const.STATUS_OFFLINE);
					doc.save();
				}
			}

			temp = view.getNextDocument(doc);
			doc.recycle();
			doc = temp;
		}
		view.setAutoUpdate(true);

	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);
	}

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:38,代码来源:ClustermateMonitor.java

示例12: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {

	if(TaskRunner.getInstance().isClosing()){
		return;
	}


	Session session =  this.openSession();
	try {	
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(Const.VIEW_USERS);
		Document doc = view.getFirstDocument();
		Document temp = null;
		while(doc!=null){
			String host = doc.getItemValueString(Const.FIELD_HOST);
			if(ServerInfo.getInstance().isCurrentServer(host)){
				String currentStatus= doc.getItemValueString(Const.FIELD_STATUS);
				//only update if we need to.
				if(!this.getStatus().equals(currentStatus)){
					doc.replaceItemValue(Const.FIELD_STATUS, this.getStatus());
					doc.save();
				}
			}

			temp = view.getNextDocument(doc);
			doc.recycle();
			doc = temp;
		}

	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);

	}finally{
		SessionFactory.closeSession(session);
	}

}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:40,代码来源:StampAllUsers.java

示例13: remove

import lotus.domino.Document; //导入方法依赖的package包/类
public static void remove(Document doc, String attachmentName) throws NotesException{
	EmbeddedObject eo = doc.getAttachment(attachmentName);
	if(eo!=null){
		eo.remove();
		doc.save();
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:8,代码来源:AttachUtils.java

示例14: attach

import lotus.domino.Document; //导入方法依赖的package包/类
public static void attach(File file, Document doc, String field) throws IOException, NotesException{
	RichTextItem item = getRichText(doc, field);
	item.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null, file.getAbsolutePath(), file.getName());
	doc.save();
	item.recycle();
	file.delete();
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:8,代码来源:AttachUtils.java

示例15: saveStore

import lotus.domino.Document; //导入方法依赖的package包/类
protected void saveStore() {
	Document doc=getStoreDoc();
	
	try {
		DevelopiUtils.saveState((HashMap<String,byte[]>)map, doc, "CredStore");
		doc.save();
	} catch(Throwable t) {
		System.out.println("Error saving tokenstore: "+t.getMessage());
		t.printStackTrace(System.err);
	} finally {
		DevelopiUtils.recycleObject(doc);
	}
	
}
 
开发者ID:sbasegmez,项目名称:ic14demos,代码行数:15,代码来源:MemoryStore.java


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