Working with Constraints

Constraint definitions let you veto the submission of a Process Definition or Chain Definition if it contains parameters values that violate certain rules. Constraints are based on constraint classes, which must be defined in a library.

To create a constraint definition, navigate to Definitions > Constraints and click .

Tabs and Fields

The following table illustrates the fields of each tab of Constraint Definition editor dialogs.

Field Description
Library The library containing the constraint class.
Factory Class Name The FQCN of the constraint class. For example: com.redwood.scheduler.custom.constraint.MyConstraint.

Attaching a Constraint Definition to a Process or Chain Definition

There is no way to attach a constraint definition to a Process Definition or Chain Definition in the user interface. Instead, use a RedwoodScript Process Definition with a Source script like the following.

Copy
{
    ConstraintDefinition cd = jcsSession.getConstraintDefinitionByName("MyConstraintDefinition");
    JobDefinition jd = jcsSession.getJobDefinitionByName("MyProcessDefinition");
    jd.createJobDefinitionConstraint(cd);
    jcsSession.persist();
}