get Expression

cancel
Showing results for 
Search instead for 
Did you mean: 
arag
Active Member II

get Expression

Jump to solution

Hello!!!

Well i have a question, and I don´t know if it is posible...

I have a bpmn with many form properties, all of them have a Expression, and i need to recover this information

is there some method or a way to do that??

Thanks for your time Smiley Happy

1 Solution

Accepted Solutions
daisuke-yoshimo
Senior Member

Re: get Expression

Jump to solution

I'm sorry that the following code works with both versions.

BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefition.getId());

// Start form
StartEvent startEvent = (StartEvent) bpmnModel.getFlowElement("startevent1");
List<org.activiti.bpmn.model.FormProperty> formProps = startEvent.getFormProperties();
for(FormProperty prop : formProps){
    System.out.println(prop.getExpression());
}

// Task form
UserTask userTask = (UserTask) bpmnModel.getFlowElement("usertask1");
formProps = userTask.getFormProperties();
for(FormProperty prop : formProps){
    System.out.println(prop.getExpression());
}

View solution in original post

5 Replies
daisuke-yoshimo
Senior Member

Re: get Expression

Jump to solution
I'm sorry. I did not understand what you really wanted to do.
Do you want to get a list of form properties?
arag
Active Member II

Re: get Expression

Jump to solution

I need to obtain "Expression"

daisuke-yoshimo
Senior Member

Re: get Expression

Jump to solution

Thank you for your reply.
If you use Activiti6, you can get expressions of form property by using internal api, like this code.

If you use Activiti 5.22, please tell me.

// Start form
org.activiti.bpmn.model.Process process = ProcessDefinitionUtil.getProcess({ProcessDefinitionId});
StartEvent startEvent = (StartEvent) process.getInitialFlowElement();
List<org.activiti.bpmn.model.FormProperty> formProps = startEvent.getFormProperties();
for(FormProperty prop : formProps){
    System.out.println(prop.getExpression());
}

// Task form
UserTask userTask = (UserTask) process.getFlowElement({ActivityId}, true);
formProps = userTask.getFormProperties();
for(FormProperty prop : formProps){
    System.out.println(prop.getExpression());
}

arag
Active Member II

Re: get Expression

Jump to solution

Thanks to you, specially for you time... I'm using activiti 5.22

daisuke-yoshimo
Senior Member

Re: get Expression

Jump to solution

I'm sorry that the following code works with both versions.

BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefition.getId());

// Start form
StartEvent startEvent = (StartEvent) bpmnModel.getFlowElement("startevent1");
List<org.activiti.bpmn.model.FormProperty> formProps = startEvent.getFormProperties();
for(FormProperty prop : formProps){
    System.out.println(prop.getExpression());
}

// Task form
UserTask userTask = (UserTask) bpmnModel.getFlowElement("usertask1");
formProps = userTask.getFormProperties();
for(FormProperty prop : formProps){
    System.out.println(prop.getExpression());
}