Package com.google.enterprise.connector.mock

Examples of com.google.enterprise.connector.mock.MockRepositoryProperty$PropertyType


    // /faire les remplacements requis entre attributs Mock et attributs
    // Dctm
    String propStrVal = null;
    if (name.equals("object_name")) {
      name = "name";
      MockRepositoryProperty pm = mockDocument.getProplist().getProperty(
          name);
      MockJcrValue propVal = new MockJcrValue(pm);
      try {
        propStrVal = propVal.getString();
      } catch (IllegalStateException e) {
        // TODO: Why is this exception ignored?
      }
    } else if (name.equals(SpiConstants.PROPNAME_DOCID)) {
      name = "docid";
      propStrVal = mockDocument.getDocID();
    } else {
      MockRepositoryProperty pm = mockDocument.getProplist().getProperty(
          name);
      MockJcrValue propVal = new MockJcrValue(pm);
      try {
        propStrVal = propVal.getString();
      } catch (IllegalStateException e) {
View Full Code Here


    return propStrVal;
  }

  @Override
  public int getInt(String name) throws RepositoryDocumentException {
    MockRepositoryProperty pm = mockDocument.getProplist().getProperty(name);
    MockJcrValue propVal = new MockJcrValue(pm);
    int propIntVal = 0;
    try {
      propIntVal = (int) propVal.getLong();
    } catch (IllegalStateException e) {
View Full Code Here

  public ITime getTime(String name) throws RepositoryDocumentException {
    Date propDateVal = null;
    if (name.equals("r_modify_date")) {
      name = "google:lastmodify";
    }
    MockRepositoryProperty pm = mockDocument.getProplist().getProperty(name);
    long time = 0;
    if (pm == null) {
      MockRepositoryDateTime dateTime = mockDocument.getTimeStamp();
      time = dateTime.getTicks();
      propDateVal = new Date(time);
    } else {
      String propVal = pm.getValue();
      SimpleDateFormat simple = new SimpleDateFormat(
          "EEE, d MMM yyyy HH:mm:ss z", new Locale("EN"));
      ParsePosition parsePosition = new ParsePosition(0);
      propDateVal = simple.parse(propVal, parsePosition);
      time = propDateVal.getTime();
View Full Code Here

  }

  @Override
  public IType getType() throws RepositoryDocumentException {
    String propType = "MockType";
    MockRepositoryProperty pm = mockDocument.getProplist()
        .getProperty("r_object_type");
    if (pm != null) {
      MockJcrValue propVal = new MockJcrValue(pm);
      try {
        propType = propVal.getString();
View Full Code Here

    return new MockDmType(propType, this);
  }

  @Override
  public double getDouble(String name) throws RepositoryDocumentException {
    MockRepositoryProperty pm = mockDocument.getProplist().getProperty(name);
    MockJcrValue propVal = new MockJcrValue(pm);
    double propDblVal = 0;
    try {
      propDblVal = propVal.getDouble();
    } catch (IllegalStateException e) {
View Full Code Here

    return propDblVal;
  }

  @Override
  public boolean getBoolean(String name) throws RepositoryDocumentException {
    MockRepositoryProperty pm = mockDocument.getProplist().getProperty(name);
    MockJcrValue propVal = new MockJcrValue(pm);
    boolean propBlVal = true;
    try {
      propBlVal = propVal.getBoolean();
    } catch (IllegalStateException e) {
View Full Code Here

    return new MockDmFormat("application/octet-stream");
  }

  @Override
  public int getAttrDataType(String name) throws RepositoryDocumentException {
    MockRepositoryProperty pm = mockDocument.getProplist().getProperty(name);
    MockJcrValue propVal = new MockJcrValue(pm);
    return propVal.getType();
  }
View Full Code Here

  }

  @Override
  public IValue getRepeatingValue(String name, int index)
      throws RepositoryDocumentException {
    return new MockDmValue(new MockJcrValue(new MockRepositoryProperty(
        name, PropertyType.STRING, getString(name))));
  }
View Full Code Here

      // 'content'
      // defined,
      // doc==null
      if (doc != null) {
        MockRepositoryPropertyList pl = doc.getProplist();
        MockRepositoryProperty p = pl.getProperty("acl");
        if (p != null) { // If doc contains acls
          String[] acl = p.getValues();
          for (int i = 0; i < acl.length; i++) {
            if (claimant.equals(acl[i])) {
              add(doc);
            }
          }
View Full Code Here

    }
    MockRepositoryDocument doc = repo.getStore().getDocByID("users");
    if (doc == null) {
      return true;
    }
    MockRepositoryProperty property = doc.getProplist().getProperty("acl");
    if (property == null) {
      return true;
    }
    String[] values = property.getValues();
    for (int i=0; i<values.length; i++) {
      if (values[i].equals(userID)) {
        if (userID.equals(password)) {
          return true;
        } else {
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.mock.MockRepositoryProperty$PropertyType

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.