cancel
Showing results for 
Search instead for 
Did you mean: 

REST, parsing definition, activity properties

iam
Champ in-the-making
Champ in-the-making
In REST I want to get all activities and their properties of the definition. But there is any problem for getting some parameters.

I get properties from activity (instance of ActivityImpl) and there is in activity.getProperties() property "timerDeclarations".
Then I try to get all parameters of this timerDeclaration, but it's impossible to get expression of this one.
Expression (for example "${PT1H}") stored in description of the timerDeclaration, but there isn't getter for it.

And, if I get activity behavior and this is instanceof SequentialMultiInstanceBehavior then a want to get innerActivityBehavior (for getting properties of callActivityBehavior for example), there isn't getter for innerActivityBehavior in the SequentialMultiInstanceBehavior.
P.S. In callActivityBehavior I need to get process definiton key.

Is there another way? Or it needs to add getters for this objects?
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
I really don't get what you are trying to achieve? Could you describe that first?

iam
Champ in-the-making
Champ in-the-making
I have process definition and I get all activities.
For each activity i can get properties.
And if one of this properties is "timerDeclarations", I want to get all parameters for this timer.
for (ActivityImpl activity : processDefinition.getActivities()) {
Map<String, Object> properties = activity.getProperties();
for (String key: properties.keySet()) {
  …
  if ("timerDeclarations".equals(key)) {
   ArrayList<TimerDeclarationImpl> timerDeclarations = (ArrayList<TimerDeclarationImpl>)properties.get(key);
   for (TimerDeclarationImpl timerDeclaration: timerDeclarations) {
    // there I want to get expression of this timer declaration, for example is "P30D"
    // but there is no getter for getting property that I need, it's private.
   }
  }
}
}
What I actually do? I want to get from REST allactivities with all their properties.
For example, in bpmn I have this one:
   <intermediateCatchEvent id="timerintermediatecatchevent4" name="NO ANSWER (+3 HOUR)">
        <timerEventDefinition>
          <timeDate>${bpmTimer.adjust("+PT3H")}</timeDate>
        </timerEventDefinition>
      </intermediateCatchEvent>
In JSON from rest I get this:
{
  "activityId": "timerintermediatecatchevent4",
  "properties": {
   "name": "TimerCatchEvent",
   "line": 67,
   "timerDeclarations": [{
    "isExclusive": true,
    "retries": "3",
    "type": "timer-intermediate-transition",
    "configuration": "timerintermediatecatchevent4"
   }],
   "type": "intermediateTimer"
  },
  "x": 464,
  "y": 160,
  "width": 35,
  "height": 35
},
I want to represent process definition in json.
But for this timer I need one parameter more - that expression (${bpmTimer.adjust("+PT3H")}). Class TimerDeclarationImpl have this expression in property:
protected Expression description;
but it's protected without getter.

jbarrez
Star Contributor
Star Contributor
Okay, so you basically want the process definition xml? Isn't it easier to then just get the xml and return that?

Alternatively, the 5.11 will ship with a bpmn to java converter (and even json). So it might be good to wait a bit (planned release tomorrow)

iam
Champ in-the-making
Champ in-the-making
I don't know, probably xml it's good. But json is simplest Smiley Happy Simplest to use and looks like an object in java. I basically don't want to parse raw xml with two parts - model and graphically representation.
And yes, I'll be waiting the 5.11 and converter, thanks!