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


Java Name类代码示例

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


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

示例1: createName

import lotus.domino.Name; //导入依赖的package包/类
@Override
public Name createName(final String name, final String lang) {
	if (lang == null) {
		return createName(name);
	}
	String[] meta = new String[2];
	meta[0] = name;
	meta[1] = lang;
	return getFactory().create(Name.SCHEMA, this, meta);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:11,代码来源:Session.java

示例2: testNamesListCreation_listComparisonWithLegacy

import lotus.domino.Name; //导入依赖的package包/类
public void testNamesListCreation_listComparisonWithLegacy() {
	runWithSession(new IDominoCallable<Object>() {

		@Override
		public Object call(Session session) throws Exception {
			NotesDatabase dbData = getFakeNamesDb();
			Database dbLegacyAPI = session.getDatabase(dbData.getServer(), dbData.getRelativeFilePath());
			
			List<String> userNamesListJNA = NotesNamingUtils.getUserNamesList(session.getEffectiveUserName());
			Assert.assertTrue("JNA names list contains the current username", userNamesListJNA.contains(session.getEffectiveUserName()));
			
			Vector<Name> userGroupNamesList = session.getUserGroupNameList();
			for (Name currNameLegacy : userGroupNamesList) {
				Assert.assertTrue("JNA list contains "+currNameLegacy.getCanonical(), userNamesListJNA.contains(currNameLegacy.getCanonical()));
			}
			Name currUserName = session.getUserNameObject();
			Assert.assertTrue("JNA usernames list contains "+currUserName.getCanonical(), userNamesListJNA.contains(currUserName.getCanonical()));
			Assert.assertTrue("JNA usernames list contains "+currUserName.getCommon(), userNamesListJNA.contains(currUserName.getCanonical()));
			Assert.assertTrue("JNA usernames list contains *", userNamesListJNA.contains("*"));
			
			return null;
		}
	});
}
 
开发者ID:klehmann,项目名称:domino-jna,代码行数:25,代码来源:TestNamesListCreation.java

示例3: getDatabaseName

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

示例4: formatName

import lotus.domino.Name; //导入依赖的package包/类
private static String formatName(String baseName, NameFormat format) throws NotesException {
    // optionally reformat the name, as contributed in #14 subpart D1:
    // https://github.com/OpenNTF/XPagesExtensionLibrary/pull/14
    if( StringUtil.isEmpty(baseName) ){
        // don't format empty string
        return baseName;
    }
    if (NameFormat.UNFORMATTED == format) {
        return baseName;
    } else {
        Session sess = ExtLibUtil.getCurrentSession();
        Name nm = sess.createName(baseName); // throws NotesException
        switch(format){
            case ABBREVIATED: return nm.getAbbreviated();
            case CANONICAL: return nm.getCanonical();
            case COMMON: return nm.getCommon();
            default: return baseName; // won't happen
        }
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:21,代码来源:DominoNABNamePickerData.java

示例5: profileRemoveDelegate

import lotus.domino.Name; //导入依赖的package包/类
/**
 * Removes a delegate from the calendar profile.
 * 
 * @param profile
 * @param delegateName
 * @throws NotesException
 */
private void profileRemoveDelegate(Document profile, String delegateName) throws NotesException {
    Session session = profile.getParentDatabase().getParent();
    
    // Do for each delegate access item
    
    for ( int i = 0; i < s_items.length; i++ ) {

        // Read the item value
        Vector values = profile.getItemValue(s_items[i]);
        
        // Remove this name from the vector
        for ( int j = 0; j < values.size(); j++ ) {
            String strName = (String)values.get(j);
            Name name = session.createName(strName);
            if ( delegateName.equals(name.getAbbreviated())) {
                values.remove(j);
                profile.replaceItemValue(s_items[i], values);
                break;
            }
        }
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:30,代码来源:DelegateProvider.java

示例6: getMyGroupsAndRoles

import lotus.domino.Name; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getMyGroupsAndRoles() {
	List<String> lstRC = new ArrayList<String>();
	try {
		XSPContext xsp = ExtLibUtil.getXspContext();
		DirectoryUser dirUser = xsp.getUser();
		Name nonUser = ExtLibUtil.getCurrentSession().createName(ExtLibUtil.getCurrentSession().getEffectiveUserName());
		lstRC.add(nonUser.getCanonical());
		lstRC.add(nonUser.getAbbreviated());
		lstRC.add(nonUser.getCommon());
		lstRC.addAll(dirUser.getGroups());
		lstRC.addAll(dirUser.getRoles());

	} catch (Exception e) {
		e.printStackTrace();
	}
	return lstRC;

}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:20,代码来源:RoleAndGroupProvider.java

示例7: getGroupsAndRolesOf

import lotus.domino.Name; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getGroupsAndRolesOf(String strUser, Database ndbTarget) {
	List<String> lstRC = new ArrayList<String>();
	try {
		Name nonUser = ndbTarget.getParent().createName(strUser);
		lstRC.add(nonUser.getCanonical());
		lstRC.add(nonUser.getAbbreviated());
		lstRC.add(nonUser.getCommon());
		lstRC.addAll(new lotus.notes.addins.DominoServer(ndbTarget.getServer()).getNamesList(nonUser.getCanonical()));
		lstRC.addAll(ndbTarget.queryAccessRoles(nonUser.getAbbreviated()));
	} catch (Exception e) {
		e.printStackTrace();
	}
	return lstRC;

}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:17,代码来源:RoleAndGroupProvider.java

示例8: _getPerson

import lotus.domino.Name; //导入依赖的package包/类
public String _getPerson(Definition def, String strValue, Session sesCurrent) {
	String rcValue = strValue;
	if (def.isReader() || def.isAuthor() || def.isNames() && !StringUtil.isEmpty(def.getShowNameAs())) {
		try {
			Name nonCurrent = sesCurrent.createName(strValue);

			if ("ABBREVIATE".equalsIgnoreCase(def.getShowNameAs())) {
				rcValue = nonCurrent.getAbbreviated();
			} else if ("CN".equals(def.getShowNameAs())) {
				rcValue = nonCurrent.getCommon();
			}
			nonCurrent.recycle();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	return rcValue;
}
 
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:19,代码来源:NamesProcessor.java

示例9: toSerializable

import lotus.domino.Name; //导入依赖的package包/类
public static Serializable toSerializable(final Object value) {
	if (value == null) {
		return null;
	}
	Serializable result = null;
	if (value instanceof org.openntf.domino.DateTime) {
		Date date = null;
		org.openntf.domino.DateTime dt = (org.openntf.domino.DateTime) value;
		result = dt.toJavaDate();
	} else if (value instanceof org.openntf.domino.Name) {
		result = DominoUtils.toNameString((org.openntf.domino.Name) value);
	} else if (value instanceof String) {
		result = (String) value;
	} else if (value instanceof Number) {
		result = (Number) value;
	}
	return result;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:19,代码来源:TypeUtils.java

示例10: toSerializables

import lotus.domino.Name; //导入依赖的package包/类
public static Collection<Serializable> toSerializables(final Object value) {
	if (value == null) {
		return null;
	}
	if (value instanceof Collection) {
		return DominoUtils.toSerializable((Collection<?>) value);
	} else if (value.getClass().isArray()) {
		return DominoUtils.toSerializable(Arrays.asList(value));
	} else {
		Collection<Serializable> result = new ArrayList<Serializable>();
		if (value instanceof org.openntf.domino.DateTime) {
			Date date = null;
			org.openntf.domino.DateTime dt = (org.openntf.domino.DateTime) value;
			date = dt.toJavaDate();
			result.add(date);
		} else if (value instanceof org.openntf.domino.Name) {
			result.add(DominoUtils.toNameString((org.openntf.domino.Name) value));
		} else if (value instanceof String) {
			result.add((String) value);
		} else if (value instanceof Number) {
			result.add((Number) value);
		}
		return result;
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:26,代码来源:TypeUtils.java

示例11: toNames

import lotus.domino.Name; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static org.openntf.domino.Name[] toNames(final Object value, final org.openntf.domino.Session session)
		throws DataNotCompatibleException {
	if (value == null) {
		return null;
	}
	if (value instanceof Collection) {
		return collectionToNames((Collection<Object>) value, session);
	} else if (value.getClass().isArray()) {
		return collectionToNames(Arrays.asList(value), session);
	} else {
		org.openntf.domino.Name[] result = new org.openntf.domino.Name[1];
		result[0] = session.createName(String.valueOf(value));
		return result;
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:17,代码来源:TypeUtils.java

示例12: collectionToNames

import lotus.domino.Name; //导入依赖的package包/类
public static org.openntf.domino.Name[] collectionToNames(final Collection<Object> vector, final org.openntf.domino.Session session)
		throws DataNotCompatibleException {
	if (vector == null || vector.isEmpty()) {
		return new org.openntf.domino.Name[0];
	}

	org.openntf.domino.Name[] result = new org.openntf.domino.Name[vector.size()];
	if (session != null) {
		int i = 0;
		for (Object o : vector) {
			result[i++] = session.createName(String.valueOf(o));
		}
		return result;
	} else {
		throw new IllegalArgumentException("Cannont convert to Name without a valid Session object");
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:18,代码来源:TypeUtils.java

示例13: register

import lotus.domino.Name; //导入依赖的package包/类
@Override
public Response register(HashMap<String, String> data)throws NotesException {
	Session s = (Session) guicer.createObject(Session.class);
	String user = s.getEffectiveUserName();
	PushToken token = new PushToken();
	
	//set the user
	token.setUserId(user);
	
	//grab the token
	token.setToken(data.get("pushToken"));
	
	//set the appId.
	token.setAppId(this.getReplicaId());
	
	//throws exception if not valid.
	tokenValidator.validate(token);
	
	//if we get here, save the token and return the prompt to the caller.
	pushManager.saveToken(token);
	
	Name name = s.createName(token.getUserId());
	
	return this.prompt(Prompt.INFO, "Push token registered for " + name.getAbbreviated());
}
 
开发者ID:mwambler,项目名称:webshell-xpages-ext-lib,代码行数:26,代码来源:RestApn.java

示例14: getOnlineUsers

import lotus.domino.Name; //导入依赖的package包/类
@Override
public List<SelectItem> getOnlineUsers() throws NotesException{
	List<SelectItem> list = new ArrayList<SelectItem>();
	for(String user : this.getUsers()){
		Name name = XSPUtils.session().createName(user);
		SelectItem select = new SelectItem(user,name.getAbbreviated());
		list.add(select);
		name.recycle();
	}
	return list;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:12,代码来源:AbstractWebSocketBean.java

示例15: getUsersByUri

import lotus.domino.Name; //导入依赖的package包/类
@Override
public List<SelectItem> getUsersByUri(String uri) throws NotesException{
	UriUserMap map = server.getUriUserMap();
	List<SelectItem> list = new ArrayList<SelectItem>();
	for(IUser user : map.get(uri)){
		ContextWrapper wrapper = user.findConnection(uri);
		if(wrapper!=null && wrapper.isOpen()){
			Name name = XSPUtils.session().createName(user.getUserId());
			SelectItem select = new SelectItem(user.getUserId(),name.getCommon());
			list.add(select);
			name.recycle();
		}
	}
	return list;
}
 
开发者ID:mwambler,项目名称:xockets.io,代码行数:16,代码来源:AbstractWebSocketBean.java


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