Class TxnBuilder


  • public class TxnBuilder
    extends java.lang.Object

    Provides a Txn value object builder class.

    This class builds anonymous saved form, task form or review form transactions. If contactEmailAddress is set, then it will be built anonymous saved form, otherwise specifying loginName and taskType with [Form|Review] value will determine what form type will be created.

    Building form task transaction basically creates a form task transaction for a user or a user group to do. The task form can be merged and rendered either by the form schema seed or using the prefill data services. Note that form data XML and prefill data XML are mutually exclusive. Note that this method contains database transactions.

    Building review task transaction basically creates a review task transaction for a user or a user group to do. A review task is based on an existing transaction and can be pre-filled with schema seed data.

    Examples

    Please find transaction builder examples below.

    Create an Anonymous Saved Form

    Build an anonymous saved form transaction using the provided parameters data.

     import com.avoka.tm.svc.*
     import com.avoka.tm.vo.*
    
     Txn txn = new TxnBuilder()
                  .setAddress("1 Street")
                  .setContactEmailAddress("[email protected]")
                  .setDatetimeScheduled(new Date())
                  .setDatetimeExpiry(new Date())
                  .setEmailSubject("Email subject")
                  .setEmailMessage("Email message")
                  .setFormCode("FRM-1234")
                  .setGroupName("Administrator")
                  .setLatitude(new Double(40))
                  .setLongitude(new Double(50))
                  .setProperty("propKey", "propValue")
                  .setReceiptNumber("RCPT-1234")
                  .setSaveChallengeAnswer("saveChallengeAnswer")
                  .setSequence(new Integer(2))
                  .setSpaceName("spaceName")
                  .setTxnXml("<Txn></Txn>")
                  .setTaskMessage("taskMessage")
                  .setTaskSubject("taskSubject")
                  .setTransRefNumber("TRANS-1234")
                  .withFormDataMap()
                  .withGroupNames()
                  .withPropertyMap()
                  .build()  

    Create a Form Task Form

    Build a form task transaction using the provided parameter data.

     import com.avoka.tm.svc.*
     import com.avoka.tm.vo.*
    
     Txn txn = new TxnBuilder()
                  .setAddress("1 Street")
                  .setDatetimeExpiry(new Date())
                  .setDatetimeScheduled(new Date())
                  .setEmailSubject("Email subject")
                  .setEmailMessage("Email message")
                  .setFormDataXml("<FormData></FormData>")
                  .setFormCode("FRM-1234")
                  .setLatitude(new Double(40))
                  .setLoginName("login")
                  .setLongitude(new Double(50))
                  .setSequence(new Integer(2))
                  .setSpaceName("space")
                  .setTaskMessage("taskMessage")
                  .setTaskSubject("taskSubject")
                  .setTaskType("Form")
                  .withUserDeletableFlag()
                  .build() 

    Create a Review Task

    Build a review task transaction using the provided parameter data.

     import com.avoka.tm.svc.*
     import com.avoka.tm.vo.*
    
     Txn txn = new TxnBuilder()
                  .setLoginName("login")
                  .setTaskType("Review")
                  .setTaskSubject("Task subject")
                  .setReviewTxn(new Long(12345678))
                  .build()  
    Since:
    5.0.0
    See Also:
    Txn
    • Constructor Detail

      • TxnBuilder

        public TxnBuilder()
    • Method Detail

      • setSpaceName

        public TxnBuilder setSpaceName​(java.lang.String spaceName)
        Set the space name parameter.
        Parameters:
        spaceName - the space name parameter
        Returns:
        the transaction builder
      • setContactEmailAddress

        public TxnBuilder setContactEmailAddress​(java.lang.String contactEmailAddress)
        Set the contact email address parameter.
        Parameters:
        contactEmailAddress - the email address parameter
        Returns:
        the transaction builder
      • setFormCode

        public TxnBuilder setFormCode​(java.lang.String formCode)
        Set the form code parameter.
        Parameters:
        formCode - the form code parameter
        Returns:
        the transaction builder
      • setLoginName

        public TxnBuilder setLoginName​(java.lang.String loginName)
        Set the login name parameter.
        Parameters:
        loginName - the login name parameter
        Returns:
        the transaction builder
      • setTaskType

        public TxnBuilder setTaskType​(java.lang.String taskType)
        Set the task type parameter [ Form | Review ].
        Parameters:
        taskType - the task type parameter [ Form | Review ]
        Returns:
        the transaction builder
      • setReviewTxn

        public TxnBuilder setReviewTxn​(java.lang.Long reviewTxnId)
        Set the review txn id parameter.
        Parameters:
        reviewTxnId - the review txn id
        Returns:
        the transaction builder
      • setTaskSubject

        public TxnBuilder setTaskSubject​(java.lang.String taskSubject)
        Set the task subject parameter.
        Parameters:
        taskSubject - task subject
        Returns:
        the transaction builder
      • setGroupName

        public TxnBuilder setGroupName​(java.lang.String groupName)
        Set group name parameter.
        Parameters:
        groupName - group name
        Returns:
        the transaction builder
      • setGroupNames

        public TxnBuilder setGroupNames​(java.util.Collection<java.lang.String> groupNames)
        Set group names parameter.
        Parameters:
        groupNames - group names
        Returns:
        the transaction builder
      • setAddress

        public TxnBuilder setAddress​(java.lang.String address)
        Set address parameter.
        Parameters:
        address - address
        Returns:
        the transaction builder
      • setCopyAttachmentsNames

        public TxnBuilder setCopyAttachmentsNames​(java.util.List<java.lang.String> copyAttachmentsNames)
        Set copy attachment names parameter.
        Parameters:
        copyAttachmentsNames - copy attachment names
        Returns:
        the transaction builder
      • setCopyAttachmentsTxn

        public TxnBuilder setCopyAttachmentsTxn​(java.lang.Long copyAttachmentsTxn)
        Set copy attachments txn id parameter.
        Parameters:
        copyAttachmentsTxn - copy attachments txn id
        Returns:
        the transaction builder
      • setEmailSubject

        public TxnBuilder setEmailSubject​(java.lang.String emailSubject)
        Set email subject parameter.
        Parameters:
        emailSubject - email subject
        Returns:
        the transaction builder
      • setEmailMessage

        public TxnBuilder setEmailMessage​(java.lang.String emailMessage)
        Set email message parameter.
        Parameters:
        emailMessage - email message
        Returns:
        the transaction builder
      • setDatetimeScheduled

        public TxnBuilder setDatetimeScheduled​(java.util.Date datetimeScheduled)
        Set date time scheduled parameter.
        Parameters:
        datetimeScheduled - date time scheduled
        Returns:
        the transaction builder
      • setDatetimeExpiry

        public TxnBuilder setDatetimeExpiry​(java.util.Date datetimeExpiry)
        Set date time expiry parameter.
        Parameters:
        datetimeExpiry - date time expiry
        Returns:
        the transaction builder
      • setFormPrefillServiceName

        public TxnBuilder setFormPrefillServiceName​(java.lang.String formPrefillServiceName)
        Set form prefill service name parameter.
        Parameters:
        formPrefillServiceName - form prefill service name
        Returns:
        the transaction builder
      • setInputXmlData

        public TxnBuilder setInputXmlData​(java.lang.String inputXmlData)
        Set input xml data parameter.
        Parameters:
        inputXmlData - input xml data
        Returns:
        the transaction builder
      • setLatitude

        public TxnBuilder setLatitude​(java.lang.Double latitude)
        Set latitude parameter.
        Parameters:
        latitude - latitude parameter
        Returns:
        the transaction builder
      • setLongitude

        public TxnBuilder setLongitude​(java.lang.Double longitude)
        Set longiture parameter.
        Parameters:
        longitude - longitude parameter
        Returns:
        the transaction builder
      • setReceiptNumber

        public TxnBuilder setReceiptNumber​(java.lang.String receiptNumber)
        Set receipt number parameter.
        Parameters:
        receiptNumber - receipt number
        Returns:
        the transaction builder
      • setSaveChallengeAnswer

        public TxnBuilder setSaveChallengeAnswer​(java.lang.String saveChallengeAnswer)
        Set save challenge answer parameter.
        Parameters:
        saveChallengeAnswer - save challenge answer
        Returns:
        the transaction builder
      • setSequence

        public TxnBuilder setSequence​(java.lang.Integer sequence)
        Set sequence number parameter.
        Parameters:
        sequence - sequnce number
        Returns:
        the transaction builder
      • withSendEmailFlag

        public TxnBuilder withSendEmailFlag()
        Set send email flag parameter to true.
        Returns:
        the transaction builder
      • setTxnXml

        public TxnBuilder setTxnXml​(java.lang.String txnXml)
        Set txn xml parameter.
        Parameters:
        txnXml - txn xml
        Returns:
        the transaction builder
      • setTaskMessage

        public TxnBuilder setTaskMessage​(java.lang.String taskMessage)
        Set task message parameter.
        Parameters:
        taskMessage - task message
        Returns:
        the transaction builder
      • setTransRefNumber

        public TxnBuilder setTransRefNumber​(java.lang.String transRefNumber)
        Set transaction reference number parameter.
        Parameters:
        transRefNumber - transaction reference number
        Returns:
        the transaction builder
      • setJobAction

        public TxnBuilder setJobAction​(java.lang.Long jobAction)
        Set job action parameter.
        Parameters:
        jobAction - job action
        Returns:
        the transaction builder
      • setProperty

        public TxnBuilder setProperty​(java.lang.String name,
                                      java.lang.String value)
        Specify the property name and value on the transaction.
        Parameters:
        name - the property name (required)
        value - the property value (required)
        Returns:
        the transaction builder
        Since:
        5.1.0
      • setPropertyMap

        public TxnBuilder setPropertyMap​(java.util.Map<java.lang.String,​java.lang.String> propertyMap)
        Specify the property map on the transaction.
        Parameters:
        propertyMap - the property map
        Returns:
        the transaction builder
        Since:
        5.1.0
      • addFileAttach

        public TxnBuilder addFileAttach​(FileAttach fileAttach)
        Add the given file attachment to the transaction.
        Parameters:
        fileAttach - the file attachment to add to the transaction
        Returns:
        the transaction builder
      • withAllowClaimFlag

        public TxnBuilder withAllowClaimFlag()
        Set allow claim flag parameter to true.
        Returns:
        the transaction builder
      • setFormDataXml

        public TxnBuilder setFormDataXml​(java.lang.String formDataXml)
        Set form data xml parameter.
        Parameters:
        formDataXml - the form data XML
        Returns:
        the transaction builder
      • addFormDataExtract

        public TxnBuilder 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 builder
      • withUserDeletableFlag

        public TxnBuilder withUserDeletableFlag()
        Set user deletable flag parameter to true.
        Returns:
        the transaction builder
      • withFormDataMap

        public TxnBuilder withFormDataMap()
        Set the query to return the transaction with the associated form data map information.
        Returns:
        the transaction builder
      • withGroupNames

        public TxnBuilder withGroupNames()
        Set the query to return the transaction with the associated group names information.
        Returns:
        the transaction builder
      • withPropertyMap

        public TxnBuilder withPropertyMap()
        Set the query to return the transaction with the associated property map information.
        Returns:
        the transaction builder
        Since:
        5.1.0
      • build

        public Txn build()
        Create a transaction based on the specified parameter and return the new Txn value object.
        Returns:
        the newly created Txn value object