protected internal virtual CmmnActivity createActivity(CmmnElement element, CmmnHandlerContext context) { string id = element.Id; CmmnActivity parent = context.Parent; CmmnActivity newActivity = null; if (parent != null) { newActivity = parent.createActivity(id); } else { CmmnCaseDefinition caseDefinition = context.CaseDefinition; newActivity = new CmmnActivity(id, caseDefinition); } newActivity.CmmnElement = element; CmmnActivityBehavior behavior = ActivityBehavior; newActivity.ActivityBehavior = behavior; return(newActivity); }
protected internal virtual void resumeChildren(CmmnActivityExecution execution) { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<? extends org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution> children = execution.getCaseExecutions(); IList <CmmnExecution> children = execution.CaseExecutions; if (children != null && children.Count > 0) { foreach (CmmnExecution child in children) { CmmnActivityBehavior behavior = getActivityBehavior(child); // during resuming the children, it can happen that a sentry // will be satisfied, so that a child will terminated. these // terminated child cannot be resumed, so ignore it. if (!child.Terminated) { if (behavior is StageOrTaskActivityBehavior) { child.parentResume(); } else { // behavior instanceof EventListenerOrMilestoneActivityBehavior child.resume(); } } } } }
protected internal virtual CmmnExecution eventNotificationsStarted(CmmnExecution execution) { CmmnActivityBehavior behavior = getActivityBehavior(execution); triggerBehavior(behavior, execution); execution.CurrentState = COMPLETED; return(execution); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testActivityBehavior() public virtual void testActivityBehavior() { // given: a case // when CmmnActivity activity = handler.handleElement(caseDefinition, context); // then CmmnActivityBehavior behavior = activity.ActivityBehavior; assertNull(behavior); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testActivityBehavior() public virtual void testActivityBehavior() { // given: a planItem // when CmmnActivity activity = handler.handleElement(planItem, context); // then CmmnActivityBehavior behavior = activity.ActivityBehavior; assertTrue(behavior is DmnDecisionTaskActivityBehavior); }
protected internal virtual void terminateChild(CmmnExecution child) { CmmnActivityBehavior behavior = getActivityBehavior(child); // "child.isTerminated()": during resuming the children, it can // happen that a sentry will be satisfied, so that a child // will terminated. these terminated child cannot be resumed, // so ignore it. // "child.isCompleted()": in case that an exitCriteria on caseInstance // (ie. casePlanModel) has been fired, when a child inside has been // completed, so ignore it. if (!child.Terminated && !child.Completed) { if (behavior is StageOrTaskActivityBehavior) { child.exit(); } else { // behavior instanceof EventListenerOrMilestoneActivityBehavior child.parentTerminate(); } } }
public virtual CaseDefinitionBuilder behavior(CmmnActivityBehavior behavior) { Activity.ActivityBehavior = behavior; return(this); }
protected internal override void postTransitionNotification(CmmnExecution execution) { if (!execution.CaseInstanceExecution) { execution.remove(); } else { CmmnExecution superCaseExecution = execution.SuperCaseExecution; PvmExecutionImpl superExecution = execution.SuperExecution; if (superCaseExecution != null) { TransferVariablesActivityBehavior behavior = (TransferVariablesActivityBehavior)getActivityBehavior(superCaseExecution); behavior.transferVariables(execution, superCaseExecution); superCaseExecution.complete(); } else if (superExecution != null) { SubProcessActivityBehavior behavior = (SubProcessActivityBehavior)getActivityBehavior(superExecution); try { behavior.passOutputVariables(superExecution, execution); } catch (Exception e) { LOG.completingSubCaseError(execution, e); throw e; } catch (Exception e) { LOG.completingSubCaseError(execution, e); throw LOG.completingSubCaseErrorException(execution, e); } // set sub case instance to null superExecution.SubCaseInstance = null; try { behavior.completed(superExecution); } catch (Exception e) { LOG.completingSubCaseError(execution, e); throw e; } catch (Exception e) { LOG.completingSubCaseError(execution, e); throw LOG.completingSubCaseErrorException(execution, e); } } execution.SuperCaseExecution = null; execution.SuperExecution = null; } CmmnExecution parent = execution.Parent; if (parent != null) { CmmnActivityBehavior behavior = getActivityBehavior(parent); if (behavior is CmmnCompositeActivityBehavior) { CmmnCompositeActivityBehavior compositeBehavior = (CmmnCompositeActivityBehavior)behavior; compositeBehavior.handleChildCompletion(parent, execution); } } }
protected internal abstract void triggerBehavior(CmmnActivityBehavior behavior, CmmnExecution execution);