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


Java PvmActivity.getId方法代码示例

本文整理汇总了Java中org.activiti.engine.impl.pvm.PvmActivity.getId方法的典型用法代码示例。如果您正苦于以下问题:Java PvmActivity.getId方法的具体用法?Java PvmActivity.getId怎么用?Java PvmActivity.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.impl.pvm.PvmActivity的用法示例。


在下文中一共展示了PvmActivity.getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNode

import org.activiti.engine.impl.pvm.PvmActivity; //导入方法依赖的package包/类
/**
 * @param activity PvmActivity
 * @param key String
 * @param forceIsTaskNode boolean
 * @return WorkflowNode
 */
private WorkflowNode getNode(PvmActivity activity, String key, boolean forceIsTaskNode)
{
    String name = activity.getId();
     String defaultTitle = (String) activity.getProperty(ActivitiConstants.NODE_NAME);
     String defaultDescription = (String) activity.getProperty(ActivitiConstants.NODE_DESCRIPTION);
     String type = (String) activity.getProperty(ActivitiConstants.NODE_TYPE);
     boolean isTaskNode = forceIsTaskNode || ActivitiConstants.USER_TASK_NODE_TYPE.equals(type);
     
     if(defaultTitle == null)
     {
     	defaultTitle = name;
     }
     if(defaultDescription == null)
     {
     	defaultDescription = name;
     }
    WorkflowTransition transition = getDefaultTransition(key, name);
    return factory.createNode(name, key, defaultTitle, defaultDescription, type, isTaskNode, transition);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:ActivitiTypeConverter.java

示例2: findFirstUserTaskActivityId

import org.activiti.engine.impl.pvm.PvmActivity; //导入方法依赖的package包/类
/**
 * 获得提交节点
 */
public String findFirstUserTaskActivityId(String processDefinitionId,
        String initiator) {
    GetDeploymentProcessDefinitionCmd getDeploymentProcessDefinitionCmd = new GetDeploymentProcessDefinitionCmd(
            processDefinitionId);
    ProcessDefinitionEntity processDefinitionEntity = processEngine
            .getManagementService().executeCommand(
                    getDeploymentProcessDefinitionCmd);

    ActivityImpl startActivity = processDefinitionEntity.getInitial();

    if (startActivity.getOutgoingTransitions().size() != 1) {
        throw new IllegalStateException(
                "start activity outgoing transitions cannot more than 1, now is : "
                        + startActivity.getOutgoingTransitions().size());
    }

    PvmTransition pvmTransition = startActivity.getOutgoingTransitions()
            .get(0);
    PvmActivity targetActivity = pvmTransition.getDestination();

    if (!"userTask".equals(targetActivity.getProperty("type"))) {
        logger.info("first activity is not userTask, just skip");

        return null;
    }

    return targetActivity.getId();
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:32,代码来源:ActivitiInternalProcessConnector.java

示例3: processNeighbor

import org.activiti.engine.impl.pvm.PvmActivity; //导入方法依赖的package包/类
public void processNeighbor(DelegateTask delegateTask, String value) {
    String processDefinitionId = delegateTask.getProcessDefinitionId();
    ProcessDefinitionEntity processDefinitionEntity = Context
            .getProcessEngineConfiguration().getProcessDefinitionCache()
            .get(processDefinitionId);
    ActivityImpl activityImpl = processDefinitionEntity
            .findActivity(delegateTask.getTaskDefinitionKey());
    PvmTransition pvmTransition = activityImpl.getIncomingTransitions()
            .iterator().next();
    PvmActivity pvmActivity = pvmTransition.getSource();

    if (!"userTask".equals(pvmActivity.getProperty("type"))) {
        logger.info("previous {} {} not userTask, just skip",
                pvmActivity.getId(), pvmActivity.getProperty("type"));

        return;
    }

    String targetActivityId = pvmActivity.getId();

    /*
     * JdbcTemplate jdbcTemplate = ApplicationContextHelper .getBean(JdbcTemplate.class); String previousAssignee =
     * jdbcTemplate .queryForObject(
     * "select ASSIGNEE_ from ACT_HI_TASKINST where ACT_ID_=? order by END_TIME_ desc", String.class,
     * targetActivityId);
     */
    List<HistoricTaskInstanceEntity> historicTaskInstanceEntities = Context
            .getCommandContext().getDbSqlSession()
            .findInCache(HistoricTaskInstanceEntity.class);
    logger.info("{}", historicTaskInstanceEntities);

    String previousAssignee = null;

    for (HistoricTaskInstanceEntity historicTaskInstanceEntity : historicTaskInstanceEntities) {
        if (targetActivityId.equals(historicTaskInstanceEntity
                .getTaskDefinitionKey())) {
            previousAssignee = historicTaskInstanceEntity.getAssignee();

            break;
        }
    }

    if (previousAssignee == null) {
        logger.info("cannot previous assignee, skip");

        return;
    }

    logger.info("previousAssignee : {}", previousAssignee);
    logger.info("delegateTask.getAssignee() : {}",
            delegateTask.getAssignee());

    if (previousAssignee.equals(delegateTask.getAssignee())) {
        logger.info("skip");

        new CompleteTaskWithCommentCmd(delegateTask.getId(),
                Collections.<String, Object> emptyMap(), "相邻相同人员自动跳过")
                .execute(Context.getCommandContext());
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:61,代码来源:SkipTaskListener.java

示例4: processNeighbor

import org.activiti.engine.impl.pvm.PvmActivity; //导入方法依赖的package包/类
public void processNeighbor(DelegateTask delegateTask, String value) {
    String processDefinitionId = delegateTask.getProcessDefinitionId();
    ProcessDefinitionEntity processDefinitionEntity = Context
            .getProcessEngineConfiguration().getProcessDefinitionCache()
            .get(processDefinitionId);
    ActivityImpl activityImpl = processDefinitionEntity
            .findActivity(delegateTask.getTaskDefinitionKey());
    PvmTransition pvmTransition = activityImpl.getIncomingTransitions()
            .iterator().next();
    PvmActivity pvmActivity = pvmTransition.getSource();

    if (!"userTask".equals(pvmActivity.getProperty("type"))) {
        logger.info("previous {} {} not userTask, just skip",
                pvmActivity.getId(), pvmActivity.getProperty("type"));

        return;
    }

    String targetActivityId = pvmActivity.getId();

    /*
     * JdbcTemplate jdbcTemplate = ApplicationContextHelper .getBean(JdbcTemplate.class); String previousAssignee =
     * jdbcTemplate .queryForObject(
     * "select ASSIGNEE_ from ACT_HI_TASKINST where ACT_ID_=? order by END_TIME_ desc", String.class,
     * targetActivityId);
     */
    List<HistoricTaskInstanceEntity> historicTaskInstanceEntities = Context
            .getCommandContext().getDbSqlSession()
            .findInCache(HistoricTaskInstanceEntity.class);
    logger.info("{}", historicTaskInstanceEntities);

    String previousAssignee = null;

    for (HistoricTaskInstanceEntity historicTaskInstanceEntity : historicTaskInstanceEntities) {
        if (targetActivityId.equals(historicTaskInstanceEntity
                .getTaskDefinitionKey())) {
            previousAssignee = historicTaskInstanceEntity.getAssignee();

            break;
        }
    }

    if (previousAssignee == null) {
        logger.info("cannot previous assignee, skip");

        return;
    }

    logger.info("previousAssignee : {}", previousAssignee);
    logger.info("delegateTask.getAssignee() : {}",
            delegateTask.getAssignee());

    if (previousAssignee.equals(delegateTask.getAssignee())) {
        logger.info("skip");

        // new CompleteTaskWithCommentCmd(delegateTask.getId(),
        // Collections.<String, Object> emptyMap(), "相邻相同人员自动跳过")
        // .execute(Context.getCommandContext());
        this.doSkip(delegateTask);
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:62,代码来源:SkipEventListener.java

示例5: execute

import org.activiti.engine.impl.pvm.PvmActivity; //导入方法依赖的package包/类
public FirstTaskForm execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinitionEntity = Context
            .getProcessEngineConfiguration().getDeploymentManager()
            .findDeployedProcessDefinitionById(processDefinitionId);

    if (processDefinitionEntity == null) {
        throw new IllegalArgumentException(
                "cannot find processDefinition : " + processDefinitionId);
    }

    if (processDefinitionEntity.hasStartFormKey()) {
        return this.findStartEventForm(processDefinitionEntity);
    }

    ActivityImpl startActivity = processDefinitionEntity.getInitial();

    if (startActivity.getOutgoingTransitions().size() != 1) {
        throw new IllegalStateException(
                "start activity outgoing transitions cannot more than 1, now is : "
                        + startActivity.getOutgoingTransitions().size());
    }

    PvmTransition pvmTransition = startActivity.getOutgoingTransitions()
            .get(0);
    PvmActivity targetActivity = pvmTransition.getDestination();

    if (!"userTask".equals(targetActivity.getProperty("type"))) {
        logger.info("first activity is not userTask, just skip");

        return new FirstTaskForm();
    }

    FirstTaskForm firstTaskForm = new FirstTaskForm();
    firstTaskForm.setProcessDefinitionId(processDefinitionId);
    firstTaskForm.setExists(true);
    firstTaskForm.setTaskForm(true);

    String taskDefinitionKey = targetActivity.getId();
    logger.debug("activityId : {}", targetActivity.getId());
    firstTaskForm.setActivityId(taskDefinitionKey);

    TaskDefinition taskDefinition = processDefinitionEntity
            .getTaskDefinitions().get(taskDefinitionKey);

    Expression expression = taskDefinition.getAssigneeExpression();

    if (expression != null) {
        String expressionText = expression.getExpressionText();
        logger.debug("{}", expressionText);
        logger.debug("{}", startActivity.getProperties());
        logger.debug("{}", processDefinitionEntity.getProperties());
        firstTaskForm.setAssignee(expressionText);
    } else {
        logger.info("cannot find expression : {}, {}", processDefinitionId,
                taskDefinitionKey);
    }

    String initiatorVariableName = (String) processDefinitionEntity
            .getProperty(BpmnParse.PROPERTYNAME_INITIATOR_VARIABLE_NAME);
    firstTaskForm.setInitiatorName(initiatorVariableName);

    DefaultFormHandler formHandler = (DefaultFormHandler) taskDefinition
            .getTaskFormHandler();

    if (formHandler.getFormKey() != null) {
        String formKey = formHandler.getFormKey().getExpressionText();
        firstTaskForm.setFormKey(formKey);
    } else {
        logger.info("cannot find formKey from xml : {}, {}",
                processDefinitionId, taskDefinitionKey);
    }

    return firstTaskForm;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:75,代码来源:FindFirstTaskFormCmd.java

示例6: findPreviousEdge

import org.activiti.engine.impl.pvm.PvmActivity; //导入方法依赖的package包/类
/**
 * 找到这个节点前面的连线.
 */
public Edge findPreviousEdge(Node currentNode, long currentStartTime) {
    String activityId = currentNode.getName();
    ActivityImpl activityImpl = processDefinitionEntity
            .findActivity(activityId);
    HistoricActivityInstance nestestHistoricActivityInstance = null;
    String temporaryPvmTransitionId = null;

    // 遍历进入当前节点的所有连线
    for (PvmTransition pvmTransition : activityImpl
            .getIncomingTransitions()) {
        PvmActivity source = pvmTransition.getSource();

        String previousActivityId = source.getId();

        HistoricActivityInstance visitiedHistoryActivityInstance = this
                .findVisitedHistoricActivityInstance(previousActivityId);

        if (visitiedHistoryActivityInstance == null) {
            continue;
        }

        // 如果上一个节点还未完成,说明不可能是从这个节点过来的,跳过
        if (visitiedHistoryActivityInstance.getEndTime() == null) {
            continue;
        }

        logger.debug("current activity start time : {}", new Date(
                currentStartTime));
        logger.debug("nestest activity end time : {}",
                visitiedHistoryActivityInstance.getEndTime());

        // 如果当前节点的开始时间,比上一个节点的结束时间要早,跳过
        if (currentStartTime < visitiedHistoryActivityInstance.getEndTime()
                .getTime()) {
            continue;
        }

        if (nestestHistoricActivityInstance == null) {
            nestestHistoricActivityInstance = visitiedHistoryActivityInstance;
            temporaryPvmTransitionId = pvmTransition.getId();
        } else if ((currentStartTime - nestestHistoricActivityInstance
                .getEndTime().getTime()) > (currentStartTime - visitiedHistoryActivityInstance
                .getEndTime().getTime())) {
            // 寻找离当前节点最近的上一个节点
            // 比较上一个节点的endTime与当前节点startTime的差
            nestestHistoricActivityInstance = visitiedHistoryActivityInstance;
            temporaryPvmTransitionId = pvmTransition.getId();
        }
    }

    // 没找到上一个节点,就返回null
    if (nestestHistoricActivityInstance == null) {
        return null;
    }

    Node previousNode = nodeMap
            .get(nestestHistoricActivityInstance.getId());

    if (previousNode == null) {
        return null;
    }

    logger.debug("previousNode : {}:{}", previousNode.getName(),
            previousNode.getId());

    Edge edge = new Edge();
    edge.setName(temporaryPvmTransitionId);
    previousNode.getOutgoingEdges().add(edge);
    edge.setSrc(previousNode);
    edge.setDest(currentNode);

    return edge;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:77,代码来源:ActivitiHistoryGraphBuilder.java


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