org.camunda.bpm.engine.impl.batch
Class AbstractProcessInstanceBatchJobHandler<T extends AbstractProcessInstanceBatchConfiguration>

java.lang.Object
  extended by org.camunda.bpm.engine.impl.batch.AbstractProcessInstanceBatchJobHandler<T>
All Implemented Interfaces:
BatchJobHandler<T>, JobHandler<BatchJobConfiguration>
Direct Known Subclasses:
DeleteProcessInstancesJobHandler, MigrationBatchJobHandler

public abstract class AbstractProcessInstanceBatchJobHandler<T extends AbstractProcessInstanceBatchConfiguration>
extends Object
implements BatchJobHandler<T>

Common methods for batch job handlers based on process instances, providing serialization, configuration instantiation, etc.

Author:
Askar Akhmerov

Constructor Summary
AbstractProcessInstanceBatchJobHandler()
           
 
Method Summary
protected  JobEntity createBatchJob(BatchEntity batch, ByteArrayEntity configuration)
           
protected abstract  T createJobConfiguration(T configuration, List<String> processIdsForJob)
           
 boolean createJobs(BatchEntity batch)
          Creates batch jobs for a batch.
 void deleteJobs(BatchEntity batch)
          Delete all jobs for a batch.
abstract  JobDeclaration<BatchJobContext,MessageEntity> getJobDeclaration()
          Get the job declaration for batch jobs.
protected abstract  JsonObjectConverter<T> getJsonConverterInstance()
           
 BatchJobConfiguration newConfiguration(String canonicalString)
           
 void onDelete(BatchJobConfiguration configuration, JobEntity jobEntity)
          Clean up before job is deleted.
protected  void postProcessJob(T configuration, JobEntity job)
           
 T readConfiguration(byte[] serializedConfiguration)
          Read the serialized configuration of the batch.
protected  ByteArrayEntity saveConfiguration(ByteArrayManager byteArrayManager, T jobConfiguration)
           
 byte[] writeConfiguration(T configuration)
          Converts the configuration of the batch to a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.camunda.bpm.engine.impl.jobexecutor.JobHandler
execute, getType
 

Constructor Detail

AbstractProcessInstanceBatchJobHandler

public AbstractProcessInstanceBatchJobHandler()
Method Detail

getJobDeclaration

public abstract JobDeclaration<BatchJobContext,MessageEntity> getJobDeclaration()
Description copied from interface: BatchJobHandler
Get the job declaration for batch jobs.

Specified by:
getJobDeclaration in interface BatchJobHandler<T extends AbstractProcessInstanceBatchConfiguration>
Returns:
the batch job declaration

createJobs

public boolean createJobs(BatchEntity batch)
Description copied from interface: BatchJobHandler
Creates batch jobs for a batch.

Specified by:
createJobs in interface BatchJobHandler<T extends AbstractProcessInstanceBatchConfiguration>
Parameters:
batch - the batch to create jobs for
Returns:
true of no more jobs have to be created for this batch, false otherwise

createJobConfiguration

protected abstract T createJobConfiguration(T configuration,
                                            List<String> processIdsForJob)

postProcessJob

protected void postProcessJob(T configuration,
                              JobEntity job)

createBatchJob

protected JobEntity createBatchJob(BatchEntity batch,
                                   ByteArrayEntity configuration)

deleteJobs

public void deleteJobs(BatchEntity batch)
Description copied from interface: BatchJobHandler
Delete all jobs for a batch.

Specified by:
deleteJobs in interface BatchJobHandler<T extends AbstractProcessInstanceBatchConfiguration>
Parameters:
batch - the batch to delete jobs for

newConfiguration

public BatchJobConfiguration newConfiguration(String canonicalString)
Specified by:
newConfiguration in interface JobHandler<BatchJobConfiguration>

onDelete

public void onDelete(BatchJobConfiguration configuration,
                     JobEntity jobEntity)
Description copied from interface: JobHandler
Clean up before job is deleted. Like removing of auxiliary entities specific for this job handler.

Specified by:
onDelete in interface JobHandler<BatchJobConfiguration>
Parameters:
configuration - the job handler configuration
jobEntity - the job entity to be deleted

saveConfiguration

protected ByteArrayEntity saveConfiguration(ByteArrayManager byteArrayManager,
                                            T jobConfiguration)

writeConfiguration

public byte[] writeConfiguration(T configuration)
Description copied from interface: BatchJobHandler
Converts the configuration of the batch to a byte array.

Specified by:
writeConfiguration in interface BatchJobHandler<T extends AbstractProcessInstanceBatchConfiguration>
Parameters:
configuration - the configuration object
Returns:
the serialized configuration

readConfiguration

public T readConfiguration(byte[] serializedConfiguration)
Description copied from interface: BatchJobHandler
Read the serialized configuration of the batch.

Specified by:
readConfiguration in interface BatchJobHandler<T extends AbstractProcessInstanceBatchConfiguration>
Parameters:
serializedConfiguration - the serialized configuration
Returns:
the deserialized configuration object

getJsonConverterInstance

protected abstract JsonObjectConverter<T> getJsonConverterInstance()


Copyright © 2016 camunda services GmbH. All rights reserved.