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:
- Form Version Property Value
- Organization Property Value
- Space Property Value
- 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 Summary
Constructors Constructor Description PropertyQuery()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getValue()
Return the property value for the query parameters.PropertyQuery
setCacheTimeout(int timeoutMins)
Set the property query cache timeout in minutes.PropertyQuery
setClientCode(String clientCode)
Set the organization client code parameter.PropertyQuery
setFormCode(String formCode)
Set the form code parameter.PropertyQuery
setName(String name)
Set the property name parameter.PropertyQuery
setSpaceName(String spaceName)
Set the property space name parameter.PropertyQuery
setTxn(Txn txn)
Set the transaction to resolve the property value against.
-
-
-
Method Detail
-
setName
public PropertyQuery setName(String name)
Set the property name parameter.- Parameters:
name
- the property name- Returns:
- the property query
-
setFormCode
public PropertyQuery setFormCode(String formCode)
Set the form code parameter.- Parameters:
formCode
- the property form code- Returns:
- the property query
-
setClientCode
public PropertyQuery setClientCode(String clientCode)
Set the organization client code parameter.- Parameters:
clientCode
- the property client code- Returns:
- the property query
-
setSpaceName
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
-
-