Class JobServiceImpl
- java.lang.Object
-
- org.bonitasoft.engine.scheduler.impl.JobServiceImpl
-
- All Implemented Interfaces:
JobService
public class JobServiceImpl extends java.lang.Object implements JobService
- Author:
- Celine Souchet, Matthieu Chaffotte
-
-
Field Summary
-
Fields inherited from interface org.bonitasoft.engine.scheduler.JobService
JOB_DESCRIPTOR, JOB_LOG, JOB_PARAMETER
-
-
Constructor Summary
Constructors Constructor Description JobServiceImpl(EventService eventService, Recorder recorder, ReadPersistenceService readPersistenceService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SJobDescriptorcreateJobDescriptor(SJobDescriptor sJobDescriptor, long tenantId)Create a new job descriptor for a specific tenantvoidcreateJobLog(java.lang.Throwable jobException, java.lang.Long jobDescriptorId)SJobLogcreateJobLog(SJobLog sJobLog)Create a new job log for a specific tenantSJobParametercreateJobParameter(SJobParameter sJobParameter, long tenantId, long jobDescriptorId)Create a new job parameter for a specific tenantjava.util.List<SJobParameter>createJobParameters(java.util.List<SJobParameter> sJobParameters, long tenantId, long jobDescriptorId)Create new job parameters for a specific tenantvoiddeleteAllJobDescriptors()Delete all job descriptors for a specific tenantprotected voiddeleteAllJobParameters(long jobDescriptorId)voiddeleteJobDescriptor(long id)Delete the specified job descriptorvoiddeleteJobDescriptor(SJobDescriptor sJobDescriptor)Delete the specified job descriptorvoiddeleteJobDescriptorByJobName(java.lang.String jobName)Delete a job descriptor corresponding to the given job namevoiddeleteJobLog(long id)Delete the specified job logvoiddeleteJobLog(SJobLog sJobLog)Delete the specified job logvoiddeleteJobLogs(long jobDescriptorId)Delete allSJobLogof a specificSJobDescriptorvoiddeleteJobParameter(long id)Delete the specified job parametervoiddeleteJobParameter(SJobParameter sJobParameter)Delete the specified job parameterjava.util.List<SFailedJob>getFailedJobs(int startIndex, int maxResults)Get list of failed jobsSJobDescriptorgetJobDescriptor(long id)Get a specific job descriptorSJobLoggetJobLog(long id)Get a specific job logjava.util.List<SJobLog>getJobLogs(long jobDescriptorId, int fromIndex, int maxResults)Get allSJobLogof a specificSJobDescriptorSJobParametergetJobParameter(long id)Get a specific job parameterjava.util.List<SJobParameter>getJobParameters(java.lang.Long jobDescriptorId)get parameters of a joblonggetNumberOfJobDescriptors(QueryOptions queryOptions)Get total number of job descriptorslonggetNumberOfJobLogs(QueryOptions queryOptions)Get total number of job logsvoidlogJobError(java.lang.Throwable jobException, java.lang.Long jobDescriptorId)log an error on a jobjava.util.List<SJobDescriptor>searchJobDescriptors(QueryOptions queryOptions)Search all job descriptors according to specific criteriajava.util.List<SJobLog>searchJobLogs(QueryOptions queryOptions)Search all job logs according to specific criteriajava.util.List<SJobParameter>setJobParameters(long tenantId, long jobDescriptorId, java.util.List<SJobParameter> parameters)Delete jobs parameters corresponding to tenant and job descriptor, if exist.voidupdateJobLog(SJobLog jobLog, EntityUpdateDescriptor descriptor)Update aSJobLog
-
-
-
Constructor Detail
-
JobServiceImpl
public JobServiceImpl(EventService eventService, Recorder recorder, ReadPersistenceService readPersistenceService)
-
-
Method Detail
-
createJobDescriptor
public SJobDescriptor createJobDescriptor(SJobDescriptor sJobDescriptor, long tenantId) throws SJobDescriptorCreationException
Description copied from interface:JobServiceCreate a new job descriptor for a specific tenant- Specified by:
createJobDescriptorin interfaceJobService- Parameters:
sJobDescriptor- JobDescriptor to createtenantId- Identifier of tenant- Returns:
- The created jobDescriptor
- Throws:
SJobDescriptorCreationException
-
deleteJobDescriptor
public void deleteJobDescriptor(long id) throws SJobDescriptorReadException, SJobDescriptorDeletionExceptionDescription copied from interface:JobServiceDelete the specified job descriptor- Specified by:
deleteJobDescriptorin interfaceJobService- Parameters:
id- Identifier of job descriptor to delete- Throws:
SJobDescriptorReadExceptionSJobDescriptorDeletionException
-
deleteJobDescriptor
public void deleteJobDescriptor(SJobDescriptor sJobDescriptor) throws SJobDescriptorDeletionException
Description copied from interface:JobServiceDelete the specified job descriptor- Specified by:
deleteJobDescriptorin interfaceJobService- Parameters:
sJobDescriptor- JobDescriptor to delete- Throws:
SJobDescriptorDeletionException
-
getJobDescriptor
public SJobDescriptor getJobDescriptor(long id) throws SJobDescriptorReadException
Description copied from interface:JobServiceGet a specific job descriptor- Specified by:
getJobDescriptorin interfaceJobService- Parameters:
id- Identifier of job descriptor- Returns:
- Null if the job descriptor doesn't exist, else the
SJobDescriptorcorresponding to the identifier - Throws:
SJobDescriptorReadException
-
getNumberOfJobDescriptors
public long getNumberOfJobDescriptors(QueryOptions queryOptions) throws SBonitaReadException
Description copied from interface:JobServiceGet total number of job descriptors- Specified by:
getNumberOfJobDescriptorsin interfaceJobService- Parameters:
queryOptions- a map of specific parameters of a query- Returns:
- total number of job logs
- Throws:
SBonitaReadException
-
searchJobDescriptors
public java.util.List<SJobDescriptor> searchJobDescriptors(QueryOptions queryOptions) throws SBonitaReadException
Description copied from interface:JobServiceSearch all job descriptors according to specific criteria- Specified by:
searchJobDescriptorsin interfaceJobService- Parameters:
queryOptions- a map of specific parameters of a query- Returns:
- A list of SJobParameter objects
- Throws:
SBonitaReadException
-
createJobParameters
public java.util.List<SJobParameter> createJobParameters(java.util.List<SJobParameter> sJobParameters, long tenantId, long jobDescriptorId) throws SJobParameterCreationException
Description copied from interface:JobServiceCreate new job parameters for a specific tenant- Specified by:
createJobParametersin interfaceJobService- Parameters:
sJobParameters- JobParameters to createtenantId- Identifier of tenantjobDescriptorId- Identifier of job descriptor- Returns:
- Throws:
SJobParameterCreationException
-
setJobParameters
public java.util.List<SJobParameter> setJobParameters(long tenantId, long jobDescriptorId, java.util.List<SJobParameter> parameters) throws SJobParameterCreationException
Description copied from interface:JobServiceDelete jobs parameters corresponding to tenant and job descriptor, if exist. After, create new job parameters for a specific tenant- Specified by:
setJobParametersin interfaceJobService- Returns:
- A list of new SJobParameter objects
- Throws:
SJobParameterCreationException
-
deleteAllJobParameters
protected void deleteAllJobParameters(long jobDescriptorId) throws SJobParameterCreationException- Throws:
SJobParameterCreationException
-
createJobParameter
public SJobParameter createJobParameter(SJobParameter sJobParameter, long tenantId, long jobDescriptorId) throws SJobParameterCreationException
Description copied from interface:JobServiceCreate a new job parameter for a specific tenant- Specified by:
createJobParameterin interfaceJobService- Parameters:
sJobParameter- JobParameter to createtenantId- Identifier of tenantjobDescriptorId- Identifier of job descriptor- Returns:
- Throws:
SJobParameterCreationException
-
deleteJobParameter
public void deleteJobParameter(long id) throws SJobParameterNotFoundException, SJobParameterReadException, SJobParameterDeletionExceptionDescription copied from interface:JobServiceDelete the specified job parameter- Specified by:
deleteJobParameterin interfaceJobService- Parameters:
id- Identifier of job parameter to delete- Throws:
SJobParameterNotFoundExceptionSJobParameterReadExceptionSJobParameterDeletionException
-
deleteJobParameter
public void deleteJobParameter(SJobParameter sJobParameter) throws SJobParameterDeletionException
Description copied from interface:JobServiceDelete the specified job parameter- Specified by:
deleteJobParameterin interfaceJobService- Parameters:
sJobParameter- JobParameter to delete- Throws:
SJobParameterDeletionException
-
getJobParameter
public SJobParameter getJobParameter(long id) throws SJobParameterNotFoundException, SJobParameterReadException
Description copied from interface:JobServiceGet a specific job parameter- Specified by:
getJobParameterin interfaceJobService- Parameters:
id- Identifier of job parameter- Returns:
- Throws:
SJobParameterNotFoundExceptionSJobParameterReadException
-
getJobParameters
public java.util.List<SJobParameter> getJobParameters(java.lang.Long jobDescriptorId) throws SBonitaReadException
Description copied from interface:JobServiceget parameters of a job- Specified by:
getJobParametersin interfaceJobService- Throws:
SBonitaReadException
-
createJobLog
public SJobLog createJobLog(SJobLog sJobLog) throws SJobLogCreationException
Description copied from interface:JobServiceCreate a new job log for a specific tenant- Specified by:
createJobLogin interfaceJobService- Parameters:
sJobLog- JobLog to create- Returns:
- Throws:
SJobLogCreationException
-
deleteJobLog
public void deleteJobLog(long id) throws SJobLogDeletionException, SBonitaReadExceptionDescription copied from interface:JobServiceDelete the specified job log- Specified by:
deleteJobLogin interfaceJobService- Parameters:
id- Identifier of job log to delete- Throws:
SJobLogDeletionExceptionSBonitaReadException
-
deleteJobLog
public void deleteJobLog(SJobLog sJobLog) throws SJobLogDeletionException
Description copied from interface:JobServiceDelete the specified job log- Specified by:
deleteJobLogin interfaceJobService- Parameters:
sJobLog- JobLog to delete- Throws:
SJobLogDeletionException
-
deleteJobLogs
public void deleteJobLogs(long jobDescriptorId) throws SJobLogDeletionException, SBonitaReadExceptionDescription copied from interface:JobServiceDelete allSJobLogof a specificSJobDescriptor- Specified by:
deleteJobLogsin interfaceJobService- Parameters:
jobDescriptorId- The identifier of theSJobDescriptor- Throws:
SJobLogDeletionExceptionSBonitaReadException
-
getJobLogs
public java.util.List<SJobLog> getJobLogs(long jobDescriptorId, int fromIndex, int maxResults) throws SBonitaReadException
Description copied from interface:JobServiceGet allSJobLogof a specificSJobDescriptor- Specified by:
getJobLogsin interfaceJobService- Parameters:
jobDescriptorId- The identifier of theSJobDescriptorfromIndex- The index of the first element of the listmaxResults- The nulber max of elements of the list- Returns:
- A list of
SJobLog - Throws:
SBonitaReadException
-
getJobLog
public SJobLog getJobLog(long id) throws SBonitaReadException
Description copied from interface:JobServiceGet a specific job log- Specified by:
getJobLogin interfaceJobService- Parameters:
id- Identifier of job log- Returns:
- Throws:
SBonitaReadException
-
getNumberOfJobLogs
public long getNumberOfJobLogs(QueryOptions queryOptions) throws SBonitaReadException
Description copied from interface:JobServiceGet total number of job logs- Specified by:
getNumberOfJobLogsin interfaceJobService- Parameters:
queryOptions- a map of specific parameters of a query- Returns:
- total number of job logs
- Throws:
SBonitaReadException
-
searchJobLogs
public java.util.List<SJobLog> searchJobLogs(QueryOptions queryOptions) throws SBonitaReadException
Description copied from interface:JobServiceSearch all job logs according to specific criteria- Specified by:
searchJobLogsin interfaceJobService- Parameters:
queryOptions- a map of specific parameters of a query- Returns:
- A list of SJobLog objects
- Throws:
SBonitaReadException
-
getFailedJobs
public java.util.List<SFailedJob> getFailedJobs(int startIndex, int maxResults) throws SFailedJobReadException
Description copied from interface:JobServiceGet list of failed jobs- Specified by:
getFailedJobsin interfaceJobService- Returns:
- A list of SFailedJob objects
- Throws:
SFailedJobReadException
-
deleteJobDescriptorByJobName
public void deleteJobDescriptorByJobName(java.lang.String jobName) throws SJobDescriptorDeletionExceptionDescription copied from interface:JobServiceDelete a job descriptor corresponding to the given job name- Specified by:
deleteJobDescriptorByJobNamein interfaceJobService- Parameters:
jobName- name of job we want the jobDsecriptor to be deleted- Throws:
SJobDescriptorDeletionException
-
deleteAllJobDescriptors
public void deleteAllJobDescriptors() throws SJobDescriptorDeletionExceptionDescription copied from interface:JobServiceDelete all job descriptors for a specific tenant- Specified by:
deleteAllJobDescriptorsin interfaceJobService- Throws:
SJobDescriptorDeletionException
-
updateJobLog
public void updateJobLog(SJobLog jobLog, EntityUpdateDescriptor descriptor) throws SJobLogUpdatingException
Description copied from interface:JobServiceUpdate aSJobLog- Specified by:
updateJobLogin interfaceJobService- Parameters:
jobLog- The log to update- Throws:
SJobLogUpdatingException
-
logJobError
public void logJobError(java.lang.Throwable jobException, java.lang.Long jobDescriptorId) throws SBonitaReadException, SJobLogUpdatingException, SJobLogCreationException, SJobDescriptorReadExceptionDescription copied from interface:JobServicelog an error on a job- Specified by:
logJobErrorin interfaceJobService- Parameters:
jobException- the exceptionjobDescriptorId- the id of the job- Throws:
SBonitaReadExceptionSJobLogUpdatingExceptionSJobLogCreationExceptionSJobDescriptorReadException
-
createJobLog
public void createJobLog(java.lang.Throwable jobException, java.lang.Long jobDescriptorId) throws SJobLogCreationException, SJobDescriptorReadException
-
-