1 Reply Latest reply on Sep 7, 2011 9:07 PM by meadlai

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

    meadlai

      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 anyone please give me some clue? I am a newer.

      Thanks very much.