AnsweredAssumed Answered

DelegateExecution.setVariable loses inherited attributes

Question asked by rufini on Oct 3, 2011
Latest reply on Oct 5, 2011 by rufini

I've an issue Using Activiti 5.6.
If I set in the DelegateExecution an object wich extends of a superclass, I lost the inherited attributes

public class Animal{
  private String color;

public class Cat extends Animal{
   private String name;

public class AnimalTask
    implements JavaDelegate {

   public void execute(DelegateExecution execution) {
      Cat cat = new Cat();
      cat.setColor = "cyan";
      cat.setName = "Tom";
      execution.setVariable("ANIMAL", cat);

(My flow ends with a UserTask):

// The inherited attribute
execution.getVariable("ANIMAL").getColor() is null
// The other attribute
execution.getVariable("ANIMAL").getName() is "Tom"

I tryied both; making Animal abstract and concrete.

Any suggestions?

Thanks in advance!