static void zak_gflow_instance_class_init (ZakGFlowInstanceClass *class);
static void zak_gflow_instance_init (ZakGFlowInstance *zak_gflow_instance);
-static void zak_gflow_instance_next (ZakGFlowInstance *instance, const gchar *node_id, GNode *cur_node);
+static gchar *zak_gflow_instance_next (ZakGFlowInstance *instance, const gchar *node_id, GNode *cur_node);
static void zak_gflow_instance_set_property (GObject *object,
guint property_id,
priv->nodes_history = g_node_new (NULL);
}
-static void
-zak_gflow_instance_next (ZakGFlowInstance *instance, const gchar *node_id, GNode *cur_node)
+static gchar
+*zak_gflow_instance_next (ZakGFlowInstance *instance, const gchar *node_id, GNode *cur_node)
{
+ gchar *ret;
+
xmlNode *cur;
GNode *_cur_node;
ZakGFlowInstancePrivate *priv;
+ ret = NULL;
+
priv = zak_gflow_instance_get_instance_private (instance);
cur = g_hash_table_lookup (priv->ht_nodes, node_id);
if (xnodeset != NULL
&& xnodeset->nodeNr > 0)
{
+ ret = g_strdup ((const gchar *)xmlNodeGetContent (xnodeset->nodeTab[0]));
zak_gflow_instance_next (instance, (const gchar *)xmlNodeGetContent (xnodeset->nodeTab[0]), _cur_node);
}
}
{
g_message ("%s: %s (targetRef %s)", cur->name, (gchar *)xmlGetProp (cur, (const xmlChar *)"name"), (gchar *)xmlGetProp (cur, (const xmlChar *)"targetRef"));
+ ret = g_strdup ((const gchar *)xmlGetProp (cur, (const xmlChar *)"targetRef"));
zak_gflow_instance_next (instance, (const gchar *)xmlGetProp (cur, (const xmlChar *)"targetRef"), _cur_node);
}
else if (xmlStrcmp (cur->name, (const xmlChar *)"task") == 0
|| xmlStrcmp (cur->name, (const xmlChar *)"userTask") == 0)
{
g_message ("%s: %s", cur->name, (gchar *)xmlGetProp (cur, (const xmlChar *)"name"));
+
+ ret = g_strdup ((gchar *)xmlGetProp (cur, (const xmlChar *)"id"));
+ }
+ else if (xmlStrcmp (cur->name, (const xmlChar *)"exclusiveGateway") == 0)
+ {
+ g_message ("%s: %s", cur->name, (gchar *)xmlGetProp (cur, (const xmlChar *)"name"));
+
+ ret = g_strdup ((gchar *)xmlGetProp (cur, (const xmlChar *)"id"));
}
else
{
{
g_warning ("Node not found: %s.", node_id);
}
+
+ return ret;
}
/*+
* @node_id:
*
*/
-gboolean
-zak_gflow_instance_task_complete (ZakGFlowInstance *instance, const gchar *node_id)
+GPtrArray
+*zak_gflow_instance_task_complete (ZakGFlowInstance *instance, const gchar *node_id)
{
- gboolean ret;
+ GPtrArray *ret;
xmlNode *xnode;
xmlNodeSet *xnodeset;
+ gint i;
+
+ gchar *cur_node_id;
+
ZakGFlowInstancePrivate *priv = zak_gflow_instance_get_instance_private (instance);
- ret = FALSE;
+ ret = g_ptr_array_new ();
xnode = (xmlNode *)g_hash_table_lookup (priv->ht_nodes, node_id);
if (xnode != NULL)
if (xnodeset != NULL
&& xnodeset->nodeNr > 0)
{
- zak_gflow_instance_next (instance, (const gchar *)xmlNodeGetContent (xnodeset->nodeTab[0]), node);
+ for (i = 0; i < xnodeset->nodeNr; i++)
+ {
+ cur_node_id = zak_gflow_instance_next (instance, (const gchar *)xmlNodeGetContent (xnodeset->nodeTab[i]), node);
+ g_ptr_array_add (ret, g_strdup (cur_node_id));
+ g_free (cur_node_id);
+ }
}
}
else
{
instance = zak_gflow_model_start (model, argv[2]);
+ /* general current nodes */
ar = zak_gflow_instance_get_current_nodes (instance);
for (i = 0; i < ar->len; i++)
{
zak_gflow_instance_task_complete (instance, "StartEvent_1");
/* right node_id */
- zak_gflow_instance_task_complete (instance, (gchar *)g_ptr_array_index (ar, 0));
+ ar = zak_gflow_instance_task_complete (instance, (gchar *)g_ptr_array_index (ar, 0));
+ for (i = 0; i < ar->len; i++)
+ {
+ g_printf ("Currente node after task_complete: %s\n", (gchar *)g_ptr_array_index (ar, i));
+ }
+ /* general current nodes */
ar = zak_gflow_instance_get_current_nodes (instance);
for (i = 0; i < ar->len; i++)
{