use of lotus.domino.Session in project openliberty-domino by OpenNTF.
the class IdentityServlet method isValidGroup.
public String isValidGroup(String groupSecurityName) throws NotesException {
Session session = NotesFactory.createSession();
try {
// $NON-NLS-1$ //$NON-NLS-2$
Database names = session.getDatabase("", "names.nsf");
Document tempDoc = names.createDocument();
// $NON-NLS-1$
tempDoc.replaceItemValue("GroupName", groupSecurityName);
// $NON-NLS-1$
List<?> result = session.evaluate(" @Trim(@NameLookup([NoCache]:[Exhaustive]; GroupName; 'ListName')) ", tempDoc);
return String.valueOf(!result.isEmpty());
} finally {
session.recycle();
}
}
use of lotus.domino.Session in project openliberty-domino by OpenNTF.
the class IdentityServlet method getUserSecurityName.
private String getUserSecurityName(String uniqueUserId) throws NotesException {
Session session = NotesFactory.createSession();
try {
// $NON-NLS-1$ //$NON-NLS-2$
Database names = session.getDatabase("", "names.nsf");
Document tempDoc = names.createDocument();
// $NON-NLS-1$
tempDoc.replaceItemValue("Username", uniqueUserId);
// $NON-NLS-1$
List<?> result = session.evaluate(" @Trim(@NameLookup([NoCache]:[Exhaustive]; Username; 'FullName')) ", tempDoc);
if (!result.isEmpty()) {
return (String) result.get(0);
} else {
// $NON-NLS-1$
return "";
}
} finally {
session.recycle();
}
}
use of lotus.domino.Session in project openliberty-domino by OpenNTF.
the class IdentityServlet method getUniqueUserId.
private String getUniqueUserId(String userSecurityName) throws NotesException {
Session session = NotesFactory.createSession();
try {
// $NON-NLS-1$ //$NON-NLS-2$
Database names = session.getDatabase("", "names.nsf");
Document tempDoc = names.createDocument();
// $NON-NLS-1$
tempDoc.replaceItemValue("Username", userSecurityName);
// $NON-NLS-1$
List<?> result = session.evaluate(" @Trim(@NameLookup([NoCache]:[Exhaustive]; Username; 'ShortName')) ", tempDoc);
if (!result.isEmpty()) {
return (String) result.get(0);
} else {
// $NON-NLS-1$
return "";
}
} finally {
session.recycle();
}
}
use of lotus.domino.Session in project openliberty-domino by OpenNTF.
the class IdentityServlet method getUsersForGroup.
@SuppressWarnings("unchecked")
public String getUsersForGroup(String groupSecurityName, int limit) throws NotesException {
Session session = NotesFactory.createSession();
try {
// TODO Look up and expand group
// TODO work with multiple group-allowed directories
// $NON-NLS-1$ //$NON-NLS-2$
Database names = session.getDatabase("", "names.nsf");
Document tempDoc = names.createDocument();
// $NON-NLS-1$
tempDoc.replaceItemValue("GroupName", groupSecurityName);
// $NON-NLS-1$
List<String> members = session.evaluate(" @Text(@Trim(@Unique(@Sort(@DbLookup(''; '':'names.nsf'; '$VIMGroups'; GroupName; 'Members'))))) ", tempDoc);
// $NON-NLS-1$
return String.join("\n", members);
} finally {
session.recycle();
}
}
use of lotus.domino.Session in project org.openntf.domino by OpenNTF.
the class LegacyCollectionTest method run.
@Override
public void run() {
try {
System.out.println("Starting NotesRunner");
Session session = NotesFactory.createSession();
Long sessId = getLotusId(session);
sessionid.set(sessId);
Database db = session.getDatabase("", "names.nsf");
System.out.println("Db id:" + getLotusId(db));
int i = 0;
try {
lotus.domino.DocumentCollection allDocs = db.getAllDocuments();
System.out.println("All Collection has " + allDocs.getCount() + " documents");
int[] nids = new int[allDocs.getCount()];
lotus.domino.Document doc = allDocs.getFirstDocument();
lotus.domino.Document nextDoc = null;
while (doc != null) {
nextDoc = allDocs.getNextDocument(doc);
nids[i++] = Integer.valueOf(doc.getNoteID(), 16);
doc.recycle();
doc = nextDoc;
}
System.out.println("noteid array has " + nids.length + " entries");
allDocs.recycle();
// lotus.domino.DocumentCollection newColl = db.getModifiedDocuments(session.createDateTime(new java.util.Date()));
lotus.domino.DocumentCollection newColl = db.getAllUnreadDocuments();
System.out.println("New Coll has " + newColl.getCount() + " documents");
// lotus.domino.DocumentCollection emptyColl = db.createDocumentCollection();
newColl.intersect(nids[0]);
System.out.println("New Coll has " + newColl.getCount() + " documents");
for (int nid : nids) {
newColl.merge(nid);
}
System.out.println("Merged Collection has " + newColl.getCount() + " documents");
newColl.recycle();
} catch (Throwable t) {
t.printStackTrace();
System.out.println("Exception at loop point " + i);
}
session.recycle();
} catch (Throwable t) {
t.printStackTrace();
}
System.out.println("FINI!");
}
Aggregations