Java Code Examples for org.activiti.engine.impl.persistence.entity.JobEntity#getProcessDefinitionId()

The following examples show how to use org.activiti.engine.impl.persistence.entity.JobEntity#getProcessDefinitionId() . 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: TimerSuspendProcessDefinitionHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
  JSONObject cfgJson = new JSONObject(configuration);
  String processDefinitionId = job.getProcessDefinitionId();
  boolean suspendProcessInstances = getIncludeProcessInstances(cfgJson);

  SuspendProcessDefinitionCmd suspendProcessDefinitionCmd = new SuspendProcessDefinitionCmd(processDefinitionId, null, suspendProcessInstances, null, job.getTenantId());
  suspendProcessDefinitionCmd.execute(commandContext);
}
 
Example 2
Source File: TimerActivateProcessDefinitionHandler.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
  JSONObject cfgJson = new JSONObject(configuration);
  String processDefinitionId = job.getProcessDefinitionId();
  boolean activateProcessInstances = getIncludeProcessInstances(cfgJson);

  ActivateProcessDefinitionCmd activateProcessDefinitionCmd = new ActivateProcessDefinitionCmd(processDefinitionId, null, activateProcessInstances, null, job.getTenantId());
  activateProcessDefinitionCmd.execute(commandContext);
}
 
Example 3
Source File: DefaultJobManager.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
protected void restoreExtraData(JobEntity timerEntity, VariableScope variableScope) {
  String activityId = timerEntity.getJobHandlerConfiguration();

  if (timerEntity.getJobHandlerType().equalsIgnoreCase(TimerStartEventJobHandler.TYPE) ||
      timerEntity.getJobHandlerType().equalsIgnoreCase(TriggerTimerEventJobHandler.TYPE)) {

    activityId = TimerEventHandler.getActivityIdFromConfiguration(timerEntity.getJobHandlerConfiguration());
    String endDateExpressionString = TimerEventHandler.getEndDateFromConfiguration(timerEntity.getJobHandlerConfiguration());

    if (endDateExpressionString != null) {
      Expression endDateExpression = processEngineConfiguration.getExpressionManager().createExpression(endDateExpressionString);

      String endDateString = null;

      BusinessCalendar businessCalendar = processEngineConfiguration.getBusinessCalendarManager().getBusinessCalendar(
          getBusinessCalendarName(TimerEventHandler.geCalendarNameFromConfiguration(timerEntity.getJobHandlerConfiguration()), variableScope));

      if (endDateExpression != null) {
        Object endDateValue = endDateExpression.getValue(variableScope);
        if (endDateValue instanceof String) {
          endDateString = (String) endDateValue;
        } else if (endDateValue instanceof Date) {
          timerEntity.setEndDate((Date) endDateValue);
        } else {
          throw new ActivitiException("Timer '" + ((ExecutionEntity) variableScope).getActivityId()
              + "' was not configured with a valid duration/time, either hand in a java.util.Date or a String in format 'yyyy-MM-dd'T'hh:mm:ss'");
        }

        if (timerEntity.getEndDate() == null) {
          timerEntity.setEndDate(businessCalendar.resolveEndDate(endDateString));
        }
      }
    }
  }

  int maxIterations = 1;
  if (timerEntity.getProcessDefinitionId() != null) {
    org.activiti.bpmn.model.Process process = ProcessDefinitionUtil.getProcess(timerEntity.getProcessDefinitionId());
    maxIterations = getMaxIterations(process, activityId);
    if (maxIterations <= 1) {
      maxIterations = getMaxIterations(process, activityId);
    }
  }
  timerEntity.setMaxIterations(maxIterations);
}