Package com.google.enterprise.connector.filenet4.filewrap

Examples of com.google.enterprise.connector.filenet4.filewrap.IDocument


  public void testMarkingPermissions() throws RepositoryException {
    IVersionSeries versionSeries =
        (IVersionSeries) ios.getObject(ClassNames.VERSION_SERIES,
            TestConnection.docVsId1);
    IDocument doc = versionSeries.get_ReleasedVersion();
    IActiveMarkingList activeMarkingList = doc.get_ActiveMarkings();
    assertNotNull("Active marking is null", activeMarkingList);
    assertTrue(user.get_Name() + " is not authorized by document's marking",
        new MarkingPermissions(activeMarkingList).authorize(user));
  }
View Full Code Here


   * Test document permissions such that Administrator user is not in the
   * document ACL but is the creator and owner and the #CREATOR-OWNER ACE must
   * be present in the ACL with AccessLevel.VIEW_AS_INT access or above.
   */
  public void testCreatorOwnerPermissions() throws RepositoryException {
    IDocument doc = (IDocument) ios.fetchObject(ClassNames.DOCUMENT,
        new FnId(TestConnection.docId4), null);
    List<Value> ownerValue = new ArrayList<Value>();
    doc.getPropertyStringValue("Owner", ownerValue);
    assertEquals(adminUser.get_Name(), ownerValue.get(0).toString());
    Permissions perms = new Permissions(doc.get_Permissions());
    assertTrue(perms.authorize(adminUser));
  }
View Full Code Here

  }

  private void testUnreleasedNextDocument(String[][] docEntries,
      Map<IId, IBaseObject> unreleasedEntries,
      SkipPosition expectedPosition) throws Exception {
    IId unreleasedGuid = unreleasedEntries.keySet().iterator().next();
    Map<IId, IBaseObject> entries =
        generateObjectMap(docEntries, false, true);
    entries.putAll(unreleasedEntries);
    testUnreleasedNextDocument(entries, unreleasedGuid, expectedPosition);
  }
View Full Code Here

  /*
   * Helper method to create add document.
   */
  private Document createAddDocument(IBaseObject object)
      throws RepositoryException {
    IId id = object.get_Id();
    logger.log(Level.FINEST, "Add document [ID: {0}]", id);
    FileDocument doc = new FileDocument(id, objectStore, connector);
    doc.processInheritedPermissions(acls);
    return doc;
  }
View Full Code Here

  /*
   * Helper method to create delete document.
   */
  private Document createDeleteDocument(IBaseObject object)
      throws RepositoryDocumentException {
    IId id = object.get_Id();
    IId versionSeriesId = object.getVersionSeriesId();
    logger.log(Level.FINEST, "Delete document [ID: {0}, VersionSeriesID: {1}]",
        new Object[] {id, versionSeriesId});
    return new FileDeleteDocument(versionSeriesId, object.getModifyDate());
  }
View Full Code Here

    Iterator<? extends IMarking> markings = this.markings.iterator();

    LOGGER.log(Level.FINER, "Authorizing user :[" + user.get_Name()
        + "] for Marking Sets");
    while (markings.hasNext()) {
      IMarking marking = markings.next();

      LOGGER.log(Level.FINEST,
          "Authorizing user: {0} [Marking: {1}, Constraint Mask: {2}]",
          new Object[] {user.get_Name(), marking.get_MarkingValue(),
                        marking.get_ConstraintMask()});

      Permissions perms = new Permissions(marking.get_Permissions());
      if (!perms.authorizeMarking(user, marking.get_ConstraintMask())) {
        LOGGER.log(Level.FINER,
            "User {0} is not authorized for Marking value: {1}",
            new Object[] {user.get_Name(), marking.get_MarkingValue()});
        return false;
      }
    }
    LOGGER.log(Level.FINER, "User " + user.get_Name()
        + " is authorized to view the document");
View Full Code Here

  public void testEmptyObjectStoreMock() throws Exception {
    IObjectStore os = createNiceMock(IObjectStore.class);
    IObjectSet objectSet = createNiceMock(IObjectSet.class);

    IObjectFactory factory = createMock(IObjectFactory.class);
    ISearch search = createMock(ISearch.class);
    expect(factory.getSearch(os)).andReturn(search);
    expect(search.execute(isA(String.class))).andReturn(objectSet).times(2);
    replay(os, factory, search, objectSet);

    FileDocumentTraverser traverser =
        new FileDocumentTraverser(factory, os, connec);
View Full Code Here

  }

  private DocumentList getDocumentList(String[][] entries,
      List<AccessPermission>... perms) throws Exception {
    MockObjectStore objectStore = getObjectStore(entries, perms);
    IObjectSet objectSet = getObjectSet(objectStore);
    assertNotNull(objectStore);
    assertEquals(entries.length, objectSet.getSize());
    return new FileDocumentList(objectSet, new EmptyObjectSet(),
        new EmptyObjectSet(), objectStore, connector, null);
  }
View Full Code Here

   * Test method for
   * 'com.google.enterprise.connector.file.filejavawrap.FnObjectFactory.getSearch(IObjectStore)'
   */
  public void testGetSearch() throws RepositoryException {
    ISearch is = iof.getSearch(ios);
    IObjectSet test = is.execute(
        "SELECT TOP 50 d.Id, d.DateLastModified FROM Document AS d WHERE d.Id='"
        + TestConnection.docId1 + "' and VersionStatus=1 "
        + "and ContentSize IS NOT NULL  AND (ISCLASS(d, Document) "
        + "OR ISCLASS(d, WorkflowDefinition))  ORDER BY DateLastModified,Id");
    assertEquals(1, test.getSize());
    Iterator<? extends IBaseObject> it = test.getIterator();
    while (it.hasNext()) {
      IBaseObject ibo = it.next();
      assertEquals("{" + TestConnection.docId1 + "}", ibo.get_Id().toString());
    }
  }
View Full Code Here

    assertEquals(10, counter);
  }

  public void testEmptyObjectStoreMock() throws Exception {
    IObjectStore os = createNiceMock(IObjectStore.class);
    IObjectSet objectSet = createNiceMock(IObjectSet.class);

    IObjectFactory factory = createMock(IObjectFactory.class);
    ISearch search = createMock(ISearch.class);
    expect(factory.getSearch(os)).andReturn(search);
    expect(search.execute(isA(String.class))).andReturn(objectSet).times(2);
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.filenet4.filewrap.IDocument

Copyright © 2018 www.massapicom. 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.