Class TxnQuery


  • public class TxnQuery
    extends 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("[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:
    Txn
    • Constructor Detail

      • TxnQuery

        public TxnQuery()
    • Method Detail

      • setAttachmentsStatus

        public TxnQuery setAttachmentsStatus​(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​(String emailAddress)
        Set the contact email address query parameters.
        Parameters:
        emailAddress - the contact address query parameter
        Returns:
        the transaction query
      • setDeliveryStatus

        public TxnQuery setDeliveryStatus​(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​(String formCode)
        Set the form code query parameter.
        Parameters:
        formCode - the form code query parameter
        Returns:
        the transaction query
      • setFormStatus

        public TxnQuery setFormStatus​(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​(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​(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​(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​(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​(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​(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​(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​(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​(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​(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​(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​(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​(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​(String name)
        Set property name parameter.
        Parameters:
        name - the property name query parameter
        Returns:
        the transaction query
        Since:
        5.0.1
      • hasPropertyValue

        public TxnQuery hasPropertyValue​(String value)
        Set property value parameter.
        Parameters:
        value - the property value query parameter
        Returns:
        the transaction query
        Since:
        5.0.1
      • hasPropertyNameValue

        public TxnQuery hasPropertyNameValue​(String name,
                                             String value)
        Set property name/value parameter.
        Parameters:
        name - the property name query parameter
        value - the property value query parameter
        Returns:
        the transaction query
        Since:
        19.05
      • hasDataExtract

        public TxnQuery hasDataExtract​(String name)
        Set data extract name parameter.
        Parameters:
        name - the data extract name query parameter
        Returns:
        the transaction query
        Since:
        19.05
      • hasDataExtractValue

        public TxnQuery hasDataExtractValue​(String value)
        Set data extract name parameter.
        Parameters:
        value - the data extract value query parameter
        Returns:
        the transaction query
        Since:
        19.05
      • hasDataExtractNameValue

        public TxnQuery hasDataExtractNameValue​(String name,
                                                String value)
        Set data extract name/value parameter.
        Parameters:
        name - the data extract name query parameter
        value - the data extract value query parameter
        Returns:
        the transaction query
        Since:
        19.05
      • hasNoProperty

        public TxnQuery hasNoProperty​(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​(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​(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
      • withComments

        public TxnQuery withComments()
        Set the query to return the transaction with the associated transaction workspaces comments.
        Returns:
        the transaction query
        Since:
        19.11.0
      • addOrderByAsc

        public TxnQuery addOrderByAsc​(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​(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 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 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 String firstJson()
        Execute the query and return the first transaction JSON value.
        Returns:
        execute the query and return the first transaction JSON value