org.apache.jackrabbit.vault.fs.api.WorkspaceFilter.covers()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(64)

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

WorkspaceFilter.covers介绍

[英]Checks if the given node path is covered in this workspace filter. It only returns true if at least one of the sets covers the path and is not globally ignored.
[中]检查给定的节点路径是否包含在此工作区筛选器中。仅当至少一个集合覆盖路径且未被全局忽略时,才会返回true。

代码示例

代码示例来源:origin: org.apache.jackrabbit.vault/org.apache.jackrabbit.vault

/**
 * Tests if the given workspace filter includes the given property. If the filter does not cover the property,
 * it returns {@code true}.
 *
 * @param filter the workspace filter
 * @param propertyPath the path to the property
 * @return {@code true} if the property is included in the aggregate
 */
private boolean includesProperty(WorkspaceFilter filter, String propertyPath) {
  if (!filter.covers(propertyPath)) {
    // include all properties that are not covered by any filter. this is to ensure that the ancestor paths
    // have at least jcr:primary type.
    return true;
  }
  for (PathFilterSet filterSet: filter.getPropertyFilterSets()) {
    if (filterSet.contains(propertyPath)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: net.adamcin.granite/granite-client-packman

protected static ValidationResult checkFilter(ValidationOptions options, WspFilter archiveFilter) {
  WspFilter wspFilter = options.getValidationFilter();
  // skip filter check if validation filter is not specified
  if (wspFilter != null)  {
    WorkspaceFilter filter = convertToWorkspaceFilter(wspFilter);
    for (Root archiveRoot : archiveFilter.getRoots()) {
      String root = archiveRoot.getPath();
      if (filter.covers(root)) {
        PathFilterSet covering = filter.getCoveringFilterSet(root);
        Root coveringRoot =
            WspFilter.adaptFilterSet(covering);
        if (!hasRequiredRules(coveringRoot, archiveRoot)) {
          return ValidationResult.rootMissingRules(archiveRoot, coveringRoot);
        }
      } else if (!options.isAllowNonCoveredRoots()) {
        return ValidationResult.rootNotAllowed(archiveRoot);
      }
    }
  }
  return ValidationResult.success();
}

相关文章