Class TxnBuilder

java.lang.Object
com.avoka.tm.svc.TxnBuilder

public class TxnBuilder extends 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:
  • Constructor Details

  • Method Details

    • setLinkedTxnId

      public TxnBuilder setLinkedTxnId(Number linkedTxnId)
      Set the linked transaction id (required).
      Parameters:
      linkedTxnId - the linkedTxnId to set
      Returns:
      the transaction builder
      Since:
      21.11
    • setSpaceName

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

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

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

      public TxnBuilder setFormVersion(String formVersion)
      Set the form version parameter.
      Parameters:
      formVersion - the form version parameter
      Returns:
      the transaction builder
      Since:
      19.11.0
    • setLoginName

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

      public TxnBuilder setTaskType(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(Long reviewTxnId)
      Set the review txn id parameter.
      Parameters:
      reviewTxnId - the review txn id
      Returns:
      the transaction builder
    • setTaskSubject

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public TxnBuilder setProperty(String name, 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(Map<String,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(String formDataXml)
      Set form data xml parameter.
      Parameters:
      formDataXml - the form data XML
      Returns:
      the transaction builder
    • addFormDataExtract

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

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

      @FluentSecurityPermission(permissions="submission-data-view") 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

      @FluentSecurityPermission(permissions="submission-data-view") 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