}
public byte[] getProcessInstanceImage(String definitionId, String instanceId) {
QName qName = decode(definitionId);
SVGInterface svg = createSVG(qName);
List<Event> executionHistory =
bpafDataSource.getPastActivities(instanceId);// no need to decode?
for(Event event : executionHistory)
{
for(Tuple t : event.getDataElement())
{
if("line-number".equals(t.getName()))
{
Integer line = Integer.valueOf(t.getValue());
if(line>0) // TODO: still carries -1 for begin/end
{
ActivityInterface activity =
svg.getActivityAtLineNumber(line);
if(null==activity)
throw new RuntimeException("No activity matching line number "+
t.getValue() + " in process "
+ qName);
activity.setState(ActivityInterface.ActivityState.Completed);
}
}
}
}
return svg.toPNGBytes();
}