Search in sources :

Example 16 with View

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

the class DominoGraph method getVertexView.

private View getVertexView() {
    View result = getRawDatabase().getView(DominoGraph.VERTEX_VIEW_NAME);
    if (result == null) {
        result = getRawDatabase().createView(DominoGraph.VERTEX_VIEW_NAME, "SELECT " + DominoElement.TYPE_FIELD + "=\"" + DominoVertex.GRAPH_TYPE_VALUE + "\"", null, false);
        org.openntf.domino.ViewColumn column1 = result.createColumn();
        column1.setTitle("Created");
        column1.setFormula("@Created");
        column1.setSortDescending(true);
    }
    return result;
}
Also used : View(org.openntf.domino.View)

Example 17 with View

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

the class DominoGraph method getEdgeView.

private View getEdgeView() {
    View result = getRawDatabase().getView(DominoGraph.EDGE_VIEW_NAME);
    if (result == null) {
        result = getRawDatabase().createView(DominoGraph.EDGE_VIEW_NAME, "SELECT " + DominoElement.TYPE_FIELD + "=\"" + DominoEdge.GRAPH_TYPE_VALUE + "\"", null, false);
        org.openntf.domino.ViewColumn column1 = result.createColumn();
        column1.setTitle("Created");
        column1.setFormula("@Created");
        column1.setSortDescending(true);
    }
    return result;
}
Also used : View(org.openntf.domino.View)

Example 18 with View

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

the class Connect17Transaction method run.

@Override
public void run() {
    Session sess = Factory.getSession(SessionType.NATIVE);
    Database extLib = sess.getDatabase("odademo/oda_1.nsf");
    Database extLib2 = sess.getDatabase("odademo/oda_2.nsf");
    View states = extLib.getView("AllStates");
    Document stateDoc = states.getFirstDocument();
    DatabaseTransaction txn = extLib.startTransaction();
    extLib2.setTransaction(txn);
    boolean successOrFail = false;
    String state = stateDoc.getItemValueString("Key");
    System.out.println("Processing state " + state);
    // Update some documents
    queueTransaction(extLib, state);
    // Update some documents
    queueTransaction(extLib2, state);
    if (successOrFail) {
        txn.commit();
        System.out.println("...Committed");
    } else {
        txn.rollback();
        System.out.println("rolled back");
    }
}
Also used : Database(org.openntf.domino.Database) DatabaseTransaction(org.openntf.domino.transactions.DatabaseTransaction) Document(org.openntf.domino.Document) View(org.openntf.domino.View) Session(org.openntf.domino.Session)

Example 19 with View

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

the class Engage17DesignView method run.

@Override
public void run() {
    Session sess = Factory.getSession(SessionType.NATIVE);
    Database extLib = sess.getDatabase("oda_1.nsf");
    View contacts = extLib.getView("AllContactsProgrammatic");
    if (null != contacts) {
        contacts.remove();
    }
    DatabaseDesign dbDesign = extLib.getDesign();
    DesignView newView = dbDesign.createView();
    newView.setSelectionFormula("SELECT Form=\"Contact\"");
    newView.setName("AllContactsProgrammatic");
    DesignColumn col = newView.addColumn();
    col.setItemName("State");
    col.setSortOrder(SortOrder.ASCENDING);
    col.setTitle("STATE");
    col.setCategorized(true);
    DesignColumn name = newView.addColumn();
    name.setFormula("FirstName+\" \"+LastName");
    name.setSortOrder(SortOrder.ASCENDING);
    name.setTitle("NAME");
    DesignColumn name2 = newView.addColumn();
    name2.setFormula("LastName");
    name2.setSortOrder(SortOrder.ASCENDING);
    name2.setTitle("NAME");
    DesignColumn city = newView.addColumn();
    city.setItemName("City");
    city.setTitle("CITY");
    city.setResortOrder(ResortOrder.ASCENDING);
    city.setSecondarySortColumn(2);
    newView.save();
}
Also used : DesignColumn(org.openntf.domino.design.DesignColumn) DesignView(org.openntf.domino.design.DesignView) DatabaseDesign(org.openntf.domino.design.DatabaseDesign) Database(org.openntf.domino.Database) View(org.openntf.domino.View) DesignView(org.openntf.domino.design.DesignView) Session(org.openntf.domino.Session)

Example 20 with View

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

the class MassViewNavigatorTest method run.

@Test
public void run() {
    Session s = Factory.getSession(SessionType.CURRENT);
    Database source = s.getDatabase("", TARGET, true);
    View view = source.getView(VIEW);
    System.out.println("-- START --");
    long start = System.nanoTime();
    if (null != view) {
        view.setAutoUpdate(false);
        System.out.println(view.getEntryCount());
        ViewNavigator nav = view.createViewNav();
        nav.setCacheSize(400);
        System.out.println("CacheSize: " + nav.getCacheSize());
        view.setAutoUpdate(true);
        ViewEntry entry = null;
        entry = nav.getFirst();
        while (null != entry) {
            entry = nav.getNext(entry);
        }
    }
    long elapsed = System.nanoTime() - start;
    System.out.println("-- STOP --");
    System.out.println("Thread " + Thread.currentThread().getName() + " elapsed time: " + elapsed / 1000000 + "ms");
}
Also used : ViewNavigator(org.openntf.domino.ViewNavigator) ViewEntry(org.openntf.domino.ViewEntry) Database(org.openntf.domino.Database) View(org.openntf.domino.View) Session(org.openntf.domino.Session) Test(org.junit.Test)

Aggregations

View (org.openntf.domino.View)33 Session (org.openntf.domino.Session)20 Database (org.openntf.domino.Database)19 Document (org.openntf.domino.Document)9 ViewEntry (org.openntf.domino.ViewEntry)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 Date (java.util.Date)5 ViewNavigator (org.openntf.domino.ViewNavigator)5 HashMap (java.util.HashMap)4 ViewColumn (org.openntf.domino.ViewColumn)4 Map (java.util.Map)3 Vector (java.util.Vector)3 DocumentCollection (org.openntf.domino.DocumentCollection)3 ViewEntryCollection (org.openntf.domino.ViewEntryCollection)3 JsonJavaObject (com.ibm.commons.util.io.json.JsonJavaObject)2 JsonObject (com.ibm.commons.util.io.json.JsonObject)2 Edge (com.tinkerpop.blueprints.Edge)2 Vertex (com.tinkerpop.blueprints.Vertex)2 EdgeFrame (com.tinkerpop.frames.EdgeFrame)2