Interface ExecutorContext
-
public interface ExecutorContext
The executor context describes what started this execution.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ExecutorOrigin
getOrigin()
Get the origin of the execution.com.redwood.scheduler.api.model.SchedulerEntity
getOriginEntity(com.redwood.scheduler.api.model.SchedulerSession session)
For origins that are based on a SchdulerEntity (Extension Point, Job etc.) this method will return the Object that is associated with that execution.String
getOriginEntityKey()
Returns the error name key of the entity that would be returned by getOriginEntity.ExecutorContext
getParentExecutorContext()
Some executions are triggered by another execution (like a trigger) and this method provides the ExecutorContext of that execution.String
getServletName()
IfExecutorOrigin
isExecutorOrigin.SERVLET
this method return the name of the servlet that the request came in on.long
getStartTime()
Get the time in millis when this executor context was startedcom.redwood.scheduler.api.model.Subject
getUser(com.redwood.scheduler.api.model.SchedulerSession session)
Get the Subject that started this execution.String
getUserName()
the name of the user.
-
-
-
Method Detail
-
getOrigin
ExecutorOrigin getOrigin()
Get the origin of the execution.- Returns:
- the origin of the execution
-
getOriginEntityKey
String getOriginEntityKey()
Returns the error name key of the entity that would be returned by getOriginEntity. This can be used if the current user does not have access to the entity.- Returns:
- the error name key of the entity if there is one.
-
getOriginEntity
com.redwood.scheduler.api.model.SchedulerEntity getOriginEntity(com.redwood.scheduler.api.model.SchedulerSession session)
For origins that are based on a SchdulerEntity (Extension Point, Job etc.) this method will return the Object that is associated with that execution. The object will be retrieved from the passed in session, and can return null when the session is not allowed to view the object.- Parameters:
session
- to use to retrieve the entity- Returns:
- the entity if applicable and the passed in session is allowed to see the entity.
-
getServletName
String getServletName()
IfExecutorOrigin
isExecutorOrigin.SERVLET
this method return the name of the servlet that the request came in on.- Returns:
- the name if the Servlet, null if this is not a
ExecutorOrigin.SERVLET
origin.
-
getUser
com.redwood.scheduler.api.model.Subject getUser(com.redwood.scheduler.api.model.SchedulerSession session)
Get the Subject that started this execution. This does not need to be the subject that the execution runs at, since f.e. an action subject can be set.- Parameters:
session
-- Returns:
- the subject that started this execution
-
getUserName
String getUserName()
the name of the user. SeegetUser(SchedulerSession)
for a description about the user.- Returns:
- the name of the origin user.
-
getParentExecutorContext
ExecutorContext getParentExecutorContext()
Some executions are triggered by another execution (like a trigger) and this method provides the ExecutorContext of that execution. All executions that originated from outside the system will have be or have a parent that isExecutorOrigin.SERVLET
withgetServletName()
set to the servlet receiving the outside request.- Returns:
- the ExecutorContext that triggered this Execution, or null if there is none
-
getStartTime
long getStartTime()
Get the time in millis when this executor context was started- Returns:
- the time in millis since Epoch
-
-