Loading...
 
Galaxia Workflow Engine

Galaxia Workflow Engine


two questions about the source code of instance.php

i have read through the source code of instance.php and have two questions,

first since the workitem represent the completed activity, why not delete the completed activity in the table instance_activity at the function complete() and abort()? i have checked the structure of table galaxia_workitem and galaxia_instance_activities, the latter one is duplicated information of the former one except the "property" field, why not deleted the completed activities? it cost more space

and in the in the instance.php, sendTo() function, what is the meaning of these codes:

$query="delete from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=? and `activityId`=?";
$this->query($query,arrayint)$iid,(int)$activityId;
$query="insert into `".GALAXIA_TABLE_PREFIX."instance_activities`(`instanceId`,`activityId`,`user`,`status`,`started`) values(?,?,?,?,?)";
$this->query($query,arrayint)$iid,(int)$activityId,$putuser,'running',(int)$now;

the delete query seems to delete the record will be inserted, so it will has nothing to do. any two instance, even of same process will have different iid, so what the meaning of the delete query?

any help will be highly appreciated!

i have some new understanding of the second question, if one activity is reused in the workflow diagram, for example, under some condition we will run the activity again, we should delete the before activity with same activityId and instanceId, or the new one couldn't been added to the alaxia_instance_activities?

i download the 1.10 tiki source code(in development) from de.tiki.org
i notice that there some difference between 1.10 instance.php and 1.9.2 one.
in the sendTo(), below codes was removed:

//we are now in a new activity
$this->activities=Array();
$query = "select * from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=?";
$result = $this->query($query,arrayint)$iid;
while ($res = $result->fetchRow()) {
$this->activities[]=$res;
}

although for auto-routed activities, the $instance->activities array could be reload by the following codes in the end of sendTo():

if ($isInteractive=='n') {

// Now execute the code for the activity (function defined in lib/Galaxia/config.php)
galaxia_execute_activity($activityId, $iid , 1);

// Reload in case the activity did some change
$this->getInstance($this->instanceId);
$this->complete($activityId);
}

(the $instance->getInstance() read the array from database again), to user interactive ones, the array could only be refreshed until in the tiki-g-run_acitivites.php:

if 'post'" class="wiki wikinew text-danger tips isset">$_REQUEST'__post' {
$instance->getInstance($_REQUEST'iid');
$instance->replace_instance_comment($_REQUEST'
cid', $activity->getActivityId(), $activity->getName(),
$user, $_REQUEST'title', $_REQUEST'comment');
}

before that the $instance->complete() in the user activity codes will be excuted and the workitem started attribute will set to $this->getStarted():

$act = $this->_get_instance_activity($activityId);
if (!$act)
{
$started = $this->getStarted();
$putuser = $this->getOwner();
}
else
{
$started=$act'started';
$putuser = $act'user';
}

could we change the first segment of codes in sendTo() to:

$query = "select * from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=? and `activityId`=?";
$result = $this->query($query,arrayint)$this->instanceId,(int)$this->activityId;
array_push($this->activities,$result->fetchRow());

that will reload the activities array.


another question about the getInstance() in instance.php

$query = "select * from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=?";
$this->query($query,arrayint)$instanceId;
while ($res = $this->fetchRow())
{
$this->activities[] = $res;
}

if we call it while the instance is still running, instead of just starting up, the existed content will be hold on, some of the added activies will be repeated in the array. could it be changed to:

$this->activities = array();
$query = "select * from `".GALAXIA_TABLE_PREFIX."instance_activities` where `instanceId`=?";
$this->query($query,arrayint)$instanceId;
while ($res = $this->fetchRow())
{
$this->activities[] = $res;
}


Brazil

meffee,
I STRONGLY suggest that you checkout branch BRANCH-1-9 from CVS - it's the latest, most stable Galaxia codebase available. 1.10 is under HEAVY development and is not yet suitable for production.
You should also visit workflow.tw.o and thoroughly read the Galaxia Concepts and Manual wiki pages. You will gain a deeper understanding of Galaxia. Regards,

Georger

ok i will, i port the galaxia so i face some problems,
like getting rid of the dependency on adodb for only mysql is
under consideration so i make use of more 'light' implementation
so i read through the codes...i will look through some information
you mentioned first, regards

> meffee,
> I STRONGLY suggest that you checkout branch BRANCH-1-9 from CVS - it's the latest, most stable Galaxia codebase available. 1.10 is under HEAVY development and is not yet suitable for production.
> You should also visit workflow.tw.o and thoroughly read the Galaxia Concepts and Manual wiki pages. You will gain a deeper understanding of Galaxia. Regards,
>
> Georger


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting