Class TaskService


public class TaskService extends CayenneService
Provides a task service.
  • Constructor Details

    • TaskService

      public TaskService()
  • Method Details

    • createFormTask

      public Submission createFormTask(Form form, String taskSubject, String taskMessage, Integer sequence, UserAccount user, Group group, String formDataXml, String inputXmlData, Double latitude, Double longitude, Date datetimeScheduled, Date datetimeExpiry, boolean sendEmailFlag, String emailSubject, String emailMessage, boolean userDeletableFlag)
      Create a form task 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.

      Parameters:
      form - the form to fill
      taskSubject - the task subject (required)
      taskMessage - task message
      sequence - a sequence number that can be set to number tasks that are part of a set (optional)
      user - the user account to assign the task to (must be specified if group is not)
      group - the forms group to assign the task to (must be specified if user is not)
      formDataXml - the schema seed for the form
      inputXmlData - the pre-filled data XML for the form.
      latitude - the latitude component of the geolocation information (optional; can range from -90 to 90)
      longitude - the longitude component of the geolocation information (optional; can range from -180 to 180)
      datetimeScheduled - scheduling information that can be displayed to the assignee(s) (optional)
      datetimeExpiry - the date/time when the task shall expire (optional; needs to be in the future)
      sendEmailFlag - whether this task needs to send out email
      emailSubject - the email subject
      emailMessage - the email body
      userDeletableFlag - whether the user can delete this flag
      Returns:
      the created task object
    • createFormTask

      public Submission createFormTask(Form form, String taskSubject, String taskMessage, Integer sequence, UserAccount user, Group group, String formDataXml, String inputXmlData, Double latitude, Double longitude, String address, Date datetimeScheduled, Date datetimeExpiry, boolean sendEmailFlag, String emailSubject, String emailMessage, boolean userDeletableFlag)
      Create a form task 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.

      Parameters:
      form - the form to fill
      taskSubject - the task subject (required)
      taskMessage - task message
      sequence - a sequence number that can be set to number tasks that are part of a set (optional)
      user - the user account to assign the task to (must be specified if group is not)
      group - the forms group to assign the task to (must be specified if user is not)
      formDataXml - the schema seed for the form
      inputXmlData - the pre-filled data XML for the form.
      latitude - the latitude component of the geolocation information (optional; can range from -90 to 90)
      longitude - the longitude component of the geolocation information (optional; can range from -180 to 180)
      address - the task location address
      datetimeScheduled - scheduling information that can be displayed to the assignee(s) (optional)
      datetimeExpiry - the date/time when the task shall expire (optional; needs to be in the future)
      sendEmailFlag - whether this task needs to send out email
      emailSubject - the email subject
      emailMessage - the email body
      userDeletableFlag - whether the user can delete this flag
      Returns:
      the created task object
      Since:
      4.0.0
    • createReviewTask

      public Submission createReviewTask(Submission reviewSubmission, Form form, String taskSubject, String taskMessage, Integer sequence, UserAccount user, Group group, String formDataXml, Double latitude, Double longitude, Date datetimeScheduled, Date datetimeExpiry, boolean sendEmailFlag, String emailSubject, String emailMessage, boolean userDeletableFlag)
      Create a review task for a user or a user group to do. A review task is based on an existing submission and can be pre-filled with schema seed data.

      Note that this method contains database transactions.

      Parameters:
      reviewSubmission - the submission to review (required)
      form - the form to fill (optional; the submission form will be used if not set)
      taskSubject - the task subject (required)
      taskMessage - task message (optional)
      sequence - a sequence number that can be set to number tasks that are part of a set (optional)
      user - the user account to assign the task to (must be specified if group is not)
      group - the forms group to assign the task to (must be specified if user is not)
      formDataXml - the populated schema seed for the form (optional)
      latitude - the latitude component of the geolocation information (optional; can range from -90 to 90)
      longitude - the longitude component of the geolocation information (optional; can range from -180 to 180)
      datetimeScheduled - scheduling information that can be displayed to the assignee(s) (optional)
      datetimeExpiry - the date/time when the task shall expire (optional; needs to be in the future)
      sendEmailFlag - whether this task needs to send out email to the assignee(s)
      emailSubject - the email subject
      emailMessage - the email body
      userDeletableFlag - whether the user can delete this task
      Returns:
      the created task object
    • createReviewTask

      public Submission createReviewTask(Submission reviewSubmission, Form form, String taskSubject, String taskMessage, Integer sequence, UserAccount user, Group group, String formDataXml, Double latitude, Double longitude, String address, Date datetimeScheduled, Date datetimeExpiry, boolean sendEmailFlag, String emailSubject, String emailMessage, boolean userDeletableFlag)
      Create a review task for a user or a user group to do. A review task is based on an existing submission and can be pre-filled with schema seed data.

      Note that this method contains database transactions.

      Parameters:
      reviewSubmission - the submission to review (required)
      form - the form to fill (optional; the submission form will be used if not set)
      taskSubject - the task subject (required)
      taskMessage - task message (optional)
      sequence - a sequence number that can be set to number tasks that are part of a set (optional)
      user - the user account to assign the task to (must be specified if group is not)
      group - the forms group to assign the task to (must be specified if user is not)
      formDataXml - the populated schema seed for the form (optional)
      latitude - the latitude component of the geolocation information (optional; can range from -90 to 90)
      longitude - the longitude component of the geolocation information (optional; can range from -180 to 180)
      address - the task location address
      datetimeScheduled - scheduling information that can be displayed to the assignee(s) (optional)
      datetimeExpiry - the date/time when the task shall expire (optional; needs to be in the future)
      sendEmailFlag - whether this task needs to send out email to the assignee(s)
      emailSubject - the email subject
      emailMessage - the email body
      userDeletableFlag - whether the user can delete this task
      Returns:
      the created task object
      Since:
      4.0.0
    • isAssignee

      public boolean isAssignee(Submission task, UserAccount user)
      Check whether the task is assigned to a particular user.

      This method is provided for backward compatibility, use IFormSubmissionAccessController instead.

      Parameters:
      task - the task (required)
      user - the user account
      Returns:
      true if the task is assigned to the user, otherwise false