本文整理汇总了Java中lotus.domino.Session类的典型用法代码示例。如果您正苦于以下问题:Java Session类的具体用法?Java Session怎么用?Java Session使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Session类属于lotus.domino包,在下文中一共展示了Session类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSampleDataViewsDb
import lotus.domino.Session; //导入依赖的package包/类
public synchronized NotesDatabase getSampleDataViewsDb() throws NotesException {
Session session = getSession();
NotesDatabase db;
try {
db = new NotesDatabase(session, "", DBPATH_SAMPLEDATA_VIEWS_NSF);
return db;
}
catch (NotesError e) {
if (e.getId() != 259) { // file does not exist
throw e;
}
}
System.out.println("Looks like our sample database "+DBPATH_SAMPLEDATA_VIEWS_NSF+" to test private views does not exist. We will now (re)create it.");
Database dbSampleDataLegacy = session.getDatabase("", DBPATH_SAMPLEDATA_NSF, true);
Database dbSampleDataViewsLegacy = dbSampleDataLegacy.createFromTemplate("", DBPATH_SAMPLEDATA_VIEWS_NSF, true);
createSampleDbDirProfile(dbSampleDataViewsLegacy);
dbSampleDataLegacy.recycle();
dbSampleDataViewsLegacy.recycle();
db = new NotesDatabase(session, "", DBPATH_SAMPLEDATA_VIEWS_NSF);
db.setTitle("Domino JNA testcase views");
return db;
}
示例2: openSessionCloner
import lotus.domino.Session; //导入依赖的package包/类
public static Session openSessionCloner(){
Session session = null;
try{
SessionCloner sessionCloner=SessionCloner.getSessionCloner();
NSFComponentModule module= NotesContext.getCurrent().getModule();
NotesContext context = new NotesContext( module );
NotesContext.initThread( context );
session = sessionCloner.getSession();
}catch(NotesException n){
logger.log(Level.SEVERE,null,n);
}
return session;
}
示例3: testDbSearch_dbByReplicaId
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testDbSearch_dbByReplicaId() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
NotesDatabase dbData = getFakeNamesDb();
String replicaId = dbData.getReplicaID();
String server = "";
String dbPathForReplicaId = NotesDatabase.findDatabaseByReplicaId(server, replicaId);
Assert.assertTrue("Database could be found by replica id in base dir", dbData.getRelativeFilePath().equalsIgnoreCase(dbPathForReplicaId));
String otherReplicaId = "AAAABBBBCCCCDDDD";
String dbPathForFakeReplicaId = NotesDatabase.findDatabaseByReplicaId(server, otherReplicaId);
Assert.assertEquals("Database could be found by replica id in base dir", null, dbPathForFakeReplicaId);
return null;
}
});
}
示例4: toDateTimeVec
import lotus.domino.Session; //导入依赖的package包/类
public Vector toDateTimeVec(Session session, List list) throws NotesException{
Vector vec = new Vector (list.size());
for(Object o: list){
Date dt = (Date) o;
DateTime dateTime = session.createDateTime(dt);
vec.add(dateTime);
}
return vec;
}
示例5: testNamesListCreation_listComparisonWithLegacy
import lotus.domino.Session; //导入依赖的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;
}
});
}
示例6: testStringUtils_unidFormattingAndParsing
import lotus.domino.Session; //导入依赖的package包/类
/**
* Tests whether the parsing of a hex encoded UNID to two {@link NotesUniversalNoteId} and
* the formatting back to a string roundtrip.
*/
@Test
public void testStringUtils_unidFormattingAndParsing() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
String origUnid = "DF8ADEA0A485F3E34825718E00585666";
NotesUniversalNoteIdStruct unidObj = NotesUniversalNoteIdStruct.fromString(origUnid);
String formattedUnid = unidObj.toString();
Assert.assertEquals("Parsing and formatting UNID returns the same result", origUnid, formattedUnid);
return null;
}
});
}
示例7: testViewMetaData_defaultCollection
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testViewMetaData_defaultCollection() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
NotesDatabase dbData = getFakeNamesDb();
NotesCollection defaultConn = dbData.openDefaultCollection();
System.out.println("Default collection name: " +defaultConn.getName());
return null;
}
});
}
示例8: testViewMetaData_nameAndAlias
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testViewMetaData_nameAndAlias() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
NotesDatabase dbData = getFakeNamesDb();
Database dbDataLegacy = getFakeNamesDbLegacy();
//CompaniesHierarchical
NotesCollection colFromDbData = dbData.openCollectionByName("AnotherAlias");
View viewCompanies = dbDataLegacy.getView("AnotherAlias");
Assert.assertEquals("Name correct", viewCompanies.getName(), colFromDbData.getName());
Assert.assertEquals("Aliases correct", viewCompanies.getAliases(), colFromDbData.getAliases());
Assert.assertEquals("Selection formula correct", viewCompanies.getSelectionFormula(), colFromDbData.getSelectionFormula());
return null;
}
});
}
示例9: testViewMetaData_columnTitleLookup
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testViewMetaData_columnTitleLookup() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
NotesDatabase dbData = getFakeNamesDb();
Database dbDataLegacy = getFakeNamesDbLegacy();
NotesCollection colFromDbData = dbData.openCollectionByName("People");
colFromDbData.update();
View viewPeople = dbDataLegacy.getView("People");
int topLevelEntriesLegacy = viewPeople.getTopLevelEntryCount();
int topLevelEntries = colFromDbData.getTopLevelEntries();
System.out.println("Top level entries: "+topLevelEntries);
Assert.assertEquals("Top level entries of JNA call is equal to legacy call", topLevelEntriesLegacy, topLevelEntries);
return null;
}
});
}
示例10: testViewTraversal_columnTitleLookup
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testViewTraversal_columnTitleLookup() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
NotesDatabase dbData = getFakeNamesDb();
NotesCollection colFromDbData = dbData.openCollectionByName("People");
colFromDbData.update();
List<NotesViewEntryData> entries = colFromDbData.getAllEntries("0", 1, EnumSet.of(Navigate.NEXT_NONCATEGORY), 10, EnumSet.of(ReadMask.NOTEID, ReadMask.SUMMARY), new EntriesAsListCallback(10));
Assert.assertTrue("Row data could be read", entries.size() > 0);
NotesViewEntryData firstEntry = entries.get(0);
//try to read a value by column title; the programmatic name for this column is different ($17)
String name = firstEntry.getAsString("name", null);
Assert.assertTrue("Name value can be read", name!=null);
return null;
}
});
}
示例11: testBrokenAllDayAnyDayCheck
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testBrokenAllDayAnyDayCheck() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
//Thu Aug 10 00:00:00 GMT:
int[] testInnards = new int[] {0, -1054506632};
NotesTimeDate timeDate = new NotesTimeDate(testInnards);
Calendar cal = NotesDateTimeUtils.innardsToCalendar(false, 0, testInnards);
int hour = cal.get(Calendar.HOUR_OF_DAY);
int minute = cal.get(Calendar.MINUTE);
int second = cal.get(Calendar.SECOND);
int millis = cal.get(Calendar.MILLISECOND);
Assert.assertEquals("Hour is 0", 0, hour);
Assert.assertEquals("Minute is 0", 0, minute);
Assert.assertEquals("Second is 0", 0, second);
Assert.assertEquals("Millisecond is 0", 0, millis);
return null;
}
});
}
示例12: testDbGetAccess
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testDbGetAccess() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
NotesDatabase dbData = getFakeNamesDb();
Database dbLegacy = getFakeNamesDbLegacy();
AccessInfoAndFlags accessInfo = dbData.getAccessInfoAndFlags();
AclLevel aclLevel = accessInfo.getAclLevel();
EnumSet<AclFlag> aclFlags = accessInfo.getAclFlags();
int legacyAclLevel = dbLegacy.queryAccess(session.getEffectiveUserName());
Assert.assertEquals("ACL level is the same", aclLevel.getValue(), legacyAclLevel);
System.out.println("Access level: "+accessInfo.getAclLevel());
System.out.println("Access flags: "+accessInfo.getAclFlags());
return null;
}
});
}
示例13: testDbGetACL
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testDbGetACL() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
NotesDatabase dbData = getFakeNamesDb();
Database dbLegacy = getFakeNamesDbLegacy();
AccessInfoAndFlags accessInfo = dbData.getAccessInfoAndFlags();
System.out.println("Access level: "+accessInfo.getAclLevel());
System.out.println("Access flags: "+accessInfo.getAclFlags());
NotesACL acl = dbData.getACL();
NotesACLAccess aclAccess = acl.lookupAccess(IDUtils.getCurrentUsername());
Assert.assertEquals("ACL level is equal", accessInfo.getAclLevel(), aclAccess.getAclLevel());
Assert.assertEquals("ACL flags are equal", accessInfo.getAclFlags(), aclAccess.getAclFlags());
Assert.assertEquals("ACL roles are equal", dbLegacy.queryAccessRoles(session.getEffectiveUserName()),
aclAccess.getRoles());
return null;
}
});
}
示例14: testNoteAccess_createNote
import lotus.domino.Session; //导入依赖的package包/类
public void testNoteAccess_createNote() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
System.out.println("Starting create note test");
NotesDatabase dbData = getFakeNamesDb();
NotesNote note = dbData.createNote();
note.setItemValueDateTime("Calendar", Calendar.getInstance());
note.setItemValueDateTime("JavaDate_Dateonly", new Date(), true, false);
note.setItemValueDateTime("JavaDate_Timeonly", new Date(), false, true);
note.setItemValueDateTime("JavaDate_DateTime", new Date(), true, true);
note.setItemValueDouble("Double", 1.5);
note.setItemValueString("String", "ABC", true);
System.out.println("Done with create note test");
return null;
}
});
}
示例15: testSignDb
import lotus.domino.Session; //导入依赖的package包/类
@Test
public void testSignDb() {
runWithSession(new IDominoCallable<Object>() {
@Override
public Object call(Session session) throws Exception {
NotesDatabase db = getFakeNamesDb();
NotesNote note = db.createNote();
String signerBefore = note.getSigner();
Assert.assertEquals("Note is not signed", "", signerBefore);
String userName = session.getUserName();
note.sign();
String signerAfter = note.getSigner();
Assert.assertTrue("Note has been signed", NotesNamingUtils.equalNames(signerAfter, userName));
return null;
}
});
}