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


Java HistoricActivityInstance.getEndTime方法代码示例

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


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

示例1: Activity

import org.activiti.engine.history.HistoricActivityInstance; //导入方法依赖的package包/类
public Activity(HistoricActivityInstance activity) {
    this.id = activity.getId();
    this.activityDefinitionId = activity.getActivityId();
    this.activityDefinitionName = activity.getActivityName();
    this.activityDefinitionType = activity.getActivityType();
    this.startedAt = activity.getStartTime();
    this.endedAt = activity.getEndTime();
    this.durationInMs = activity.getDurationInMillis();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:10,代码来源:Activity.java

示例2: addActivityList

import org.activiti.engine.history.HistoricActivityInstance; //导入方法依赖的package包/类
private void addActivityList(String processInstanceId, ObjectNode responseJSON) {
  List<HistoricActivityInstance> activityList = ActivitiUtil.getHistoryService()
      .createHistoricActivityInstanceQuery()
      .processInstanceId(processInstanceId)
      .orderByHistoricActivityInstanceStartTime()
      .asc()
      .list();
  
  if(activityList != null && activityList.size() > 0) {
    ArrayNode activitiesJSON = new ObjectMapper().createArrayNode();
    responseJSON.put("activities", activitiesJSON);
    for (HistoricActivityInstance historicActivityInstance : activityList) {
      ObjectNode activityJSON = new ObjectMapper().createObjectNode();
      activityJSON.put("activityId", historicActivityInstance.getActivityId());
      activityJSON.put("activityName", historicActivityInstance.getActivityName() != null ? historicActivityInstance.getActivityName() : "null");
      activityJSON.put("activityType", historicActivityInstance.getActivityType());
      activityJSON.put("startTime", RequestUtil.dateToString(historicActivityInstance.getStartTime()));
      if(historicActivityInstance.getEndTime() == null) {
        activityJSON.put("completed", false);
      } else {
        activityJSON.put("completed", true);
        activityJSON.put("endTime", RequestUtil.dateToString(historicActivityInstance.getEndTime()));
        activityJSON.put("duration", historicActivityInstance.getDurationInMillis());
      }
      activitiesJSON.add(activityJSON);
    }
  }
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:29,代码来源:ProcessInstanceResource.java

示例3: findPreviousEdge

import org.activiti.engine.history.HistoricActivityInstance; //导入方法依赖的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.history.HistoricActivityInstance.getEndTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。