org.activiti.engine.impl.cmd.ValidateBpmnModelCmd Maven / Gradle / Ivy
The newest version!
package org.activiti.engine.impl.cmd;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.validation.ProcessValidator;
import org.activiti.validation.ValidationError;
import java.util.List;
/**
*/
public class ValidateBpmnModelCmd implements Command> {
protected BpmnModel bpmnModel;
public ValidateBpmnModelCmd(BpmnModel bpmnModel) {
this.bpmnModel = bpmnModel;
}
@Override
public List execute(CommandContext commandContext) {
ProcessValidator processValidator = commandContext.getProcessEngineConfiguration().getProcessValidator();
if (processValidator == null) {
throw new ActivitiException("No process validator defined");
}
return processValidator.validate(bpmnModel);
}
}