cancel
Showing results for 
Search instead for 
Did you mean: 

ActivitiUtil class is no longer available in 5.18.0

krull80
Champ in-the-making
Champ in-the-making
Hello,

I have a project that is extending Activiti REST to include some extra functionality. This project is using Activiti 5.16.1 version andwe would like to move it to the latest version 5.18.0. After changing my project dependencies I have found some issues:
1.
org.activiti.designer.integration.servicetask.annotation
has been moved to
org.activiti.designer.integration.annotation

2. An the main problem, not too sure how to sove it. We are using :
org.activiti.rest.common.api.ActivitiUtil

but it's not availble in 5.18.0. A sample of usage:


   @Override
   public Void doExecute(CommandContext commandContext) {
      this.userService.setUser(examiner);
      ActivitiUtil.getRuntimeService().setVariable(executionId, Variable.EXECUTION_RESULT.getValue(), TaskResult.OK);
      Map<String, Object> variablesToSet = new HashMap<String, Object>();
      variablesToSet.put(Variable.SENDING_MODE.getValue(), sendingMode);
      ActivitiUtil.getRuntimeService().messageEventReceived(NotifyLetterSent.NOTIFY_SEND_LETTER, executionId, variablesToSet);
      this.userService.clearUser();
      return null;
   }


5 REPLIES 5

vasile_dirla
Star Contributor
Star Contributor
Hi,
in order to obtain a service here you could do it like that:
<code>
RuntimeService runtimeService = commandContext.getProcessEngineConfiguration(). getRuntimeService();
</code>

krull80
Champ in-the-making
Champ in-the-making
Thanks a million!!

I will  use it.

krull80
Champ in-the-making
Champ in-the-making
Hello

I have tested it and it works for those scenarios where I have the Commandcontext, but How about this other scenario?
<code>
private String findTaskByVariableList() {
  TaskQuery taskQuery = ActivitiUtil.getTaskService().createTaskQuery().includeProcessVariables();

  for (Entry<String, RestVariable> var : variables.entrySet()) {
   taskQuery.processVariableValueEquals(var.getKey(), var.getValue().getValue());
  }

  List<Task> tasks = taskQuery.list();
  for (Task task : tasks) {
   if (StringUtils.equals(taskKey, task.getFormKey())) {
    return task.getId();
   }
  }

  return StringUtils.EMPTY;
}
</code>

Is there any similar class to ActivitiUtil for doing this?

Thanks in advance

krull80
Champ in-the-making
Champ in-the-making
Hello again,

I have found the old code from ActivitiUtil ,
<code>
    public static ProcessEngine getProcessEngine() {
     if (activitiProvider != null) {
       return activitiProvider.getProcessEngine();
     } else {
       return ProcessEngines.getDefaultProcessEngine();
     }
   }
</code>

basically each time I see a reference to ActivitiUtil I will replace it with <code>ProcessEngines.getDefaultProcessEngine(). …</code>

Thanks and sorry for the inconveniences
Luis

vasile_dirla
Star Contributor
Star Contributor
Great,
thank you for sharing your finding.