Programmer's Guide to the wftk: working with processes

[ wftk documentation home ] [ wftk programmer's guide home ]

Processes

The process in wftk is represented by a datasheet. The datasheet is an XML document (whether a file or stored some other place, it ends up as an XML structure by the time wftk works with it). Its primary function is to store the data values attached to a process, hence its name, but it also stores the workflow execution state of the process, the enactment history, associated (involved) users, current role assignments, and so forth. In other words, it does a lot.

When creating a new process, you may or may not have a key in mind. If you don't, the datasheet repository picks one for you -- but it doesn't actually pick the ID until you save the datasheet. This may cause some confusion, but the idea there is that if you don't actually have to save the datasheet, you shouldn't have to pollute the datasheet repository.

Functions

XML  * wftk_process_new     (void * session, const char * dsrep, const char * datasheet_id);
XML  * wftk_process_load    (void * session, const char * dsrep, const char * datasheet_id);
int    wftk_process_save    (void * session, XML * datasheet);
int    wftk_process_define  (void * session, XML * datasheet, const char * pdrep, const char * procdef_id);
int    wftk_process_archive (void * session, const char * dsrep, const char * datasheet_id, const char * archive);
int    wftk_process_delete  (void * session, const char * dsrep, const char * datasheet_id);
int    wftk_process_adhoc   (void * session, XML * datasheet, XML * arbitraryworkflow);

Details

wftk_process_new returns XML *
void * session,
const char * dsrep,
const char * datasheet_id
Creates a new process in the named datasheet repository (dsrep) with the requested datasheet_id. If the dsrep parameter is NULL, the default datasheet repository specified in the configuration will be used. If the datasheet_id is NULL, then one will be assigned when the new process is saved. If the datasheet_id is given but is already taken in the datasheet repository, then the newly created process will not have the given ID but will be treated as though no ID were requested. You're on your own to handle that situation. Finally, if the datasheet_id is given and isn't already used, then the "id" attribute will be set in the newly created process, and the (very empty) process will be saved in order to stake the claim to the ID.

wftk_process_load returns XML *
void * session,
const char * dsrep,
const char * datasheet_id
Loads the named datasheet. The dsrep may be NULL, in which case the default repository will be used. The datasheet_id, of course, may not be NULL here (it'll return NULL in that case, not dump core.) Returns NULL if the specified datasheet isn't found, otherwise retrieves the datasheet, makes sure it's cached, and returns it.

wftk_process_save returns int
void * session,
XML * datasheet
Saves the datasheet. If the datasheet doesn't have an ID yet, one is generated. Returns 0 if there's a problem.

wftk_process_define returns int
void * session,
XML * datasheet,
const char * pdrep,
const char * procdef_id
Associates the indicated procdef with the process. As usual, if you pass NULL as the pdrep, the default procdef repository will be used. Returns 0 if there's a problem.

wftk_process_archive returns int
NOT YET IMPLEMENTED
void * session,
const char * dsrep,
const char * datasheet_id,
const char * archive_id
Archives a process. Or will, as soon as I figure out exactly how it should work.

wftk_process_delete returns int
void * session,
const char * dsrep,
const char * datasheet_id
Deletes the indicated process. Returns 0 if the process couldn't be deleted.

wftk_process_adhoc returns int
void * session,
XML * datasheet,
XML * arbitraryworkflow
Attaches arbitrary workflow to the given process. The workflow will be activated as soon as it's attached and will use the same interpreter as the defined workflow would, blocking on tasks and so forth.





Copyright (c) 2001 Vivtek. Please see the licensing terms for more information.