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


Java Database.getView方法代码示例

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


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

示例1: loadAppstore

import lotus.domino.Database; //导入方法依赖的package包/类
private void loadAppstore() {
	Database db=ExtLibUtil.getCurrentDatabase();
	View view=null;
	Document appstore=null;
	
	try {
		view=db.getView("apps");
		appstore=view.getDocumentByKey(DEFAULT_ENDPOINT_NAME, true);
		
		if(appstore==null) {
			System.out.println("No Application found for "+DEFAULT_ENDPOINT_NAME);
		} else {
			consumerKey=appstore.getItemValueString("ConsumerKey");
			consumerSecret=appstore.getItemValueString("ConsumerSecret");
		}
	} catch(NotesException ne) {
		ne.printStackTrace();
	} finally {
		DevelopiUtils.recycleObjects(appstore, view);
	}
}
 
开发者ID:sbasegmez,项目名称:Blogged,代码行数:22,代码来源:BoxService.java

示例2: getLatestMessage

import lotus.domino.Database; //导入方法依赖的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

示例3: getMessages

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

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

	Database db = XSPUtils.session().getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
	View view = db.getView(Const.VIEW_MESSAGES_BY_USER);
	ViewEntryCollection col = view.getAllEntriesByKey(XSPUtils.session().getEffectiveUserName(),true);
	List<SocketMessage> list = msgFactory.buildMessages(col);

	//mark the collection as sent
	col.stampAll(Const.FIELD_SENTFLAG, Const.FIELD_SENTFLAG_VALUE_SENT);

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

	return this.buildResponse(list);
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:21,代码来源:RestWebSocket.java

示例4: getUserDoc

import lotus.domino.Database; //导入方法依赖的package包/类
/**
 * Gets the user doc.
 *
 * @param session the session
 * @param create the create
 * @return the user doc
 * @throws NotesException the notes exception
 */
private Document getUserDoc(Session session, boolean create) throws NotesException{
	Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
	Document doc = null;

	View users = db.getView(Const.VIEW_USERS);
	View sessions = db.getView(Const.VIEW_SESSIONS);
	doc = users.getDocumentByKey(user.getUserId().trim(),true);
	if(doc == null){
		doc = sessions.getDocumentByKey(user.getSessionId(),true);
	}
	//if we get here... create the doc.
	if(doc==null && create){
		doc = db.createDocument();
	}
	//cleanup
	users.recycle();
	sessions.recycle();

	return doc;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:29,代码来源:ApplyStatus.java

示例5: deleteAnonymousDoc

import lotus.domino.Database; //导入方法依赖的package包/类
/**
 * Delete anonymous doc.
 *
 * @param session the session
 * @throws NotesException the notes exception
 */
//if the user moved from anonymous to person to anonymous to person
private void deleteAnonymousDoc(Session session) throws NotesException{
	Database db = session.getDatabase(StringCache.EMPTY, Const.WEBSOCKET_PATH);
	View view = db.getView(Const.VIEW_USERS);
	Vector<String> keys = new Vector<String>(3);
	keys.add(this.getSessionId().trim());
	keys.add(this.getSessionId().trim());


	DocumentCollection col = view.getAllDocumentsByKey(keys,true);
	if(col!=null && col.getCount() > 0){
		col.stampAll(Const.FIELD_FORM, Const.FIELD_VALUE_DELETE);
		col.recycle();
	}
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:22,代码来源:ApplyStatus.java

示例6: openView

import lotus.domino.Database; //导入方法依赖的package包/类
@Override
protected View openView() throws NotesException {
    Database db = DominoUtils.openDatabaseByName(getDatabaseName());
    View view = db.getView(getViewName());
    String labelName = getLabelColumn();
    if(StringUtil.isNotEmpty(labelName)) {
        try {
            view.resortView(labelName, true);
        } catch(NotesException ex) {
            // We can't resort the view so we silently fail
            // We just report it to the console
            if( ExtlibDominoLogger.DOMINO.isWarnEnabled() ){
                ExtlibDominoLogger.DOMINO.warnp(this, "openView", ex, //$NON-NLS-1$ 
                        StringUtil.format("The view {0} needs the column {1} to be sortable for the value picker to be searchable",getViewName(),labelName)); // $NLW-DominoViewPickerData_ValuePickerNotSearchable_UnsortableColumn-1$
            }
        }
    }
    return view;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:20,代码来源:DominoViewPickerData.java

示例7: openView

import lotus.domino.Database; //导入方法依赖的package包/类
@Override
protected View openView() throws NotesException {
    // Find the database
    Database nabDb = findNAB();
    if(nabDb==null) {
        throw new FacesExceptionEx(null,"Not able to find a valid address book for the name picker"); // $NLX-DominoNABNamePickerData.Notabletofindavalidaddressbookfor-1$
    }
    // Find the view
    String viewName = getViewName();
    if(StringUtil.isEmpty(viewName)) {
        throw new FacesExceptionEx(null,"Not able to find a view in the address book that matches the selection criterias"); // $NLX-DominoNABNamePickerData.Notabletofindaviewintheaddressboo-1$
    }
    
    View view = nabDb.getView(viewName);
    return view;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:17,代码来源:DominoNABNamePickerData.java

示例8: loadView

import lotus.domino.Database; //导入方法依赖的package包/类
protected void loadView() throws NotesException {
    ViewParameters parameters = getParameters();
    Database db = getDatabase(parameters);
    String viewName = parameters.getViewName();
    if(StringUtil.isEmpty(viewName)) {
        if(defaultView==null) {
            throw new IllegalStateException("No default view assigned to the service"); // $NLX-RestViewService.Nodefaultviewassignedtotheservice-1$
        }
        this.view = defaultView;
        this.view.setAutoUpdate(false);
        this.shouldRecycleView = false;
        return;
    }
    this.view = db.getView(viewName);
    if(view==null) {
        throw new NotesException(0,StringUtil.format("Unknown view {0} in database {1}",viewName,db.getFileName())); // $NLX-RestViewService.Unknownview0indatabase1-1$
    }
    this.view.setAutoUpdate(false);
    this.shouldRecycleView = true;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:21,代码来源:RestViewService.java

示例9: getCurrentViewByName

import lotus.domino.Database; //导入方法依赖的package包/类
/**
 * 
 * Get the current View object by its name or aliases with access control check
 * @return the view object for the specified name/alias
 */
protected View getCurrentViewByName(Database db, String name){
    try {
        View view = db.getView(name);
        if ( view == null ) {
            // This resource should always have a database context
            throw new WebApplicationException(ErrorHelper.createErrorResponse("The URI must refer to an existing view.", Response.Status.NOT_FOUND)); // $NLX-AbstractDasResource.TheURImustrefertoanexistingview-1$
        }           
        doViewAccessCheck(view);                    
        return view;
    } catch (NotesException e) {
        if(DasServlet.DAS_LOGGER.isTraceDebugEnabled()){
            DasServlet.DAS_LOGGER.traceDebug(e, "Error accessing the view by name: {0}",name); // $NON-NLS-1$
        }
        throw new WebApplicationException(ErrorHelper.createErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
    }        
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:22,代码来源:AbstractDasResource.java

示例10: getClusterMates

import lotus.domino.Database; //导入方法依赖的package包/类
/**
 * Gets the cluster mates.
 *
 * @param s the s
 * @return the cluster mates
 * @throws NotesException the notes exception
 */
private List<String> getClusterMates(Session s) throws NotesException{
	if(clusterMates.isEmpty()){
		synchronized(clusterMates){
			if(clusterMates.isEmpty()){

				if(!Config.getInstance().isClustered()){
					clusterMates.add(ServerInfo.getInstance().getServerName());
					return clusterMates;
				}

				System.out.println("loading clustermates");
				/*
				 * all below should get recycled after session is recycled.
				 */
				final Database db = s.getDatabase(StringCache.EMPTY, StringCache.NAMES_DOT_NSF);
				final View view = db.getView(Const.VIEW_SERVERS);
				final Document docServer = view.getDocumentByKey(ServerInfo.getInstance().getServerName(), true);
				final String clusterName = docServer.getItemValueString(Const.FIELD_CLUSTERNAME);
				final DocumentCollection col = db.getView(Const.VIEW_CLUSTERS).getAllDocumentsByKey(clusterName,true);
				Document doc = col.getFirstDocument();
				while(doc!=null){
					clusterMates.add(doc.getItemValueString(Const.FIELD_SERVERNAME));
					doc = col.getNextDocument(doc);
				}
			}
		}
	}
	return clusterMates;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:37,代码来源:BroadcastQueueProcessor.java

示例11: run

import lotus.domino.Database; //导入方法依赖的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

示例12: run

import lotus.domino.Database; //导入方法依赖的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

示例13: setClustermateUsersOffline

import lotus.domino.Database; //导入方法依赖的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

示例14: run

import lotus.domino.Database; //导入方法依赖的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

示例15: getStoreDoc

import lotus.domino.Database; //导入方法依赖的package包/类
private Document getStoreDoc() {
	Database database=ExtLibUtil.getCurrentDatabase();
			
	Document doc=null;
	View view=null;

	try {
		view=database.getView("tokenstores");
		String serverName=database.getServer();
		
		doc=view.getDocumentByKey(serverName, true);
		
		if(doc==null) {
			doc=database.createDocument();
			doc.replaceItemValue("Form", "tokenstore");
			doc.replaceItemValue("ServerName", serverName);
			doc.computeWithForm(false, false);
			doc.save();
		}
		
	} catch (NotesException e) {
		e.printStackTrace();
	} finally {
		DevelopiUtils.recycleObject(view);
	}

	return doc;
}
 
开发者ID:sbasegmez,项目名称:ic14demos,代码行数:29,代码来源:MemoryStore.java


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