How can get the ProcessDefinition properties by Java Api?

Hey guys,
I can get the ProcessDefinition list by

  List<ProcessDefinition> definitinList = 

repositoryService.createProcessDefinitionQuery().latestVersion().list();
but I need get the properties, how can I get this.

@Leo_Liu To get Process definition properties, You need to use BPMN Model api.

Refer this page: Read a Model | docs.camunda.org

Hi @aravindhrs

  	BpmnModelInstance modelInstance = Bpmn.readModelFromStream(repositoryService.getProcessModel(pd.getId()));`

Now I have get the BpmnModelInstance but now I don’t how to get properties

Hi,

which properties do you mean exactly?

Starting with the modelInstance you can access the definitons:

        Definitions definitions = modelInstance.getDefinitions();
        CamundaInterface.LOGGER.info( "Definitions.id: " + definitions.getAttributeValue( "id" ) );

and the process model:

        ModelElementInstance model = definitions.getUniqueChildElementByType( org.camunda.bpm.model.bpmn.instance.Process.class );
        CamundaInterface.LOGGER.info( "Process.id: " + model.getAttributeValue( "id" ) );
        CamundaInterface.LOGGER.info( "Process.name: " + model.getAttributeValue( "name" ) );

Regards, Frank

Hi @langfr
I want get the Extensions Properties
Like this I need get the property1

I try this

Collection elementInstances = modelInstance.getModelElementsByType(CamundaProperty.class);
elementInstances.forEach(i->{
System.err.println(i.getCamundaName());
System.err.println(i.getCamundaValue());
});

It can get all Extensions Properties , I can just get the property1 ?

Try like below in Task Listener of the UserTask

public void execute(DelegateExecution execution) throws Exception {
    BpmnModelInstance modelInstance = execution.getBpmnModelInstance();
    Collection<CamundaProperty> elementInstances = modelInstance.getModelElementsByType(CamundaProperty.class);
    if (elementInstances == null) return;
	for (CamundaProperty camundaProperty : elementInstances) {
	      String key = camundaProperty.getCamundaName();
          String value = camundaProperty..getCamundaValue());
	}
  }