本文整理汇总了Java中lotus.domino.Name.getCommon方法的典型用法代码示例。如果您正苦于以下问题:Java Name.getCommon方法的具体用法?Java Name.getCommon怎么用?Java Name.getCommon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Name
的用法示例。
在下文中一共展示了Name.getCommon方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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
}
}
}
示例3: _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;
}
示例4: 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;
}
示例5: toCommon
import lotus.domino.Name; //导入方法依赖的package包/类
public static String toCommon(Session session, String anyName) {
if(StringUtil.isEmpty(anyName)) return "";
Name nn=null;
try {
nn = session.createName(anyName);
return nn.getCommon();
} catch (NotesException e) {
// Not supposed to be here
} finally {
recycleObject(nn);
}
return "";
}
示例6: getCommonName
import lotus.domino.Name; //导入方法依赖的package包/类
protected String getCommonName(Session session, String id, Name n) throws NotesException {
// Ref SPR# PHAN94NCQA - account for LDAP server
if(!StringUtil.equalsIgnoreCase(id, "Anonymous")) { // $NON-NLS-1$
String ldapName = (String)session.evaluate("@NameLookup([NoUpdate];\""+JavaScriptUtil.toJavaScriptString(id)+"\";\"cn\")").firstElement(); // $NON-NLS-1$ // $NON-NLS-2$ // $NON-NLS-3$
if(!StringUtil.isSpace(ldapName)) {
return ldapName;
}
}
return n.getCommon();
}
示例7: parseRoom
import lotus.domino.Name; //导入方法依赖的package包/类
private Room parseRoom(Session session, String rawValue) throws NotesException {
Room room = null;
String displayName = null;
String distinguishedName = null;
String domain = null;
String email = null;
int capacity = 0;
StringTokenizer tokenizer = new StringTokenizer(rawValue, ";");
if ( tokenizer.hasMoreTokens() ) {
// Get room name
String rawName = tokenizer.nextToken();
Name name = session.createName(rawName);
displayName = name.getCommon();
distinguishedName = name.getAbbreviated();
}
if ( tokenizer.hasMoreTokens() ) {
try {
// Get room capacity
String rawCapacity = tokenizer.nextToken();
capacity = Integer.parseInt(rawCapacity);
}
catch (NumberFormatException e) {
// Ignore
}
}
if ( tokenizer.hasMoreTokens() ) {
// Get email address, but ignore bad addresses.
// TODO: Revisit this. The initial implementation of freeResourceSearch was returning
// a bad email address for rooms without a stored email address. The bad address
// had a trailing "@". When the freeResourceSearch is fixed, we can remove some of
// this code.
String rawEmail = tokenizer.nextToken();
if ( rawEmail != null && !rawEmail.endsWith("@") ) {
email = rawEmail;
}
}
return new Room(displayName, distinguishedName, domain, email, capacity);
}
示例8: findMailUser
import lotus.domino.Name; //导入方法依赖的package包/类
public MailUser findMailUser(Session session, String userName) throws ModelException {
MailUser mu = null;
Directory lookupDir = null;
Name no = null;
try {
lookupDir = session.getDirectory();
if ( lookupDir == null ) {
throw new ModelException("Cannot lookup the name."); // $NLX-LookupProvider.Cannotlookupthename-1$
}
Vector<String> vName = new Vector<String>();
vName.addElement(userName);
DirectoryNavigator dirNav = lookupDir.lookupNames("($Users)", vName, s_userLookupItems, true); //$NON-NLS-1$
if( dirNav == null || dirNav.getCurrentMatches() == 0 ){
throw new ModelException("Name not found.", ModelException.ERR_NOT_FOUND); // $NLX-LookupProvider.Namenotfound-1$
}
// Digest the results of the lookup
Vector<String> value = null;
value = dirNav.getFirstItemValue();
String fullName = value.elementAt(0);
no = session.createName(fullName);
value = dirNav.getNextItemValue();
String mailFile = value.elementAt(0);
if ( StringUtil.isNotEmpty(mailFile) && !mailFile.toLowerCase().endsWith(DOT_NSF) ) {
mailFile = mailFile + DOT_NSF;
}
value = dirNav.getNextItemValue();
String mailServer = value.elementAt(0);
value = dirNav.getNextItemValue();
String emailAddress = value.elementAt(0);
mu = new MailUser(no.getCommon(), no.getAbbreviated(),
emailAddress, mailServer, mailFile);
}
catch (NotesException e) {
throw new ModelException("Error looking up user name.", e); // $NLX-LookupProvider.Errorlookingupusername-1$
}
finally {
BackendUtil.safeRecycle(no);
BackendUtil.safeRecycle(lookupDir);
}
return mu;
}