Examples of DocumentList

Boundary cases are important for {@link #checkpoint()}: The typical pattern for consuming an object that implements this interface is as follows (disregarding exception handling):
 DocumentList docList = ... Document doc; while (doc = docList.nextDocument()) { handleDoc(doc); if (whatever reason) break; } String check = doclist.checkpoint(); 
Note: because of the restriction that the next call to {@link #nextDocument()} invalidates the previous Document, and thereare similar restrictions in the {@link Document} interface, it is possibleto provide a single stateful object that implements {@link DocumentList}, {@link Document} and {@link Property}, by returning {@code this}(or {@code null}) to all calls to {@link #nextDocument()} and{@link Document#findProperty(String)}. However, if preferred, the implementor may also use separate objects for each of those interfaces. @since 1.0
  • edu.harvard.wcfia.yoshikoder.document.DocumentList
    @author will
  • org.openntf.domino.impl.DocumentList

  • Examples of com.google.enterprise.connector.spi.DocumentList

        Traverser traverser = getObjectUnderTest();
        traverser.setBatchHint(100);
        // Under live test and the test account, the deletion events weren't
        // returned from FileNet.
        boolean tested = false;
        DocumentList docList = traverser.getDocumentList(new Checkpoint());
        Document doc;
        while ((doc = docList.nextDocument()) != null) {
          assertTrue(checkpointContains(docList.checkpoint(),
              doc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED),
              JsonField.LAST_MODIFIED_TIME));
          tested = true;
        }
        assertTrue(tested);
    View Full Code Here

    Examples of com.google.enterprise.connector.spi.DocumentList

       * Testing chronological traversal
       */
      public void testLiveNextDocument() throws Exception {
        Traverser traverser = getObjectUnderTest();
        boolean isTested = false;
        DocumentList docList = traverser.getDocumentList(new Checkpoint());
        assertNotNull("Document list is null", docList);
        Document doc = docList.nextDocument();
        while (doc != null && doc instanceof FileDocument) {
          Property lastModifiedProp =
              doc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
          Value lastModifiedValue = lastModifiedProp.nextValue();
          Calendar cal = Value.iso8601ToCalendar(lastModifiedValue.toString());

          Document nextDoc = docList.nextDocument();
          if (nextDoc != null && nextDoc instanceof FileDocument) {
            Property nextDocLastModifiedProp =
                nextDoc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
            Value nextDocLastModifiedValue = nextDocLastModifiedProp.nextValue();
            Calendar nextCal =
    View Full Code Here

    Examples of com.google.enterprise.connector.spi.DocumentList

      private void testSorting(int[] expectedOrder, String[][] entries,
          DatabaseType dbType) throws Exception {
        MockObjectStore os = new MockObjectStore("objectstore", dbType,
            generateObjectMap(entries, false, true));
        DocumentList docList =
            getObjectUnderTest(os, getDocuments(os.getObjects()),
                getCustomDeletion(os.getObjects()),
                getDeletionEvents(os.getObjects()));

        // Test the order
        for (int index : expectedOrder) {
          Document doc = docList.nextDocument();
          Property fid = doc.findProperty(SpiConstants.PROPNAME_DOCID);
          assertEquals("[" + dbType + "] Incorrect id sorting order",
              "{" + entries[index][0] + "}", fid.nextValue().toString());
        }
      }
    View Full Code Here

    Examples of com.google.enterprise.connector.spi.DocumentList

        @SuppressWarnings("unchecked")
        MockObjectStore os =
            newObjectStore("MockObjectStore", DatabaseType.MSSQL, entries);

        // Begin testing nextDocument for exception
        DocumentList docList = getObjectUnderTest(os, getDocuments(os.getObjects()),
            getCustomDeletion(os.getObjects()), getDeletionEvents(os.getObjects()));

        SkipPosition actualPosition = SkipPosition.FIRST;
        try {
          for (Document doc = docList.nextDocument(); doc != null;
              doc = docList.nextDocument()) {
            actualPosition = SkipPosition.MIDDLE;
          }
          fail("Expect SkippedDocumentException");
        } catch (SkippedDocumentException expected) {
          if (!expected.getMessage().contains(unreleasedGuid.toString())) {
            throw expected;
          }
          if (docList.nextDocument() == null) {
            actualPosition = SkipPosition.LAST;
          }
        }
        assertEquals(expectedPosition, actualPosition);
      }
    View Full Code Here

    Examples of com.google.enterprise.connector.spi.DocumentList

        boolean isAddTested = false;
        boolean isDeletionEventTested = false;
        boolean isCustomDeletionTested = false;

        DocumentList docList =
            getObjectUnderTest(os, docSet, customDeletionSet, deletionEventSet);
        Document doc = null;
        while ((doc = docList.nextDocument()) != null) {
          Property actionProp = doc.findProperty(SpiConstants.PROPNAME_ACTION);
          ActionType actionType = SpiConstants.ActionType.findActionType(
              actionProp.nextValue().toString());

          String id =
              doc.findProperty(SpiConstants.PROPNAME_DOCID).nextValue().toString();
          if (ActionType.ADD.equals(actionType)) {
            IBaseObject object = os.getObject(null, id);
            assertFalse(object instanceof FileDeletionObject);
            assertTrue(checkpointContains(docList.checkpoint(),
                doc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED),
                JsonField.LAST_MODIFIED_TIME));
            isAddTested = true;
          } else if (ActionType.DELETE.equals(actionType)) {
            IBaseObject object = os.getObject(null, id);
            if (object.isDeletionEvent()) {
              assertTrue(checkpointContains(docList.checkpoint(),
                  doc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED),
                  JsonField.LAST_DELETION_EVENT_TIME));
              isDeletionEventTested = true;
            } else {
              assertTrue(checkpointContains(docList.checkpoint(),
                  doc.findProperty(SpiConstants.PROPNAME_LASTMODIFIED),
                  JsonField.LAST_CUSTOM_DELETION_TIME));
              isCustomDeletionTested = true;
            }
          }
        }
        assertEquals(expectAddTested, isAddTested);
        assertEquals(expectCustomDeletionTested, isCustomDeletionTested);
        assertEquals(expectDeletionEventTested, isDeletionEventTested);

        String expectedCheckpoint = "{"
            + (expectAddTested
                ? "\"uuid\":\"{AAAAAAA4-0000-0000-0000-000000000000}\","
                + "\"lastModified\":\"" + CHECKPOINT_TIMESTAMP + TZ_OFFSET + "\","
                : "\"uuid\":\"{AAAAAAAA-0000-0000-0000-000000000000}\","
                + "\"lastModified\":\"1990-01-01T00:00:00.000\",")
            + (expectDeletionEventTested
                ? "\"uuidToDelete\":\"{DE000002-0000-0000-0000-000000000000}\","
                + "\"lastRemoveDate\":\"" + CHECKPOINT_TIMESTAMP + TZ_OFFSET + "\","
                : "\"uuidToDelete\":\"{BBBBBBBB-0000-0000-0000-000000000000}\","
                + "\"lastRemoveDate\":\"2000-01-01T00:00:00.000\",")
            + (expectCustomDeletionTested
                ? "\"uuidToDeleteDocs\":\"{CD000003-0000-0000-0000-000000000000}\","
                + "\"lastModifiedDate\":\"" + CHECKPOINT_TIMESTAMP + TZ_OFFSET
                + "\""
                : "\"uuidToDeleteDocs\":\"{CCCCCCCC-0000-0000-0000-000000000000}\","
                + "\"lastModifiedDate\":\"2010-01-01T00:00:00.000\"")
            + "}";
        assertCheckpointEquals(expectedCheckpoint, docList.checkpoint());
      }
    View Full Code Here

    Examples of edu.harvard.wcfia.yoshikoder.document.DocumentList

            if ((doctitle == null) || doctitle.length()==0){
                throw new CommitException("Please give the document a title");
            }
           
            DocumentList dl = yoshikoder.getDocumentList();
            for (Iterator iter = dl.iterator(); iter.hasNext();) {
                YKDocument doc = (YKDocument) iter.next();
                if (doctitle.equals(doc.getTitle()))
                    throw new CommitException("A document with this name already exists.  Please choose another");
            }
           
    View Full Code Here

    Examples of edu.harvard.wcfia.yoshikoder.document.DocumentList

       
        public ComparisonPanel(Yoshikoder yk) {
            super();
            yoshikoder = yk;
           
            DocumentList dl = yk.getProject().getDocumentList();
            YKDocument[] docarray =
                (YKDocument[])dl.toArray(new YKDocument[dl.size()]);
            doc1combo = new JComboBox(docarray);
            doc2combo = new JComboBox(docarray);
           
            YKDocument doc = yoshikoder.getSelectedDocument();
            if (doc != null){
    View Full Code Here

    Examples of edu.harvard.wcfia.yoshikoder.document.DocumentList

                  cnode = (CategoryNode)n.getParent();
                final CategoryNode catnode = cnode;
               
                dworker = new DialogWorker(yoshikoder){
                    protected void doWork() throws Exception {
                        DocumentList dl = new DocumentListImpl();
                        dl.add(doc1);
                        dl.add(doc2);

                        TokenizationCache tcache = yoshikoder.getTokenizationCache();
                        TokenList tl1 = tcache.getTokenList(doc1);
                        TokenList tl2 = tcache.getTokenList(doc2);
                        if (tl1 == null){
    View Full Code Here

    Examples of edu.harvard.wcfia.yoshikoder.document.DocumentList

       
      }
     
      protected Object[][] run(){
        // do the analysis
        DocumentList list = new DocumentListImpl();
        for (int ii=0; ii<files.length; ii++){
          YKDocument doc = YKDocumentFactory.createYKDocument(files[ii]);
          list.add(doc);
        }
            return null;
        }
    View Full Code Here

    Examples of edu.harvard.wcfia.yoshikoder.document.DocumentList

           
            row = sheet.createRow((short)4);
            setExcelValue(row, 0, "Documents:");
           
            int ii=5;
            DocumentList dl = getDocuments();
            for (Iterator iterator = dl.iterator(); iterator.hasNext();) {
                YKDocument d = (YKDocument) iterator.next();
                row = sheet.createRow((short)ii);
                setExcelValue(row, 0, d.getTitle());
                ii++;
            }
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.