public class IlvBPMNFlowValidator extends Object
IlvBPMNFlowValidator
object is created and set to
a IlvBPMNModeler
, it can be used any time a flow needs
to be validated. For example, this class is used by
IlvBPMNMakeSDMLinkInteractor
to check if specific objects can be
the source or target objects of a flow that is being created.
IlvBPMNMakeSDMLinkInteractor
is the interactor that creates
flow objects.
This flow validating object is based on a list of
objects that can
added or removed independently. This is done using the
IlvBPMNFlowValidator.FlowRule
,
addRule(FlowRule)
and
insertRule(int, FlowRule)
methods. This default implementation comes with
a set of predefined flow rules that are pointed to by static fields.
removeRule(FlowRule)
The following code example shows how to implement the
noGatewayForMessageFlow
sample flow rule provided:
public static FlowRule noGatewayForMessageFlow = new FlowRule() { public boolean isValidSource(IlvSDMEngine engine, Object flow, Object source) { IlvSDMModel model = engine.getModel(); return !(IlvBPMNUtilities.isGateway(model, source) && IlvBPMNUtilities.isMessageFlow(model, flow)); } public boolean isValidTarget(IlvSDMEngine engine, Object flow, Object source, Object target) { IlvSDMModel model = engine.getModel(); return !(IlvBPMNUtilities.isGateway(model, target) && IlvBPMNUtilities.isMessageFlow(model, flow)); } };
The following code example shows how a flow rule can be added:
FlowRule myFlowRule = new FlowRule() { public boolean isValidTarget(IlvSDMEngine engine, Object flow, Object source, Object target) { return (source != target); } }; IlvBPMNFlowValidator validator = myBPMNModeler.getFlowValidator(); validator.addRule(myFlowRule);
Modifier and Type | Class and Description |
---|---|
static class |
IlvBPMNFlowValidator.FlowRule
The base class for flow rule that is used by
IlvBPMNFlowValidator . |
Modifier and Type | Field and Description |
---|---|
static IlvBPMNFlowValidator.FlowRule |
compensationAssociation
This flow rule verifies that a Compensation Intermediate Event cannot
have an outgoing Sequence Flow, but a Compensation Association link.
|
static IlvBPMNFlowValidator.FlowRule |
interruptIntermediateTarget
The Interrupt Intermediate Event cannot be the target of a flow.
|
static IlvBPMNFlowValidator.FlowRule |
noArtifact
This flow rule verifies that the objects connected by a flow are not artifacts.
|
static IlvBPMNFlowValidator.FlowRule |
noEndEventSourceOfSequenceFlow
This flow rule verifies that an End Event cannot be the source of
a Sequence Flow.
|
static IlvBPMNFlowValidator.FlowRule |
noEndEventTargetOfMessageFlow
This flow rule verifies that an End Event cannot be the target of a
Message Flow.
|
static IlvBPMNFlowValidator.FlowRule |
noGatewayForMessageFlow
This flow rule verifies that a Gateway cannot be connect by a Message Flow.
|
static IlvBPMNFlowValidator.FlowRule |
noLane
This flow rule verifies that a Lane cannot be connect by any flow.
|
static IlvBPMNFlowValidator.FlowRule |
noPoolForSequenceFlow
This flow rule verifies that a Pool cannot be connected by a Sequence Flow.
|
static IlvBPMNFlowValidator.FlowRule |
noSameLaneForMessageFlow
Deprecated.
since JViews 8.1, according to the BPMN 1.1 working draft.
|
static IlvBPMNFlowValidator.FlowRule |
noSamePoolForMessageFlow
This flow rule verifies that two objects connected by a Message Flow must
not be within the same Participant Pool boundary.
|
static IlvBPMNFlowValidator.FlowRule |
noStartEventSourceOfMessageFlow
This flow rule verifies that a Start Event cannot be the source of
a Message Flow.
|
static IlvBPMNFlowValidator.FlowRule |
noStartEventTargetOfSequenceFlow
This flow rule verifies that a Start Event cannot be the target of
a Sequence Flow.
|
static IlvBPMNFlowValidator.FlowRule |
notSameNode
This flow rule verifies that the source and the target of a flow are
two different objects.
|
static IlvBPMNFlowValidator.FlowRule |
samePoolForSequenceFlow
This flow rule verifies that two objects connected by a Sequence Flow
are in the same pool.
|
static IlvBPMNFlowValidator.FlowRule |
sameSubProcessForSequenceFlow
This flow rule verifies that two objects connected by a Sequence Flow
are not in different sub-processes.
|
static IlvBPMNFlowValidator.FlowRule |
sourceForOnlyOneDefaultFlow
This flow rule verifies that an object cannot be the source of multiple
Default Flow objects.
|
Constructor and Description |
---|
IlvBPMNFlowValidator()
Constructs a flow validating object that uses a predefined flow rule.
|
Modifier and Type | Method and Description |
---|---|
void |
addRule(IlvBPMNFlowValidator.FlowRule rule)
Adds a rule to validate flow connection.
|
static boolean |
areInSameLane(IlvSDMEngine engine,
Object obj1,
Object obj2)
Tests if two objects are in a same swimlane.
|
static boolean |
areInSamePool(IlvSDMEngine engine,
Object obj1,
Object obj2)
Tests if two objects are located in a same pool.
|
IlvBPMNFlowValidator.FlowRule |
getRule(int index)
Returns the rule at a given index.
|
int |
getRuleCount()
Returns the number of rules in this
IlvBPMNFlowValidator
instance. |
void |
insertRule(int index,
IlvBPMNFlowValidator.FlowRule rule)
Inserts a rule to validate flow connection at a specified index.
|
boolean |
isValidSource(IlvSDMEngine engine,
Object flow,
Object source)
Tests if a given flow can connect from an object.
|
boolean |
isValidTarget(IlvSDMEngine engine,
Object flow,
Object source,
Object target)
Tests if a given flow can connect from an object.
|
void |
removeRule(IlvBPMNFlowValidator.FlowRule rule)
Removes a rule.
|
public static IlvBPMNFlowValidator.FlowRule notSameNode
public static IlvBPMNFlowValidator.FlowRule noArtifact
public static IlvBPMNFlowValidator.FlowRule noLane
public static IlvBPMNFlowValidator.FlowRule noPoolForSequenceFlow
public static IlvBPMNFlowValidator.FlowRule noGatewayForMessageFlow
public static IlvBPMNFlowValidator.FlowRule noEndEventSourceOfSequenceFlow
public static IlvBPMNFlowValidator.FlowRule noStartEventSourceOfMessageFlow
public static IlvBPMNFlowValidator.FlowRule sourceForOnlyOneDefaultFlow
public static IlvBPMNFlowValidator.FlowRule samePoolForSequenceFlow
public static IlvBPMNFlowValidator.FlowRule sameSubProcessForSequenceFlow
public static IlvBPMNFlowValidator.FlowRule noStartEventTargetOfSequenceFlow
public static IlvBPMNFlowValidator.FlowRule noEndEventTargetOfMessageFlow
@Deprecated public static IlvBPMNFlowValidator.FlowRule noSameLaneForMessageFlow
noSamePoolForMessageFlow
public static IlvBPMNFlowValidator.FlowRule noSamePoolForMessageFlow
public static IlvBPMNFlowValidator.FlowRule compensationAssociation
public static IlvBPMNFlowValidator.FlowRule interruptIntermediateTarget
public IlvBPMNFlowValidator()
public void addRule(IlvBPMNFlowValidator.FlowRule rule)
rule
- The new rule to add.public void insertRule(int index, IlvBPMNFlowValidator.FlowRule rule)
index
- The position of the new rule in the rule list.rule
- The new rule to be added.public void removeRule(IlvBPMNFlowValidator.FlowRule rule)
rule
- The rule to be removed.public int getRuleCount()
IlvBPMNFlowValidator
instance.IlvBPMNFlowValidator
instance.public IlvBPMNFlowValidator.FlowRule getRule(int index)
index
- The index of the rule to returned.index
.public boolean isValidSource(IlvSDMEngine engine, Object flow, Object source)
IlvBPMNFlowValidator.FlowRule.isValidSource(IlvSDMEngine, Object, Object)
method of all the flow rules added until one of them returns
false
.engine
- The SDM engine.flow
- The flow that is supposed to be used to connect
the given object.source
- The object that is supposed to be connected to as the source
of the given flow.true
, true
is returned. If at least one of them return false
,
false
is returned.addRule(FlowRule)
public boolean isValidTarget(IlvSDMEngine engine, Object flow, Object source, Object target)
IlvBPMNFlowValidator.FlowRule.isValidTarget(IlvSDMEngine, Object, Object, Object)
method of all the flow rules added until one of them returns
false
.engine
- The SDM engine.flow
- The flow that is supposed to be used to connect to
the given target object.source
- The object from which the flow starts.target
- The object that is supposed to be the target
of flow
.true
, true
is returned. If at least one flow rule returns false
,
false
is returned.addRule(FlowRule)
public static boolean areInSameLane(IlvSDMEngine engine, Object obj1, Object obj2)
engine
- The SDM engine containing the objects to test.obj1
- One of the two objects to test.obj2
- The Other object to test.true
is returned.public static boolean areInSamePool(IlvSDMEngine engine, Object obj1, Object obj2)
engine
- The SDM engine which contains the objects to test.obj1
- One of the two objects to test.obj2
- The other object to test.true
is returned.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.