示例#1
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;

            if (isCompensationBoundaryEvent(sourceActivity))
            {
                // this is not required for compensation boundary events since their
                // event scopes need not be active at runtime
                return;
            }

            ScopeImpl sourceEventScope = instruction.SourceActivity.EventScope;
            ScopeImpl targetEventScope = instruction.TargetActivity.EventScope;

            if (sourceEventScope == null || sourceEventScope == sourceActivity.FlowScope)
            {
                // event scopes must only match if the event scopes are not the flow scopes
                // => validation necessary for boundary events;
                // => validation not necessary for event subprocesses
                return;
            }

            if (targetEventScope == null)
            {
                report.addFailure("The source activity's event scope (" + sourceEventScope.Id + ") must be mapped but the " + "target activity has no event scope");
            }
            else
            {
                ScopeImpl mappedSourceEventScope = findMappedEventScope(sourceEventScope, instruction, instructions);
                if (mappedSourceEventScope == null || !mappedSourceEventScope.Id.Equals(targetEventScope.Id))
                {
                    report.addFailure("The source activity's event scope (" + sourceEventScope.Id + ") " + "must be mapped to the target activity's event scope (" + targetEventScope.Id + ")");
                }
            }
        }
示例#2
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;

            if (instruction.UpdateEventTrigger && !definesPersistentEventTrigger(sourceActivity))
            {
                report.addFailure("Cannot update event trigger because the activity does not define a persistent event trigger");
            }
        }
示例#3
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;

            if (sourceActivity.ActivityBehavior is ConditionalEventBehavior && !instruction.UpdateEventTrigger)
            {
                report.addFailure(MIGRATION_CONDITIONAL_VALIDATION_ERROR_MSG);
            }
        }
示例#4
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;
            IList <ValidatingMigrationInstruction> instructionsForSourceActivity = instructions.getInstructionsBySourceScope(sourceActivity);

            if (instructionsForSourceActivity.Count > 1)
            {
                addFailure(sourceActivity.Id, instructionsForSourceActivity, report);
            }
        }
示例#5
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl targetActivity = instruction.TargetActivity;

            if (isWaitStateGateway(targetActivity))
            {
                validateIncomingSequenceFlows(instruction, instructions, report);
                validateParentScopeMigrates(instruction, instructions, report);
                validateSingleInstruction(instruction, instructions, report);
            }
        }
示例#6
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;
            ActivityImpl targetActivity = instruction.TargetActivity;

            Type sourceBehaviorClass = sourceActivity.ActivityBehavior.GetType();
            Type targetBehaviorClass = targetActivity.ActivityBehavior.GetType();

            if (!sameBehavior(sourceBehaviorClass, targetBehaviorClass))
            {
                report.addFailure("Activities have incompatible types " + "(" + sourceBehaviorClass.Name + " is not compatible with " + targetBehaviorClass.Name + ")");
            }
        }
示例#7
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ValidatingMigrationInstruction ancestorScopeInstruction = getClosestPreservedAncestorScopeMigrationInstruction(instruction, instructions);
            ScopeImpl targetScope = instruction.TargetActivity;

            if (ancestorScopeInstruction != null && targetScope != null && targetScope != targetScope.ProcessDefinition)
            {
                ScopeImpl parentInstanceTargetScope = ancestorScopeInstruction.TargetActivity;
                if (parentInstanceTargetScope != null && !parentInstanceTargetScope.isAncestorFlowScopeOf(targetScope))
                {
                    report.addFailure("The closest mapped ancestor '" + ancestorScopeInstruction.SourceActivity.Id + "' is mapped to scope '" + parentInstanceTargetScope.Id + "' which is not an ancestor of target scope '" + targetScope.Id + "'");
                }
            }
        }
示例#8
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl targetActivity = instruction.TargetActivity;

            if (isMultiInstance(targetActivity))
            {
                ActivityImpl innerActivity = getInnerActivity(targetActivity);

                if (instructions.getInstructionsByTargetScope(innerActivity).Count == 0)
                {
                    report.addFailure("Must map the inner activity of a multi-instance body when the body is mapped");
                }
            }
        }
示例#9
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;

            if (isMultiInstance(sourceActivity))
            {
                ActivityImpl innerActivity = getInnerActivity(sourceActivity);

                if (instructions.getInstructionsBySourceScope(innerActivity).Count == 0)
                {
                    report.addFailure("Cannot remove the inner activity of a multi-instance body when the body is mapped");
                }
            }
        }
示例#10
0
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;
            ActivityImpl targetActivity = instruction.TargetActivity;

            if (isEvent(sourceActivity) && isEvent(targetActivity))
            {
                string sourceType = sourceActivity.Properties.get(BpmnProperties.TYPE);
                string targetType = targetActivity.Properties.get(BpmnProperties.TYPE);

                if (!sourceType.Equals(targetType))
                {
                    report.addFailure("Events are not of the same type (" + sourceType + " != " + targetType + ")");
                }
            }
        }
示例#11
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: @Override public void validate(ValidatingMigrationInstruction instruction, final ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        public virtual void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl targetActivity = instruction.TargetActivity;

            FlowScopeWalker flowScopeWalker = new FlowScopeWalker(targetActivity.FlowScope);
            MiBodyCollector miBodyCollector = new MiBodyCollector();

            flowScopeWalker.addPreVisitor(miBodyCollector);

            // walk until a target scope is found that is mapped
            flowScopeWalker.walkWhile(new WalkConditionAnonymousInnerClass(this, instructions));

            if (miBodyCollector.firstMiBody != null)
            {
                report.addFailure("Target activity '" + targetActivity.Id + "' is a descendant of multi-instance body '" + miBodyCollector.firstMiBody.Id + "' that is not mapped from the source process definition.");
            }
        }
示例#12
0
        protected internal virtual ValidatingMigrationInstruction getClosestPreservedAncestorScopeMigrationInstruction(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions)
        {
            ScopeImpl parent = instruction.SourceActivity.FlowScope;

            while (parent != null && instructions.getInstructionsBySourceScope(parent).Count == 0)
            {
                parent = parent.FlowScope;
            }

            if (parent != null)
            {
                return(instructions.getInstructionsBySourceScope(parent)[0]);
            }
            else
            {
                return(null);
            }
        }
示例#13
0
        protected internal virtual void validateSingleInstruction(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl targetActivity = instruction.TargetActivity;
            IList <ValidatingMigrationInstruction> instructionsToTargetGateway = instructions.getInstructionsByTargetScope(targetActivity);

            if (instructionsToTargetGateway.Count > 1)
            {
                report.addFailure("Only one gateway can be mapped to gateway '" + targetActivity.Id + "'");
            }
        }
示例#14
0
 protected internal virtual bool isValidInstruction(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, IList <MigrationInstructionValidator> migrationInstructionValidators)
 {
     return(!validateInstruction(instruction, instructions, migrationInstructionValidators).hasFailures());
 }
示例#15
0
        protected internal virtual MigrationInstructionValidationReportImpl validateInstruction(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, IList <MigrationInstructionValidator> migrationInstructionValidators)
        {
            MigrationInstructionValidationReportImpl validationReport = new MigrationInstructionValidationReportImpl(instruction.toMigrationInstruction());

            foreach (MigrationInstructionValidator migrationInstructionValidator in migrationInstructionValidators)
            {
                migrationInstructionValidator.validate(instruction, instructions, validationReport);
            }
            return(validationReport);
        }
示例#16
0
        protected internal virtual void validateIncomingSequenceFlows(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;
            ActivityImpl targetActivity = instruction.TargetActivity;

            int numSourceIncomingFlows = sourceActivity.IncomingTransitions.Count;
            int numTargetIncomingFlows = targetActivity.IncomingTransitions.Count;

            if (numSourceIncomingFlows > numTargetIncomingFlows)
            {
                report.addFailure("The target gateway must have at least the same number " + "of incoming sequence flows that the source gateway has");
            }
        }
示例#17
0
 protected internal virtual ScopeImpl findMappedEventScope(ScopeImpl sourceEventScope, ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions)
 {
     if (sourceEventScope != null)
     {
         if (sourceEventScope == sourceEventScope.ProcessDefinition)
         {
             return(instruction.TargetActivity.ProcessDefinition);
         }
         else
         {
             IList <ValidatingMigrationInstruction> eventScopeInstructions = instructions.getInstructionsBySourceScope(sourceEventScope);
             if (eventScopeInstructions.Count > 0)
             {
                 return(eventScopeInstructions[0].TargetActivity);
             }
         }
     }
     return(null);
 }
示例#18
0
        protected internal virtual void validateParentScopeMigrates(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = instruction.SourceActivity;
            ScopeImpl    flowScope      = sourceActivity.FlowScope;

            if (flowScope != flowScope.ProcessDefinition)
            {
                if (instructions.getInstructionsBySourceScope(flowScope).Count == 0)
                {
                    report.addFailure("The gateway's flow scope '" + flowScope.Id + "' must be mapped");
                }
            }
        }