Class FormQuery

java.lang.Object
com.avoka.tm.query.FormQuery

public class FormQuery extends Object

Provides a form value object query class.

Examples

Please find the form query examples of listValues and listJson below.

Form Query List Example

This Groovy example shows how to list forms sorted by name, with the result set limited to a maximum of 50 records.

 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*
 

List forms = new FormQuery() .addOrderByAsc("name") .setFetchLimit(50) .listValues()

// In JSON format String FormsJson = new FormQuery() .addOrderByAsc("name") .setFetchLimit(50) .listJson()

Form Query First Example

This Groovy example shows how to get first form matching certain criteria.

 import com.avoka.tm.query.*
 import com.avoka.tm.vo.*
 

Form form = new FormQuery() .setId(1L) .firstValue()

//By name criteria Form form = new FormQuery() .setName("testName") .firstValue()

Form count query Example

This Groovy example shows how to count all forms.

 import com.avoka.tm.query.*
 

int formCount = new FormQuery() .count()

Since:
23.10.0
See Also:
  • Constructor Details

  • Method Details

    • setId

      public FormQuery setId(Long id)
      Set the form id (PK) query parameter.
      Parameters:
      id - the form id (PK) query parameter
      Returns:
      the form query
    • setFormCode

      public FormQuery setFormCode(String formCode)
      Set the form code parameter.
      Parameters:
      formCode - the form code
      Returns:
      the form query
    • setName

      public FormQuery setName(String name)
      Set the name parameter.
      Parameters:
      name - the form name query parameter
      Returns:
      the form query
    • setClientCode

      public FormQuery setClientCode(String clientCode)
      Set the form client code query parameter.
      Parameters:
      clientCode - the form client code query parameter
      Returns:
      the form query
    • setCategoryName

      public FormQuery setCategoryName(String categoryName)
      Set the category name parameter.
      Parameters:
      categoryName - the category name
      Returns:
      the form query
    • setCategoryNames

      public FormQuery setCategoryNames(Set<String> categoryNames)
      Set the category name list parameter.
      Parameters:
      categoryNames - the category names
      Returns:
      the form query
    • setSpaceName

      public FormQuery setSpaceName(String spaceName)
      Set the SpaceName parameter.
      Parameters:
      spaceName - of the hosting Form Space
      Returns:
      the form query
    • setRequest

      public FormQuery setRequest(jakarta.servlet.http.HttpServletRequest request)
      Set the request parameter.
      Parameters:
      request - the servlet request
      Returns:
      the form query
    • setIncludeAllForms

      public FormQuery setIncludeAllForms(boolean includeAllForms)
      Set the includeAllForms parameter. If it sets to true, query includes all inactive clients, inactive or testEnabledFlag form. The default value is false.
      Parameters:
      includeAllForms - the includeAllForms parameter.If it sets to true, query includes all inactive clients, inactive or testEnabledFlag form
      Returns:
      the form query
    • setFetchLimit

      public FormQuery 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 form query
    • withSpaces

      @FluentSecurityPermission(permissions="portal-view") public FormQuery withSpaces()
      Set the query to return the spaces associated with the form.
      Returns:
      the form query.
      Since:
      23.10.0
    • addOrderByAsc

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

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

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

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

      public Form firstValue()
      Execute the query and return the first form value object for the query.
      Returns:
      execute the query and return the first form value object for the query.
    • listValues

      public List<Form> listValues()
      Execute the form query and return a list of form value objects.
      Returns:
      Execute the form query and return a list of form value objects.
    • listValuesForAuthorizedAccess

      public List<Form> listValuesForAuthorizedAccess()
      Execute the form query and return a list of Form value objects the authenticated user is permitted to render.
      Returns:
      execute the form query and return a list of Form value objects