Class TxnQuery
Provides a transaction value object query class.
Examples
Please find the transaction query examples about list, get first and count below.
Transaction Query List Example
This Groovy example shows how to list transactions matching certain criteria ordered descending by id (maximum number of 150 records).
import com.avoka.tm.query.* import com.avoka.tm.vo.* List<Txn> txns = new TxnQuery() .setFormVersionNumber("2.0") .setFetchLimit(150) .addOrderByDesc("id") .listValues() // In JSON format String txnsReady = new TxnQuery() .setFormVersionNumber("2.0") .setDeliveryStatus("Ready") .setUserLoginName("[email protected]") .setSpaceName("Work Space") .listJson()
Transaction Query First Example
This Groovy example shows how to get first transaction matching certain criteria ordered descending by id.
import com.avoka.tm.query.* import com.avoka.tm.vo.* Txn txn = new TxnQuery() .setFormVersionNumber("3.2") .addOrderByDesc("id") .firstValue() // In JSON format String txnReady = new TxnQuery() .setFormVersionNumber("2.0") .setDeliveryStatus(Txn.DELIVERY_READY) .firstJson()
Transaction Query Count Example
This Groovy example shows how to count all transactions matching certain criteria.
import com.avoka.tm.query.* int readyCount = new TxnQuery() .setFormVersionNumber("2.0") .setDeliveryStatus(Txn.DELIVERY_READY) .count()
Transaction Query Job Example
The example below returns the list of transactions associated the job reference number.
import com.avoka.tm.query.* import com.avoka.tm.vo.* List<Txn> txns = new TxnQuery() .setJobRefNumber("L9MKYT") .listValues()
The example below returns the list of transactions associated the specified job step.
import com.avoka.tm.query.* import com.avoka.tm.vo.* Job job = new JobQuery() .setJobRefNumber("L9MKYT") .firstValue() JobStep jobStep = job.jobSteps.get(1) List<Txn> txns = new TxnQuery() .setJobStep(jobStep) .listValues()
Transaction Query "With" Example
For performance reasons TxnQuery does not load all of the Txn properties (formDataMap, formXml, receiptPdf, fileAttachList etc. or all of them) by default. Note the capability of withXYZ()
methods for loading necessary transaction attributes.
This Groovy example shows how to query transactions and load their form data map and receipt pdf.
import com.avoka.tm.query.* import com.avoka.tm.vo.* Txn txn = new TxnQuery() .setFormVersionNumber("2.0") .setDeliveryStatus(Txn.DELIVERY_READY) .withFormDataMap() .withReceiptPdf() .firstValue() byte[] receiptPdf = txn.receiptPdf
This Groovy example shows how to query transactions and load all transaction attributes (fileAttachList, formDataMap, formXml, groupNames, propertyMap, receiptPdf).
import com.avoka.tm.query.* import com.avoka.tm.vo.* String txnJson = new TxnQuery() .setFormVersionNumber("2.0") .setDeliveryStatus(Txn.DELIVERY_READY) .withAll() .firstJson() String formXml = txn.formXml byte[] receiptPdf = txn.receiptPdf
- Since:
- 5.0.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The startDate and endDate filter time type. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd the group name to the transaction query so that only transactions belonging to the form group are included.addOrderByAsc
(String orderProperty) Add the sort order by ascending to the query.addOrderByDesc
(String orderProperty) Add the sort order by descending to the query.int
count()
Execute a select count query and return the total number of records selected by the query.Execute the query and return the first transaction JSON value.Execute the query and return the first transaction value object for the query.hasDataExtract
(String name) Set data extract name parameter.hasDataExtractNameValue
(String name, String value) Set data extract name/value parameter.hasDataExtractValue
(String value) Set data extract name parameter.hasNoProperty
(String name) Set has none of the property names in this query filter parameter.hasProperty
(String name) Set property name parameter.hasPropertyNameValue
(String name, String value) Set property name/value parameter.hasPropertyValue
(String value) Set property value parameter.listJson()
Execute the query and return an transactions JSON array list.Execute the transaction query and return a list of Txn value objects.setAttachmentsStatus
(String attachmentsStatus) Set the transaction attachment status query parameter [ Required | Optional | Completed ].setDeliveryStatus
(String deliveryStatus) Set the transaction delivery status query parameter [ Not Ready | Ready | Sent_Email | In Progress | Pending | Completed | Error | Undeliverable | Not Required ].setEmailAddress
(String emailAddress) Set the contact email address query parameters.setEndDate
(Date date) Set the transaction end date filter (defaults to request time).setFetchLimit
(int fetchLimit) Set the query fetch limit to limit the maximum number of records returned.setFormCode
(String formCode) Set the form code query parameter.setFormStatus
(String formStatus) Set the transaction form status query parameter [ Assigned | Opened | Saved | Submitted | Completed | Expired | Abandoned ].setFormVersionNumber
(String formVersionNumber) Set the form version number query parameter.Set the transaction id (PK) query parameter.setJobRefNumber
(String jobRefNumber) Set the job reference number query parameter.setJobStep
(JobStep jobStep) Set the job step query parameter.setLinkedTxnId
(Number linkedTxnId) Set the transaction linkedTxnId query parameter.setMilestone
(String milestone) Set the transaction milestone query parameter.setPaymentStatus
(String paymentStatus) Set the transaction payment status query parameter [ Required | Completed | Error | Pending ].setReceiptNumber
(String receiptNumber) Set the transaction receipt number query parameter.setSpaceName
(String spaceName) Set the form space name query parameter.setStartDate
(Date date) Set the transaction time start date filter (defaults to request time).setSubmitKey
(String submitKey) Set the transaction submission key (GUID) query parameter.setTaskClaimed
(Boolean taskClaimed) Set whether to filter for claimable tasks which have been either claimed or not claimed.setTime
(TxnQuery.Time time) setTrackingCode
(String trackingCode) Set the transaction tracking code query parameter.Set the transaction query parameter.setTxnReferenceNumber
(String txnReferenceNumber) Set the transaction reference number query parameter.setUserLoginName
(String userLoginName) Set the transaction user's login name (username).setUserSaved
(boolean userSaved) Set the user saved query parameter.withAll()
Set the query to return the transaction with all the associated attachments map, form data map, form XML, group names, property map and receipt PDF data.Set the query to return the transaction with the associated transaction workspaces comments.Set the query to return the transaction with the associated transaction delivery functions.Set the query to return the transaction with the associated file attachment list.Set the query to return the transaction with the associated form data map information.Set the query to return the transaction with the associated form XML information.Set the query to return the transaction with the associated group names information.Set the query to return the transaction with the associated property map information.Set the query to return the transaction with the associated receipt PDF data.
-
Constructor Details
-
TxnQuery
-
-
Method Details
-
setAttachmentsStatus
Set the transaction attachment status query parameter [ Required | Optional | Completed ].- Parameters:
attachmentsStatus
- the attachments status- Returns:
- the transaction query
-
setEmailAddress
Set the contact email address query parameters.- Parameters:
emailAddress
- the contact address query parameter- Returns:
- the transaction query
-
setDeliveryStatus
Set the transaction delivery status query parameter [ Not Ready | Ready | Sent_Email | In Progress | Pending | Completed | Error | Undeliverable | Not Required ].- Parameters:
deliveryStatus
- the delivery status query parameter- Returns:
- the transaction query
-
setFormCode
Set the form code query parameter.- Parameters:
formCode
- the form code query parameter- Returns:
- the transaction query
-
setFormStatus
Set the transaction form status query parameter [ Assigned | Opened | Saved | Submitted | Completed | Expired | Abandoned ].- Parameters:
formStatus
- the form status query parameter- Returns:
- the transaction query
-
addGroup
Add the group name to the transaction query so that only transactions belonging to the form group are included. Filtering on multiple groups is supported.- Parameters:
groupName
- the group name to query parameter- Returns:
- the transaction query
- Since:
- 17.10.0
-
setId
Set the transaction id (PK) query parameter.- Parameters:
id
- the transaction id (PK) query parameter- Returns:
- the transaction query
-
setLinkedTxnId
Set the transaction linkedTxnId query parameter.- Parameters:
linkedTxnId
- the transaction linkedTxnId query parameter- Returns:
- the transaction query
- Since:
- 21.11
-
setTxn
Set the transaction query parameter.- Parameters:
txn
- the transaction query parameter (required)- Returns:
- the transaction query
-
setJobStep
Set the job step query parameter.- Parameters:
jobStep
- the job step query parameter- Returns:
- the transaction query
-
setJobRefNumber
Set the job reference number query parameter.- Parameters:
jobRefNumber
- the job reference number query parameter- Returns:
- the transaction query
-
setUserLoginName
Set the transaction user's login name (username).- Parameters:
userLoginName
- the transaction user's login name (username).- Returns:
- the transaction query
-
setPaymentStatus
Set the transaction payment status query parameter [ Required | Completed | Error | Pending ].- Parameters:
paymentStatus
- the transaction payment status query parameter- Returns:
- the transaction query
-
setReceiptNumber
Set the transaction receipt number query parameter.- Parameters:
receiptNumber
- the transaction receipt number query parameter- Returns:
- the transaction query
-
setSubmitKey
Set the transaction submission key (GUID) query parameter.- Parameters:
submitKey
- the transaction submission key (GUID) query parameter- Returns:
- the transaction query
-
setTrackingCode
Set the transaction tracking code query parameter.- Parameters:
trackingCode
- the transaction tracking code query parameter- Returns:
- the transaction query
-
setTxnReferenceNumber
Set the transaction reference number query parameter.- Parameters:
txnReferenceNumber
- the transaction reference number query parameter- Returns:
- the transaction query
-
setFormVersionNumber
Set the form version number query parameter.- Parameters:
formVersionNumber
- the form version number query parameter- Returns:
- the transaction query
-
setSpaceName
Set the form space name query parameter.- Parameters:
spaceName
- the form space name query parameter- Returns:
- the transaction query
-
setUserSaved
Set the user saved query parameter.- Parameters:
userSaved
- the the user saved query parameter- Returns:
- the transaction query
- Since:
- 5.1.3
-
setMilestone
Set the transaction milestone query parameter.- Parameters:
milestone
- the transaction milestone- Returns:
- the transaction query
- Since:
- 17.10.0
-
setTaskClaimed
Set whether to filter for claimable tasks which have been either claimed or not claimed. Applying this filter will exclude any transactions which are not claimable. Please note claimable transactions are for authenticated users only, and not for anonymous (email) tasks.- Parameters:
taskClaimed
- the task claimed status- Returns:
- the transaction query
- Since:
- 18.11.0
-
hasProperty
Set property name parameter.- Parameters:
name
- the property name query parameter- Returns:
- the transaction query
- Since:
- 5.0.1
-
hasPropertyValue
Set property value parameter.- Parameters:
value
- the property value query parameter- Returns:
- the transaction query
- Since:
- 5.0.1
-
hasPropertyNameValue
Set property name/value parameter.- Parameters:
name
- the property name query parametervalue
- the property value query parameter- Returns:
- the transaction query
- Since:
- 19.05
-
hasDataExtract
Set data extract name parameter.- Parameters:
name
- the data extract name query parameter- Returns:
- the transaction query
- Since:
- 19.05
-
hasDataExtractValue
Set data extract name parameter.- Parameters:
value
- the data extract value query parameter- Returns:
- the transaction query
- Since:
- 19.05
-
hasDataExtractNameValue
Set data extract name/value parameter.- Parameters:
name
- the data extract name query parametervalue
- the data extract value query parameter- Returns:
- the transaction query
- Since:
- 19.05
-
hasNoProperty
Set has none of the property names in this query filter parameter.- Parameters:
name
- the has not property name query parameter- Returns:
- the transaction query
- Since:
- 5.1.10
-
setStartDate
Set the transaction time start date filter (defaults to request time).- Parameters:
date
- the transaction start date filter (defaults to request time)- Returns:
- the transaction query
- Since:
- 17.10.0
-
setEndDate
Set the transaction end date filter (defaults to request time).- Parameters:
date
- the transaction end date filter (defaults to request time)- Returns:
- the transaction query
- Since:
- 17.10.0
-
setTime
- Parameters:
time
- the time to set (defaults to request time)- Returns:
- the transaction query
- Since:
- 17.10.0
-
setFetchLimit
Set the query fetch limit to limit the maximum number of records returned. The default query fetch limit is 100 records. The maximum fetch limit is 10,000 records.- Parameters:
fetchLimit
- the query fetch limit- Returns:
- the transaction query
-
withAll
@FluentSecurityPermission(permissions={"submission-data-view","submission-xml-data-view"}) public TxnQuery withAll()Set the query to return the transaction with all the associated attachments map, form data map, form XML, group names, property map and receipt PDF data.- Returns:
- the transaction query
-
withFormDataMap
Set the query to return the transaction with the associated form data map information.- Returns:
- the transaction query
-
withFormXml
Set the query to return the transaction with the associated form XML information.- Returns:
- the transaction query
-
withGroupNames
Set the query to return the transaction with the associated group names information.- Returns:
- the transaction query
-
withPropertyMap
Set the query to return the transaction with the associated property map information.- Returns:
- the transaction query
-
withReceiptPdf
Set the query to return the transaction with the associated receipt PDF data.- Returns:
- the transaction query
-
withFileAttachList
Set the query to return the transaction with the associated file attachment list.- Returns:
- the transaction query
-
withDeliveryFuncs
Set the query to return the transaction with the associated transaction delivery functions.- Returns:
- the transaction query
- Since:
- 17.10.0
-
withComments
Set the query to return the transaction with the associated transaction workspaces comments.- Returns:
- the transaction query
- Since:
- 19.11.0
-
addOrderByAsc
Add the sort order by ascending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the transaction query
-
addOrderByDesc
Add the sort order by descending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the transaction query
-
count
public int count()Execute a select count query and return the total number of records selected by the query. Does not support count queries with more than one property.- Returns:
- the total number of records selected by the query
-
listValues
Execute the transaction query and return a list of Txn value objects. Can result in less records returned than defined by the fetch limit.- Returns:
- execute the transaction query and return a list of Txn value objects
-
listJson
Execute the query and return an transactions JSON array list.- Returns:
- execute the query and return an transactions JSON array list
-
firstValue
Execute the query and return the first transaction value object for the query.- Returns:
- execute the query and return the first transaction value object for the query
-
firstJson
Execute the query and return the first transaction JSON value.- Returns:
- execute the query and return the first transaction JSON value
-