STWProcessStack

abstract class STWProcessStack

The ProcessStack is a class that holds all data and information about a specific process. Also this Stack helps developer to launch all operations offered by the SmartMS SDK and register on all events related to this process.

Properties

Link copied to clipboard
val displayMode: Int

The current DisplayMode of the process

Link copied to clipboard
val process: STWProcess

STWProcess the process subject of this Stack

Link copied to clipboard
lateinit val processForm: ProcessForm

The ProcessForm contains all information (Data & metaData) related to the process form (Sections, widgets, data, AutoRouting rules ..)

Link copied to clipboard
val processUUID: String

The UUID of the current process

Link copied to clipboard
val savedRecipients: Array<String>? = null

This property will contain previous recipient from last process created with the same template for new process, or the saved recipients from saved draft version

Link copied to clipboard
val templateUUID: String

The UUID of the template used in the current process

Functions

Link copied to clipboard
abstract suspend fun cancel(    context: Context,     processName: String? = null,     values: JSONObject? = null,     onSuccess: () -> Unit?,     onError: (MyBusinessError) -> Unit?)

Cancels the current process.

Link copied to clipboard
abstract suspend fun complete(    context: Context,     processName: String? = null,     recipientList: List<RecipientModel>? = null,     onSuccess: () -> Unit? = null,     onError: (MyBusinessError) -> Unit? = null): Any

Saves and completes the current process to the given recipients.

Link copied to clipboard
abstract suspend fun delete(context: Context): ApiResult<Int>

Deletes the current process and destroys the current process stack, so it will not be used anymore.

Link copied to clipboard
abstract suspend fun duplicate(context: Context): ApiResult<STWProcess>

Creates a new draft copy of the current process. The copy will contain all values of the original process except signatures.

Link copied to clipboard
abstract suspend fun forward(    context: Context,     onSuccess: (Uri?) -> Unit? = null,     onError: (MyBusinessError) -> Unit? = null): Any

Exports process in PDF format so that can be forwarded as a file attachment.

Link copied to clipboard
abstract suspend fun getProcessHistory(context: Context): List<STWProcessVersion?>?

Gets the history of the process. The history contains: 1-All the process versions 2-Called processes started by current process 3-All escalation done

Link copied to clipboard
abstract suspend fun getProcessParticipants(context: Context): List<STWContact>?

Gets the list of participants in the given processes.

Link copied to clipboard
abstract suspend fun loadHistoryByVersion(context: Context, version: Int): ApiResult<ProcessHistoryVersion>

Loads the process history for the given version. PS: It is recommended to save process before calling this methode if the process is currently in DisplayMode.EDIT mode, To not lose data entered by user.

Link copied to clipboard
abstract suspend fun loadPreviousProcessData(    context: Context,     widgetUUID: String,     widgetValue: Any,     blacklistedWidgetsUUIDs: List<String?>?,     onSuccess: () -> Unit? = null,     onError: (MyBusinessError) -> Unit? = null)

Loads last data entered in a completed process using same template and same data entered in the given widget.

Link copied to clipboard
abstract suspend fun markAsRead(context: Context)

Marks the current process as read. This operation will be synchronized with other client Apps.

Link copied to clipboard
abstract fun release()

Releases the current process and destroys the current process stack, so it will not be used anymore

Link copied to clipboard
abstract suspend fun releaseTheControl(context: Context): ApiResult<Any>

Requests to release the control on the current process.

Link copied to clipboard
abstract suspend fun resetProcessData(exceptions: List<String> = listOf())

Resets data in all widgets

Link copied to clipboard
abstract suspend fun save(    context: Context,     processName: String,     recipientList: List<RecipientModel>? = null,     isAutomatic: Boolean = false,     onSuccess: (String) -> Unit? = null,     onError: (MyBusinessError) -> Unit? = null): Any

Saves the process locally and synchronises new values with other clients like web App connected to the same account.

Link copied to clipboard
abstract suspend fun saveOptions(context: Context, options: STWProcessOptions): ApiResult<Nothing>

Saves the given ProcessOptions locally. PS: This operation is allowed only at process initialization step (version =0)

Link copied to clipboard
abstract suspend fun stopRepeat(context: Context): ApiResult<Any>

Stops the planed repetition of current process

Link copied to clipboard
abstract suspend fun submit(    context: Context,     processName: String? = null,     recipientList: List<RecipientModel>? = null,     onSuccess: () -> Unit? = null,     onError: (MyBusinessError) -> Unit? = null): Any

Saves and Submits the current process to the given recipients.

Link copied to clipboard
abstract fun subscribeFor(    eventTypes: Array<String>,     lifecycleOwner: LifecycleOwner? = null,     listener: STWEventListener<STWEvent>)

Subscribes to the specific eventTypes, in the lifecycle of lifecycleOwner.

Link copied to clipboard
abstract suspend fun takeTheLead(context: Context): ApiResult<Any>

Requests to take the lead on the current process.

Link copied to clipboard
abstract suspend fun validateForm(processName: String, fullValidation: Boolean): ValidationResult?

Validates the process name and all the current data in widgets, and prepare values for other operations (save/submit/complete/cancel).