コード例 #1
0
 private void deleteFlowNodeInstanceElements(
     final SFlowNodeInstance flowNodeInstance, final SProcessDefinition processDefinition)
     throws SBonitaException {
   if (flowNodeInstance.getType().equals(SFlowNodeType.INTERMEDIATE_CATCH_EVENT)) {
     bpmEventInstanceService.deleteWaitingEvents(flowNodeInstance);
   }
   if (flowNodeInstance instanceof SEventInstance) {
     bpmEventInstanceService.deleteEventTriggerInstances(flowNodeInstance.getId());
   } else if (flowNodeInstance instanceof SActivityInstance) {
     deleteDataInstancesIfNecessary(flowNodeInstance, processDefinition);
     deleteConnectorInstancesIfNecessary(flowNodeInstance, processDefinition);
     if (SFlowNodeType.USER_TASK.equals(flowNodeInstance.getType())
         || SFlowNodeType.MANUAL_TASK.equals(flowNodeInstance.getType())) {
       activityService.deleteHiddenTasksForActivity(flowNodeInstance.getId());
       try {
         activityService.deletePendingMappings(flowNodeInstance.getId());
       } catch (final SActivityModificationException e) {
         throw new SFlowNodeReadException(e);
       }
     } else if (SFlowNodeType.CALL_ACTIVITY.equals(flowNodeInstance.getType())
         || SFlowNodeType.SUB_PROCESS.equals(flowNodeInstance.getType())) {
       // in the case of a call activity or subprocess activity delete the child process instance
       try {
         deleteProcessInstance(getChildOfActivity(flowNodeInstance.getId()));
       } catch (final SProcessInstanceNotFoundException e) {
         final StringBuilder stb = new StringBuilder();
         stb.append("Can't find the process instance called by the activity [id: ");
         stb.append(flowNodeInstance.getId());
         stb.append(", name: ");
         stb.append(flowNodeInstance.getName());
         stb.append("]. This process may be already finished");
         // if the child process is not found, it's because it has already finished and archived or
         // it was not created
         if (logger.isLoggable(getClass(), TechnicalLogSeverity.DEBUG)) {
           logger.log(getClass(), TechnicalLogSeverity.DEBUG, stb.toString());
           logger.log(getClass(), TechnicalLogSeverity.DEBUG, e);
         }
       }
     }
   }
 }
コード例 #2
0
 @Override
 public void execute() throws SBonitaException {
   final SActivityInstance activityInstance =
       activityInstanceService.getActivityInstance(userTaskId);
   if (userId == 0 && SFlowNodeType.MANUAL_TASK.equals(activityInstance.getType())) {
     throw new SUnreleasableTaskException(
         "The activity with id "
             + activityInstance.getId()
             + " can't be assigned because it is a manual sub task");
   }
   activityInstanceService.assignHumanTask(userTaskId, userId);
   if (userId > 0) {
     activityInstanceService.deleteHiddenTasksForActivity(activityInstance.getId());
     final SUser user = identityService.getUser(userId);
     if (commentService.isCommentEnabled(SystemCommentType.STATE_CHANGE)) {
       commentService.addSystemComment(
           activityInstance.getRootContainerId(),
           "The task \""
               + activityInstance.getDisplayName()
               + "\" is now assigned to "
               + user.getUserName());
     }
   }
 }