AnsweredAssumed Answered

Java Service Task Problem with List

Question asked by smee82 on Nov 2, 2011
Latest reply on Nov 2, 2011 by smee82
i want to set List of users (productmanagers) as a variable. I want to reuse this variable for a multiinstance task which needs a collection. The collection should contain these users. I tried different possibilities but only get Exception:couldn't instantiate class. Does anybody know how to store a list as a process variable so i can use it as a collection in a multi-instance task?

Thank for your help!

public class IdentifyMembers implements JavaDelegate {

   public void execute(DelegateExecution execution) {
      String[] str_memberList = {"geschaeftsfuehrer", "controller", "hbl_it", "hbl_2", "prod_man_1", "prod_man_2", "auftraggeber_1"};
      String[] str_productmanagerList = {"prod_man_1", "prod_man_2"};
      List<String> productmanagerList = Arrays.asList(str_productmanagerList);
                //first try
      execution.setVariable("productmanagerList",  CollectionUtil.singletonMap("productmanagerList", productmanagerList));
      //second try
      //Map<String, Object> map = new HashMap<String, Object>();
       //map.put("productmanagerList", productmanagerList);
       //execution.setVariable("productmanagerList", map);