Search in sources :

Example 16 with NotesException

use of lotus.domino.NotesException in project org.openntf.domino by OpenNTF.

the class Database method createDocument.

/*
	 * (non-Javadoc)
	 *
	 * @see org.openntf.domino.Database#createDocument()
	 */
@Override
public Document createDocument() {
    // System.out.println("Generating a new document in " + this.getFilePath());
    // try {
    // Thread.sleep(100);
    // } catch (InterruptedException e1) {
    // DominoUtils.handleException(e1);
    // return null;
    // }
    Document result = null;
    boolean go;
    go = !hasListeners() ? true : fireListener(generateEvent(Events.BEFORE_CREATE_DOCUMENT, this, null));
    if (go) {
        try {
            open();
            result = fromLotus(getDelegate().createDocument(), Document.SCHEMA, this);
            ((org.openntf.domino.impl.Document) result).isNew_ = true;
        } catch (NotesException e) {
            DominoUtils.handleException(e, this);
        }
        if (hasListeners()) {
            fireListener(generateEvent(Events.AFTER_CREATE_DOCUMENT, this, null));
        }
    }
    // }
    return result;
}
Also used : OpenNTFNotesException(org.openntf.domino.exceptions.OpenNTFNotesException) NotesException(lotus.domino.NotesException) Document(org.openntf.domino.Document)

Example 17 with NotesException

use of lotus.domino.NotesException in project org.openntf.domino by OpenNTF.

the class Database method getModifiedDocuments.

/*
	 * (non-Javadoc)
	 *
	 * @see org.openntf.domino.Database#getModifiedDocuments(lotus.domino.DateTime, int)
	 */
@Override
public DocumentCollection getModifiedDocuments(final lotus.domino.DateTime since, final int noteClass) {
    try {
        DocumentCollection result;
        lotus.domino.DateTime dt = toLotus(since);
        result = fromLotus(getDelegate().getModifiedDocuments(dt, noteClass), DocumentCollection.SCHEMA, this);
        if (since instanceof Encapsulated) {
            dt.recycle();
        }
        return result;
    } catch (NotesException e) {
        DominoUtils.handleException(e, this);
        return null;
    }
}
Also used : Encapsulated(org.openntf.domino.types.Encapsulated) OpenNTFNotesException(org.openntf.domino.exceptions.OpenNTFNotesException) NotesException(lotus.domino.NotesException) DocumentCollection(org.openntf.domino.DocumentCollection)

Example 18 with NotesException

use of lotus.domino.NotesException in project org.openntf.domino by OpenNTF.

the class Database method getModifiedDocuments.

@Override
public DocumentCollection getModifiedDocuments(java.util.Date since, final ModifiedDocClass noteClass) {
    try {
        DocumentCollection result;
        if (since == null) {
            since = new Date(0);
        }
        lotus.domino.DateTime tempDT = getAncestorSession().createDateTime(since);
        lotus.domino.DateTime dt = toLotus(tempDT);
        if (!getDelegate().isOpen()) {
            getDelegate().open();
        }
        result = fromLotus(getDelegate().getModifiedDocuments(dt, noteClass.getValue()), DocumentCollection.SCHEMA, this);
        if (tempDT instanceof Encapsulated) {
            dt.recycle();
        }
        return result;
    } catch (NotesException e) {
        DominoUtils.handleException(e, this);
        return null;
    }
}
Also used : Encapsulated(org.openntf.domino.types.Encapsulated) OpenNTFNotesException(org.openntf.domino.exceptions.OpenNTFNotesException) NotesException(lotus.domino.NotesException) DocumentCollection(org.openntf.domino.DocumentCollection) Date(java.util.Date)

Example 19 with NotesException

use of lotus.domino.NotesException in project org.openntf.domino by OpenNTF.

the class Database method createMergeableDocumentCollection.

@Override
@Incomplete
public DocumentCollection createMergeableDocumentCollection() {
    try {
        lotus.domino.Database db = getDelegate();
        if (!db.isOpen()) {
            db.open();
        }
        // $NON-NLS-1$
        lotus.domino.DocumentCollection rawColl = getDelegate().search("@False", db.getLastModified(), 1);
        if (rawColl.getCount() > 0) {
            int[] nids = CollectionUtils.getNoteIDs(rawColl);
            for (int nid : nids) {
                rawColl.subtract(nid);
            }
        }
        org.openntf.domino.DocumentCollection result = fromLotus(rawColl, DocumentCollection.SCHEMA, this);
        return result;
    } catch (NotesException e) {
        DominoUtils.handleException(e, this);
        return null;
    }
}
Also used : OpenNTFNotesException(org.openntf.domino.exceptions.OpenNTFNotesException) NotesException(lotus.domino.NotesException) DocumentCollection(org.openntf.domino.DocumentCollection) Incomplete(org.openntf.domino.annotations.Incomplete)

Example 20 with NotesException

use of lotus.domino.NotesException in project org.openntf.domino by OpenNTF.

the class DbDirectory method createDatabase.

/*
	 * (non-Javadoc)
	 *
	 * @see org.openntf.domino.DbDirectory#createDatabase(java.lang.String, boolean)
	 */
@Override
public Database createDatabase(final String dbFile, final boolean open) {
    org.openntf.domino.Database result = null;
    try {
        if (getAncestorSession().isFixEnabled(Fixes.CREATE_DB)) {
            result = openDatabase(dbFile, false);
            if (result != null) {
                return result;
            }
        }
        lotus.domino.Database delDb = getDelegate().createDatabase(dbFile, open);
        result = fromLotus(delDb, Database.SCHEMA, getAncestorSession());
        return result;
    } catch (NotesException e) {
        // System.out.println("DEBUG: " + e.id + " - " + e.text);
        if (e.id == 4005 && getAncestorSession().isFixEnabled(Fixes.CREATE_DB)) {
            result = getAncestorSession().getDatabase(getName(), dbFile);
            return result;
        } else {
            DominoUtils.handleException(e);
            return null;
        }
    }
}
Also used : NotesException(lotus.domino.NotesException) Database(org.openntf.domino.Database)

Aggregations

NotesException (lotus.domino.NotesException)105 OpenNTFNotesException (org.openntf.domino.exceptions.OpenNTFNotesException)29 ArrayList (java.util.ArrayList)28 List (java.util.List)19 ViewNavigator (org.openntf.domino.ViewNavigator)13 Vector (java.util.Vector)11 Database (lotus.domino.Database)11 Database (org.openntf.domino.Database)10 IOException (java.io.IOException)8 ViewColumn (org.openntf.domino.ViewColumn)8 DocumentCollection (org.openntf.domino.DocumentCollection)7 EmbeddedObject (org.openntf.domino.EmbeddedObject)7 RichTextItem (org.openntf.domino.RichTextItem)7 Session (lotus.domino.Session)6 MIMEEntity (org.openntf.domino.MIMEEntity)5 Date (java.util.Date)4 Document (org.openntf.domino.Document)4 DocumentCollection (lotus.domino.DocumentCollection)3 DominoQuery (lotus.domino.DominoQuery)3 Item (org.openntf.domino.Item)3