public void addRoutingConstraint ( String activity , AbstractConstraint < ? > constraint ) throws PropertyException { Validate . notNull ( activity ) ; Validate . notEmpty ( activity ) ; Validate . notNull ( constraint ) ; //1. Add constraint itself // This also adds the constraint to the list of constraints String propertyNameForNewConstraint = addConstraint ( constraint ) ; //2. Add constraint name to the list of constraints for this activity Set < String > currentConstraintNames = getConstraintNames ( activity ) ; currentConstraintNames . add ( propertyNameForNewConstraint ) ; if ( currentConstraintNames . size ( ) == 1 ) { //Add the activity to the list of activities with routing constraints addActivityWithConstraints ( activity ) ; } props . setProperty ( String . format ( ACTIVITY_CONSTRAINTS_FORMAT , activity ) , ArrayUtils . toString ( currentConstraintNames . toArray ( ) ) ) ; }
Adds a routing constraint for an activity .