/** * 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; }
/** * Returns a multimap of propertyKey -> values * * @param results The AQL properties search result */ public static HashMultimap<String, String> propsToMap(AqlEagerResult<AqlProperty> results) { HashMultimap<String, String> map = HashMultimap.create(); for (AqlProperty property : results.getResults()) { map.put(property.getKey(), property.getValue()); } return map; }