当前位置: 首页>>代码示例>>Java>>正文


Java TimerExecuteNestedActivityJobHandler类代码示例

本文整理汇总了Java中org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler的典型用法代码示例。如果您正苦于以下问题:Java TimerExecuteNestedActivityJobHandler类的具体用法?Java TimerExecuteNestedActivityJobHandler怎么用?Java TimerExecuteNestedActivityJobHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TimerExecuteNestedActivityJobHandler类属于org.activiti.engine.impl.jobexecutor包,在下文中一共展示了TimerExecuteNestedActivityJobHandler类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initJobExecutor

import org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler; //导入依赖的package包/类
@Override
protected void initJobExecutor() 
{
    super.initJobExecutor();

    // Wrap timer-job handler to handle authentication
    JobHandler timerJobHandler = jobHandlers.get(TimerExecuteNestedActivityJobHandler.TYPE);
    JobHandler wrappingTimerJobHandler = new AuthenticatedTimerJobHandler(timerJobHandler, unprotectedNodeService);
    jobHandlers.put(TimerExecuteNestedActivityJobHandler.TYPE, wrappingTimerJobHandler);
    
    // Wrap async-job handler to handle authentication
    JobHandler asyncJobHandler = jobHandlers.get(AsyncContinuationJobHandler.TYPE);
    JobHandler wrappingAsyncJobHandler = new AuthenticatedAsyncJobHandler(asyncJobHandler);
    jobHandlers.put(AsyncContinuationJobHandler.TYPE, wrappingAsyncJobHandler);
    
    // Wrap intermediate-timer-job handler to handle authentication
    JobHandler intermediateJobHandler = jobHandlers.get(TimerCatchIntermediateEventJobHandler.TYPE);
    JobHandler wrappingIntermediateJobHandler = new AuthenticatedAsyncJobHandler(intermediateJobHandler);
    jobHandlers.put(TimerCatchIntermediateEventJobHandler.TYPE, wrappingIntermediateJobHandler);
    
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:AlfrescoProcessEngineConfiguration.java

示例2: testActivitiUnReportableError

import org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler; //导入依赖的package包/类
/**
 * This method tests the scenario when an workflow related error is throws while workflow is executing an Async type task like Timer. This error is logged
 * as WARN.
 */
@Test(expected = ActivitiException.class)
public void testActivitiUnReportableError() throws Exception
{
    BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_TIMER_WITH_CLASSPATH);

    ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");

    serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
    serviceTask.setImplementation("${BeanNotAvailable}");

    jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel));
    Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME, null));
    org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
    if (timer != null)
    {
        executeWithoutLogging(TimerExecuteNestedActivityJobHandler.class, () -> {
            activitiManagementService.executeJob(timer.getId());
        });
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:25,代码来源:ActivitiDelegateTest.java

示例3: initJobHandlers

import org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler; //导入依赖的package包/类
protected void initJobHandlers() {
    jobHandlers = new HashMap<>();
    TimerExecuteNestedActivityJobHandler timerExecuteNestedActivityJobHandler = new TimerExecuteNestedActivityJobHandler();
    jobHandlers.put(timerExecuteNestedActivityJobHandler.getType(), timerExecuteNestedActivityJobHandler);

    TimerCatchIntermediateEventJobHandler timerCatchIntermediateEvent = new TimerCatchIntermediateEventJobHandler();
    jobHandlers.put(timerCatchIntermediateEvent.getType(), timerCatchIntermediateEvent);

    TimerStartEventJobHandler timerStartEvent = new TimerStartEventJobHandler();
    jobHandlers.put(timerStartEvent.getType(), timerStartEvent);

    AsyncContinuationJobHandler asyncContinuationJobHandler = new AsyncContinuationJobHandler();
    jobHandlers.put(asyncContinuationJobHandler.getType(), asyncContinuationJobHandler);

    ProcessEventJobHandler processEventJobHandler = new ProcessEventJobHandler();
    jobHandlers.put(processEventJobHandler.getType(), processEventJobHandler);

    TimerSuspendProcessDefinitionHandler suspendProcessDefinitionHandler = new TimerSuspendProcessDefinitionHandler();
    jobHandlers.put(suspendProcessDefinitionHandler.getType(), suspendProcessDefinitionHandler);

    TimerActivateProcessDefinitionHandler activateProcessDefinitionHandler = new TimerActivateProcessDefinitionHandler();
    jobHandlers.put(activateProcessDefinitionHandler.getType(), activateProcessDefinitionHandler);

    // if we have custom job handlers, register them
    if (getCustomJobHandlers() != null) {
        for (JobHandler customJobHandler : getCustomJobHandlers()) {
            jobHandlers.put(customJobHandler.getType(), customJobHandler);
        }
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:31,代码来源:ProcessEngineConfigurationImpl.java

示例4: testActivitiReportableError

import org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler; //导入依赖的package包/类
/**
 * This method tests the scenario when an error that is not workflow related is throws while workflow is executing an Async type task like Timer. This error
 * is logged as ERROR.
 */
@Test(expected = ActivitiException.class)
public void testActivitiReportableError() throws Exception
{
    BpmnModel bpmnModel = getBpmnModelForXmlResource(ACTIVITI_XML_HERD_TIMER_WITH_CLASSPATH);

    ServiceTask serviceTask = (ServiceTask) bpmnModel.getProcesses().get(0).getFlowElement("servicetask1");

    FieldExtension exceptionField = new FieldExtension();
    exceptionField.setFieldName("exceptionToThrow");
    exceptionField.setExpression("${exceptionToThrow}");
    serviceTask.getFieldExtensions().add(exceptionField);

    jobDefinitionServiceTestHelper.createJobDefinitionForActivitiXml(getActivitiXmlFromBpmnModel(bpmnModel));

    List<Parameter> parameters = new ArrayList<>();

    Parameter parameter = new Parameter("exceptionToThrow", MockJavaDelegate.EXCEPTION_BPMN_ERROR);
    parameters.add(parameter);

    Job job = jobService.createAndStartJob(jobServiceTestHelper.createJobCreateRequest(TEST_ACTIVITI_NAMESPACE_CD, TEST_ACTIVITI_JOB_NAME, parameters));
    org.activiti.engine.runtime.Job timer = activitiManagementService.createJobQuery().processInstanceId(job.getId()).timers().singleResult();
    if (timer != null)
    {
        executeWithoutLogging(Arrays.asList(ActivitiRuntimeHelper.class, TimerExecuteNestedActivityJobHandler.class), () -> {
            activitiManagementService.executeJob(timer.getId());
        });
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:33,代码来源:ActivitiDelegateTest.java

示例5: restoreExtraData

import org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler; //导入依赖的package包/类
protected void restoreExtraData(CommandContext commandContext, String jobHandlerConfiguration) {
    String embededActivityId = jobHandlerConfiguration;

    if (jobHandlerType.equalsIgnoreCase(TimerExecuteNestedActivityJobHandler.TYPE) ||
            jobHandlerType.equalsIgnoreCase(TimerCatchIntermediateEventJobHandler.TYPE) ||
            jobHandlerType.equalsIgnoreCase(TimerStartEventJobHandler.TYPE)) {

        embededActivityId = TimerEventHandler.getActivityIdFromConfiguration(jobHandlerConfiguration);

        String endDateExpressionString = TimerEventHandler.getEndDateFromConfiguration(jobHandlerConfiguration);

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

            String endDateString = null;

            BusinessCalendar businessCalendar = Context.getProcessEngineConfiguration().getBusinessCalendarManager()
                    .getBusinessCalendar(getBusinessCalendarName(TimerEventHandler.geCalendarNameFromConfiguration(jobHandlerConfiguration)));

            VariableScope executionEntity = null;
            if (executionId != null) {
                executionEntity = commandContext.getExecutionEntityManager().findExecutionById(executionId);
            }

            if (executionEntity == null) {
                executionEntity = NoExecutionVariableScope.getSharedInstance();
            }

            if (endDateExpression != null) {
                Object endDateValue = endDateExpression.getValue(executionEntity);
                if (endDateValue instanceof String) {
                    endDateString = (String) endDateValue;
                } else if (endDateValue instanceof Date) {
                    endDate = (Date) endDateValue;
                } else {
                    throw new ActivitiException("Timer '" + ((ExecutionEntity) executionEntity).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 (endDate == null) {
                    endDate = businessCalendar.resolveEndDate(endDateString);
                }
            }
        }
    }

    if (processDefinitionId != null) {
        ProcessDefinition def = Context.getProcessEngineConfiguration().getRepositoryService().getProcessDefinition(processDefinitionId);
        maxIterations = checkStartEventDefinitions(def, embededActivityId);
        if (maxIterations <= 1) {
            maxIterations = checkBoundaryEventsDefinitions(def, embededActivityId);
        }
    } else {
        maxIterations = 1;
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:57,代码来源:TimerJobEntity.java

示例6: createTimer

import org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler; //导入依赖的package包/类
protected TimerDeclarationImpl createTimer(BpmnParse bpmnParse, TimerEventDefinition timerEventDefinition, ScopeImpl timerActivity, String jobHandlerType) {
    TimerDeclarationType type = null;
    Expression expression = null;
    Expression endDate = null;
    Expression calendarName = null;
    ExpressionManager expressionManager = bpmnParse.getExpressionManager();
    if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDate())) {
        // TimeDate
        type = TimerDeclarationType.DATE;
        expression = expressionManager.createExpression(timerEventDefinition.getTimeDate());
    } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeCycle())) {
        // TimeCycle
        type = TimerDeclarationType.CYCLE;
        expression = expressionManager.createExpression(timerEventDefinition.getTimeCycle());
        // support for endDate
        if (StringUtils.isNotEmpty(timerEventDefinition.getEndDate())) {
            endDate = expressionManager.createExpression(timerEventDefinition.getEndDate());
        }
    } else if (StringUtils.isNotEmpty(timerEventDefinition.getTimeDuration())) {
        // TimeDuration
        type = TimerDeclarationType.DURATION;
        expression = expressionManager.createExpression(timerEventDefinition.getTimeDuration());
    }

    if (StringUtils.isNotEmpty(timerEventDefinition.getCalendarName())) {
        calendarName = expressionManager.createExpression(timerEventDefinition.getCalendarName());
    }

    // neither date, cycle or duration configured!
    if (expression == null) {
        LOGGER.warn("Timer needs configuration (either timeDate, timeCycle or timeDuration is needed) ({})", timerActivity.getId());
    }

    String jobHandlerConfiguration = timerActivity.getId();

    if (jobHandlerType.equalsIgnoreCase(TimerExecuteNestedActivityJobHandler.TYPE) ||
            jobHandlerType.equalsIgnoreCase(TimerCatchIntermediateEventJobHandler.TYPE) ||
            jobHandlerType.equalsIgnoreCase(TimerStartEventJobHandler.TYPE)) {
        jobHandlerConfiguration = TimerStartEventJobHandler.createConfiguration(timerActivity.getId(), endDate, calendarName);
    }

    // Parse the timer declaration
    // TODO move the timer declaration into the bpmn activity or next to the
    // TimerSession
    TimerDeclarationImpl timerDeclaration = new TimerDeclarationImpl(expression, type, jobHandlerType, endDate, calendarName);
    timerDeclaration.setJobHandlerConfiguration(jobHandlerConfiguration);

    timerDeclaration.setExclusive(true);
    return timerDeclaration;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:51,代码来源:TimerEventDefinitionParseHandler.java

示例7: parseBoundaryTimerEventDefinition

import org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler; //导入依赖的package包/类
/**
 * Parses a boundary timer event. The end-result will be that the given nested
 * activity will get the appropriate {@link ActivityBehavior}.
 * 
 * @param timerEventDefinition
 *          The XML element corresponding with the timer event details
 * @param interrupting
 *          Indicates whether this timer is interrupting.
 * @param timerActivity
 *          The activity which maps to the structure of the timer event on the
 *          boundary of another activity. Note that this is NOT the activity
 *          onto which the boundary event is attached, but a nested activity
 *          inside this activity, specifically created for this event.
 */
public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting, ActivityImpl timerActivity) {
  timerActivity.setProperty("type", "boundaryTimer");
  TimerDeclarationImpl timerDeclaration = parseTimer(timerEventDefinition, timerActivity, TimerExecuteNestedActivityJobHandler.TYPE);
  addTimerDeclaration(timerActivity.getParent(), timerDeclaration);

  if (timerActivity.getParent() instanceof ActivityImpl) {
    ((ActivityImpl) timerActivity.getParent()).setScope(true);
  }

  for (BpmnParseListener parseListener : parseListeners) {
    parseListener.parseBoundaryTimerEventDefinition(timerEventDefinition, interrupting, timerActivity);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:28,代码来源:BpmnParse.java


注:本文中的org.activiti.engine.impl.jobexecutor.TimerExecuteNestedActivityJobHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。