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 
    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
      • 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
      • 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
      • 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