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

The following examples show how to use org.camunda.bpm.engine.impl.persistence.entity.JobEntity#getJobHandlerType() . 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: JobExecutable.java    From camunda-bpm-assert-scenario with Apache License 2.0 6 votes vote down vote up
private void log() {
  JobEntity entity = (JobEntity) delegate;
  String type = entity.getJobHandlerType();
  String config;
  if (Api.feature(JobEntity.class.getName(), "getJobHandlerConfigurationRaw").isSupported()) {
    config = entity.getJobHandlerConfigurationRaw();
  } else {
    try {
      config = (String) JobEntity.class.getMethod("getJobHandlerConfiguration").invoke(entity);
    } catch (Exception e) {
      config = "";
    }
  }
  Action.Executing_Job.log(
      type,
      config,
      null,
      getRepositoryService().createProcessDefinitionQuery().processDefinitionId(runner.processInstance.getProcessDefinitionId()).singleResult().getKey(),
      runner.processInstance.getId(),
      null,
      null
  );
}
 
Example 2
Source File: DefaultJobRetryCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected ActivityImpl getCurrentActivity(CommandContext commandContext, JobEntity job) {
  String type = job.getJobHandlerType();
  ActivityImpl activity = null;

  if (SUPPORTED_TYPES.contains(type)) {
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    ProcessDefinitionEntity processDefinitionEntity =
        deploymentCache.findDeployedProcessDefinitionById(job.getProcessDefinitionId());
    activity = processDefinitionEntity.findActivity(job.getActivityId());

  } else {
    // noop, because activity type is not supported
  }

  return activity;
}
 
Example 3
Source File: Executable.java    From camunda-bpm-assert-scenario with Apache License 2.0 5 votes vote down vote up
static JobExecutable newInstance(ProcessRunnerImpl runner, Job job) {
  JobEntity entity = (JobEntity) job;
  String type = entity.getJobHandlerType();
  if (types.containsKey(type)) {
    try {
      return (JobExecutable) Class.forName(ContinuationExecutable.class.getPackage().getName() + "." + types.get(type)).getConstructor(ProcessRunnerImpl.class, Job.class).newInstance(runner, job);
    } catch (Exception e) {
      throw new IllegalArgumentException(e);
    }
  }
  return null;
}
 
Example 4
Source File: RecalculateJobDuedateCmd.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void checkJobType(JobEntity job) {
  String type = job.getJobHandlerType();
  if (!(TimerExecuteNestedActivityJobHandler.TYPE.equals(type) ||
      TimerCatchIntermediateEventJobHandler.TYPE.equals(type) ||
      TimerStartEventJobHandler.TYPE.equals(type) ||
      TimerStartEventSubprocessJobHandler.TYPE.equals(type) ||
      TimerTaskListenerJobHandler.TYPE.equals(type)) ||
      !(job instanceof TimerEntity)) {
    throw new ProcessEngineException("Only timer jobs can be recalculated, but the job with id '" + jobId + "' is of type '" + type + "'.");
  }
}