protected override void ExecuteValidation(BpmnModel bpmnModel, BPMN.Model.Process process, List <ValidationError> errors) { List <EventListener> eventListeners = process.EventListeners; if (eventListeners != null) { foreach (EventListener eventListener in eventListeners) { if (eventListener.ImplementationType != null && eventListener.ImplementationType == ImplementationType.IMPLEMENTATION_TYPE_INVALID_THROW_EVENT) { AddError(errors, Problems.EVENT_LISTENER_INVALID_THROW_EVENT_TYPE, process, eventListener, "Invalid or unsupported throw event type on event listener"); } else if (eventListener.ImplementationType == null || eventListener.ImplementationType.Length == 0) { AddError(errors, Problems.EVENT_LISTENER_IMPLEMENTATION_MISSING, process, eventListener, "Element 'class', 'delegateExpression' or 'throwEvent' is mandatory on eventListener"); } else if (eventListener.ImplementationType != null) { if (!ImplementationType.IMPLEMENTATION_TYPE_CLASS.Equals(eventListener.ImplementationType) && !ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.Equals(eventListener.ImplementationType) && !ImplementationType.IMPLEMENTATION_TYPE_THROW_SIGNAL_EVENT.Equals(eventListener.ImplementationType) && !ImplementationType.IMPLEMENTATION_TYPE_THROW_GLOBAL_SIGNAL_EVENT.Equals(eventListener.ImplementationType) && !ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT.Equals(eventListener.ImplementationType) && !ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT.Equals(eventListener.ImplementationType)) { AddError(errors, Problems.EVENT_LISTENER_INVALID_IMPLEMENTATION, process, eventListener, "Unsupported implementation type for event listener"); } } } } }
protected abstract void ExecuteValidation(BpmnModel bpmnModel, BPMN.Model.Process process, List <ValidationError> errors);
protected void AddError(List <ValidationError> validationErrors, String problem, BPMN.Model.Process process, String id, String description) { ValidationError error = new ValidationError(); if (process != null) { error.setProcessDefinitionId(process.Id); error.setProcessDefinitionName(process.Name); } error.setProblem(problem); error.setDefaultDescription(description); error.setActivityId(id); AddError(validationErrors, error); }
protected void AddError(List <ValidationError> validationErrors, String problem, BPMN.Model.Process process, BaseElement baseElement, String description, bool isWarning) { ValidationError error = new ValidationError(); error.IsWarning = isWarning; if (process != null) { error.setProcessDefinitionId(process.Id); error.setProcessDefinitionName(process.Name); } if (baseElement != null) { error.setXmlLineNumber(baseElement.XmlRowNumber); error.setXmlColumnNumber(baseElement.XmlColumnNumber); } error.setProblem(problem); error.setDefaultDescription(description); if (baseElement is FlowElement) { FlowElement flowElement = (FlowElement)baseElement; error.setActivityId(flowElement.Id); error.setActivityName(flowElement.Name); } AddError(validationErrors, error); }
protected void addWarning(List <ValidationError> validationErrors, String problem, BPMN.Model.Process process, BaseElement baseElement, String description) { AddError(validationErrors, problem, process, baseElement, description, true); }