iTasksProcessHandling.dcl 2.76 KB
Newer Older
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
definition module iTasksProcessHandling

// *********************************************************************************************************************************
// This module contains iTask combinators for creating iTask workflow processes
// *********************************************************************************************************************************
// iTask & iData Concept and Implementation: (c) 2006,2007,2008 - Rinus Plasmeijer
// *********************************************************************************************************************************
//
import StdOverloaded, iTasksHandler

derive gForm 	Wid
derive gUpd 	Wid
derive gParse 	Wid
derive gPrint 	Wid
derive gerda 	Wid
derive read 	Wid
derive write 	Wid

// iTask workflow processes types:

:: Wid a											// reference to a workflow process

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
23 24
:: WorkflowStatus	= WflActive	UserId				// iTask workflow process is still being processed by indicated user
					| WflSuspended UserId			// it is assigned to indicated user but it is (temporally) suspended
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
					| WflFinished					// it is finshed
					| WflDeleted					// it does not exist anymore because it is deleted

instance ==			WorkflowStatus

/* iTask Workflow process management:
spawnWorkflow 		:: spawn an iTask workflow as a new separate process, Wid is a handle to that process, bool indicates whether it is active or suspended 
waitForWorkflow		:: wait until the indicated process is finished and obtain the resulting value; returns Nothing when process is deleted
getWorkflowStatus 	:: get status of workflow
deleteWorkflow 		:: delete iTask workflow; returns False if workflow does not exist anymore
suspendWorkflow 	:: suspend iTask workflow, all corresponding tasks will vanish temporally; returns False if workflow does not exist anymore
activateWorkflow 	:: activate the iTask workflow again; returns False if workflow does not exist anymore
changeWorkflowUser :: transfer the workflow task to the indicated user; returns False if workflow does not exist anymore

suspendMe 			:: suspend current workflow process; no effect on start task
deleteMe 			:: delete current workflow process;  no effect on start task
*/

spawnWorkflow 		:: !UserId !Bool !(LabeledTask a) 					-> Task (Wid a) 	| iData a
waitForWorkflow 	:: !(Wid a) 										-> Task (Maybe a )	| iData a
getWorkflowStatus 	:: !(Wid a) 										-> Task WorkflowStatus
activateWorkflow 	:: !(Wid a) 										-> Task Bool 	
suspendWorkflow 	:: !(Wid a) 										-> Task Bool 		
deleteWorkflow 		:: !(Wid a) 										-> Task Bool 		
changeWorkflowUser	:: !UserId !(Wid a) 								-> Task Bool 

suspendMe 			:: (Task Void)
deleteMe 			:: (Task Void)


Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
55 56

// internally used...
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
57 58 59

showWorkflows 		:: !Bool !*TSt -> (![BodyTag],*TSt)
scheduleWorkflows 	:: !(Task a) -> (Task a) | iData a