5 Replies Latest reply on Feb 18, 2009 2:24 PM by maxrunner

    How to set Token name?

    j.wozniakowski

      Hello,

      I need to set Token name when it is created. Token class allows setting name only through the constructor (setter setName() is missing). Starting the process is done like this:

      JbpmContext context = getJbmContext();
      ProcessDefinition pd = context.getGraphSession().findLatestProcessDefinition(definition);
      context.setActorId(Actor.instance().getId());
      ProcessInstance p = new ProcessInstance(pd);
      TaskMgmtInstance taskMgmtInstance = p.getTaskMgmtInstance();
      context.save(p);
      TaskInstance task = taskMgmtInstance.createStartTaskInstance();
      task.start();
      task.end();
      context.save(task);
      context.close();
      


      but ProcessInstance creates Token with empty name!

      I think the best solution would be another ProcessInstance constructor like this:

      public ProcessInstance( ProcessDefinition processDefinition, String rootTokenName){ ... }


      Is this a good idea? Feature request in Jira?