Interface ConstraintContext
-
- All Superinterfaces:
Serializable
public interface ConstraintContext extends Serializable
The context in which constraints are executed.
-
-
Field Summary
Fields Modifier and Type Field Description static String
NO_OBJECTS_FOUND
static String
TOO_MANY_OBJECTS
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
applyRouting(boolean isQueueInherited)
Do the constraints allow routing to be used in a chain for this entity?boolean
constraintsSatisfied()
Are all constraints satisfied? Only valid after a call to execute().void
execute()
Execute all constraints.ConstraintEntity
getConstraintEntity()
Get a representation of the entity to use for constraint evaluation.List<ConstraintViolatedException>
getConstraintViolations()
Get a list of constraint violations.String
getDisplayValue(String parameterName, Object value)
Calculate the display value for the given internal value.String
getInternalValue(String parameterName, String query)
Find the internal value for the given search string for a display value.String
getIsolationGroup()
Get the isolation group for this constraint context.LOVCollection
getLOV(Locale locale, String parameterName, String query, int startAt, int fetchSize)
Get an LOV for the specified parameter.LOVSupport
getLOVSupport(String parameterName)
Does this constraint provide LOV support for the specified parameter?com.redwood.scheduler.api.model.SchedulerSession
getSchedulerSession()
Get a scheduler session.ConstraintViolatedException
getViolationException()
Get the first constraint violation.boolean
isAllowedForcedProcessServer(com.redwood.scheduler.api.model.ProcessServer processServer)
Do the constraints allow this process server to be used for this entity?boolean
isAllowedQueue(com.redwood.scheduler.api.model.Queue queue)
Do the constraints allow this queue to be used for this entity?void
update(String parameterName, String changedParameterName)
Notifies constraint about parameter changes.
-
-
-
Field Detail
-
NO_OBJECTS_FOUND
static final String NO_OBJECTS_FOUND
- See Also:
- Constant Field Values
-
TOO_MANY_OBJECTS
static final String TOO_MANY_OBJECTS
- See Also:
- Constant Field Values
-
-
Method Detail
-
constraintsSatisfied
boolean constraintsSatisfied()
Are all constraints satisfied? Only valid after a call to execute().- Returns:
- true if all constraints are satisfied, false otherwise.
-
getConstraintViolations
List<ConstraintViolatedException> getConstraintViolations()
Get a list of constraint violations. Will return an empty list if there are no violations. Only valid after a call to execute().- Returns:
- a list of
ConstraintViolatedException
objects representing violations or an empty list for no violations.
-
getViolationException
ConstraintViolatedException getViolationException()
Get the first constraint violation. Only valid after a call to execute().- Returns:
- the first violation, or null if there are no violations.
-
getLOV
LOVCollection getLOV(Locale locale, String parameterName, String query, int startAt, int fetchSize)
Get an LOV for the specified parameter.- Parameters:
locale
- the locale for the LOV.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(String parameterName)
Does this constraint provide LOV support for the specified parameter?- Parameters:
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.
-
execute
void execute()
Execute all constraints. The results of the execution are available in various forms fromconstraintsSatisfied()
,getViolationException()
, orgetConstraintViolations()
.
-
getConstraintEntity
ConstraintEntity getConstraintEntity()
Get a representation of the entity to use for constraint evaluation. This representation may wrap:- a real
Job
- a
JobChainCall
if the constraint is being evaluated in the job chain editor - a row in a
Table
if the constraint is being evaluated in the context of a table
- Returns:
- a representation of the entity to use for constraint evaluation.
- a real
-
getSchedulerSession
com.redwood.scheduler.api.model.SchedulerSession getSchedulerSession()
Get a scheduler session. The locale of this session will be set to the locale last passed togetLOV(Locale, String, String, int, int)
.- Returns:
- the scheduler session.
-
isAllowedQueue
boolean isAllowedQueue(com.redwood.scheduler.api.model.Queue queue)
Do the constraints allow this queue to be used for this entity?- Parameters:
queue
- the queue in question- Returns:
- true if the queue is allowed, false otherwise.
-
isAllowedForcedProcessServer
boolean isAllowedForcedProcessServer(com.redwood.scheduler.api.model.ProcessServer processServer)
Do the constraints allow this process server to be used for this entity?- Parameters:
processServer
- the process server in question- Returns:
- true if the process server is allowed, false otherwise.
-
applyRouting
void applyRouting(boolean isQueueInherited)
Do the constraints allow routing to be used in a chain for this entity?- Parameters:
isQueueInherited
- is the queue set by the user or inherited from it's parent
-
getIsolationGroup
String getIsolationGroup()
Get the isolation group for this constraint context.- Returns:
- the isolation group of the session for this constraint context.
-
getDisplayValue
String getDisplayValue(String parameterName, Object value)
Calculate the display value for the given internal value.- Parameters:
parameterName
-value
-- Returns:
- String
-
getInternalValue
String getInternalValue(String parameterName, String query)
Find the internal value for the given search string for a display value. Only returns the internal value if there is only one match. It does not need to be an exact match. If there are no matches, the constant string NO_OBJECTS_FOUND is returned. If there is more than one match, the constant string TOO_MANY_OBJECTS is returned.- Parameters:
parameterName
- for which the internal value is requestedquery
- is a search string for the display value- Returns:
- the internal value of the object that matches the query, or a fixed string if the query does not match a single object
-
-