Interface Constraint

  • All Superinterfaces:
    Serializable

    public interface Constraint
    extends Serializable
    A runtime instance of a constraint. This is a constraint definition that has been instantiated and had its parameters and other runtime references set. The construction of constraint objects has the following phases:
    1. The object is constructed by calling ConstraintFactory.create().
    2. The setParameterMappings() method will be called to set parameter values.
    3. The freeze() will be called.
    • Method Detail

      • getLOV

        LOVCollection getLOV​(ConstraintContext context,
                             String parameterName,
                             String query,
                             int startAt,
                             int fetchSize)
        Get an LOV for the specified parameter.
        Parameters:
        context - the context in which the constraint is to execute.
        parameterName - the name of the parameter for which an LOV is required.
        query - a user specified query.
        startAt - the starting position for the query results.
        fetchSize - the fetch size for the query results.
        Returns:
        an LOVCollection representing the results.
      • getLOVSupport

        LOVSupport getLOVSupport​(ConstraintContext context,
                                 String parameterName)
        Does this constraint provide LOV support for the specified parameter?
        Parameters:
        context - the context in which the constraint is to execute.
        parameterName - the name of the parameter for which an LOV is required.
        Returns:
        an LOVSupport object representing the level of LOV support provided by this constraint for the specified parameter.
      • validate

        default void validate()
        Validate the constraint parameter mappings provided to this constraint instance.
        Throws:
        RuntimeException - if the constraint parameter mappings are invalid.
      • freeze

        void freeze()
        Freeze the values of constraint parameter mappings for this constraint instance.
      • setParameterMappings

        void setParameterMappings​(Iterator<? extends com.redwood.scheduler.api.model.EntityDefinitionConstraintParameterMapping> parameterMappings)
        Set the parameter mappings for this constraint.
        Parameters:
        parameterMappings - an Iterator of EntityDefinitionConstraintParameterMapping objects representing the values of the parameters for this instance of the constraint definition.
      • getDisplayValue

        String getDisplayValue​(ConstraintContext context,
                               String parameterName,
                               Object value)
        Calculate the display value for the given internal value
        Parameters:
        context -
        parameterName -
        value -
        Returns:
        String
      • update

        void update​(ConstraintContext context,
                    String parameterName,
                    String changedParameterName)
        Notifies constraint about parameter changes
        Parameters:
        context -
        parameterName -
        changedParameterName -
      • supportsArray

        boolean supportsArray()
        Returns true if this constraint is capable of handling array values, instead of a single value only.
        Returns:
        True if it does, false otherwise.