Пример #1
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);
        }
Пример #2
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 + ")");
                }
            }
        }
Пример #3
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");
            }
        }
Пример #4
0
 protected internal virtual void addFailure(ValidatingMigrationInstruction instruction, MigrationInstructionValidationReportImpl report, string sourceScopeId, string targetScopeId)
 {
     report.addFailure("The source activity's event scope (" + sourceScopeId + ") " + "must be mapped to the target activity's event scope (" + targetScopeId + ")");
 }
Пример #5
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 + ")");
                }
            }
        }
Пример #6
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");
                }
            }
        }
Пример #7
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 + "'");
            }
        }
Пример #8
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 + ")");
            }
        }
Пример #9
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");
            }
        }
Пример #10
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);
            }
        }
Пример #11
0
 protected internal virtual void addFailure(string sourceActivityId, IList <ValidatingMigrationInstruction> migrationInstructions, MigrationInstructionValidationReportImpl report)
 {
     report.addFailure("There are multiple mappings for source activity id '" + sourceActivityId + "': " + StringUtil.join(new StringIteratorAnonymousInnerClass(this, migrationInstructions.GetEnumerator())));
 }
Пример #12
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);
            }
        }
Пример #13
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");
                }
            }
        }
Пример #14
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 + "'");
                }
            }
        }
Пример #15
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");
                }
            }
        }
Пример #16
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);
            }
        }
Пример #17
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.");
            }
        }