use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class OpenntfDominoImplicitObjectFactory method createImplicitObjects.
/**
* Creates the "cheap" objects
*/
@Override
public void createImplicitObjects(final FacesContextEx ctx) {
if (!implicitsDone_) {
implicitsDone_ = true;
if (!ODAPlatform.isAPIEnabled(null))
return;
Session session = Factory.getSession(SessionType.CURRENT);
Database db = session.getCurrentDatabase();
Map<String, Object> ecMap = TypedUtil.getRequestMap(ctx.getExternalContext());
// $NON-NLS-1$
ecMap.put("openSession", session);
// $NON-NLS-1$
ecMap.put("openDatabase", db);
// Attach NSA
if (ODAPlatform.isAppFlagSet("nsa")) {
// $NON-NLS-1$
Application app = ctx.getApplication();
if (app instanceof ApplicationEx) {
NSA.INSTANCE.registerApplication((ApplicationEx) app);
NSA.INSTANCE.registerSession((ApplicationEx) app, (HttpSession) ctx.getExternalContext().getSession(true));
}
}
}
}
use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class AbstractXPageSessionFactory method wrapSession.
protected Session wrapSession(final lotus.domino.Session raw, final boolean selfCreated) {
Session sess = Factory.getWrapperFactory().fromLotus(raw, Session.SCHEMA, null);
sess.setNoRecycle(!selfCreated);
boolean allFix = true;
AutoMime autoMime = AutoMime.WRAP_32K;
boolean mimeFriendly = true;
boolean viewExactMatch = false;
if (NotesContext.getCurrentUnchecked() != null) {
allFix = ODAPlatform.isAppAllFix(null);
autoMime = ODAPlatform.getAppAutoMime(null);
mimeFriendly = ODAPlatform.isAppMimeFriendly(null);
viewExactMatch = ODAPlatform.isAppViewExactMatch(null);
}
if (allFix) {
for (Fixes fix : Fixes.values()) {
if (fix.isKhan()) {
sess.setFixEnable(fix, true);
}
}
}
sess.setAutoMime(autoMime);
sess.setViewExactMatch(viewExactMatch);
if (mimeFriendly) {
sess.setConvertMIME(false);
}
if (selfCreated && currentApiPath_ != null) {
Database db = sess.getCurrentDatabase();
if (db == null) {
db = sess.getDatabase(currentApiPath_);
setCurrentDatabase(sess, db);
}
}
return sess;
}
use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class DasCurrentSessionFactory method createSession.
/**
* returns the current Das-Session
*
* @throws
*/
@Override
public Session createSession() {
if (request_ == null || request_.getUserPrincipal() == null) {
lotus.domino.Session rawSession = ContextInfo.getUserSession();
if (rawSession == null) {
NativeSessionFactory nsf = new NativeSessionFactory(null);
Session result = nsf.createSession();
Factory.setCurrentToSession(result);
return result;
}
try {
lotus.domino.Database rawDb = rawSession.getCurrentDatabase();
if (rawDb != null) {
if (StringUtil.isEmpty(rawDb.getServer())) {
currentApiPath_ = rawDb.getFilePath();
} else {
// $NON-NLS-1$
currentApiPath_ = rawDb.getServer() + "!!" + rawDb.getFilePath();
}
}
} catch (NotesException e) {
DominoUtils.handleException(e);
}
return wrapSession(rawSession, false);
} else {
String name = request_.getUserPrincipal().getName();
Session session = createSession(name);
Factory.setCurrentToSession(session);
return session;
}
}
use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class LocalNoteList method getDatabase.
protected Database getDatabase() {
if (db_ == null) {
String replid = getReplidFromLong(replid_);
Session session = Factory.getSession(SessionType.CURRENT);
DbDirectory dir = session.getDbDirectory(serverName_);
db_ = dir.openDatabaseByReplicaID(replid);
}
return db_;
}
use of org.openntf.domino.Session in project org.openntf.domino by OpenNTF.
the class NoteCoordinate method getDatabase.
protected Database getDatabase(final String server) {
String replid = getReplidFromLong(db);
Session session = Factory.getSession(SessionType.CURRENT);
DbDirectory dir = session.getDbDirectory(server);
return dir.openDatabaseByReplicaID(replid);
}
Aggregations