cancel
Showing results for 
Search instead for 
Did you mean: 

Spatial attributes to query tasks

tomvandamme
Champ in-the-making
Champ in-the-making
Hi,

I'm looking at Activiti as a candidate BPMN solution. In my use case, all tasks would have a spatial attribute: mostly a point location, but potential more complex geometries like lines or areas. The idea would be that people can search for and subsequently claim tasks that are within a certain distance from a certain location. Searching for those tasks could be achieved using PostGIS or something similar.

Although I couldn't find anything like this while searching the web, maybe someone already thought about or implemented this functionality in Activiti?

If it doesn't exist yet: Is there an "easy" way to implement this kind of functionality? If so, are there examples that could show me how to extend the activiti engine to support this new attribute type and provide specific query possibilities on the attribute type? Or is the idea of implementing the functionality like this too "intrusive" and is there a more elegant/effective way to do this?

Thanks in advance for any feedback.

Kind regards,
Tom

4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
What you could do (in case of you're plane being a rectangle) is to store the x and y-coordinates separately, so you can use the ProcessInstanceQuery variableValueGreaterThan(String name, Object value); method (and other) to get process-instances which are located in that rectangle.

Other shapes and geometries don't work this way, off course… The variable-query mechanism is quite fixed in activiti, using the available columns in ACT_RU_VARIABLE (TEXT_, LONG_, …) to do simple operators on. If you want to have advanced querying-support on top of the relation DB activiti is using, you're basically on your own.

If you depend on an external system to "index" or "query" the coordinates, than you can keep the task-id and coordinates up to date using activiti-task-listeners and execution-listeners, preventing you to manually keep both sides up to date with new processes…

Thanks, I'll try to see how it behaves when putting the co-ordinates in separate long fields. And I'll have to read the listener documentation as well: sounds promising.

Tom

Looking further at what we want to achieve, we could also opt to extend activiti's capabilities and introduce support for "geometry" attributes inside activiti. Any idea if there's a chance that this could then make it to the activiti mainline, so we don't need to re-merge our extensions on every activiti release?

Tom

frederikherema1
Star Contributor
Star Contributor
If it's implemented as a "custom variable type" and doesn't require DB-changes, you don't need to merge any code, just plugin your classes into the configuration and it will work on future versions as well.

If it required DB-modification, that's another thing. We only accept "general" features in the engine, so depending on the actual implementation, we can consider adding this. Again, the feature should be "generic" enough, so not sure about the geometry-stuff.