Esempio n. 1
0
        public virtual ProcessDefinitionBuilder attachedTo(string id, bool isInterrupting)
        {
            ActivityImpl activity = Activity;

            activity.EventScope = processDefinition.findActivity(id);

            if (isInterrupting)
            {
                activity.ActivityStartBehavior = ActivityStartBehavior.INTERRUPT_EVENT_SCOPE;
            }
            else
            {
                activity.ActivityStartBehavior = ActivityStartBehavior.CONCURRENT_IN_FLOW_SCOPE;
            }

            return(this);
        }
Esempio n. 2
0
        protected internal virtual ISet <string> collectParentScopeIdsForActivity(ProcessDefinitionImpl processDefinition, string activityId)
        {
            ISet <string> parentScopeIds = new HashSet <string>();
            ScopeImpl     scope          = processDefinition.findActivity(activityId);

            while (scope != null)
            {
                parentScopeIds.Add(scope.Id);
                scope = scope.FlowScope;
            }

            return(parentScopeIds);
        }
Esempio n. 3
0
        protected internal virtual ScopeImpl getScopeForActivityInstance(ProcessDefinitionImpl processDefinition, ActivityInstance activityInstance)
        {
            string scopeId = activityInstance.ActivityId;

            if (processDefinition.Id.Equals(scopeId))
            {
                return(processDefinition);
            }
            else
            {
                return(processDefinition.findActivity(scopeId));
            }
        }
Esempio n. 4
0
        protected internal virtual ValidatingMigrationInstructions wrapMigrationInstructions(MigrationPlan migrationPlan, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition, MigrationPlanValidationReportImpl planReport)
        {
            ValidatingMigrationInstructions validatingMigrationInstructions = new ValidatingMigrationInstructions();

            foreach (MigrationInstruction migrationInstruction in migrationPlan.Instructions)
            {
                MigrationInstructionValidationReportImpl instructionReport = new MigrationInstructionValidationReportImpl(migrationInstruction);

                string sourceActivityId = migrationInstruction.SourceActivityId;
                string targetActivityId = migrationInstruction.TargetActivityId;
                if (!string.ReferenceEquals(sourceActivityId, null) && !string.ReferenceEquals(targetActivityId, null))
                {
                    ActivityImpl sourceActivity = sourceProcessDefinition.findActivity(sourceActivityId);
                    ActivityImpl targetActivity = targetProcessDefinition.findActivity(migrationInstruction.TargetActivityId);

                    if (sourceActivity != null && targetActivity != null)
                    {
                        validatingMigrationInstructions.addInstruction(new ValidatingMigrationInstructionImpl(sourceActivity, targetActivity, migrationInstruction.UpdateEventTrigger));
                    }
                    else
                    {
                        if (sourceActivity == null)
                        {
                            instructionReport.addFailure("Source activity '" + sourceActivityId + "' does not exist");
                        }
                        if (targetActivity == null)
                        {
                            instructionReport.addFailure("Target activity '" + targetActivityId + "' does not exist");
                        }
                    }
                }
                else
                {
                    if (string.ReferenceEquals(sourceActivityId, null))
                    {
                        instructionReport.addFailure("Source activity id is null");
                    }
                    if (string.ReferenceEquals(targetActivityId, null))
                    {
                        instructionReport.addFailure("Target activity id is null");
                    }
                }

                if (instructionReport.hasFailures())
                {
                    planReport.addInstructionReport(instructionReport);
                }
            }
            return(validatingMigrationInstructions);
        }
Esempio n. 5
0
        public virtual ExecutionEntity getExecution(ActivityInstance activityInstance)
        {
            ScopeImpl scope = null;

            if (activityInstance.Id.Equals(activityInstance.ProcessInstanceId))
            {
                scope = processDefinition;
            }
            else
            {
                scope = processDefinition.findActivity(activityInstance.ActivityId);
            }

            return(intersect(getExecutions(scope), activityInstance.ExecutionIds));
        }
Esempio n. 6
0
        public override Void execute(CommandContext commandContext)
        {
            ExecutionEntity       processInstance   = commandContext.ExecutionManager.findExecutionById(processInstanceId);
            ProcessDefinitionImpl processDefinition = processInstance.getProcessDefinition();

            PvmActivity activity = processDefinition.findActivity(activityId);

            // forbid instantiation of compensation boundary events
            if (activity != null && "compensationBoundaryCatch".Equals(activity.getProperty("type")))
            {
                throw new ProcessEngineException("Cannot start before activity " + activityId + "; activity " + "is a compensation boundary event.");
            }

            return(base.execute(commandContext));
        }
Esempio n. 7
0
        protected internal virtual TransitionImpl findTransition(ProcessDefinitionImpl processDefinition)
        {
            PvmActivity activity = processDefinition.findActivity(activityId);

            EnsureUtil.ensureNotNull(typeof(NotValidException), describeFailure("Activity '" + activityId + "' does not exist"), "activity", activity);

            if (activity.OutgoingTransitions.Count == 0)
            {
                throw new ProcessEngineException("Cannot start after activity " + activityId + "; activity " + "has no outgoing sequence flow to take");
            }
            else if (activity.OutgoingTransitions.Count > 1)
            {
                throw new ProcessEngineException("Cannot start after activity " + activityId + "; " + "activity has more than one outgoing sequence flow");
            }

            return((TransitionImpl)activity.OutgoingTransitions[0]);
        }
Esempio n. 8
0
        protected internal override CoreModelElement getTargetElement(ProcessDefinitionImpl processDefinition)
        {
            ActivityImpl activity = processDefinition.findActivity(activityId);

            return(activity);
        }
Esempio n. 9
0
        protected internal override ScopeImpl getTargetFlowScope(ProcessDefinitionImpl processDefinition)
        {
            PvmActivity activity = processDefinition.findActivity(activityId);

            return(activity.FlowScope);
        }