AnsweredAssumed Answered

Accessing object hierarchy in usertask via expession languag

Question asked by mrhu on Nov 8, 2012
Latest reply on Nov 13, 2012 by jbarrez
Hi all,

I'm trying to set a process variable inside a userTask via client application by using juel and pojos as follows:

BPMN2.0 Snippet:
<activiti:formProperty id="weight"  name="Weight?" activiti:expression="#{measurement.measurementEntities[0].value}" >

A client that externaly renders the corresponding userTask sends a json serialisation as follows:
{"deviceID":"AA:FF.04:D3:DD:90","deviceName":"A&D_UC321PBT-C","deviceType":"MDC_DEV_SPEC_PROFILE_SCALE",
  "measurementEntities":[{"dateTime":"2012-04-13 14:53:20","type":"MDC_MASS_BODY_ACTUAL","unit":"MDC_DIM_KILO_G","value":"87.5"},
                                {"dateTime":"2012-04-13 14:53:20","type":"MDC_RATIO_MASS_BODY_LEN_SQ","unit":"MDC_DIM_KG_PER_M_SQ","value":"24.8"}]
}

The classes that are used to serialize are as follows:

@XmlRootElement(name = "Measurement")
@JsonPropertyOrder ( value= {"deviceID",   "deviceName",  "deviceType",  "measurementEntities", "measurementWaveForms"} )
public class Measurement implements Serializable {

   /**
    *
    */
   private static final long serialVersionUID = 3375595783735588076L;

   private String deviceID;
   private String deviceName;
   private String deviceType;
   private List<MeasurementEntities> measurementEntities;
   private List<MeasurementWaveForms> measurementWaveForms;
   
   /**
    * @return the measurementEntities
    */
   public List<MeasurementEntities> getMeasurementEntities() {
      return measurementEntities;
   }
   
   /**
    * @param measurementEntities the measurementEntities to set
    */
   public void setMeasurementEntities(List<MeasurementEntities> measurementEntities) {
      this.measurementEntities = measurementEntities;
   }
   
   
   /**
    * @return the deviceID
    */
   public String getDeviceID() {
      return deviceID;
   }
   
   /**
    * @param deviceID the deviceID to set
    */
   public void setDeviceID(String deviceID) {
      this.deviceID = deviceID;
   }
   
   /**
    * @return the deviceName
    */
   public String getDeviceName() {
      return deviceName;
   }
   
   /**
    * @param deviceName the deviceName to set
    */
   public void setDeviceName(String deviceName) {
      this.deviceName = deviceName;
   }
   
   /**
    * @return the deviceType
    */
   public String getDeviceType() {
      return deviceType;
   }
   
   /**
    * @param deviceType the deviceType to set
    */
   public void setDeviceType(String deviceType) {
      this.deviceType = deviceType;
   }
   
   
   /**
    * @return the measurementWaveForms
    */
   public List<MeasurementWaveForms> getMeasurementWaveForms() {
      return measurementWaveForms;
   }
   
   /**
    * @param measurementWaveForms the measurementWaveForms to set
    */
   public void setMeasurementWaveForms(
         List<MeasurementWaveForms> measurementWaveForms) {
      this.measurementWaveForms = measurementWaveForms;
   }
}

@JsonPropertyOrder ( value= {"measurementType",   "measurementUnit",  "measurementValue",  "measurementDateTime"} )
public class MeasurementEntities implements Serializable {

   
   /**
    *
    */
   private static final long serialVersionUID = 8130667358544290237L;
   
   private String measurementType;
   private String measurementUnit;
   private String measurementValue;
   private String measurementDateTime;

   /**
    * @return the measurementType
    */
    @XmlElement(name = "type")
   public String getMeasurementType() {
      return measurementType;
   }

    /**
    * @param measurementType the measurementType to set
    */
   public void setMeasurementType(String measurementType) {
      this.measurementType = measurementType;
   }
   
   
   /**
    * @return the measurementUnit
    */
    @XmlElement(name = "unit")
   public String getMeasurementUnit() {
      return measurementUnit;
   }
   
   /**
    * @param measurementUnit the measurementUnit to set
    */
   public void setMeasurementUnit(String measurementUnit) {
      this.measurementUnit = measurementUnit;
   }
   
   
    /**
    * @return the measurementValue
    */
    @XmlElement(name = "value")
    public String getMeasurementValue() {
      return measurementValue;
   }
   
   /**
    * @param measurementValue the measurementValue to set
    */
   public void setMeasurementValue(String measurementValue) {
      this.measurementValue = measurementValue;
   }
   
   
    /**
    * @return the measurementDateTime
    */
    @XmlElement(name = "dateTime")    
    public String getMeasurementDateTime() {
      return measurementDateTime;
   }
   
   /**
    * @param measurementDateTime the measurementDateTime to set
    */
   public void setMeasurementDateTime(String measurementDateTime) {
      this.measurementDateTime = measurementDateTime;
   }

}

The result I can see in Activiti Explorer is that a process variable measurementEntities is created, but not a process variable weight which is set to 87.5. Now, I'm wondering, why I can't see the elements from the measuermentEntities list in the Acitviti Explorer, instated I see only measurementEntities which probably represents the list reference. Secondly and more important, why can't I access the elements of the list? Can somebody tell me, how I need modify this expression: measurement.measurementEntities[0].value in order to access the elements in the list.

Many Thanks,
Marco

Outcomes