Пример #1
0
 /**
  * Returns true if the node that the path points to exists (Use with files only!)
  *
  * @param path repo path to check for existence
  */
 public static boolean exists(RepoPath path) {
   AqlSearchablePath aqlPath = new AqlSearchablePath(path);
   AqlApiItem aql =
       AqlApiItem.create()
           .filter(
               and(
                   AqlApiItem.repo().equal(aqlPath.getRepo()),
                   AqlApiItem.path().equal(aqlPath.getPath()),
                   AqlApiItem.name().equal(aqlPath.getFileName())));
   AqlEagerResult<AqlItem> results =
       ContextHelper.get().beanForType(AqlService.class).executeQueryEager(aql);
   return results != null && results.getResults() != null && results.getResults().size() > 0;
 }
Пример #2
0
 /** Returns an AqlApiItem OR clause containing an AND for each of the searchable paths given */
 public static AqlBase.OrClause getSearchClauseForPaths(
     List<AqlSearchablePath> aqlSearchablePaths) {
   AqlBase.OrClause searchClause = AqlBase.or();
   for (AqlSearchablePath path : aqlSearchablePaths) {
     log.debug("Adding path '{}' to artifact search", path.toRepoPath().toString());
     searchClause.append(
         and(
             AqlApiItem.repo().matches(path.getRepo()),
             AqlApiItem.path().matches(path.getPath()),
             AqlApiItem.name().matches(path.getFileName())));
   }
   return searchClause;
 }