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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
}
Aggregations