Class PropertyQuery

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

public class PropertyQuery extends Object

Provides a property value query service.

Property values are cached in memory for a period of 30 seconds to improve database performance.

Examples

Example scripts are provided below.

Form Property Example

The example below get the "Product Codes" form version property value for the form's current form version. The property value may be use in Form Prefill or Dynamic Data services.

 import com.avoka.tm.query.*

 String value = new PropertyQuery()
     .setName("Product Codes")
     .setFormCode("PDS-12")
     .getValue() 

Organization Property Example

The example below will get the "Loan Types" Organization property value.

 import com.avoka.tm.query.*

 String value = new PropertyQuery()
     .setName("Loan Types")
     .setClientCode("maguire")
     .getValue() 

Form Space Property Example

The example below will get the "Locale Messages" Form Space property value.

 import com.avoka.tm.query.*

 String value = new PropertyQuery()
     .setName("Locale Messages")
     .setSpaceName("Work Space")
     .getValue() 

Transaction Property Lookup Example

The example below will get the "Saved Email" via the specified Txn value object. This method will attempt to resolve the property value, which this transaction has inherited from, in the following order:

  1. Form Version Property Value
  2. Organization Property Value
  3. Space Property Value
  4. Deployment Property Value

If the specified property is not found, null will be returned.

Note, this method doesn't query the txn properties set on the transaction itself, so null will be returned.

Note, To query the txn properties, use TxnQuery().withPropertyMap() or TxnQuery().withAll() APIs.

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

 Txn txn = ...

 String value = new PropertyQuery()
     .setName("Saved Email")
     .setTxn(txn)
     .getValue() 

Cached Organization Reference Data Example

The example below will get the "maguire" organization's "Product Codes" reference data. This query data will be cache the value in memory for a period 60 minutes.

 import com.avoka.tm.query.*

 String refData = new PropertyQuery()
     .setName("Product Codes")
     .setClientCode("maguire")
     .setCacheTimeout(60)
     .getValue() 
Since:
5.0.0
See Also:
  • Constructor Details

    • PropertyQuery

      public PropertyQuery()
  • Method Details

    • setName

      public PropertyQuery setName(String name)
      Set the property name parameter.
      Parameters:
      name - the property name
      Returns:
      the property query
    • setFormCode

      @FluentSecurityPermission(permissions="form-view") public PropertyQuery setFormCode(String formCode)
      Set the form code parameter.
      Parameters:
      formCode - the property form code
      Returns:
      the property query
    • setClientCode

      @FluentSecurityPermission(permissions="organization-property-view") public PropertyQuery setClientCode(String clientCode)
      Set the organization client code parameter.
      Parameters:
      clientCode - the property client code
      Returns:
      the property query
    • setSpaceName

      @FluentSecurityPermission(permissions="organization-view") public PropertyQuery setSpaceName(String spaceName)
      Set the property space name parameter.
      Parameters:
      spaceName - the property space name
      Returns:
      the property query
    • setTxn

      public PropertyQuery setTxn(Txn txn)
      Set the transaction to resolve the property value against.
      Parameters:
      txn - the transaction to resolve the property against
      Returns:
      the property query
    • setCacheTimeout

      public PropertyQuery setCacheTimeout(int timeoutMins)
      Set the property query cache timeout in minutes.
      Parameters:
      timeoutMins - the query cache timeout in minutes, must be a positive value.
      Returns:
      the property query
    • getValue

      public String getValue()
      Return the property value for the query parameters.
      Returns:
      the property value for the query parameter