Java Code Examples for org.camunda.bpm.engine.impl.persistence.entity.JobEntity#setDeploymentId()

The following examples show how to use org.camunda.bpm.engine.impl.persistence.entity.JobEntity#setDeploymentId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RestartProcessInstancesJobHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
protected void postProcessJob(RestartProcessInstancesBatchConfiguration configuration, JobEntity job) {
  if (job.getDeploymentId() == null) {
    CommandContext commandContext = Context.getCommandContext();
    ProcessDefinitionEntity processDefinitionEntity = commandContext.getProcessEngineConfiguration().getDeploymentCache()
        .findDeployedProcessDefinitionById(configuration.getProcessDefinitionId());
    job.setDeploymentId(processDefinitionEntity.getDeploymentId());
  }
}
 
Example 2
Source File: MigrationBatchJobHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
protected void postProcessJob(MigrationBatchConfiguration configuration, JobEntity job) {
  if (job.getDeploymentId() == null) {
    CommandContext commandContext = Context.getCommandContext();
    String sourceProcessDefinitionId = configuration.getMigrationPlan().getSourceProcessDefinitionId();

    ProcessDefinitionEntity processDefinition = getProcessDefinition(commandContext, sourceProcessDefinitionId);
    job.setDeploymentId(processDefinition.getDeploymentId());
  }
}
 
Example 3
Source File: AbstractBatchJobHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void createJobEntities(BatchEntity batch, T configuration, String deploymentId,
    List<String> processIds, int invocationsPerBatchJob) {

  if (processIds == null || processIds.isEmpty()) {
    return;
  }

  CommandContext commandContext = Context.getCommandContext();
  ByteArrayManager byteArrayManager = commandContext.getByteArrayManager();
  JobManager jobManager = commandContext.getJobManager();

  int createdJobs = 0;
  while (!processIds.isEmpty()) {
    int lastIdIndex = Math.min(invocationsPerBatchJob, processIds.size());
    // view of process instances for this job
    List<String> idsForJob = processIds.subList(0, lastIdIndex);

    T jobConfiguration = createJobConfiguration(configuration, idsForJob);
    ByteArrayEntity configurationEntity = saveConfiguration(byteArrayManager, jobConfiguration);

    JobEntity job = createBatchJob(batch, configurationEntity);
    job.setDeploymentId(deploymentId);
    postProcessJob(configuration, job);
    jobManager.insertAndHintJobExecutor(job);

    idsForJob.clear();
    createdJobs++;
  }

  // update created jobs for batch
  batch.setJobsCreated(batch.getJobsCreated() + createdJobs);
}
 
Example 4
Source File: ModificationBatchJobHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
protected void postProcessJob(ModificationBatchConfiguration configuration, JobEntity job) {
  if (job.getDeploymentId() == null) {
    CommandContext commandContext = Context.getCommandContext();
    ProcessDefinitionEntity processDefinitionEntity = commandContext.getProcessEngineConfiguration().getDeploymentCache()
        .findDeployedProcessDefinitionById(configuration.getProcessDefinitionId());
    job.setDeploymentId(processDefinitionEntity.getDeploymentId());
  }
}
 
Example 5
Source File: SetProcessDefinitionVersionCmd.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void switchVersionOfJob(JobEntity jobEntity, ProcessDefinitionEntity newProcessDefinition, Map<String, String> jobDefinitionMapping) {
  jobEntity.setProcessDefinitionId(newProcessDefinition.getId());
  jobEntity.setDeploymentId(newProcessDefinition.getDeploymentId());

  String newJobDefinitionId = jobDefinitionMapping.get(jobEntity.getJobDefinitionId());
  jobEntity.setJobDefinitionId(newJobDefinitionId);
}