Class JobControllerService
- java.lang.Object
-
- com.avoka.fc.core.service.BaseService
-
- com.avoka.fc.core.service.CayenneService
-
- com.avoka.fc.core.service.job.impl.JobControllerService
-
- All Implemented Interfaces:
IServiceDefinitionAware
,IJobController
public class JobControllerService extends CayenneService implements IJobController, IServiceDefinitionAware
Provides a Collaboration Job Controller service.- Since:
- 4.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected Integer
actionRetryDelayMins
-
Constructor Summary
Constructors Constructor Description JobControllerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cancelJob(Job job)
Cancel the job, abandon any Assigned or Saved Tasks and make submission data ready for purging.boolean
cancelledTaskSubmission(Submission submission)
Provides a callback to tell the Job controller that the given task submission has been cancelled.boolean
completedJobAsyncAction(String jobActionKey)
Provides a callback to tell the Job controller that the specified asynchronous action ('Job Async Action') has been completed.boolean
completedTaskSubmission(Submission submission)
Provides a callback to tell the Job controller that the given task submission has been completed.Job
createJobWithClient(Client client)
Create a job with the client, initializing the first step and action and put in 'Ready' state.Job
createJobWithSubmission(Submission submission)
Create a job with the submission, initializing the first step and action, and using the given submission and put step action in 'Ready' state.Integer
getActionRetryDelayMins()
String
getJobDefinition()
Return the Job definition configuration (JSON format).ServiceDefinition
getServiceDefinition()
Return the service definition.boolean
isJobControllerEnabled()
Return true if the job controller service is enabled and should be processed by the scheduled job.boolean
isLogJobHistory()
Set the log job history.boolean
pausedJob(Job job)
Pause the job from performing any further processing.void
processJob(Job job)
Process the job when a job action is in a 'Ready' state.void
processJob(Job job, boolean logHistory)
Process the job when a job action is in a 'Ready' state.boolean
resumeJob(Job job)
Resume the job to perform further processing.void
setActionRetryDelayMins(Integer delayMins)
Set the default action service retry delay minutes.void
setJobControllerEnabled(boolean enabled)
Specify whether the Job Controller service is enabled.void
setJobDefinition(String jobDefinition)
Set the Job definition configuration (JSON format).void
setLogJobHistory(boolean logJobHistory)
Return the log job historyvoid
setServiceDefinition(ServiceDefinition serviceDefinition)
Set the service definition.String
toString()
Return the string representation of this object.-
Methods inherited from class com.avoka.fc.core.service.CayenneService
commitChanges, deleteObject, deleteObjects, findObject, getDataContext, getDataDomain, getObjectForPK, getObjectStore, newObject, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, refetchEntity, refetchObject, registerNewObject, rollbackChanges, toMap, toMap
-
Methods inherited from class com.avoka.fc.core.service.BaseService
getLogger
-
-
-
-
Field Detail
-
actionRetryDelayMins
protected Integer actionRetryDelayMins
-
-
Method Detail
-
getJobDefinition
public String getJobDefinition()
Return the Job definition configuration (JSON format).- Returns:
- Job definition configuration (JSON format)
-
setJobDefinition
public void setJobDefinition(String jobDefinition)
Set the Job definition configuration (JSON format).- Parameters:
jobDefinition
- the Job definition configuration (JSON format).
-
setJobControllerEnabled
public void setJobControllerEnabled(boolean enabled)
Specify whether the Job Controller service is enabled.- Parameters:
enabled
- specify whether the Job Controller service is enabled
-
getServiceDefinition
public ServiceDefinition getServiceDefinition()
Return the service definition.- Specified by:
getServiceDefinition
in interfaceIServiceDefinitionAware
- Returns:
- the service definition
- See Also:
IServiceDefinitionAware.getServiceDefinition()
-
setServiceDefinition
public void setServiceDefinition(ServiceDefinition serviceDefinition)
Set the service definition.- Specified by:
setServiceDefinition
in interfaceIServiceDefinitionAware
- Parameters:
serviceDefinition
- the service definition- See Also:
IServiceDefinitionAware.setServiceDefinition(ServiceDefinition)
-
setActionRetryDelayMins
public void setActionRetryDelayMins(Integer delayMins)
Set the default action service retry delay minutes.- Parameters:
delayMins
- the default action service retry delay minutes
-
getActionRetryDelayMins
public Integer getActionRetryDelayMins()
- Returns:
- the Mins the default action service retry delay minutes
-
isLogJobHistory
public boolean isLogJobHistory()
Set the log job history.- Returns:
- the logJobHistory
- Since:
- 5.1.0
-
setLogJobHistory
public void setLogJobHistory(boolean logJobHistory)
Return the log job history- Parameters:
logJobHistory
- the logJobHistory to set- Since:
- 5.1.0
-
createJobWithClient
public Job createJobWithClient(Client client)
Description copied from interface:IJobController
Create a job with the client, initializing the first step and action and put in 'Ready' state.
If the controller is configured to process the job immediately after creation, this method will also process the job before it is returned.- Specified by:
createJobWithClient
in interfaceIJobController
- Parameters:
client
- the client organization which owns the job (required)- Returns:
- a new job instance
- See Also:
IJobController.createJobWithClient(Client)
-
createJobWithSubmission
public Job createJobWithSubmission(Submission submission)
Description copied from interface:IJobController
Create a job with the submission, initializing the first step and action, and using the given submission and put step action in 'Ready' state.
If the controller is configured to process the job immediately after creation, this method will also process the job before it is returned. This can be useful to create an Task assigned to the user who created the job with the initial submission.- Specified by:
createJobWithSubmission
in interfaceIJobController
- Parameters:
submission
- the initial job submission (required)- Returns:
- a new job instance
- See Also:
IJobController.createJobWithSubmission(Submission)
-
processJob
public void processJob(Job job)
Description copied from interface:IJobController
Process the job when a job action is in a 'Ready' state.- Specified by:
processJob
in interfaceIJobController
- Parameters:
job
- the Job instance to process- See Also:
IJobController.processJob(Job)
-
processJob
public void processJob(Job job, boolean logHistory)
Process the job when a job action is in a 'Ready' state.- Parameters:
job
- the Job instance to processlogHistory
- log the job execution history- Since:
- 5.1.0
-
completedTaskSubmission
public boolean completedTaskSubmission(Submission submission)
Description copied from interface:IJobController
Provides a callback to tell the Job controller that the given task submission has been completed. The job controller should progress the associated task assign action status to 'Completed' and the next task wait action status to 'Ready'.- Specified by:
completedTaskSubmission
in interfaceIJobController
- Parameters:
submission
- the completed task submission (required)- Returns:
- true if the submission task was found and associated "Task Assigned" was set to "Completed" or false otherwise
- See Also:
IJobController.completedTaskSubmission(Submission)
-
cancelledTaskSubmission
public boolean cancelledTaskSubmission(Submission submission)
Description copied from interface:IJobController
Provides a callback to tell the Job controller that the given task submission has been cancelled. The job controller should progress the associated task assign action status to 'Cancelled' and the next task wait action status to 'Ready'.- Specified by:
cancelledTaskSubmission
in interfaceIJobController
- Parameters:
submission
- the cancelled task submission (required)- Returns:
- true if the submission task was found and associated "Task Assigned" was set to "Cancelled" or false otherwise
- See Also:
IJobController.cancelledTaskSubmission(Submission)
-
completedJobAsyncAction
public boolean completedJobAsyncAction(String jobActionKey)
Description copied from interface:IJobController
Provides a callback to tell the Job controller that the specified asynchronous action ('Job Async Action') has been completed. The job controller should progress the associated action status to 'Completed' and the next wait action status to 'Ready'.- Specified by:
completedJobAsyncAction
in interfaceIJobController
- Parameters:
jobActionKey
- the unique job key identifier (required)- Returns:
- true if the job async action was found and set to "Completed" or false otherwise
- See Also:
IJobController.completedJobAsyncAction(String)
-
cancelJob
public boolean cancelJob(Job job)
Description copied from interface:IJobController
Cancel the job, abandon any Assigned or Saved Tasks and make submission data ready for purging.- Specified by:
cancelJob
in interfaceIJobController
- Parameters:
job
- the job instance to cancel (required)- Returns:
- true if the job was cancelled, or false if the job was already finished
- See Also:
IJobController.cancelJob(Job)
-
pausedJob
public boolean pausedJob(Job job)
Description copied from interface:IJobController
Pause the job from performing any further processing.- Specified by:
pausedJob
in interfaceIJobController
- Parameters:
job
- the job instance to pause (required)- Returns:
- true if the job was paused
- See Also:
IJobController.pausedJob(Job)
-
resumeJob
public boolean resumeJob(Job job)
Description copied from interface:IJobController
Resume the job to perform further processing.- Specified by:
resumeJob
in interfaceIJobController
- Parameters:
job
- the job instance to pause (required)- Returns:
- true if the job was resumed
- See Also:
IJobController.resumeJob(Job)
-
isJobControllerEnabled
public boolean isJobControllerEnabled()
Description copied from interface:IJobController
Return true if the job controller service is enabled and should be processed by the scheduled job. This property can be used to prevent a controllers jobs from being processed while some other maintenance action is being performed.- Specified by:
isJobControllerEnabled
in interfaceIJobController
- Returns:
- true if the controller service is enabled
- See Also:
IJobController.isJobControllerEnabled()
-
-