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


Java Database.getParent方法代码示例

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


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

示例1: getDatabaseName

import lotus.domino.Database; //导入方法依赖的package包/类
/**
 * Return the name of Database contain the View this View Entry comes from.
    * If Database is remote - then name is <db server>!!<database file path>
    * 
 * @return Return the name of Database contain the View this View Entry comes from.
 * @throws NotesException
 */
public String getDatabaseName() throws NotesException {
	Database db = getDatabase();
	Session session = db.getParent();
	
    String databaseName = PlatformUtil.getRelativeFilePath(db);
    if (StringUtil.isNotEmpty(db.getServer())) {
    	Name serverName = session.createName(db.getServer());
    	if(serverName.isHierarchical()){
    		// SPR# EGLN92PHT6
    		// Use common rather than abbreviated name due to encoding complications with abbreviated format
    		databaseName =  serverName.getCommon() + "!!" + databaseName; // $NON-NLS-1$ 
    		// serverName.getAbbreviated() + "!!" + databaseName; // $NON-NLS-1$
    	}
    }
    return databaseName;
   }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:24,代码来源:ViewRowDataOverride.java

示例2: setImpl

import lotus.domino.Database; //导入方法依赖的package包/类
protected void setImpl(Database database, Delegate delegate, Document profile) throws ModelException, NotesException {
    AdministrationProcess adminp = null;
    
    try {
        Session session = database.getParent();
        
        // Can't modify the owner's access
        
        String owner = profile.getItemValueString(OWNER_ITEM);
        verifyDelegateNotOwner(session, delegate.getName(), owner);
        
        // Can't modify a delegate that's not there
        
        Vector[] vectors = loadVectors(profile);
        Name name = session.createName(delegate.getName());
        if ( !delegateExists(vectors, name.getCanonical()) ) {
            throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NON-NLS-1$
        }
        
        // Update the right vector(s)

        delegateRemove(vectors, name.getCanonical());
        delegateAdd(vectors, name.getCanonical(), delegate.getAccess());
        
        // Send the adminp request
        
        String mailFile = database.getFilePath();
        String server = session.getServerName();
        
        adminp = session.createAdministrationProcess(null);
        String unid = adminp.delegateMailFile(owner, 
                            vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], vectors[5],  
                            null, mailFile, server);
    }
    finally {
        BackendUtil.safeRecycle(adminp);
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:39,代码来源:Delegate901Provider.java

示例3: addImpl

import lotus.domino.Database; //导入方法依赖的package包/类
protected void addImpl(Database database, Delegate delegate, Document profile) throws ModelException, NotesException {
    AdministrationProcess adminp = null;
    
    try {
        Session session = database.getParent();
        
        // Can't add the owner as a delegate
        
        String owner = profile.getItemValueString(OWNER_ITEM);
        verifyDelegateNotOwner(session, delegate.getName(), owner);
        
        // Can't add someone that's already there
        
        Vector[] vectors = loadVectors(profile);
        Name name = session.createName(delegate.getName());
        if ( delegateExists(vectors, name.getCanonical()) ) {
            throw new ModelException("A delegate of that name already exists", ModelException.ERR_CONFLICT); // $NON-NLS-1$
        }
        
        // Add the delegate to the right vector(s)
        
        delegateAdd(vectors, name.getCanonical(), delegate.getAccess());
        
        // Send the adminp request
        
        String mailFile = database.getFilePath();
        String server = session.getServerName();
        
        adminp = session.createAdministrationProcess(null);
        String unid = adminp.delegateMailFile(owner, 
                            vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], vectors[5],  
                            null, mailFile, server);
    }
    finally {
        BackendUtil.safeRecycle(adminp);
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:38,代码来源:Delegate901Provider.java

示例4: deleteImpl

import lotus.domino.Database; //导入方法依赖的package包/类
protected void deleteImpl(Database database, String name, Document profile) throws ModelException, NotesException {
    AdministrationProcess adminp = null;
    
    try {
        Session session = database.getParent();
        
        // Can't remove the owner
        
        String owner = profile.getItemValueString(OWNER_ITEM);
        verifyDelegateNotOwner(session, name, owner);
        
        // Can't remove a delegate that's not there
        
        Vector[] vectors = loadVectors(profile);
        Name no = session.createName(name);
        if ( !delegateExists(vectors, no.getCanonical()) ) {
            throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NON-NLS-1$
        }

        // Send the adminp request
        
        Vector removeList = new Vector();
        removeList.add(no.getCanonical());
        
        String mailFile = database.getFilePath();
        String server = session.getServerName();
        
        adminp = session.createAdministrationProcess(null);
        String unid = adminp.delegateMailFile(owner, 
                            null, null, null, null, null, null, 
                            removeList, mailFile, server);
    }
    finally {
        BackendUtil.safeRecycle(adminp);
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:37,代码来源:Delegate901Provider.java

示例5: hasManagerAccess

import lotus.domino.Database; //导入方法依赖的package包/类
/**
 * Does the user have Manager access to the database?
 * 
 * <p>This method doesn't check the ACL's internet access level.  That
 * must be checked at a level that knows we are executing in the
 * HTTP task.
 * 
 * @param database
 * @return
 * @throws NotesException
 */
private boolean hasManagerAccess(Database database) throws NotesException {
    boolean managerAccess = false;
    
    Session session = database.getParent();
    String user = session.getEffectiveUserName();
    if ( !StringUtil.isEmpty(user) ) {
        int level = database.queryAccess(user);
        if ( level >= ACL.LEVEL_MANAGER ) {
            managerAccess = true;
        }
    }

    return managerAccess;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:26,代码来源:DelegateProvider.java

示例6: NotesDatabase

import lotus.domino.Database; //导入方法依赖的package包/类
/**
 * Creates a new NotesDatabase
 * 
 * @param adaptable adaptable providing enough information to create the database
 */
public NotesDatabase(IAdaptable adaptable) {
	Database legacyDB = adaptable.getAdapter(Database.class);
	if (legacyDB!=null) {
		if (isRecycled(legacyDB))
			throw new NotesError(0, "Legacy database already recycled");
		
		long dbHandle = LegacyAPIUtils.getDBHandle(legacyDB);
		if (dbHandle==0)
			throw new NotesError(0, "Could not read db handle");
		
		if (PlatformUtils.is64Bit()) {
			m_hDB64 = dbHandle;
		}
		else {
			m_hDB32 = (int) dbHandle;
		}
		NotesGC.__objectCreated(NotesDatabase.class, this);
		setNoRecycleDb();
		m_legacyDbRef = legacyDB;

		Session session;
		try {
			session = legacyDB.getParent();
			String effUserName = session.getEffectiveUserName();
			m_asUserCanonical = effUserName;
			
			List<String> names = NotesNamingUtils.getUserNamesList(m_asUserCanonical);
			m_namesList = NotesNamingUtils.writeNewNamesList(names);

			//setting authenticated flag for the user is required when running on the server
			NotesNamingUtils.setPrivileges(m_namesList, EnumSet.of(Privileges.Authenticated));

		} catch (NotesException e) {
			throw new NotesError(e.id, e.getLocalizedMessage());
		}
	}
	else {
		throw new NotesError(0, "Unsupported adaptable parameter");
	}
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:46,代码来源:NotesDatabase.java

示例7: getFirstMimeEntity

import lotus.domino.Database; //导入方法依赖的package包/类
public MIMEEntity getFirstMimeEntity(boolean ignoreForm) throws NotesException {
	
	if ( _mimeEntity == null ) {

		Database database = _document.getParentDatabase();
		Session session = database.getParent();
		boolean restoreConvertMime = false;
		
		if (session.isConvertMime()) {
			// Do not convert MIME to rich text.
			session.setConvertMIME(false);
			restoreConvertMime = true;
		}
		
		try {
			Item item = _document.getFirstItem(_itemName);
			if (item != null) {
				if (item.getType() == Item.RICHTEXT) {
					if ( ITEM_BODY.equalsIgnoreCase(_itemName) && !ignoreForm) {
						_document.removeItem("$KeepPrivate"); //$NON-NLS-1$
						_document.convertToMIME(lotus.domino.Document.CVT_RT_TO_PLAINTEXT_AND_HTML, 0);
						_mimeEntity = _document.getMIMEEntity(_itemName);
					}
					else {
						_tempDocument = database.createDocument();
						_tempDocument.copyItem(item, ITEM_BODY);	
						_tempDocument.convertToMIME(lotus.domino.Document.CVT_RT_TO_PLAINTEXT_AND_HTML, 0);
						_mimeEntity = _tempDocument.getMIMEEntity(ITEM_BODY);	
					}
				} 
				else if (item.getType() == Item.MIME_PART) {
					_mimeEntity = _document.getMIMEEntity(_itemName);
				}
			}
		}
		finally {
			if (restoreConvertMime) {
				session.setConvertMime(true);
			}
		}
	}

	return _mimeEntity;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:45,代码来源:MimeEntityHelper.java

示例8: getEffectiveAccess

import lotus.domino.Database; //导入方法依赖的package包/类
public DelegateAccess getEffectiveAccess(Database database) throws ModelException {
    
    DelegateAccess access = null;
    
    try {
        
        Session session = database.getParent();
        String user = session.getEffectiveUserName();
        if ( StringUtil.isEmpty(user) ) {
            throw new ModelException("Error getting effective user name"); // $NLX-DelegateProvider.Errorgettingeffectiveusername-1$
        }
        
        int level = database.queryAccess(user);
        int privileges = database.queryAccessPrivileges(user);
        
        DelegateAccess.What what = DelegateAccess.What.NOTHING;
        boolean read = false;
        boolean create = false;
        boolean delete = false;
        boolean edit = false;
        
        if ( level < ACL.LEVEL_READER ) {
            if ( (privileges & Database.DBACL_READ_PUBLIC_DOCS) != 0 ) {
                what = DelegateAccess.What.CALENDAR;
                read = true;
                if ( (privileges & Database.DBACL_WRITE_PUBLIC_DOCS) != 0 ) {
                    create = true;
                }
            }
        }
        else {
            what = DelegateAccess.What.MAIL;
            read = true;
            if ( level == ACL.LEVEL_AUTHOR ) {
                create = true;
            }
            else if ( level >= ACL.LEVEL_EDITOR ) {
                create = true;
                edit = true;
            }
            
            if ( (privileges & Database.DBACL_DELETE_DOCS) != 0 ) {
                delete = true;
            }
        }
        
        access = new DelegateAccess(what, read, create, delete, edit);
    }
    catch (NotesException e) {
        throw new ModelException("Error getting effective access", e); // $NLX-DelegateProvider.Errorgettingeffectiveaccess-1$
    }
    
    return access;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:55,代码来源:DelegateProvider.java

示例9: createAllType

import lotus.domino.Database; //导入方法依赖的package包/类
void createAllType(Database db, int index) throws NotesException {
	Session session = db.getParent();
	String sIndex = Integer.toString(index);
	Document doc = db.createDocument();
	try {
		doc.replaceItemValue("Form","AllTypes");	
		
		doc.replaceItemValue("fldIcon",index);		
		doc.replaceItemValue("fldText","text_"+sIndex);		
		doc.replaceItemValue("fldNumber",index*100);
		doc.replaceItemValue("fldDate",createDate(session, 2010, 1, index));
		doc.replaceItemValue("fldTime",createTime(session, 5, 1, index));
		doc.replaceItemValue("fldDateTime",createDateTime(session, 2011, 2, index, 8, 9, index));
		doc.replaceItemValue("fldDateTimeRange",createDateTimeRange(session, 2012, 3, index, 8, 9, index));
		doc.replaceItemValue("fldDialogList","dlg_"+sIndex);	
		
		Vector<Object> mx = new Vector<Object>();
		mx.add("text_"+sIndex+"_1");
		mx.add("text_"+sIndex+"_2");
		mx.add("text_"+sIndex+"_3");
		doc.replaceItemValue("fldText2",mx);		
		
		Vector<Object> mn = new Vector<Object>();
		mn.add(index*100+1);
		mn.add(index*100+2);
		mn.add(index*100+3);
		doc.replaceItemValue("fldNumber2",mn);		

		Vector<Object> md = new Vector<Object>();
		md.add(createDate(session, 2010, 1, index));
		md.add(createDate(session, 2010, 2, index));
		md.add(createDate(session, 2010, 3, index));
		doc.replaceItemValue("fldDate2",md);		

		Vector<Object> mt = new Vector<Object>();
		mt.add(createTime(session, 6, 1, index));
		mt.add(createTime(session, 6, 2, index));
		mt.add(createTime(session, 6, 3, index));
		doc.replaceItemValue("fldTime2",mt);		

		Vector<Object> mdt = new Vector<Object>();
		mdt.add(createDateTime(session, 2011, 1, index, 6, 1, index));
		mdt.add(createDateTime(session, 2011, 2, index, 6, 2, index));
		mdt.add(createDateTime(session, 2011, 3, index, 6, 3, index));
		doc.replaceItemValue("fldDateTime2",mdt);		

		if(false) { // DateTime range do not work with multiple values?
			Vector<Object> mrg = new Vector<Object>();
			mrg.add(createDateTimeRange(session, 2012, 2, index, 4, 1, index));
			mrg.add(createDateTimeRange(session, 2012, 3, index, 5, 1, index));
			mrg.add(createDateTimeRange(session, 2012, 4, index, 6, 1, index));
			doc.replaceItemValue("fldDateTimeRange2",mrg);
		}
		
		Vector<Object> mdg = new Vector<Object>();
		mdg.add("dlgx_"+sIndex+"_1");
		mdg.add("dlgx_"+sIndex+"_1");
		mdg.add("dlgx_"+sIndex+"_1");
		doc.replaceItemValue("fldDialogList2",mdg);		

		doc.save();
	} finally {
		doc.recycle();
	}
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:66,代码来源:DataInitializer.java


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