Rest - get list of activities by definition id

730 views
Skip to first unread message

Clint Manning

unread,
Aug 6, 2013, 10:10:18 AM8/6/13
to camunda...@googlegroups.com

In rest, we have a requirement to return the list of activities and their transitions given a process definition id. From what I understand, a Process Definition implementation has an initial ActivityImpl and the list can be recursively retrieved from this. Would this be something camunda is interested in?


Proposed url
@GET
/process-definition/{id}/activities

The DTO would modeled after the ActivityImpl, e.g.

public class ActivityDto {

    protected String id;   
    protected String parent;
    protected ActivityDto[] childActivitys;
    protected TransitionDto[] outgoingTransitons;
    protected TransitionDto[] incomingTransitons;
    protected boolean isScope;
    protected boolean isAsync;
    protected boolean isExclusive;
    ...
    ...
}

Because it is related to a process definition the functionality belongs in the Process Definition Resource and all DTOs created in the package org.camunda.bpm.engine.rest.dto.repository.


Regards, Clint


Daniel Meyer

unread,
Aug 7, 2013, 1:46:30 AM8/7/13
to Clint Manning, camunda...@googlegroups.com

Hi Clint,

 

The internal Activity Model is currently not exposed via public Java API. The reason is that it is the internal process definition structure used by the process engine. I am a bit reluctant about exposing it. I see two problems:

-          The process definition is structurally not 100% aligned with BPMN. Example: boundary events are nested inside the scope they are attached to instead of being siblings of the scope they are attached to as in BPMN. And concerns like isScope, isAsync, isExclusive are proprietary process engine internal implementation details.

-          I want to reserve the possibility of changing this dramatically (for the better of course J)

 

So if you want to expose a  process definition model as JSON Document through the REST Api, I would be in favor of not exposing the proprietary process engine internal structures but rather parsing the BPMN 2.0 Xml and returning a Structure that is aligned with BPMN 2.0.

 

FYI: What we do in cockpit is we have a client-side Javascript based parser for BPMN 2.0 XML (https://github.com/camunda/camunda-bpmn.js) which we can use for obtaining all activities from the BPMN 2.0 XML. Then we use the activity instance tree that can be obtained via public API and is structurally aligned with the BPMN 2.0 XML and map the runtime state of a process instance to the process definition.

http://docs.camunda.org/api-references/rest/#!/process-instance/get-activity-instances

 

Cheers,

Daniel Meyer

--
You received this message because you are subscribed to the Google Groups "camunda BPM platform internal" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-d...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages