コード例 #1
0
  // 人工环节重启规则:最终参与者
  private void setManualActParticipants(ActivityRestartEvent event) {
    if (Constants.ACT_RESTART_FINAL.equals(event.getActivityXml().getResetParticipant())) {
      event
          .getWorkItemRep()
          .updateActWorkItemStateAndStartTime(
              event.getActivityInst().getActivityInstId(),
              StarFlowState.WORKITEM_RUNNING,
              new Date());
    } else {
      List<WorkItem> workItems =
          event.getWorkItemRep().findActivityWorkItems(event.getActivityInst().getActivityInstId());
      for (WorkItem workItem : workItems) {
        int state = StarFlowState.WORKITEM_RUNNING;
        List<Participant> participants =
            event.getWorkItemRep().findWorkItemParticipants(workItem.getWorkItemId());
        if (participants.size() == 1) {
          Participant participant = participants.get(0);
          if (Constants.PARTICIPANT_TYPE_PERSON.equals(participant.getParticType()))
            state = StarFlowState.WORKITEM_RUNNING;
          else state = StarFlowState.WORKITEM_WAITING_RECEIVE;
        } else state = StarFlowState.WORKITEM_WAITING_RECEIVE;

        event
            .getWorkItemRep()
            .updateWorkItemStateAndStartTime(workItem.getWorkItemId(), state, new Date());
      }
    }
  }
コード例 #2
0
  @Override
  public void activityRestart(ActivityRestartEvent event) {
    // 环节实例状态更新为待激活状态。
    event
        .getActInstRep()
        .updateActivityStateToRunning(
            event.getActivityInst().getActivityInstId(),
            StarFlowState.ACT_INST_WAITING,
            new Date());

    if (!ActivityStartRuleUtil.isStartActivity(event, event.getActivityInst())) return;

    String type = event.getActivityXml().getType();
    if (Constants.ACT_TYPE_MANUL.equals(type)) setManualActParticipants(event);

    EventUtil.publishActivityStartEvent(
        event.getProcessEngine(),
        event.getProcessInstance(),
        event.getActivityInst(),
        event.getActivityXml());
  }