Search in sources :

Example 11 with Database

use of org.openntf.domino.Database in project org.openntf.domino by OpenNTF.

the class RichTextDoclink method getView.

/* (non-Javadoc)
	 * @see org.openntf.domino.ext.RichTextDoclink#getView()
	 */
@Override
public View getView() {
    String viewId = getViewUnID();
    if (viewId != null && !viewId.isEmpty()) {
        // Use session.resolve to not run afoul of same-named views
        Database database = getDatabase();
        Session session = getAncestorSession();
        String databaseUrl = database.getURL();
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        String url = databaseUrl.substring(0, databaseUrl.length() - "?OpenDatabase".length()) + "/" + viewId + "?OpenView";
        return (View) session.resolve(url);
    }
    return null;
}
Also used : Database(org.openntf.domino.Database) View(org.openntf.domino.View) Session(org.openntf.domino.Session)

Example 12 with Database

use of org.openntf.domino.Database in project org.openntf.domino by OpenNTF.

the class BigNoteCollection method getAddress.

public static String getAddress(final Document doc) {
    final Database db = doc.getAncestorDatabase();
    String result = getAddress(db);
    result += doc.getNoteID();
    return result;
}
Also used : Database(org.openntf.domino.Database)

Example 13 with Database

use of org.openntf.domino.Database in project org.openntf.domino by OpenNTF.

the class BigNoteCollection method getDocument.

public static Document getDocument(final Session session, final String server, final String replid, final String noteid) {
    final Database db = session.getDatabase("", "");
    db.openByReplicaID(server, replid);
    if (db.isOpen()) {
        final Document result = db.getDocumentByID(noteid);
        return result;
    } else {
        // TODO handle exception properly
        return null;
    }
}
Also used : Database(org.openntf.domino.Database) Document(org.openntf.domino.Document)

Example 14 with Database

use of org.openntf.domino.Database in project org.openntf.domino by OpenNTF.

the class DbCache method getDatabase.

public Database getDatabase(final long dbid, final String server, final Session session) {
    Database result = dbMap_.get(dbid);
    if (result == null) {
        String replid = getReplidFromLong(dbid);
        DbDirectory dir = session.getDbDirectory(server);
        result = dir.openDatabaseByReplicaID(replid);
        dbMap_.put(dbid, result);
    }
    return result;
}
Also used : DbDirectory(org.openntf.domino.DbDirectory) Database(org.openntf.domino.Database)

Example 15 with Database

use of org.openntf.domino.Database in project org.openntf.domino by OpenNTF.

the class DbCache method getDocument.

public Document getDocument(final NoteCoordinate nc) {
    Document result = null;
    long id = nc.getDbid();
    Database db = getDatabase(id);
    if (db == null) {
        System.out.println("DEBUG: Unable to find database with id " + id + " (" + org.openntf.domino.big.NoteCoordinate.Utils.getReplidFromLong(id) + ")");
    }
    result = db.getDocumentByUNID(nc.getUNID(), true);
    return result;
}
Also used : Database(org.openntf.domino.Database) Document(org.openntf.domino.Document)

Aggregations

Database (org.openntf.domino.Database)131 Session (org.openntf.domino.Session)73 Document (org.openntf.domino.Document)49 Test (org.junit.Test)19 View (org.openntf.domino.View)19 DbDirectory (org.openntf.domino.DbDirectory)17 NotesException (lotus.domino.NotesException)12 ArrayList (java.util.ArrayList)11 NoteCollection (org.openntf.domino.NoteCollection)11 OpenNTFNotesException (org.openntf.domino.exceptions.OpenNTFNotesException)10 DocumentCollection (org.openntf.domino.DocumentCollection)8 NoteCoordinate (org.openntf.domino.big.NoteCoordinate)8 Date (java.util.Date)6 UserAccessException (org.openntf.domino.exceptions.UserAccessException)6 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 ViewEntry (org.openntf.domino.ViewEntry)5 FastTable (javolution.util.FastTable)4 Item (org.openntf.domino.Item)4 RichTextItem (org.openntf.domino.RichTextItem)4