Class CosmosQuery


  • public class CosmosQuery
    extends Object
    Class for cosmos query
    • Constructor Detail

      • CosmosQuery

        public CosmosQuery​(@NonNull
                           Criteria criteria)
        Initialization
        Parameters:
        criteria - object
    • Method Detail

      • getCriteria

        public Criteria getCriteria()
        To get Criteria object
        Returns:
        Criteria
      • getSort

        public org.springframework.data.domain.Sort getSort()
        To get Sort object
        Returns:
        Sort
      • getPageable

        public org.springframework.data.domain.Pageable getPageable()
        To get Pageable object
        Returns:
        Pageable
      • getLimit

        public int getLimit()
        To get limit number
        Returns:
        int limit
      • setLimit

        public void setLimit​(int limit)
        To set limit number
        Parameters:
        limit - int
      • with

        public CosmosQuery with​(@NonNull
                                org.springframework.data.domain.Sort sort)
        With Sort
        Parameters:
        sort - Sort
        Returns:
        DocumentQuery object
      • with

        public CosmosQuery with​(@NonNull
                                org.springframework.data.domain.Pageable pageable)
        With Sort
        Parameters:
        pageable - Sort
        Returns:
        DocumentQuery object
      • isCrossPartitionQuery

        public boolean isCrossPartitionQuery​(@NonNull
                                             List<String> partitionKeys)
        Indicate if DocumentQuery should enable cross partition query.
        Parameters:
        partitionKeys - The list of partitionKey names.
        Returns:
        If DocumentQuery should enable cross partition query
      • hasPartitionKeyCriteria

        public boolean hasPartitionKeyCriteria​(@NonNull
                                               String partitionKeyFieldName)
        Returns true if this criteria or sub-criteria has partition key field present as one of the subjects.
        Parameters:
        partitionKeyFieldName - partition key field name
        Returns:
        returns true if this criteria or sub criteria has partition key field present as one of the subjects.
      • getPartitionKeyValue

        public <T> Optional<Object> getPartitionKeyValue​(@NonNull
                                                         Class<T> domainType)
        Returns partition key value based on the criteria.
        Type Parameters:
        T - entity class type
        Parameters:
        domainType - domain type
        Returns:
        Optional of partition key value
      • getCriteriaByType

        public Optional<Criteria> getCriteriaByType​(@NonNull
                                                    CriteriaType criteriaType)
        To get criteria by type
        Parameters:
        criteriaType - the criteria type
        Returns:
        Optional