JBoss Community

jbpm4.4,how to get property from custom activity in jPDL(xml)

created by Mead Lai in jBPM - View the full discussion

jbpm4.4,how to get property from custom activity in jPDL(xml)

================

 

<custom id="Act_2" name="myCustomTask" class="com.meadlai.CustomActivity" point="309,70" memo="">

    <property name="form"><string value="99801"/></property>

    <property name="mark"><string value=""/></property>

    <property name="model"><string value="2"/></property>

</custom>

 

===============

I know I can get property "model" in the class:"com.meadlai.CustomActivity" by coding:

 

public class CustomActivity{

private String model; //getter & setter to get the property

private String mark;

...

execute(){...}

...

}

 

===============

but, I need to get it in another way, just with taskName.

 

EnvironmentImpl environment = ((ProcessEngineImpl) processEngine).openEnvironment();

    try{

    ProcessDefinitionImpl pdf = execution.getProcessDefinition();

    ActivityImpl activity = pdf.getActivity(taskName);

         if ("custom".equals(activity.getType())) {

           Object model= activity.getProperty("model");

           System.out.println("model = "+ model);

          }

    }catch(Exception ex){

     

    }finally{

      environment.close();

    }

 

==============

sadly, I got "null" with this manner.

Could you please give me some clue? I am a newer.

Thanks very mcuh.

Reply to this message by going to Community

Start a new discussion in jBPM at Community