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


Java Document.isValid方法代码示例

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


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

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public List<SocketMessage> buildMessages(ViewEntryCollection col){
	List<SocketMessage> list = new ArrayList<SocketMessage>();
	
	try{
	ViewEntry entry = col.getFirstEntry();
	ViewEntry temp = null;
	while(entry!=null){
		
		if(entry.isDocument()){
			Document doc = entry.getDocument();
			if(doc.isValid()){
				//add the message to the list.
				list.add(this.buildMessage(doc));
			}
		}
		
		temp = col.getNextEntry(entry);
		entry.recycle();
		entry = temp;
	}
	
	
	}catch(NotesException n){
		LOG.log(Level.SEVERE,null,n);
		
	}
	
	return list;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:32,代码来源:SocketMessageFactory.java

示例3: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
@Stopwatch
public void run() {
	
	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	//exit if nobody on.
	if(server.getWebSocketCount() == 0) return;
	
	Session session = this.openSession();
	try {
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(this.getEventQueue());
		view.setAutoUpdate(false);
		DocumentCollection col = view.getAllDocumentsByKey(target, true);
		Document doc = col.getFirstDocument();
		Document temp = null;
		while(doc!=null){
			if(doc.isValid()){
				this.processDoc(doc);
			}
			temp = col.getNextDocument(doc);
			doc.recycle();
			doc = temp;
		}

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

	}finally{
		this.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:37,代码来源:EventQueueProcessor.java

示例4: run

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

	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	if(server.getWebSocketAndObserverCount() == 0)return;

	Session session = this.openSession();
	try {
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(Const.VIEW_MSG_QUEUE);
		if(view.getAllEntries().getCount() > 0){
			view.setAutoUpdate(false);
			Document doc = view.getFirstDocument();
			Document temp = null;
			while(doc!=null){
				if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){
					this.processDoc(doc);

				}else if(doc.isValid() && doc.hasItem(StringCache.FIELD_CONFLICT)){
					this.processConflict(doc);
				}
				temp = view.getNextDocument(doc);
				doc.recycle();
				doc = temp;	
			}

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

	}finally{
		this.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:40,代码来源:QueueProcessor.java

示例5: 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

示例6: run

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

	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	//exit if nobody on.
	if(server.getWebSocketCount() == 0) return;

	Session session = super.openSession();
	try {

		if(ServerInfo.getInstance().isCurrentServer(Config.getInstance().getBroadcastServer())){
			Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
			View view = db.getView(Const.VIEW_BROADCAST_QUEUE);
			view.setAutoUpdate(false);
			Document doc = view.getFirstDocument();
			Document temp = null;
			while(doc!=null){
				if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){
					this.buildDirectMessages(doc);
					doc.replaceItemValue(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_SENT);
					doc.save();
				}
				temp = view.getNextDocument(doc);
				doc.recycle();
				doc = temp;
			}
			
			
			view.setAutoUpdate(true);
		}
	} catch (NotesException e) {
		LOG.log(Level.SEVERE,null,e);

	}finally{
		super.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:42,代码来源:BroadcastQueueProcessor.java

示例7: run

import lotus.domino.Document; //导入方法依赖的package包/类
@Override
public void run() {
	if(TaskRunner.getInstance().isClosing()){
		return;
	}
	
	Session session = super.openSession();
	try {
		Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
		View view = db.getView(Const.VIEW_USERS);
		view.setAutoUpdate(false);
		Document doc = view.getFirstDocument();

		Document temp = null;
		while(doc!=null){
			//can't seem to stop this from happening in clustered environment (hack for now)	
			if(doc.isValid() && !doc.hasItem(StringCache.FIELD_CONFLICT)){ 
				IUser user = userFactory.createUser(doc);
				if(Const.STATUS_ONLINE.equals(user.getStatus()) && !ServerInfo.getInstance().isCurrentServer(user.getHost())){
					server.addUser(user);
					
					
				}else if(Const.STATUS_OFFLINE.equals(user.getStatus()) && !ServerInfo.getInstance().isCurrentServer(user.getHost())){
					server.removeUser(user);
					
				}
			}
			
			//cleanup the conflicts. (hack... need to revisit)
			else if( doc.isValid() && doc.hasItem(StringCache.FIELD_CONFLICT)){
				this.processConflict(doc);
			}
			
			
			temp = view.getNextDocument(doc);
			doc.recycle();
			doc = temp;
		}

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

	}finally{
		super.closeSession(session);
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:48,代码来源:UserMonitor.java


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