All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.activiti.engine.impl.cmd.RemoveTaskVariablesCmd Maven / Gradle / Ivy

The newest version!
package org.activiti.engine.impl.cmd; 

import java.util.Collection;

import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.impl.persistence.entity.TaskEntity;

/**
 * @author roman.smirnov
 * @author Joram Barrez
 */
public class RemoveTaskVariablesCmd extends NeedsActiveTaskCmd {
  
  private static final long serialVersionUID = 1L;

  private final Collection variableNames;
  private final boolean isLocal;

  public RemoveTaskVariablesCmd(String taskId, Collection variableNames, boolean isLocal) {
    super(taskId);
    this.variableNames = variableNames;
    this.isLocal = isLocal;
  }
  
  protected Void execute(CommandContext commandContext, TaskEntity task) {

    if (isLocal) {
      task.removeVariablesLocal(variableNames);
    } else {
      task.removeVariables(variableNames);
    }
    
    return null;
  }
  
  @Override
  protected String getSuspendedTaskException() {
    return "Cannot remove variables from a suspended task.";
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy