public void build(Process process,
ProcessDescr processDescr,
ProcessBuildContext context,
Node node) {
Split splitNode = ( Split ) node;
if ( splitNode.getType() != Split.TYPE_XOR && splitNode.getType() != Split.TYPE_OR ) {
// we only process or/xor
return;
}
// we need to clone the map, so we can update the original while iterating.
Map<ConnectionRef, Constraint> map = new HashMap<ConnectionRef, Constraint>( splitNode.getConstraints() );
for ( Iterator<Map.Entry<ConnectionRef, Constraint>> it = map.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<ConnectionRef, Constraint> entry = it.next();
ConnectionRef connection = entry.getKey();
ConstraintImpl constraint = (ConstraintImpl) entry.getValue();
Connection outgoingConnection = null;
for (Connection out: splitNode.getDefaultOutgoingConnections()) {
if (out.getToType().equals(connection.getToType())
&& out.getTo().getId() == connection.getNodeId()) {
outgoingConnection = out;
}
}
if (outgoingConnection == null) {
throw new IllegalArgumentException("Could not find outgoing connection");
}
if ( "rule".equals( constraint.getType() )) {
RuleConstraintEvaluator ruleConstraint = new RuleConstraintEvaluator();
ruleConstraint.setDialect( constraint.getDialect() );
ruleConstraint.setName( constraint.getName() );
ruleConstraint.setPriority( constraint.getPriority() );
ruleConstraint.setDefault( constraint.isDefault() );
splitNode.setConstraint( outgoingConnection, ruleConstraint );
} else if ( "code".equals( constraint.getType() ) ) {
ReturnValueConstraintEvaluator returnValueConstraint = new ReturnValueConstraintEvaluator();
returnValueConstraint.setDialect( constraint.getDialect() );
returnValueConstraint.setName( constraint.getName() );
returnValueConstraint.setPriority( constraint.getPriority() );
returnValueConstraint.setDefault( constraint.isDefault() );
splitNode.setConstraint( outgoingConnection, returnValueConstraint );
ReturnValueDescr returnValueDescr = new ReturnValueDescr();
returnValueDescr.setText( constraint.getConstraint() );
ProcessDialect dialect = ProcessDialectRegistry.getDialect( constraint.getDialect() );