use of lotus.domino.DbDirectory in project org.openntf.xsp.jakartaee by OpenNTF.
the class DefaultDominoDocumentCollectionManager method getQrpDatabase.
private Database getQrpDatabase(Session session, Database database) throws NotesException {
String server = database.getServer();
String filePath = database.getFilePath();
try {
// $NON-NLS-1$
String fileName = md5(server + filePath) + ".nsf";
Path tempDir = getTempDirectory();
Path dest = tempDir.resolve(getClass().getPackage().getName());
Files.createDirectories(dest);
Path dbPath = dest.resolve(fileName);
// $NON-NLS-1$
Database qrp = session.getDatabase("", dbPath.toString());
if (!qrp.isOpen()) {
qrp.recycle();
DbDirectory dbDir = session.getDbDirectory(null);
// TODO encrypt when the API allows
qrp = dbDir.createDatabase(dbPath.toString(), true);
ACL acl = qrp.getACL();
ACLEntry entry = acl.createACLEntry(session.getEffectiveUserName(), ACL.LEVEL_MANAGER);
entry.setCanDeleteDocuments(true);
acl.save();
}
return qrp;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
Aggregations