use of org.openntf.domino.View in project org.openntf.domino by OpenNTF.
the class Database method getView.
@Override
public View getView(final Document viewDocument) {
View result = null;
if (viewDocument.hasItem("$Index") || viewDocument.hasItem("$Collection") || viewDocument.hasItem("$Collation") || viewDocument.hasItem("$VIEWFORMAT")) {
String unid = viewDocument.getUniversalID();
String rawtitles = viewDocument.getItemValue("$Title", String.class);
String[] titles = PIPE_SPLIT.split(rawtitles);
for (String title : titles) {
View chk = getView(title);
if (chk.getUniversalID().equalsIgnoreCase(unid)) {
result = chk;
break;
}
}
if (result == null) {
System.out.println("TEMP DEBUG Unable to find view object from document " + unid);
}
} else {
Throwable t = new Throwable();
StackTraceElement[] ste = t.getStackTrace();
StackTraceElement elem = ste[0];
String calledFrom1 = elem.getClassName() + "." + elem.getMethodName() + "(" + elem.getFileName() + ":" + elem.getLineNumber() + ")";
elem = ste[1];
String calledFrom2 = elem.getClassName() + "." + elem.getMethodName() + "(" + elem.getFileName() + ":" + elem.getLineNumber() + ")";
elem = ste[2];
String calledFrom3 = elem.getClassName() + "." + elem.getMethodName() + "(" + elem.getFileName() + ":" + elem.getLineNumber() + ")";
System.err.println("TEMP DEBUG View Document " + viewDocument.getMetaversalID() + " does not have a $Index item! " + viewDocument.getItemValueString("$Title") + " called from " + calledFrom1 + ", " + calledFrom2 + ", " + // $NON-NLS-1$
calledFrom3);
}
return result;
}
use of org.openntf.domino.View in project org.openntf.domino by OpenNTF.
the class DocumentSyncHelper method process.
/**
* Process a specific DocumentCollection.
*
* WARNING: Does not currently check that all properties of the SyncHelper have been set up
*
* @param coll
* DocumentCollection of source documents
* @since org.openntf.domino 1.0.0
*/
public void process(final DocumentCollection coll) {
// TODO Check to make sure properties are all set up before running
Session session = coll.getAncestorSession();
Database targetDb = session.getDatabase(getTargetServer(), getTargetFilepath());
View targetView = targetDb.getView(getTargetLookupView());
Strategy strategy = getStrategy();
DatabaseTransaction txn = null;
if (getTransactionRule() == TransactionRule.COMMIT_AT_END) {
txn = targetDb.startTransaction();
}
for (Document source : coll) {
txn = processDocument(targetDb, targetView, strategy, txn, source);
}
if (getTransactionRule() == TransactionRule.COMMIT_AT_END && txn != null) {
txn.commit();
txn = null;
}
}
use of org.openntf.domino.View 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;
}
use of org.openntf.domino.View in project org.openntf.domino by OpenNTF.
the class IndexDatabase method initIndexDb.
protected View initIndexDb() {
View indexView = getIndexDb().getView(TERM_VIEW_NAME);
if (indexView == null) {
indexView = getIndexDb().createView(TERM_VIEW_NAME, "Form=\"" + TERM_FORM_NAME + "\"");
for (ViewColumn column : indexView.getColumns()) {
column.setFormula(TERM_KEY_NAME);
column.setTitle("Term");
column.setSorted(true);
column.setSortDescending(false);
}
}
View dbView = getIndexDb().getView(DB_VIEW_NAME);
if (dbView == null) {
dbView = getIndexDb().createView(DB_VIEW_NAME, "Form=\"" + DB_FORM_NAME + "\"");
for (ViewColumn column : dbView.getColumns()) {
column.setFormula(DB_KEY_NAME);
column.setTitle("ID");
column.setSorted(true);
column.setSortDescending(false);
}
ViewColumn titleColumn = dbView.createColumn();
titleColumn.setFormula(DB_TITLE_NAME);
titleColumn.setTitle("TITLE");
}
return indexView;
}
use of org.openntf.domino.View in project org.openntf.domino by OpenNTF.
the class IndexDatabase method getDbView.
/* (non-Javadoc)
* @see org.openntf.domino.big.impl.IIndexDatabase#getDbView()
*/
@Override
public View getDbView() {
View result = null;
result = getIndexDb().getView(DB_VIEW_NAME);
if (result == null) {
initIndexDb();
result = getIndexDb().getView(DB_VIEW_NAME);
}
return result;
// if (termView_ == null) {
// initIndexDb();
// termView_ = getIndexDb().getView(DB_VIEW_NAME);
// }
// return termView_;
}
Aggregations