本文整理汇总了Java中lotus.domino.Session.getEffectiveUserName方法的典型用法代码示例。如果您正苦于以下问题:Java Session.getEffectiveUserName方法的具体用法?Java Session.getEffectiveUserName怎么用?Java Session.getEffectiveUserName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Session
的用法示例。
在下文中一共展示了Session.getEffectiveUserName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEffectiveUserName
import lotus.domino.Session; //导入方法依赖的package包/类
/**
* Method required to read username in constructor
*
* @param session session
* @return effective username
*/
private static String getEffectiveUserName(Session session) {
try {
return session.getEffectiveUserName();
} catch (NotesException e) {
throw new NotesError(e.id, e.getLocalizedMessage());
}
}
示例2: registerCurrentUser
import lotus.domino.Session; //导入方法依赖的package包/类
/**
* Register current user.
*
* @param req the req
* @throws NotesException the notes exception
*/
public void registerCurrentUser(HttpServletRequest req) throws NotesException{
try{
Session session = XSPUtils.session();
String userName = session.getEffectiveUserName();
String sessionId = req.getSession().getId();
//don't allow it...
if(!Config.getInstance().isAllowAnonymous() && StringCache.ANONYMOUS.equals(userName)){
return;
}
//create the user and add to the server's in memory map
IUser user = userFactory.createUser(sessionId, userName, Const.STATUS_ONLINE);
server.addUser(user);
//update the status of the doc
ApplyStatus status = new ApplyStatus(user);
TaskRunner.getInstance().add(status);
}catch(Exception e){
LOG.log(Level.SEVERE, null, e);
}
}
示例3: NotesDatabase
import lotus.domino.Session; //导入方法依赖的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");
}
}