Author: cziegeler Date: Fri Oct 30 11:08:19 2015 New Revision: 1711446 URL: http://svn.apache.org/viewvc?rev=1711446&view=rev Log: SLING-4752 : New resource query API. update api
Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/Query.java sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/Query.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/Query.java?rev=1711446&r1=1711445&r2=1711446&view=diff ============================================================================== --- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/Query.java (original) +++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/Query.java Fri Oct 30 11:08:19 2015 @@ -19,6 +19,7 @@ package org.apache.sling.api.resource.query; import java.util.List; +import java.util.Set; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; @@ -100,24 +101,24 @@ public interface Query { /** * Returns constraints on the resource paths. - * This method returns an empty list if it's a compound query. - * @return The list of paths, might be empty. + * This method returns {@code null} if it's a compound query. + * @return The list of paths, might be empty or {@code null}. */ - @CheckForNull List<String> getPaths(); + @CheckForNull Set<String> getPaths(); /** * Returns constraints on the resource names. - * This method returns an empty list if it's a compound query. - * @return The list of names, might be empty. + * This method returns {@code null} if it's a compound query. + * @return The list of names, might be empty or {@code null}. */ - @CheckForNull List<String> getResourceNames(); + @CheckForNull Set<String> getResourceNames(); /** * Returns constraints on the resource types. - * This method returns an empty list if it's a compound query. - * @return The list of types, might be empty. + * This method returns {@code null} if it's a compound query. + * @return The list of types, might be empty or {@code null}. */ - @CheckForNull List<String> getIsA(); + @CheckForNull Set<String> getIsA(); /** * Return the list of property constraints. @@ -125,11 +126,11 @@ public interface Query { * is {@link QueryType#SINGLE}. * @return The list of property constraints or {@code null}. */ - @CheckForNull List<PropertyConstraint> getPropertyConstraints(); + @CheckForNull Set<PropertyConstraint> getPropertyConstraints(); /** - * Returns the queries if {@link #getPartOperatorType()} does not - * return {@link PartOperatorType#NONE}. + * Returns the queries if {@link #getQueryType()} does not + * return {@link QueryType#SINGLE}. * @return The parts or {@code null} if this query is not an operation * on other queries. */ Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java?rev=1711446&r1=1711445&r2=1711446&view=diff ============================================================================== --- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java (original) +++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryBuilder.java Fri Oct 30 11:08:19 2015 @@ -41,7 +41,7 @@ public interface QueryBuilder { @Nonnull Query build(); /** - * At a path condition to the query. + * Add a path condition to the query. * If several paths are added to the query, these are handled as an or. * If no path is specified for a query, the search paths of the resource * resolver are used. Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java?rev=1711446&r1=1711445&r2=1711446&view=diff ============================================================================== --- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java (original) +++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/query/QueryInstructions.java Fri Oct 30 11:08:19 2015 @@ -20,8 +20,11 @@ package org.apache.sling.api.resource.qu import java.util.List; +import javax.annotation.CheckForNull; import javax.annotation.Nonnull; +import org.apache.sling.api.resource.Resource; + import aQute.bnd.annotation.ProviderType; /** @@ -35,6 +38,7 @@ public interface QueryInstructions { String getPropertyName(); boolean isAscending(); } + /** * Unique global id. * The id can be used by implementations to cache the parsed query. @@ -51,6 +55,12 @@ public interface QueryInstructions { int getLimit(); /** + * Get the currently provided continuation key. + * @return A continuation key or {@code null}. + */ + @CheckForNull String getContinuationKey(); + + /** * Generate a continuation key to be used with {@link QueryInstructionsBuilder#continueAt(String)}. * The continuation can be used for paging: the last resource of a page is feed into this * method to get a key to be used to get the start for the next page. @@ -59,7 +69,7 @@ public interface QueryInstructions { * @return A continuation key for the next resource after this one, according to the sorting. * @throws IllegalArgumentException if the resource is {@code null} */ - @Nonnull String getContinuationKey(); + @Nonnull String generateContinuationKey(Resource resource); /** * Unmodifiable list with the sort criteria.