Bug 550406
fixed version - added test for MIXED type
Change-Id: I8a2f3c84e5836c14e6689109559520c41e214042
Signed-off-by: Ralph Soika <ralph.soika@imixs.com>
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/GatewayValidator.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/GatewayValidator.java
index f7b8fbb..8a6e120 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/GatewayValidator.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/GatewayValidator.java
@@ -26,7 +26,16 @@
import org.eclipse.emf.validation.IValidationContext;
/**
- *
+ * This class is responsible to validate the gateway direction
+ * for the different gateway types. The Gateway type relates to
+ * the number of incoming and outgoing sequence flows.
+ * <ul>
+ * <li>Converging gateways MUST have multiple incoming, and zero or one outgoing connection</li>
+ * <li>Diverging gateways MUST have zero or one incoming, and multiple outgoing connections</li>
+ * <li>Mixed gateways MUST have multiple incoming, and multiple outgoing connections</li>
+ * <li>Unspecified gateways MUST have either multiple incoming, or multiple outgoing connections</li>
+ * </ul>
+ *
*/
public class GatewayValidator extends AbstractBpmn2ElementValidator<Gateway> {
@@ -107,38 +116,41 @@
}
}
- if (object instanceof ExclusiveGateway) {
- if (direction != GatewayDirection.DIVERGING
- && direction != GatewayDirection.CONVERGING) {
- addStatus(object, "gatewayDirection", //$NON-NLS-1$
- Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Exclusive_Converging_Diverging);
+ // validate direction type (skip for mixed gateway type)
+ if (direction != GatewayDirection.MIXED) {
+ if (object instanceof ExclusiveGateway) {
+ if (direction != GatewayDirection.DIVERGING
+ && direction != GatewayDirection.CONVERGING) {
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Exclusive_Converging_Diverging);
+ }
}
- }
- if (object instanceof EventBasedGateway) {
- if (direction != GatewayDirection.DIVERGING) {
- addStatus(object,"gatewayDirection", //$NON-NLS-1$
- Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Event_Diverging);
+ if (object instanceof EventBasedGateway) {
+ if (direction != GatewayDirection.DIVERGING) {
+ addStatus(object,"gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Event_Diverging);
+ }
}
- }
- if (object instanceof ParallelGateway) {
- if (direction != GatewayDirection.DIVERGING
- && direction != GatewayDirection.CONVERGING) {
- addStatus(object,"gatewayDirection", //$NON-NLS-1$
- Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Parallel_Converging_Diverging);
+ if (object instanceof ParallelGateway) {
+ if (direction != GatewayDirection.DIVERGING
+ && direction != GatewayDirection.CONVERGING) {
+ addStatus(object,"gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Parallel_Converging_Diverging);
+ }
}
- }
- if (object instanceof InclusiveGateway) {
- if (direction != GatewayDirection.DIVERGING
- && direction != GatewayDirection.CONVERGING) {
- addStatus(object,"gatewayDirection", //$NON-NLS-1$
- Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Inclusive_Converging_Diverging);
+ if (object instanceof InclusiveGateway) {
+ if (direction != GatewayDirection.DIVERGING
+ && direction != GatewayDirection.CONVERGING) {
+ addStatus(object,"gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Inclusive_Converging_Diverging);
+ }
}
- }
- if (object instanceof ComplexGateway) {
- if (direction != GatewayDirection.DIVERGING
- && direction != GatewayDirection.CONVERGING) {
- addStatus(object,"gatewayDirection", //$NON-NLS-1$
- Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Complex_Converging_Diverging);
+ if (object instanceof ComplexGateway) {
+ if (direction != GatewayDirection.DIVERGING
+ && direction != GatewayDirection.CONVERGING) {
+ addStatus(object,"gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, org.eclipse.bpmn2.modeler.core.validation.validators.Messages.GatewayValidator_Complex_Converging_Diverging);
+ }
}
}
return getResult();