Package com.google.enterprise.connector.spi

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


  }

  @Override
  public Property findProperty(String name) {
    List<Value> property = properties.get(name);
    return (property == null) ? null : new SimpleProperty(property);
  }
View Full Code Here


      } else {
        // No roles for this scope; just add scope to the list.
        acl.add(scopeVal);
      }
    }
    return new SimpleProperty(acl);
  }
View Full Code Here

  @Override
  public Property findProperty(Document source, String name)
      throws RepositoryException {
    if (SpiConstants.PROPNAME_DOCUMENTTYPE.equals(name)) {
      return new SimpleProperty(Value.getStringValue(
          DocumentType.ACL.toString()));
    } else if (SpiConstants.PROPNAME_FRAGMENT.equals(name)) {
      return new SimpleProperty(Value.getStringValue(EXTRACTED_ACL_FRAGMENT));
    } else if (SpiConstants.PROPNAME_ACLINHERITANCETYPE.equals(name)) {
      String inheritanceType = Value.getSingleValueString(source, name);
      if (AclInheritanceType.AND_BOTH_PERMIT.toString().equals(inheritanceType)) {
        throw new SkippedDocumentException(
            "Extracting 'and-both-permit' ACLs is not supported.");
      }
      return new SimpleProperty(Value.getStringValue(
          Strings.isNullOrEmpty(inheritanceType) ?
          AclInheritanceType.PARENT_OVERRIDES.toString() : inheritanceType));
    } else {
      return source.findProperty(name);
    }
View Full Code Here

  public Property findProperty(Document source, String name)
      throws RepositoryException {
    if (SpiConstants.PROPNAME_ACLINHERITFROM_DOCID.equals(name)) {
      return source.findProperty(SpiConstants.PROPNAME_DOCID);
    } else if (SpiConstants.PROPNAME_ACLINHERITFROM_FRAGMENT.equals(name)) {
      return new SimpleProperty(Value.getStringValue(
          ExtractedAclDocumentFilter.EXTRACTED_ACL_FRAGMENT));
    } else if (SpiConstants.PROPNAME_ACLINHERITANCETYPE.equals(name)) {
      String inheritanceType = Value.getSingleValueString(source, name);
      if (Strings.isNullOrEmpty(inheritanceType)) {
        return null// Leaf.
      } else {
        return new SimpleProperty(Value.getStringValue(
            AclInheritanceType.CHILD_OVERRIDES.toString()));
      }
    } else {
      return super.findProperty(source, name);
    }
View Full Code Here

  @Override
  public Property findProperty(Document source, String name)
      throws RepositoryException {
    if (SpiConstants.PROPNAME_ACLINHERITFROM.equals(name)) {
      return new SimpleProperty(
          Value.getStringValue(urlConstructor.getInheritFromUrl(source)));
    } else {
      return source.findProperty(name);
    }
  }
View Full Code Here

        ConnectorTestUtils.createSimpleDocumentBasicProperties("dummy");
    return new SimpleDocument(ConnectorTestUtils.createSpiProperties(props)) {
      @Override
      public Property findProperty(String name) {
        if (name.equals("nonExistentProperty")) {
          return new SimpleProperty(valueList("dummy"));
        } else {
          return super.findProperty(name);
        }
      }
    };
View Full Code Here

  private static class NoAclsDocumentFilter extends StripAclDocumentFilter {
    @Override
    public Property findProperty(Document source, String name)
        throws RepositoryException {
      if (name == SpiConstants.PROPNAME_ISPUBLIC) {
        return new SimpleProperty(Value.getBooleanValue(false));
      } else {
        return super.findProperty(source, name);
      }
    }
View Full Code Here

public class SimplePropertyTest extends TestCase {

  public void testSingleValue() throws Exception {
    Value expected = Value.getStringValue("test1");
    SimpleProperty property = new SimpleProperty(expected);

    // We should get our value back, but only once.
    Value value = property.nextValue();
    assertNotNull(value);
    assertEquals(expected, value);

    // Next fetch should yield null.
    value = property.nextValue();
    assertNull(value);

    // In fact, all subsequent fetches should yield null.
    for (int i = 0; i < 10; i++) {
      assertNull(property.nextValue());
    }
  }
View Full Code Here

    // Should work with different subclasses of Value.
    checkMultiValues(list);
  }

  private void checkMultiValues(List<Value> list) throws Exception {
    SimpleProperty property = new SimpleProperty(list);

    // We should get our values back, in order.
    for (Value expected : list) {
      Value value = property.nextValue();
      assertNotNull(value);
      assertEquals(expected, value);
    }

    // All subsequent fetches should yield null.
    for (int i = 0; i < 10; i++) {
      assertNull(property.nextValue());
    }
  }
View Full Code Here

                  principal.getNamespace(), getPrincipalName(principal, name),
                  principal.getCaseSensitivityType());
          newValues.add(new PrincipalValue(newPrincipal));
        }
      }
      return new SimpleProperty(newValues);
    } else {
      return source.findProperty(name);
    }
  }
View Full Code Here

TOP

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

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.