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


Java ActivitiEvent类代码示例

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


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

示例1: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
    switch (event.getType()) {
    case ACTIVITY_STARTED:
        this.onActivityStart((ActivitiActivityEvent) event);

        break;

    case ACTIVITY_COMPLETED:
        this.onActivityEnd((ActivitiActivityEvent) event);

        break;

    default:
        logger.debug("Event received: {}", event.getType());
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:18,代码来源:FunctionEventListener.java

示例2: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
    if (!(event instanceof ActivitiSequenceFlowTakenEvent)) {
        return;
    }

    ActivitiSequenceFlowTakenEvent activitiSequenceFlowTakenEvent = (ActivitiSequenceFlowTakenEvent) event;
    String code = activitiSequenceFlowTakenEvent.getId();
    String sourceCode = activitiSequenceFlowTakenEvent
            .getSourceActivityId();
    String targetCode = activitiSequenceFlowTakenEvent
            .getTargetActivityId();
    String processInstanceId = activitiSequenceFlowTakenEvent
            .getProcessInstanceId();
    BpmSequence bpmSequence = new BpmSequence();
    bpmSequence.setCode(code);
    bpmSequence.setSourceCode(sourceCode);
    bpmSequence.setTargetCode(targetCode);
    bpmSequence.setProcessInstanceId(processInstanceId);
    bpmSequence.setCreateTime(new Date());
    bpmSequenceManager.save(bpmSequence);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:22,代码来源:SequenceFlowEventListener.java

示例3: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
    if (!(event instanceof ActivitiEntityEventImpl)) {
        return;
    }

    ActivitiEntityEventImpl activitiEntityEventImpl = (ActivitiEntityEventImpl) event;
    Object entity = activitiEntityEventImpl.getEntity();

    if (!(entity instanceof TaskEntity)) {
        return;
    }

    TaskEntity taskEntity = (TaskEntity) entity;

    try {
        switch (event.getType()) {
        case TASK_CREATED:
            logger.debug("create : {}", taskEntity.getId());
            this.onCreate(taskEntity);

            break;
        }
    } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:27,代码来源:SkipEventListener.java

示例4: handle

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void handle(ActivitiEvent event) {

    /*ActivitiEntityEventImpl activitiEvent = (ActivitiEntityEventImpl) event;
    TaskEntity taskEntity = (TaskEntity) activitiEvent.getEntity();
    System.out.println("---------------指定委托人:-----------------"+taskEntity.getId());
    //------------------------获取委托人-----------------------------
    if(!StrUtil.isEmpty(taskEntity.getAssignee())) {
        String attorney=delegateService.getAttorneyByAssignee(taskEntity.getAssignee());
        if(!StrUtil.isEmpty(attorney)) {
            System.out.println("------任务委托------任务ID:"+taskEntity.getId()+"委托人:"+taskEntity.getAssignee()+";被委托人ID:"+attorney);
            taskEntity.delegate(attorney);
        }
        //taskEntity.setAssignee(attorney);
    }*/

}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:18,代码来源:TaskAssignedListener.java

示例5: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
    ActivitiEntityEvent entityEvent = (ActivitiEntityEvent) event;
    Object entity = entityEvent.getEntity();
    if (entity instanceof TaskEntity) {
        TaskEntity task = (TaskEntity) entity;
        String originUserId = task.getAssignee();
        String newUserId = userMap.get(originUserId);
        if (StringUtils.isNotBlank(newUserId)) {
            task.setAssignee(newUserId);
            TaskService taskService = event.getEngineServices().getTaskService();
            String message = getClass().getName() + "-> 任务[" + task.getName() + "]的办理人[" +
                    originUserId + "]自动转办给了用户[" + newUserId + "]";
            taskService.addComment(task.getId(), task.getProcessInstanceId(), "redirect", message);
        }
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:18,代码来源:TaskAutoRedirectGlobalEventListener.java

示例6: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
    if (!isEventValid(event)) {
        return;
    }

    String processInstanceId = event.getProcessInstanceId();
    String correlationId = getCorrelationId(event);

    new SafeExecutor().executeSafely(() -> {
        new ProcessConflictPreventer(getOperationDao()).attemptToReleaseLock(correlationId);
    });

    new SafeExecutor().executeSafely(() -> {
        setOperationInAbortedState(correlationId);
    });

    HistoryService historyService = event.getEngineServices().getHistoryService();

    new SafeExecutor().executeSafely(() -> {
        deleteAllocatedRoutes(historyService, processInstanceId);
    });
    new SafeExecutor().executeSafely(() -> {
        deleteDeploymentFiles(historyService, processInstanceId);
    });

    new SafeExecutor().executeSafely(() -> {
        new ClientReleaser(event, getClientProvider()).releaseClient();
    });

    new SafeExecutor().executeSafely(() -> {
        if (configuration.shouldGatherUsageStatistics()) {
            sendStatistics(event);
        }
    });

}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:38,代码来源:AbortProcessListener.java

示例7: getCorrelationId

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
private String getCorrelationId(ActivitiEvent event) {
    HistoricVariableInstance correlationId = getHistoricVarInstanceValue(event.getEngineServices().getHistoryService(),
        event.getProcessInstanceId(), Constants.VAR_CORRELATION_ID);
    if (correlationId != null) {
        return (String) correlationId.getValue();
    }
    // The process was started before we introduced subprocesses in our BPMN
    // diagrams. Therefore, the correlation ID is the ID of the
    // process instance.
    return event.getProcessInstanceId();
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:12,代码来源:AbortProcessListener.java

示例8: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
    String eventType=event.getType().name();

    //根据事件的类型ID,找到对应的事件处理器
    String eventHandlerBeanId=handlers.get(eventType);
    if(eventHandlerBeanId!=null){
        EventHandler handler=(EventHandler) SpringContextUtil.getBean(eventHandlerBeanId);
        handler.handle(event);
    }
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:12,代码来源:CustomEventListener.java

示例9: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
    switch (event.getType()) {

        case VARIABLE_CREATED:
            ActivitiVariableEvent variableEvent = (ActivitiVariableEvent) event;
            System.out.println("创建了变量: " + variableEvent.getVariableName() + ", 值:" + variableEvent.getVariableValue());
            break;

        default:
            System.out.println("Event received: " + event.getType());
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:13,代码来源:VariableCreateListener.java

示例10: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {        
    switch (event.getType()) {
        case ACTIVITY_STARTED: {
            broadcastEvent((ActivitiActivityEvent)event);
            break;
        }
        case ACTIVITY_COMPLETED: {
            broadcastEvent((ActivitiActivityEvent)event);
            break;
        }
    }
}
 
开发者ID:wrobelm,项目名称:activiti-websockets,代码行数:14,代码来源:ActivitiProcessEventsWebsocketBroadcaster.java

示例11: onEvent

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public void onEvent(ActivitiEvent event) {
    if (!(event instanceof ActivitiEntityEventImpl)) {
        return;
    }

    ActivitiEntityEventImpl activitiEntityEventImpl = (ActivitiEntityEventImpl) event;
    Object entity = activitiEntityEventImpl.getEntity();

    if (!(entity instanceof TaskEntity)) {
        return;
    }

    TaskEntity taskEntity = (TaskEntity) entity;

    try {
        switch (event.getType()) {
        case TASK_CREATED:
            logger.debug("create : {}", taskEntity.getId());
            this.onCreate(taskEntity);

            break;

        case TASK_ASSIGNED:
            logger.debug("assign : {}", taskEntity.getId());
            this.onAssign(taskEntity);

            break;

        case TASK_COMPLETED:
            logger.debug("complete : {}", taskEntity.getId());
            this.onComplete(taskEntity);

            break;

        case ENTITY_DELETED:
            logger.debug("delete : {}", taskEntity.getId());
            this.onDelete(taskEntity);

            break;

        default:
            logger.debug("{} : {}", event.getType(), taskEntity.getId());
        }
    } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:48,代码来源:HumanTaskEventListener.java

示例12: onInitialized

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
protected void onInitialized(ActivitiEvent event) {
    if (!(event instanceof ActivitiEntityEventImpl)) {
        return;
    }

    ActivitiEntityEventImpl activitiEntityEventImpl = (ActivitiEntityEventImpl) event;
    Object entity = activitiEntityEventImpl.getEntity();

    if (!(entity instanceof ExecutionEntity)) {
        return;
    }

    ExecutionEntity executionEntity = (ExecutionEntity) entity;

    if (!executionEntity.isProcessInstanceType()) {
        return;
    }

    String processInstanceId = executionEntity.getId();
    String processDefinitionId = executionEntity.getProcessDefinitionId();
    CommandContext commandContext = Context.getCommandContext();
    ProcessDefinitionEntity processDefinition = new GetDeploymentProcessDefinitionCmd(
            processDefinitionId).execute(commandContext);

    // {流程标题:title}-{发起人:startUser}-{发起时间:startTime}
    String processDefinitionName = processDefinition.getName();

    if (processDefinitionName == null) {
        processDefinitionName = processDefinition.getKey();
    }

    String userId = Authentication.getAuthenticatedUserId();
    String displayName = userConnector.findById(userId).getDisplayName();
    String processInstanceName = processDefinitionName + "-" + displayName
            + "-"
            + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
    // runtime
    executionEntity.setName(processInstanceName);

    // history
    HistoricProcessInstanceEntity historicProcessInstanceEntity = commandContext
            .getHistoricProcessInstanceEntityManager()
            .findHistoricProcessInstance(processInstanceId);
    historicProcessInstanceEntity.setName(processInstanceName);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:46,代码来源:UpdateProcessInstanceNameEventListener.java

示例13: ActivitiEventToDelegateExecutionAdapter

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public ActivitiEventToDelegateExecutionAdapter(ActivitiEvent event) {
    this.event = event;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:4,代码来源:ActivitiEventToDelegateExecutionAdapter.java

示例14: ClientReleaser

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
public ClientReleaser(ActivitiEvent event, CloudFoundryClientProvider clientProvider) {
    this.event = event;
    this.clientProvider = clientProvider;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:5,代码来源:ClientReleaser.java

示例15: sendStatistics

import org.activiti.engine.delegate.event.ActivitiEvent; //导入依赖的package包/类
protected void sendStatistics(ActivitiEvent event) {
    DelegateExecution context = new ActivitiEventToDelegateExecutionAdapter(event);
    RestTemplate restTemplate = new RestTemplate();
    AnalyticsData collectedData = dataSender.collectAnalyticsData(context, State.ABORTED);
    dataSender.sendCollectedData(restTemplate, dataSender.convertCollectedAnalyticsDataToXml(context, collectedData));
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:7,代码来源:AbortProcessListener.java


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