コード例 #1
0
  protected ActivityImpl getCurrentActivity(CommandContext commandContext, JobEntity job) {
    String type = job.getJobHandlerType();
    ActivityImpl activity = null;

    String configuration = job.getJobHandlerConfiguration();

    if (TimerExecuteNestedActivityJobHandler.TYPE.equals(type)
        || TimerCatchIntermediateEventJobHandler.TYPE.equals(type)) {
      ExecutionEntity execution = fetchExecutionEntity(job.getExecutionId());
      if (execution != null) {
        String acitivtyId = TimerEventJobHandler.getKey(configuration);
        activity = execution.getProcessDefinition().findActivity(acitivtyId);
      }

    } else if (TimerStartEventJobHandler.TYPE.equals(type)) {
      DeploymentCache deploymentCache =
          Context.getProcessEngineConfiguration().getDeploymentCache();
      String definitionKey = TimerEventJobHandler.getKey(configuration);
      ProcessDefinitionEntity processDefinition =
          deploymentCache.findDeployedLatestProcessDefinitionByKey(definitionKey);
      if (processDefinition != null) {
        activity = processDefinition.getInitial();
      }

    } else if (AsyncContinuationJobHandler.TYPE.equals(type)) {
      ExecutionEntity execution = fetchExecutionEntity(job.getExecutionId());
      if (execution != null) {
        activity = execution.getActivity();
      }

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

    return activity;
  }
コード例 #2
0
 @Override
 protected String getIndexValue(JobEntity entity) {
   return entity.getExecutionId();
 }