Class TxnUpdater


  • public class TxnUpdater
    extends Object

    Provides a transaction value object updater class.

    Examples

    Please find the transaction updater examples below.

    Set Transaction Delivery Ready

    This Groovy example shows how to update a transaction setting its delivery status to 'Ready'.

     import com.avoka.tm.svc.*
     import com.avoka.tm.vo.*
    
     new TxnUpdater(txn)
         .setDeliveryStatus(Txn.DELIVERY_READY)
         .update() 

    Set Transaction Abandoned

    This Groovy example shows how to update a form status to 'Abandoned'. Note this update() method returns an updated Txn value object. Please note Txn objects are immutable, and you need to refetch them after performing anu updates.

     import com.avoka.tm.svc.*
     import com.avoka.tm.vo.*
    
     new TxnUpdater(txn)
         .setFormStatus(Txn.FORM_ABANDONED)
         .update() 

    Set Transaction to be returned with file attachments after the update

    This Groovy example shows how to update transaction and then get it with the attachments list loaded in the object.

     import com.avoka.tm.svc.*
     import com.avoka.tm.vo.*
    
     Txn txn = new TxnUpdater(txn)
         .setFormStatus(Txn.FORM_ABANDONED)
         .withFileAttachList()
         .update()
    
      txn.fileAttachList 

    This Groovy example shows how to perform an immediate full purge on a transaction.

     import com.avoka.tm.svc.*
     import com.avoka.tm.vo.*
    
     Txn txn2 = new TxnUpdater(txn)
          .setAbandonMode(TxnUpdater.AbandonMode.IMMEDIATE_ADMIN_FULL_PURGE)
          .update(); 
    Since:
    5.0.0
    • Constructor Detail

      • TxnUpdater

        public TxnUpdater()
        Create a transaction updater.
      • TxnUpdater

        public TxnUpdater​(Txn txn)
        Create a transaction updater for the given txn value object.
        Parameters:
        txn - the transaction value object to update (required)
    • Method Detail

      • setId

        public TxnUpdater setId​(Number id)
        Set the transaction id (PK) to identify the transaction to update.
        Parameters:
        id - the transaction id of the transaction to update (required)
        Returns:
        the transaction updater
      • setFormStatus

        public TxnUpdater setFormStatus​(String formStatus)
        Set the form status value to set on the transaction [ Txn.FORM_SAVED | Txn.FORM_COMPLETED | Txn.FORM_ABANDONED ]. Setting form status values other than those specified will either be ignored or result in an IllegalArgumentException.
        Parameters:
        formStatus - the form status value to set on the transaction
        Returns:
        the transaction updater
      • setAttachmentsStatus

        public TxnUpdater setAttachmentsStatus​(String attachmentsStatus)
        The attachments status value to set on the transaction.
        Parameters:
        attachmentsStatus - attachments status value on the transaction
        Returns:
        the transaction updater
      • setPaymentStatus

        public TxnUpdater setPaymentStatus​(String paymentStatus)
        The payment status value to set on the transaction.
        Parameters:
        paymentStatus - the payment status value to set on the transaction
        Returns:
        the transaction updater
      • setSpace

        public TxnUpdater setSpace​(Space space)
        The space value to set on the transaction.
        Parameters:
        space - the space value to set on the transaction
        Returns:
        the transaction updater
        Since:
        5.0.3
      • setUser

        public TxnUpdater setUser​(User user)
        The user value to set on the transaction.
        Parameters:
        user - the user value to set on the transaction
        Returns:
        the transaction updater
        Since:
        5.0.3
      • setReceiptStatusReady

        public TxnUpdater setReceiptStatusReady()
        Set the transaction PDF receipt generation status to be ready.
        Returns:
        the transaction updater
      • setDeliveryStatus

        public TxnUpdater setDeliveryStatus​(String deliveryStatus)
        The delivery status value to set on the transaction.
        Parameters:
        deliveryStatus - the delivery status value to set on the transaction
        Returns:
        the transaction updater
      • setDeliveryChannel

        public TxnUpdater setDeliveryChannel​(String deliveryChannel)
        The organization delivery channel to associate with the transaction.
        Parameters:
        deliveryChannel - the name of the organization delivery channel (required)
        Returns:
        the transaction updater
      • setProperty

        public TxnUpdater setProperty​(String name,
                                      String value)
        Specify the property name and value to add or update on the transaction.
        Parameters:
        name - the property name (required)
        value - the property value (required)
        Returns:
        the transaction updater
      • removeProperty

        public TxnUpdater removeProperty​(String name)
        Specify the property to remove from the transaction.
        Parameters:
        name - the property name to remove (required)
        Returns:
        the transaction updater
      • setFormXml

        public TxnUpdater setFormXml​(String formXml)
        The form XML data value to set on the transaction.
        Parameters:
        formXml - the form XML data value to set on the transaction (required)
        Returns:
        the transaction updater
      • addFileAttach

        public TxnUpdater addFileAttach​(FileAttach fileAttach)
        Add the given file attachment to the transaction.
        Parameters:
        fileAttach - the file attachment to add to the transaction (required)
        Returns:
        the transaction updater
      • removeFileAttach

        public TxnUpdater removeFileAttach​(FileAttach fileAttach)
        Remove the given file attachment from the transaction.
        Parameters:
        fileAttach - the file attachment to remove from the transaction (required)
        Returns:
        the transaction updater
      • addServiceCallLog

        public TxnUpdater addServiceCallLog​(String svcName,
                                            String info,
                                            String url)
        Add a service call log to the transaction.
        Parameters:
        svcName - the service definition called (required)
        info - the service call information (optional)
        url - the service URL called (optional)
        Returns:
        the transaction updater
      • setExternalUserId

        public TxnUpdater setExternalUserId​(String externalUserId)
        Set external user id to the transaction.
        Parameters:
        externalUserId - external user id
        Returns:
        the transaction updater
      • addMilestone

        public TxnUpdater addMilestone​(String milestone)
        Add the transaction milestone event (maximum 100 characters).
        Parameters:
        milestone - the transaction milestone event to add (maximum 100 characters).
        Returns:
        the transaction updater
        Since:
        17.10.0
      • addSegment

        public TxnUpdater addSegment​(String name,
                                     String value)
        Add the transaction segment event name and value
        Parameters:
        name - the segment String key value
        value - the segment String value
        Returns:
        the transaction updater
        Since:
        18.05.0
      • addFormDataExtract

        public TxnUpdater addFormDataExtract​(String name,
                                             String value)
        Add form data (data extract) to the transaction.
        Parameters:
        name - form data (extract) name
        value - form data (extract) value
        Returns:
        the transaction updater
      • removeFormDataExtract

        public TxnUpdater removeFormDataExtract​(String name)
        Remove form data (data extract) from the transaction.
        Parameters:
        name - form data (extract) name
        Returns:
        the transaction updater
      • setGroupName

        public TxnUpdater setGroupName​(String groupName)
        Set group name parameter.
        Parameters:
        groupName - group name
        Returns:
        the transaction updater
        Since:
        17.10.4
      • setGroupNames

        public TxnUpdater setGroupNames​(Collection<String> groupNames)
        Set group names parameter.
        Parameters:
        groupNames - group names
        Returns:
        the transaction updater
        Since:
        17.10.4
      • setSaveChallengeAnswer

        public TxnUpdater setSaveChallengeAnswer​(String saveChallengeAnswer)
        Set save challenge answer to the transaction.
        Parameters:
        saveChallengeAnswer - save challenge answer
        Returns:
        the transaction updater
        Since:
        5.1.0
      • setSaveChallengeTimeout

        public TxnUpdater setSaveChallengeTimeout​(Date saveChallengeTimeout)
        Set save challenge timeout to the transaction.
        Parameters:
        saveChallengeTimeout - save challenge timeout
        Returns:
        the transaction updater
        Since:
        5.1.0
      • setSaveChallengeLocked

        public TxnUpdater setSaveChallengeLocked​(Boolean saveChallengeLocked)
        Set save challenge locked to the transaction.
        Parameters:
        saveChallengeLocked - save challenge locked
        Returns:
        the transaction updater
        Since:
        21.5.0
      • setUserSaved

        public TxnUpdater setUserSaved​(boolean userSaved)
        Set the user saved to the transaction.
        Parameters:
        userSaved - the the user saved
        Returns:
        the transaction updater
        Since:
        5.1.3
      • setFormVersionNumber

        public TxnUpdater setFormVersionNumber​(String formVersionNumber)
        Set the form version number for the transaction.
        Parameters:
        formVersionNumber - the form version number
        Returns:
        the transaction updater
        Since:
        17.10.0
      • setProcessStatus

        public TxnUpdater setProcessStatus​(String processStatus)
        Set the Process Status.
        Parameters:
        processStatus - the processStatus to set
        Returns:
        the transaction updater
        Since:
        19.11.0
      • setReceiptNumber

        public TxnUpdater setReceiptNumber​(String receiptNumber)
        Set the Receipt Number.
        Parameters:
        receiptNumber - the receiptNumber to set
        Returns:
        the transaction updater
        Since:
        19.11.0
      • setTaskAllowClaim

        public TxnUpdater setTaskAllowClaim​(boolean taskAllowClaim)
        Set the Task Allow Claim Flag
        Parameters:
        taskAllowClaim - task allow claim boolean
        Returns:
        the transaction updater
        Since:
        19.11.0
      • setTimeTaskExpiry

        public TxnUpdater setTimeTaskExpiry​(Date timeTaskExpiry)
        Set the Task Expiry Time
        Parameters:
        timeTaskExpiry - task expiry timestamp
        Returns:
        the transaction updater
        Since:
        19.11.0
      • setTimeTxnExpiry

        public TxnUpdater setTimeTxnExpiry​(Date timeTxnExpiry)
        Set the Txn Expiry Date
        Parameters:
        timeTxnExpiry - transaction expiry date
        Returns:
        the transaction updater
        Since:
        19.11.0
      • setAbandonMode

        public TxnUpdater setAbandonMode​(TxnUpdater.AbandonMode abandonMode)
        Perform an abandonment on the transaction to be purged
        Parameters:
        abandonMode - purge abandon mode
        Returns:
        the transaction updater
        Since:
        19.11.0
      • addComment

        public TxnUpdater addComment​(Comment comment)
        Add comment to the transaction.
        Parameters:
        comment - transaction comment
        Returns:
        the transaction updater
        Since:
        21.5.0
      • returnNull

        public TxnUpdater returnNull()
        Set the updater to return null instead of a transaction object. This can improve performance when the updated transaction object is not required by the caller. Note: If this method is called, update() will return null even if other with...() methods were called.
        Returns:
        the transaction updater
        Since:
        19.11.1
      • withAll

        public TxnUpdater withAll()
        Set the updater to return the transaction with all the associated attachments map, form data map, form XML, group names, property map, receipt PDF data, etc.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • withNone

        public TxnUpdater withNone()
        Set the updater to return the transaction with none of the associated attachments map, form data map, form XML, group names, property map, receipt PDF data, etc.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • withComments

        public TxnUpdater withComments()
        Set the updater to return the transaction with the comments.
        Returns:
        the transaction updater
        Since:
        21.5.0
      • withFormDataMap

        public TxnUpdater withFormDataMap()
        Set the updater to return the transaction with the associated form data map information.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • withFormXml

        public TxnUpdater withFormXml()
        Set the updater to return the transaction with the associated form XML information.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • withGroupNames

        public TxnUpdater withGroupNames()
        Set the updater to return the transaction with the associated group names information.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • withPropertyMap

        public TxnUpdater withPropertyMap()
        Set the updater to return the transaction with the associated property map information.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • withReceiptPdf

        public TxnUpdater withReceiptPdf()
        Set the updater to return the transaction with the associated receipt PDF data.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • withFileAttachList

        public TxnUpdater withFileAttachList()
        Set the updater to return the transaction with the associated file attachment list.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • withDeliveryFuncs

        public TxnUpdater withDeliveryFuncs()
        Set the updater to return the transaction with the associated transaction delivery functions.
        Returns:
        the transaction updater
        Since:
        19.5.4
      • update

        public Txn update()
        Update the identified transaction with the specified parameters, and return a new immutable Txn value object.
        Returns:
        an updated immutable Txn value object