[dev] whups: Batch changes on tickets

Auke Bruinsma air2 at dds.nl
Thu Apr 14 02:40:29 PDT 2005


Hello,

As pointed out in ticket 1612 (http://bugs.horde.org/ticket/?id=1612) 
some batch execution should be handy. So I am thinking about the best 
approach of implementing such a feature. My approach would be to make a 
new object (Whups_Batch) when its created an array of tickets must be 
provided. The object has multple actions, like: Move, Change (this 
includes assign, comment, new queue etc.), Delete, Commit.
Maybe the Move already includes delete (move to nowhere) but the 
downside of this is, that it is not possible to check for accedently 
empty destinations. So I think there should be a protected _move and a 
Move and Delete who both call this _move. But if Delete is totally 
different from move, they must be seperated.
But Move is also included in Change, so maybe just make only a Change 
implementation. Or make functions that call the change implementation.
Like done in the Ticket class.

All the actions should optionally supplied with the ticket array. If 
none is given, the one given when the Batch class was created should be 
used. If none is given an error should be raised.

Another approach is not to supply the ticket array, but the query that 
generated the ticket array. After every chnage the query could 
optionally be executed again, to re-evalute the results and continue to 
working on the new set of tickets. (But how to handle when a ticket is 
added, between the first query execute and the second) So the query 
should only execute on the array generated by the last query execute in 
that batch class.

Like this:

$change [0]['queue'] = 'Whups';
$change [1]['state'] = 'resolved';
$obj = new Whups_Batch ($queryobj);
$obj->Change ($change);

The result would be:
Change ($changes)
{
       $tickets = NULL;
       loop thru $changes
            $tickets = queryobj->execute ($tickets);
            loop thru $tickets
                 $ticket->Change ($changes[0]);
           done
      done
}

Something like above. I don't know if its handy or not, its just my 
thoughts about different approaches. So if anyone has pro's/ con's let 
me know. Other approaches are very welcome off course.

Auke

ps. Where you read query, it should be query or quick search. :-)


More information about the dev mailing list