Class TxnUpdater


  • public class TxnUpdater
    extends java.lang.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() 
    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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String name,
                                      java.lang.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​(java.lang.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​(java.lang.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​(java.lang.String svcName,
                                            java.lang.String info,
                                            java.lang.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​(java.lang.String externalUserId)
        Set external user id to the transaction.
        Parameters:
        externalUserId - external user id
        Returns:
        the transaction updater
      • addMilestone

        public TxnUpdater addMilestone​(java.lang.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​(java.lang.String name,
                                     java.lang.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​(java.lang.String name,
                                             java.lang.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​(java.lang.String name)
        Remove form data (data extract) from the transaction.
        Parameters:
        name - form data (extract) name
        Returns:
        the transaction updater
      • setGroupName

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

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

        public TxnUpdater setSaveChallengeAnswer​(java.lang.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​(java.util.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​(java.lang.String formVersionNumber)
        Set the form version number for the transaction.
        Parameters:
        formVersionNumber - the form version number
        Returns:
        the transaction updater
        Since:
        17.10.0
      • 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