|
if (strcmp (xml_attrval (item, "block"), "resume")) {
/* Notify task indices of the new active task. */
task = xml_create ("task");
xml_set (task, "id", xml_attrval (item, "id"));
xml_set_nodup (task, "label", wftk_value_interpreta (session, datasheet, xml_attrval (def, "label")));
xml_set (task, "role", xml_attrval (def, "role"));
xml_set (task, "user", xml_attrval (def, "user"));
if (!*xml_attrval (task, "user") && *xml_attrval (task, "role")) {
xml_set (task, "user", wftk_role_user (session, datasheet, xml_attrval (task, "role")));
}
xml_set (task, "process", xml_attrval (datasheet, "id"));
mark = xml_firstelem (def);
while (mark) {
if (xml_is (mark, "data")) {
if (!wftk_value_find (session, datasheet, xml_attrval (mark, "id"))) {
xml_append (datasheet, xml_copy (mark));
}
}
mark = xml_nextelem (mark);
}
adlist = wftk_get_adaptorlist (session, TASKINDEX);
wftk_call_adaptorlist (adlist, "tasknew", task);
wftk_free_adaptorlist (session, adlist);
xml_free (task);
keep = 1; /* This blocks the current item, so that the active task will be available for retrieval. */
}
Handling action
Taking action requires decorating the action specifier with the current datasheet, procdef, and userid (from the session).
Some attributes will also be interpreted at some point, but as that's not yet entirely clear, I'll just defer it for the
time being.
|
/* Notify task indices of the new active task. */
if (!strcmp (xml_attrval (item, "where"), "datasheet")) {
mark = xml_loc (datasheet, xml_attrval (item, "loc"));
} else {
mark = xml_loc (procdef, xml_attrval (item, "loc"));
}
if (mark) {
holder = xml_copy (mark);
if (wftk_session_getuser (session)) {
xml_set (holder, "by", xml_attrval (wftk_session_getuser(session), "id"));
}
xml_set (holder, "dsrep", xml_attrval (datasheet, "dsrep"));
xml_set (holder, "process", xml_attrval (datasheet, "id"));
xml_set (holder, "pdrep", xml_attrval (procdef, "pdrep"));
xml_set (holder, "procdef", xml_attrval (procdef, "id"));
wftk_action (session, holder);
}
Handling data
The data element is really just an assignment, nothing more. Along with decisions, I think that simple
assignment will be enough. I'll also write an eval data "source" which evaluates expressions, and that will give us
plenty of power. Scripts, of course, are actions.
|
if (!strcmp (xml_attrval (item, "where"), "datasheet")) {
mark = xml_loc (datasheet, xml_attrval (item, "loc"));
} else {
mark = xml_loc (procdef, xml_attrval (item, "loc"));
}
if (mark) {
value = wftk_value_interpreta (session, datasheet, xml_attrval (mark, "value"));
wftk_value_set (session, datasheet, xml_attrval (mark, "id"), value);
free (value);
}
|
Handling situation
TODO: To be implemented later. Oy.
Handling decide
Decisions use the wftk_decide function, documented rather completely here.
|
if (!strcmp ("", xml_attrval (item, "cur"))) {
if (!strcmp (xml_attrval (item, "where"), "datasheet")) {
mark = xml_loc (datasheet, xml_attrval (item, "loc"));
} else {
mark = xml_loc (procdef, xml_attrval (item, "loc"));
}
if (mark) {
holder = wftk_decide (session, datasheet, mark);
if (*xml_attrval (holder, "loc")) {
if (!strcmp (xml_attrval (item, "where"), "datasheet")) {
next = xml_loc (datasheet, xml_attrval (holder, "loc"));
} else {
next = xml_loc (procdef, xml_attrval (holder, "loc"));
}
}
xml_free (holder);
}
}
if (next) {
xml_set (queue_procdef (session, datasheet, state, queue, next, xml_attrval (item, "where")), "parent", xml_attrval (item, "parent"));
keep = 1;
}
|
Handling alerts
Alerts use the function wftk_notify , which is basically a wrapper for notification adaptors.
The nice thing about this is that it allows us to expose the function itself, which makes it a convenient little
addition to the library.
|
wftk_notify (session, datasheet, def);
|
start: Starting subprocesses
TODO: To be implemented later. Basically it creates a new simple task, creates a new process, and calls wftk_process_attach
to attach the subprocess.
[ Previous: Making decisions: wftk_decide ]
[ Top: ]
[ Next: wftk core library ]
This code and documentation are released under the terms of the GNU license. They are
additionally copyright (c) 2000, Vivtek. All rights reserved except those explicitly
granted under the terms of the GNU license.
|
| |