Class RelatedQueryParameters


  • public final class RelatedQueryParameters
    extends Object
    Represents the query parameters to perform a related query operation. A prerequisite for querying related features is that all the participating tables must be part of the same map, as either feature layers FeatureLayer or tables, ServiceFeatureTable or GeodatabaseFeatureTable.

    RelatedQueryParameters lets you specify details about the related query to perform and how to return the result, including:

    • Details about the relationship to be queried.
    • A where clause used to filter features from the related table.
    • How to sort the results.
    • Whether to return geometry within the results.

    Since:
    100.1.0
    • Constructor Detail

      • RelatedQueryParameters

        public RelatedQueryParameters​(RelationshipInfo relationshipInfo)
        Creates a new instance of RelatedQueryParameters with a given RelationshipInfo.
        Parameters:
        relationshipInfo - the relationshipInfo defining the query relationship, cannot be null
        Throws:
        IllegalArgumentException - if relationshipInfo is null
        Since:
        100.1.0
    • Method Detail

      • getOrderByFields

        public List<QueryParameters.OrderBy> getOrderByFields()
        Gets a mutable list of QueryParameters.OrderBy objects, indicating the fields the results are sorted by, and the order in which they are sorted. By default this list is empty. Add instances of OrderBy to this list to sort the query result.
        Returns:
        a mutable list of OrderBy objects
        Since:
        100.1.0
      • setWhereClause

        public void setWhereClause​(String whereClause)
        Sets the where clause. Any legal SQL where clause operating on the fields in the layer/table is allowed, for example 'POP2000 > 500000'.
        Parameters:
        whereClause - the where clause. May be null or empty.
        Since:
        100.1.0
      • getWhereClause

        public String getWhereClause()
        Gets the where clause; which is a legal SQL statement.
        Returns:
        the where clause
        Since:
        100.1.0
      • getRelationshipInfo

        public RelationshipInfo getRelationshipInfo()
        Gets the relationship info used to define the tables to use for this query.
        Returns:
        the relationship info used to define the tables to use for this query
        Since:
        100.1.0
      • setRelationshipInfo

        public void setRelationshipInfo​(RelationshipInfo relationshipInfo)
        Sets the relationship info used to define the tables to use for this query.
        Parameters:
        relationshipInfo - the relationship info used to define the tables to use for this query
        Throws:
        IllegalArgumentException - if relationshipInfo is null
        Since:
        100.1.0
      • setReturnGeometry

        public void setReturnGeometry​(boolean returnGeometry)
        Sets whether to return geometries of features in the query result. By default, is true. Excluding geometries may be recommended for queries to a service in order to reduce the amount of information received over a network.
        Parameters:
        returnGeometry - true to return geometries in the result; otherwise false.
        Since:
        100.1.0
      • isReturnGeometry

        public boolean isReturnGeometry()
        Gets whether geometries of features are returned in the query result.
        Returns:
        true if geometries are returned in the result; false otherwise
        Since:
        100.1.0
      • setResultOffset

        public void setResultOffset​(int resultOffset)
        Sets the offset of results to fetch.

        If providing a result offset to support paging of results, you must also set a maximum features value. If result offset is set, but maximum features is not, the offset will be ignored.

        For consistent ordering of results, include a QueryParameters.OrderBy in the list provided by getOrderByFields().

        Parameters:
        resultOffset - the offset of results to fetch
        Since:
        100.2.1
      • getResultOffset

        public int getResultOffset()
        Gets the starting offset of results to fetch.

        If providing a result offset to support paging of results, you must also set a maximum features value. If result offset is set, but maximum features is not, the offset will be ignored.

        Returns:
        the offset of results to fetch
        Since:
        100.2.1
      • setMaxFeatures

        public void setMaxFeatures​(int maxFeatures)
        Sets the maximum number of features to be included in the result. If 0, then there is no limit set on the number of features.

        For consistent ordering of results when using pagination, you should also provide value(s) for the order by field(s). See getOrderByFields().

        If providing a maximum features value to support paging of results, you should also set a result offset. See getResultOffset().

        If maximum features is set, but result offset is not, the result may contain local features in place of server features if they satisfy the query. To ensure strict paging of server features, specify both maximum features and result offset.

        Parameters:
        maxFeatures - the maximum number of features to be included in the result, 0 for no limit
        Throws:
        IllegalArgumentException - if maxFeatures is less than 0
        Since:
        100.2.1
        See Also:
        getMaxFeatures()
      • getMaxFeatures

        public int getMaxFeatures()
        Gets the maximum number of features to be included in the result.

        For consistent ordering of results when using pagination, you should also provide value(s) for the order by field(s). See getOrderByFields().

        If providing a maximum features value to support paging of results, you should also set a result offset. See getResultOffset().

        If maximum features is set, but result offset is not, the result may contain local features in place of server features if they satisfy the query. To ensure strict paging of server features, specify both maximum features and result offset.

        Returns:
        the maximum number of features to be included in the result
        Since:
        100.2.1
        See Also:
        setMaxFeatures(int)