Class 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:
    MemCache
    • Constructor Detail

      • PropertyQuery

        public PropertyQuery()
    • Method Detail

      • setName

        public PropertyQuery setName​(String name)
        Set the property name parameter.
        Parameters:
        name - the property 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