Class TxnQuery
public class TxnQuery
extends java.lang.Object
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("john.smith@avoka.com")
.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 ofwithXYZ()
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:
Txn
Nested Class Summary
Nested ClassesModifier and Type | Class | Description |
---|---|---|
static class |
TxnQuery.Time |
The startDate and endDate filter time type. |
Constructor Summary
ConstructorsConstructor | Description |
---|---|
TxnQuery() |
Method Summary
All Methods Instance Methods Concrete MethodsModifier and Type | Method | Description |
---|---|---|
TxnQuery |
addGroup(java.lang.String groupName) |
Add the group name to the transaction query so that only transactions belonging to the form group are included. |
TxnQuery |
addOrderByAsc(java.lang.String orderProperty) |
Add the sort order by ascending to the query. |
TxnQuery |
addOrderByDesc(java.lang.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. |
java.lang.String |
firstJson() |
Execute the query and return the first transaction JSON value. |
Txn |
firstValue() |
Execute the query and return the first transaction value object for the query. |
TxnQuery |
hasNoProperty(java.lang.String name) |
Set has no property name query filter parameter. |
TxnQuery |
hasProperty(java.lang.String name) |
Set property name parameter. |
java.lang.String |
listJson() |
Execute the query and return an transactions JSON array list. |
java.util.List<Txn> |
listValues() |
Execute the transaction query and return a list of Txn value objects. |
TxnQuery |
setAttachmentsStatus(java.lang.String attachmentsStatus)
|
Set the transaction attachment status query parameter [ Required | Optional | Completed ]. |
TxnQuery |
setDeliveryStatus(java.lang.String deliveryStatus) |
Set the transaction delivery status query parameter [ Not Ready | Ready | Sent_Email | In Progress | Pending | Completed | Error | Undeliverable | Not Required ]. |
TxnQuery |
setEmailAddress(java.lang.String emailAddress) |
Set the contact email address query parameters. |
TxnQuery |
setEndDate(java.util.Date date) |
Set the transaction end date filter (defaults to request time). |
TxnQuery |
setFetchLimit(int fetchLimit) |
Set the query fetch limit to limit the maximum number of records returned. |
TxnQuery |
setFormCode(java.lang.String formCode) |
Set the form code query parameter. |
TxnQuery |
setFormStatus(java.lang.String formStatus) |
Set the transaction form status query parameter [ Assigned | Opened | Saved | Submitted | Completed | Expired | Abandoned ]. |
TxnQuery |
setFormVersionNumber(java.lang.String formVersionNumber)
|
Set the form version number query parameter. |
TxnQuery |
setId(java.lang.Number id) |
Set the transaction id (PK) query parameter. |
TxnQuery |
setJobRefNumber(java.lang.String jobRefNumber) |
Set the job reference number query parameter. |
TxnQuery |
setJobStep(JobStep jobStep) |
Set the job step query parameter. |
TxnQuery |
setMilestone(java.lang.String milestone) |
Set the transaction milestone query parameter. |
TxnQuery |
setPaymentStatus(java.lang.String paymentStatus) |
Set the transaction payment status query parameter [ Required | Completed | Error | Pending ]. |
TxnQuery |
setReceiptNumber(java.lang.String receiptNumber) |
Set the transaction receipt number query parameter. |
TxnQuery |
setSpaceName(java.lang.String spaceName) |
Set the form space name query parameter. |
TxnQuery |
setStartDate(java.util.Date date) |
Set the transaction time start date filter (defaults to request time). |
TxnQuery |
setSubmitKey(java.lang.String submitKey) |
Set the transaction submission key (GUID) query parameter. |
TxnQuery |
setTaskClaimed(java.lang.Boolean taskClaimed) |
Set whether to filter for claimable tasks which have been either claimed or not claimed. |
TxnQuery |
setTime(TxnQuery.Time time) |
|
TxnQuery |
setTrackingCode(java.lang.String trackingCode) |
Set the transaction tracking code query parameter. |
TxnQuery |
setTxn(Txn txn) |
Set the transaction query parameter. |
TxnQuery |
setTxnReferenceNumber(java.lang.String txnReferenceNumber)
|
Set the transaction reference number query parameter. |
TxnQuery |
setUserLoginName(java.lang.String userLoginName) |
Set the transaction user's login name (username). |
TxnQuery |
setUserSaved(boolean userSaved) |
Set the user saved query parameter. |
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. |
TxnQuery |
withDeliveryFuncs() |
Set the query to return the transaction with the associated transaction delivery functions. |
TxnQuery |
withFileAttachList() |
Set the query to return the transaction with the associated file attachment list. |
TxnQuery |
withFormDataMap() |
Set the query to return the transaction with the associated form data map information. |
TxnQuery |
withFormXml() |
Set the query to return the transaction with the associated form XML information. |
TxnQuery |
withGroupNames() |
Set the query to return the transaction with the associated group names information. |
TxnQuery |
withPropertyMap() |
Set the query to return the transaction with the associated property map information. |
TxnQuery |
withReceiptPdf() |
Set the query to return the transaction with the associated receipt PDF data. |
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString,
wait, wait, wait
Constructor Detail
TxnQuery
public TxnQuery()
Method Detail
setAttachmentsStatus
public TxnQuery setAttachmentsStatus(java.lang.String attachmentsStatus)
Set the transaction attachment status query parameter [ Required | Optional |
Completed ].
- Parameters:
attachmentsStatus
- the attachments status- Returns:
- the transaction query
setEmailAddress
public TxnQuery setEmailAddress(java.lang.String emailAddress)
Set the contact email address query parameters.
- Parameters:
emailAddress
- the contact address query parameter- Returns:
- the transaction query
setDeliveryStatus
public TxnQuery setDeliveryStatus(java.lang.String deliveryStatus)
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
public TxnQuery setFormCode(java.lang.String formCode)
Set the form code query parameter.
- Parameters:
formCode
- the form code query parameter- Returns:
- the transaction query
setFormStatus
public TxnQuery setFormStatus(java.lang.String formStatus)
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
public TxnQuery addGroup(java.lang.String groupName)
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
public TxnQuery setId(java.lang.Number id)
Set the transaction id (PK) query parameter.
- Parameters:
id
- the transaction id (PK) query parameter- Returns:
- the transaction query
setTxn
public TxnQuery setTxn(Txn txn)
Set the transaction query parameter.
- Parameters:
txn
- the transaction query parameter (required)- Returns:
- the transaction query
setJobStep
public TxnQuery setJobStep(JobStep jobStep)
Set the job step query parameter.
- Parameters:
jobStep
- the job step query parameter- Returns:
- the transaction query
setJobRefNumber
public TxnQuery setJobRefNumber(java.lang.String jobRefNumber)
Set the job reference number query parameter.
- Parameters:
jobRefNumber
- the job reference number query parameter- Returns:
- the transaction query
setUserLoginName
public TxnQuery setUserLoginName(java.lang.String userLoginName)
Set the transaction user's login name (username).
- Parameters:
-
userLoginName
- the transaction user's login name (username). - Returns:
- the transaction query
setPaymentStatus
public TxnQuery setPaymentStatus(java.lang.String paymentStatus)
Set the transaction payment status query parameter [ Required | Completed |
Error | Pending ].
- Parameters:
-
paymentStatus
- the transaction payment status query parameter - Returns:
- the transaction query
setReceiptNumber
public TxnQuery setReceiptNumber(java.lang.String receiptNumber)
Set the transaction receipt number query parameter.
- Parameters:
-
receiptNumber
- the transaction receipt number query parameter - Returns:
- the transaction query
setSubmitKey
public TxnQuery setSubmitKey(java.lang.String submitKey)
Set the transaction submission key (GUID) query parameter.
- Parameters:
-
submitKey
- the transaction submission key (GUID) query parameter - Returns:
- the transaction query
setTrackingCode
public TxnQuery setTrackingCode(java.lang.String trackingCode)
Set the transaction tracking code query parameter.
- Parameters:
-
trackingCode
- the transaction tracking code query parameter - Returns:
- the transaction query
setTxnReferenceNumber
public TxnQuery setTxnReferenceNumber(java.lang.String txnReferenceNumber)
Set the transaction reference number query parameter.
- Parameters:
-
txnReferenceNumber
- the transaction reference number query parameter - Returns:
- the transaction query
setFormVersionNumber
public TxnQuery setFormVersionNumber(java.lang.String formVersionNumber)
Set the form version number query parameter.
- Parameters:
-
formVersionNumber
- the form version number query parameter - Returns:
- the transaction query
setSpaceName
public TxnQuery setSpaceName(java.lang.String spaceName)
Set the form space name query parameter.
- Parameters:
spaceName
- the form space name query parameter- Returns:
- the transaction query
setUserSaved
public TxnQuery setUserSaved(boolean userSaved)
Set the user saved query parameter.
- Parameters:
userSaved
- the the user saved query parameter- Returns:
- the transaction query
- Since:
- 5.1.3
setMilestone
public TxnQuery setMilestone(java.lang.String milestone)
Set the transaction milestone query parameter.
- Parameters:
milestone
- the transaction milestone- Returns:
- the transaction query
- Since:
- 17.10.0
setTaskClaimed
public TxnQuery setTaskClaimed(java.lang.Boolean taskClaimed)
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
public TxnQuery hasProperty(java.lang.String name)
Set property name parameter.
- Parameters:
name
- the property name query parameter- Returns:
- the transaction query
- Since:
- 5.0.1
hasNoProperty
public TxnQuery hasNoProperty(java.lang.String name)
Set has no property name query filter parameter.
- Parameters:
name
- the has not property name query parameter- Returns:
- the transaction query
- Since:
- 5.1.10
setStartDate
public TxnQuery setStartDate(java.util.Date date)
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
public TxnQuery setEndDate(java.util.Date date)
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
public TxnQuery setTime(TxnQuery.Time time)
- Parameters:
time
- the time to set (defaults to request time)- Returns:
- the transaction query
- Since:
- 17.10.0
setFetchLimit
public TxnQuery setFetchLimit(int fetchLimit)
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
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
public TxnQuery withFormDataMap()
Set the query to return the transaction with the associated form data map
information.
- Returns:
- the transaction query
withFormXml
public TxnQuery withFormXml()
Set the query to return the transaction with the associated form XML
information.
- Returns:
- the transaction query
withGroupNames
public TxnQuery withGroupNames()
Set the query to return the transaction with the associated group names
information.
- Returns:
- the transaction query
withPropertyMap
public TxnQuery withPropertyMap()
Set the query to return the transaction with the associated property map
information.
- Returns:
- the transaction query
withReceiptPdf
public TxnQuery withReceiptPdf()
Set the query to return the transaction with the associated receipt PDF data.
- Returns:
- the transaction query
withFileAttachList
public TxnQuery withFileAttachList()
Set the query to return the transaction with the associated file attachment
list.
- Returns:
- the transaction query
withDeliveryFuncs
public TxnQuery withDeliveryFuncs()
Set the query to return the transaction with the associated transaction delivery
functions.
- Returns:
- the transaction query
- Since:
- 17.10.0
addOrderByAsc
public TxnQuery addOrderByAsc(java.lang.String orderProperty)
Add the sort order by ascending to the query.
- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the transaction query
addOrderByDesc
public TxnQuery addOrderByDesc(java.lang.String orderProperty)
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
public java.util.List<Txn> 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
public java.lang.String listJson()
Execute the query and return an transactions JSON array list.
- Returns:
- execute the query and return an transactions JSON array list
firstValue
public Txn 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
public java.lang.String firstJson()
Execute the query and return the first transaction JSON value.
- Returns:
- execute the query and return the first transaction JSON value