javax.jcr.observation.Event.getPath()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中javax.jcr.observation.Event.getPath()方法的一些代码示例,展示了Event.getPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getPath()方法的具体详情如下:
包路径:javax.jcr.observation.Event
类名称:Event
方法名:getPath

Event.getPath介绍

[英]Returns the absolute path associated with this event or null if this event has no associated identifier. The meaning of the associated path depends upon the type of the event. See event type constants above.
[中]返回与此事件关联的绝对路径,如果此事件没有关联的标识符,则返回null。关联路径的含义取决于事件的类型。请参阅上面的事件类型常量。

代码示例

代码示例来源:origin: info.magnolia/magnolia-core

@Override
  public boolean evaluate(Object event) {
    try {
      return !((Event) event).getPath().startsWith("/" + JcrConstants.JCR_SYSTEM);
    } catch (RepositoryException e) {
      log.error("Could not get path of event {}.", event);
      return false;
    }
  }
};

代码示例来源:origin: org.apache.sling/org.apache.sling.distribution.core

String getNodePathFromEvent(Event event) throws RepositoryException {
  String eventPath = event.getPath();
  int type = event.getType();
  if (eventPath == null) {
    return null;
  }
  if (Event.PROPERTY_REMOVED == type || Event.PROPERTY_CHANGED == type || Event.PROPERTY_ADDED == type) {
    eventPath = eventPath.substring(0, eventPath.lastIndexOf('/'));
  }
  return eventPath;
}

代码示例来源:origin: org.onehippo.jcr.console/hippo-jcr-console-api

public JcrNodeModel getSource() {
  try {
    return new JcrNodeModel(event.getPath());
  } catch (RepositoryException ex) {
    log.error("unable to retrieve path from event", ex);
  }
  return null;
}

代码示例来源:origin: org.onehippo.cms7/hippo-cms-api

public JcrNodeModel getSource() {
  try {
    return new JcrNodeModel(event.getPath());
  } catch (RepositoryException ex) {
    log.error("unable to retrieve path from event", ex);
  }
  return null;
}

代码示例来源:origin: sinnerschrader/aem-react

@Override
public void onEvent(EventIterator itr) {
 try {
  this.listener.changed(itr.nextEvent().getPath());
 } catch (RepositoryException e) {
  LOG.error("erorr when observing resource", e);
 }
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public void onEvent(EventIterator events) {
    try {
      while (events.hasNext()) {
        events.nextEvent().getPath();
      }
    } catch (RepositoryException e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: info.magnolia/magnolia-core

private String getPath(Event event) {
  try {
    return event.getPath();
  } catch (RepositoryException e) {
    throw new RuntimeRepositoryException(e);
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    return event.getType() == PROPERTY_ADDED &&
        event.getPath().endsWith("n2/jcr:mixinTypes");
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getPath().equals(TEST_PATH + "/a/b/c") && event.getType() == NODE_REMOVED) {
      return true;
    }
    return false;
  }
});

代码示例来源:origin: info.magnolia/magnolia-core

private String getPath(Event event) {
  try {
    return event.getPath();
  } catch (RepositoryException e) {
    throw new RuntimeRepositoryException(e);
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    return PathUtils.isAncestor(path, event.getPath());
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws RepositoryException {
    return type == event.getType() && equal(path, event.getPath());
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    return event.getType() == PROPERTY_ADDED &&
        event.getPath().endsWith("n2/jcr:primaryType");
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getType() == PROPERTY_CHANGED &&
        event.getPath().endsWith("n3/p1")) {
      Map<?, ?> info = event.getInfo();
      return info != null &&
          NT_UNSTRUCTURED.equals(info.get(JCR_PRIMARYTYPE));
    } else {
      return false;
    }
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getType() == PROPERTY_ADDED &&
        event.getPath().endsWith("n1/jcr:primaryType")) {
      Map<?, ?> info = event.getInfo();
      return info != null &&
          "oak:Unstructured".equals(info.get(JCR_PRIMARYTYPE));
    } else {
      return false;
    }
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getType() == PROPERTY_REMOVED &&
        event.getPath().endsWith("n3/p2")) {
      Map<?, ?> info = event.getInfo();
      return info != null &&
          NT_UNSTRUCTURED.equals(info.get(JCR_PRIMARYTYPE));
    } else {
      return false;
    }
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    if (event.getType() == NODE_ADDED && event.getPath().endsWith("n1")) {
      Map<?, ?> info = event.getInfo();
      return info != null &&
          "oak:Unstructured".equals(info.get(JCR_PRIMARYTYPE));
    } else {
      return false;
    }
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws RepositoryException {
    return type == event.getType() && equal(path, event.getPath()) && equal(identifier, event.getIdentifier());
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws Exception {
    return event.getType() == NODE_MOVED &&
        equal(dst, event.getPath()) &&
        equal(src, event.getInfo().get("srcAbsPath")) &&
        equal(dst, event.getInfo().get("destAbsPath"));
  }
});

代码示例来源:origin: apache/jackrabbit-oak

@Override
  public boolean onEvent(Event event) throws RepositoryException {
    return type == event.getType() && equal(path, event.getPath()) && event.getInfo().containsKey("beforeValue") && beforeValue.equals(((Value)event.getInfo().get("beforeValue")).getString());
  }
});

相关文章