Class GroupQuery


  • public class GroupQuery
    extends Object

    Provides a group query class.

    Examples

    Please find the Group query examples about list, get first and count below.

    Group Query List Example

    This Groovy example shows how to list group matching certain criteria ordered ascending by name (maximum number of 4 records).

     import com.avoka.tm.query.*
     import com.avoka.tm.vo.*
    
     List<Group> groups = new GroupQuery()
         .setFetchLimit(4)
         .addOrderByAsc("name")
         .listValues()
    
     // In JSON format
     String groupsJson = new GroupQuery()
         .setFetchLimit(4)
         .addOrderByAsc("name")
         .listJson() 

    Group Query First Example

    This Groovy example shows how to get first group matching certain criteria ordered descending by id.

     import com.avoka.tm.query.*
     import com.avoka.tm.vo.*
    
     Group group = new GroupQuery()
         .setName(groupName)
         .firstValue()
    
     // In JSON format
     String groupJson = new GroupQuery()
         .setName(groupName)
         .firstJson()  
    Since:
    18.11.0
    See Also:
    Group
    • Method Detail

      • setId

        public GroupQuery setId​(Long id)
        Set the group id (PK) query parameter.
        Parameters:
        id - the group id (PK) query parameter
        Returns:
        the group query
      • setName

        public GroupQuery setName​(String name)
        Set the group name query parameter.
        Parameters:
        name - the group name query parameter
        Returns:
        the group query
      • setType

        public GroupQuery setType​(String type)
        Set the group type parameter.
        Parameters:
        type - the group type parameter
        Returns:
        the group query
      • setFetchLimit

        public GroupQuery setFetchLimit​(int fetchLimit)
        Set the query fetch limit to limit the maximum number of records returned. The default query fetch limit is 100 records.
        Parameters:
        fetchLimit - the query fetch limit
        Returns:
        the group query
      • addOrderByAsc

        public GroupQuery addOrderByAsc​(String orderProperty)
        Add the sort order by ascending to the query.
        Parameters:
        orderProperty - the property to sort by (required)
        Returns:
        the group query
      • addOrderByDesc

        public GroupQuery addOrderByDesc​(String orderProperty)
        Add the sort order by descending to the query.
        Parameters:
        orderProperty - the property to sort by (required)
        Returns:
        the group query
      • count

        public int count()
        Execute a select count query and return the total number of records selected by the query.
        Returns:
        the total number of records selected by the query
      • listValues

        public List<Group> listValues()
        Execute the group query and return a list of Group value objects.
        Returns:
        execute the group query and return a list of Group value objects
      • listJson

        public String listJson()
        Execute the query and return a group JSON array list.
        Returns:
        execute the query and return a group JSON array list
      • firstValue

        public Group firstValue()
        Execute the query and return the first group value object for the query.
        Returns:
        execute the query and return the first group value object for the query
      • firstJson

        public String firstJson()
        Execute the query and return the first group JSON value.
        Returns:
        execute the query and return the first group JSON value