本文整理汇总了Java中lotus.domino.Name.getAbbreviated方法的典型用法代码示例。如果您正苦于以下问题:Java Name.getAbbreviated方法的具体用法?Java Name.getAbbreviated怎么用?Java Name.getAbbreviated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Name
的用法示例。
在下文中一共展示了Name.getAbbreviated方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
}
}
}
示例2: _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;
}
示例3: 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;
}
示例4: getPeopleData
import lotus.domino.Name; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") // $NON-NLS-1$
private PeopleData getPeopleData(PersonImpl person) {
String id = person.getId();
if(StringUtil.isEmpty(id)) {
return EMPTY_DATA;
}
PeopleData data = (PeopleData)getProperties(id,PeopleData.class);
if(data==null) {
synchronized(getSyncObject()) {
data = (PeopleData)getProperties(id,PeopleData.class);
if(data==null) {
try {
data = new PeopleData();
Session session = ExtLibUtil.getCurrentSession(FacesContext.getCurrentInstance());
// TODO get a Notes/Domino id from an identity provider...
Name n = session.createName(id);
data.displayName = getCommonName(session, id, n); //n.getCommon();
data.abbreviatedName = n.getAbbreviated();
data.canonicalName = n.getCanonical();
data.effectiveUserName = session.getEffectiveUserName();
addProperties(id,data);
} catch(NotesException ex) {
throw new FacesExceptionEx(ex,"Error while retrieving user names"); // $NLX-DominoUserBeanDataProvider.Errorwhileretrievingusernames-1$
}
}
}
}
return data;
}
示例5: getOnlineUsers
import lotus.domino.Name; //导入方法依赖的package包/类
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;
}
示例6: renderUser
import lotus.domino.Name; //导入方法依赖的package包/类
@Override
public Response renderUser() throws NotesException {
Session s = (Session) guicer.createObject(Session.class);
Name nm =s.createName(s.getEffectiveUserName());
String user =nm.getAbbreviated();
return this.prompt("INFO", user);
}
示例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;
}
示例9: findServer
import lotus.domino.Name; //导入方法依赖的package包/类
public Server findServer(Session session, String serverName) throws ModelException {
Server server = null;
Directory lookupDir = null;
Name no = null;
try {
lookupDir = session.getDirectory();
if ( lookupDir == null ) {
throw new ModelException("Cannot lookup the server."); // $NLX-LookupProvider.Cannotlookuptheserver-1$
}
Vector<String> vName = new Vector<String>();
vName.addElement(serverName);
DirectoryNavigator dirNav = lookupDir.lookupNames("($Servers)", vName, s_serverLookupItems, true); //$NON-NLS-1$
if( dirNav == null || dirNav.getCurrentMatches() == 0 ){
throw new ModelException("Server not found.", ModelException.ERR_NOT_FOUND); // $NLX-LookupProvider.Servernotfound-1$
}
// Digest the results of the server lookup
String hostName = null;
Vector<String> value = null;
value = dirNav.getFirstItemValue();
String fullName = value.elementAt(0);
no = session.createName(fullName);
Vector<String> ports = dirNav.getNextItemValue();
value = dirNav.getNextItemValue();
for ( int i = 0; i < ports.size(); i++) {
if ( "TCPIP".equals(ports.elementAt(i)) ) { //$NON-NLS-1$
hostName = value.elementAt(i);
break;
}
}
value = dirNav.getNextItemValue();
String clusterName = value.elementAt(0);
value = dirNav.getNextItemValue();
boolean imsaServer = false;
if ( value != null && value.size() > 0 ) {
String strImsaServer = value.elementAt(0);
if ( "1".equals(strImsaServer) ) {
imsaServer = true;
}
}
server = new Server(no.getAbbreviated(), hostName, clusterName, imsaServer);
}
catch (NotesException e) {
throw new ModelException("Error looking up server.", e); // $NLX-LookupProvider.Errorlookingupserver-1$
}
finally {
BackendUtil.safeRecycle(no);
BackendUtil.safeRecycle(lookupDir);
}
return server;
}
示例10: getDocumentEntryRepresentation
import lotus.domino.Name; //导入方法依赖的package包/类
public NameEntry getDocumentEntryRepresentation(Document docSearch) {
try {
String strDbPath = docSearch.getParentDatabase().getServer() + "!!" + docSearch.getParentDatabase().getFilePath();
DominoDocument dDoc = DominoDocument.wrap(strDbPath, docSearch, "", "", false, "", "");
Object[] objExec = { dDoc };
String strLine = computeValueMB(m_BuildLine, objExec);
if (strLine == null) {
strLine = getField(docSearch, "InternetAddress");
}
String strValue = computeValueMB(m_BuildValue, objExec);
if (strValue == null) {
strValue = getField(docSearch, "FullName");
Name non = docSearch.getParentDatabase().getParent().createName(strValue);
strValue = non.getAbbreviated();
non.recycle();
}
String strLabel = computeValueMB(m_BuildLabel, objExec);
if (strLabel == null) {
strLabel = getField(docSearch, "InternetAddress");
}
if (StringUtil.isEmpty(strValue)) {
return null;
}
if (StringUtil.isEmpty(strLine)) {
if (StringUtil.isEmpty(strLabel)) {
strLine = strValue;
strLabel = strValue;
} else {
strLine = strLabel;
}
}
return new NameEntry(strValue, strLabel, strLine);
} catch (Exception ex) {
LoggerFactory.logError(getClass(), "General Error", ex);
}
return null;
}