Package com.google.enterprise.connector.spi

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


    props.put(SpiConstants.PROPNAME_ACLUSERS, userList);

    Document input = ConnectorTestUtils.createSimpleDocument(props);
    Document output = createFilter(input,
        CaseSensitivityType.EVERYTHING_CASE_SENSITIVE, null, false);
    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value;
    while ((value = prop.nextValue()) != null) {
      if (value instanceof PrincipalValue) {
        Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
        assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
            newPrincipal.getCaseSensitivityType());
      }
View Full Code Here


    return ConnectorTestUtils.createSimpleDocument(props);
  }

  public Principal getPrincipal(Document output, String name)
      throws Exception {
    Property prop = output.findProperty(name);
    Value value = prop.nextValue();
    return ((PrincipalValue) value).getPrincipal();
  }
View Full Code Here

    }

    printStream.println("<document>");

    // first take care of some special attributes
    Property property = null;

    // we just do the DOCID first so it is easy to find
    String name = SpiConstants.PROPNAME_DOCID;
    if ((property = document.findProperty(name)) == null) {
      throw new RepositoryDocumentException(SpiConstants.PROPNAME_DOCID
View Full Code Here

    Document input = createDocument("Jane Doe", "John Doe");

    AclPropertyFilter factory = new AclPropertyFilter();
    Document output = factory.newDocumentFilter(input);

    Property prop = output.findProperty(SpiConstants.PROPNAME_ACLUSERS);
    Value value = prop.nextValue();
    Principal newPrincipal = ((PrincipalValue) value).getPrincipal();
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
        newPrincipal.getCaseSensitivityType());
    assertEquals("Jane Doe", newPrincipal.getName());

    Property denyprop =
        output.findProperty(SpiConstants.PROPNAME_ACLDENYUSERS);
    Value denyvalue = denyprop.nextValue();
    Principal denyPrincipal = ((PrincipalValue) denyvalue).getPrincipal();
    assertEquals(CaseSensitivityType.EVERYTHING_CASE_SENSITIVE,
        denyPrincipal.getCaseSensitivityType());
    assertEquals("John Doe", denyPrincipal.getName());
  }
View Full Code Here

        doc.getPropertyNames().contains("nonExistentProperty"));
    Document filter = createFilter("nonExistentProperty", "nondummy", true,
        doc);
    assertTrue(filter.getPropertyNames().toString(),
        filter.getPropertyNames().contains("nonExistentProperty"));
    Property unpublished = filter.findProperty("nonExistentProperty");
    assertNotNull(unpublished);
    assertEquals("", unpublished.nextValue().toString());
    assertNull(unpublished.nextValue());
  }
View Full Code Here

   * which may be a subset of the full document properties.
   */
  protected void checkDocumentProperties(Document document,
      Map<String, List<Value>> expectedProps) throws Exception {
    for (Map.Entry<String, List<Value>> entry : expectedProps.entrySet()) {
      Property prop = document.findProperty(entry.getKey());
      assertNotNull(prop);
      for (Value expectedValue : entry.getValue()) {
        Value value = prop.nextValue();
        assertNotNull(value);
        if (value instanceof BinaryValue) {
          assertEquals(getStringFromBinaryValue(expectedValue),
              getStringFromBinaryValue(value));
        } else {
          assertEquals(expectedValue.toString(), value.toString());
        }
      }
      assertNull(prop.nextValue());
    }
  }
View Full Code Here

   *         processing errors
   */
  public List<Value> getPropertyValues(Document source, String name)
      throws RepositoryException {
    LinkedList<Value> values = new LinkedList<Value>();
    Property prop = source.findProperty(name);
    if (prop != null) {
      Value value;
      while ((value = prop.nextValue()) != null) {
        values.add(value);
      }
    }
    return values;
  }
View Full Code Here

  @Override
  public Property findProperty(Document source, String name)
      throws RepositoryException {
    Preconditions.checkState(propertyName != null, "must set propertyName");
    Property prop = source.findProperty(name);
    if (propertyName.equals(name)) {
      if (pattern == null) {
        // If there is no pattern, then check presence/absence of the property.
        if ((prop == null) ^ skipOnMatch) {
          throw new SkippedDocumentException("Skipping document based upon "
View Full Code Here

      SocialUserProfileDocument socialDoc = (SocialUserProfileDocument) doc;
      // I'm using getUserContent to simplify the comparisons.
      // MockUserProfileGenerator happens to return bare usernames here.
      names.add(socialDoc.getUserContent().toString());

      Property propDocId = doc.findProperty(SpiConstants.PROPNAME_DOCID);
      assertNotNull(propDocId);
      String docid = propDocId.nextValue().toString();
      assertTrue(docid, docid.startsWith("social"));
    }
  }
View Full Code Here

      System.out.println("Documents found - ");
      if (rs != null) {
        SPDocument pm = (SPDocument) rs.nextDocument();
        while (pm != null) {
          System.out.println("<document>");
          final Property lastModProp = pm.findProperty(SpiConstants.PROPNAME_LASTMODIFIED);
          if (lastModProp != null) {
            System.out.println("<lastModify>"
                + lastModProp.nextValue().toString() + "</lastModify>");
          }
          final Property docProp = pm.findProperty(SpiConstants.PROPNAME_DOCID);
          if (lastModProp != null) {
            System.out.println("<docId>" + docProp.nextValue().toString()
                + "</docId>");
          }
          final Property searchUrlProp = pm.findProperty(SpiConstants.PROPNAME_SEARCHURL);
          if (searchUrlProp != null) {
            System.out.println("<searchUrl>"
                + searchUrlProp.nextValue().toString() + "</searchUrl>");
          }
          final Property listGuidProp = pm.findProperty(SPConstants.LIST_GUID);
          if (listGuidProp != null) {
            System.out.println("<listGuid>"
                + listGuidProp.nextValue().toString() + "</listguid>");
          }
          final Property displayUrlProp = pm.findProperty(SpiConstants.PROPNAME_DISPLAYURL);
          if (displayUrlProp != null) {
            System.out.println("<displayUrl>"
                + displayUrlProp.nextValue().toString() + "</displayUrl>");
          }
          final Property authorProp = pm.findProperty(SPConstants.AUTHOR);
          if (authorProp != null) {
            System.out.println("<author>" + authorProp.nextValue().toString()
                + "</author>");
          }
          final Property objTypeProp = pm.findProperty(SPConstants.OBJECT_TYPE);
          if (objTypeProp != null) {
            System.out.println("<" + SPConstants.OBJECT_TYPE + ">"
                + objTypeProp.nextValue().toString() + "<"
                + SPConstants.OBJECT_TYPE + ">");
          }
          final Property isPublicProp = pm.findProperty(SpiConstants.PROPNAME_ISPUBLIC);
          if (isPublicProp != null) {
            System.out.println("<isPublic>"
                + isPublicProp.nextValue().toString() + "</isPublic>");
          }
          System.out.println("</document>");

          pm.dumpAllAttrs();
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.spi.Property

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.