Search in sources :

Example 1 with ViewEntry

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

the class ViewEntryCollection method getNextEntry.

/*
	 * (non-Javadoc)
	 *
	 * @see org.openntf.domino.ViewEntryCollection#getNextEntry(lotus.domino.ViewEntry)
	 */
@Override
public ViewEntry getNextEntry(final lotus.domino.ViewEntry entry) {
    try {
        ViewEntry result = fromLotus(getDelegate().getNextEntry(toLotus(entry)), ViewEntry.SCHEMA, parent);
        entry.recycle();
        return result;
    } catch (NotesException e) {
        DominoUtils.handleException(e);
        return null;
    }
}
Also used : NotesException(lotus.domino.NotesException) ViewEntry(org.openntf.domino.ViewEntry)

Example 2 with ViewEntry

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

the class ViewNavigator method getNthDocument.

@Override
public ViewEntry getNthDocument(final int nth) {
    // System.out.println("TEMP DEBUG getting document " + nth + " from a navigator with " + getCount() + " entries");
    if (nth > getCount()) {
        return null;
    }
    ViewEntry next = getFirstDocument();
    int i = 1;
    while (i < nth) {
        next = getNextDocument();
        if (next == null) {
            return null;
        }
        i++;
    }
    return next;
}
Also used : ViewEntry(org.openntf.domino.ViewEntry)

Example 3 with ViewEntry

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

the class ViewEntryIterator method next.

/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Iterator#next()
	 */
@Override
@SuppressWarnings("deprecation")
public ViewEntry next() {
    ViewEntry result = null;
    ViewEntry currentEntry = getCurrentEntry();
    try {
        result = ((currentEntry == null) ? collection_.getFirstEntry() : collection_.getNextEntry(currentEntry));
        currentIndex_++;
    } catch (Throwable t) {
        DominoUtils.handleException(t);
    } finally {
        setCurrentEntry(result);
    }
    return result;
}
Also used : ViewEntry(org.openntf.domino.ViewEntry)

Example 4 with ViewEntry

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

the class IndexDatabase method getTermStarts.

/* (non-Javadoc)
	 * @see org.openntf.domino.big.impl.IIndexDatabase#getTermStarts(java.lang.String, int)
	 */
@Override
public List<String> getTermStarts(final String startsWith, final int count) {
    List<String> result = new ArrayList<String>();
    ViewEntry startEntry = getTermView().getFirstEntryByKey(startsWith, false);
    if (startEntry == null) {
        if (log_.isLoggable(Level.FINE)) {
            log_.log(Level.FINE, "Unable to find ViewEntry for key " + startsWith);
        }
        // System.out.println("ViewEntryCollection strategy returned " + vec.getCount() + " entries.");
        return result;
    }
    String val = startEntry.getColumnValue(IndexDatabase.TERM_KEY_NAME, String.class);
    result.add(val);
    ViewNavigator nav = getTermView().createViewNavFrom(startEntry, count);
    for (int i = 1; i < count; i++) {
        ViewEntry nextEntry = nav.getNextSibling();
        val = nextEntry.getColumnValue(IndexDatabase.TERM_KEY_NAME, String.class);
        result.add(val);
    }
    return result;
}
Also used : ViewNavigator(org.openntf.domino.ViewNavigator) ViewEntry(org.openntf.domino.ViewEntry) ArrayList(java.util.ArrayList) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString)

Example 5 with ViewEntry

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

the class DEntryEdge method getVertexId.

@Override
public Object getVertexId(final Direction direction) {
    if (Direction.OUT.equals(direction)) {
        if (outKey_ == null) {
            try {
                ViewEntry entry = (org.openntf.domino.ViewEntry) getDelegate();
                if (entry.isDocument()) {
                    String mid = entry.getDocument().getMetaversalID();
                    setOutId(NoteCoordinate.Utils.getNoteCoordinate(mid));
                } else if (entry.isCategory()) {
                    String entryid = delegateKey_.toString();
                    String mid = "V" + entryid.substring(1);
                    setOutId(ViewEntryCoordinate.Utils.getViewEntryCoordinate(mid));
                } else if (entry.isTotal()) {
                    setOutId("TOTAL");
                // FIXME NTF Implement this please
                } else {
                    Exception e = new UnimplementedException();
                    e.printStackTrace();
                    try {
                        throw e;
                    } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                }
            } catch (Throwable t) {
                t.printStackTrace();
            }
        }
    } else if (Direction.IN.equals(direction)) {
        if (inKey_ == null) {
            // NTF only occurs when EntryEdge is manifested by direct request from ID rather than iteration of EdgeEntryList
            ViewEntryCoordinate vec = (ViewEntryCoordinate) delegateKey_;
            String mid = vec.getViewDocument().getMetaversalID();
            setInId(NoteCoordinate.Utils.getNoteCoordinate(mid));
        }
    }
    return super.getVertexId(direction);
}
Also used : ViewEntryCoordinate(org.openntf.domino.big.ViewEntryCoordinate) ViewEntry(org.openntf.domino.ViewEntry) UnimplementedException(org.openntf.domino.exceptions.UnimplementedException) UnimplementedException(org.openntf.domino.exceptions.UnimplementedException)

Aggregations

ViewEntry (org.openntf.domino.ViewEntry)21 View (org.openntf.domino.View)7 ViewNavigator (org.openntf.domino.ViewNavigator)7 Database (org.openntf.domino.Database)5 Session (org.openntf.domino.Session)5 Test (org.junit.Test)3 ViewEntryCollection (org.openntf.domino.ViewEntryCollection)3 ViewEntryCoordinate (org.openntf.domino.big.ViewEntryCoordinate)3 ArrayList (java.util.ArrayList)2 FastSet (javolution.util.FastSet)2 NotesException (lotus.domino.NotesException)2 Edge (com.tinkerpop.blueprints.Edge)1 Vertex (com.tinkerpop.blueprints.Vertex)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 TreeSet (java.util.TreeSet)1 Vector (java.util.Vector)1 Document (org.openntf.domino.Document)1 DocumentCollection (org.openntf.domino.DocumentCollection)1