Пример #1
0
        public virtual void Validate(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var sourceActivity = instruction.SourceActivity;

            if (IsCompensationBoundaryEvent(sourceActivity))
            {
                return;
            }

            var sourceEventScope = (ScopeImpl)instruction.SourceActivity.EventScope;
            var targetEventScope = (ScopeImpl)instruction.TargetActivity.EventScope;

            if ((sourceEventScope == null) || (sourceEventScope == sourceActivity.FlowScope))
            {
                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
            {
                var 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(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var sourceActivity = instruction.SourceActivity;

            if (sourceActivity.ActivityBehavior is IConditionalEventBehavior && !instruction.UpdateEventTrigger)
            {
                report.AddFailure(MigrationConditionalValidationErrorMsg);
            }
        }
Пример #3
0
        public virtual void Validate(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var 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 ValidateSingleInstruction(IValidatingMigrationInstruction instruction,
                                                                  ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var targetActivity = instruction.TargetActivity;
            var instructionsToTargetGateway = instructions.GetInstructionsByTargetScope(targetActivity);

            if (instructionsToTargetGateway.Count > 1)
            {
                report.AddFailure("Only one gateway can be mapped to gateway '" + targetActivity.Id + "'");
            }
        }
        public virtual void Validate(IValidatingMigrationInstruction instruction,
            ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var sourceActivity = instruction.SourceActivity;
            var targetActivity = instruction.TargetActivity;

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

            if (!SameBehavior(sourceBehaviorClass, targetBehaviorClass))
                report.AddFailure("Activities have incompatible types " + "(" + sourceBehaviorClass.Name +
                                  " is not compatible with " + targetBehaviorClass.Name + ")");
        }
Пример #6
0
        protected internal virtual void ValidateParentScopeMigrates(IValidatingMigrationInstruction instruction,
                                                                    ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var sourceActivity = instruction.SourceActivity;
            var 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");
                }
            }
        }
Пример #7
0
        protected internal virtual void ValidateIncomingSequenceFlows(IValidatingMigrationInstruction instruction,
                                                                      ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var sourceActivity = instruction.SourceActivity;
            var targetActivity = instruction.TargetActivity;

            var numSourceIncomingFlows = sourceActivity.IncomingTransitions.Count;
            var 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");
            }
        }
        public virtual void Validate(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl targetActivity = (ActivityImpl)instruction.TargetActivity;

            if (IsMultiInstance(targetActivity))
            {
                var 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(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            ActivityImpl sourceActivity = (ActivityImpl)instruction.SourceActivity;

            if (IsMultiInstance(sourceActivity))
            {
                var 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(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var sourceActivity = instruction.SourceActivity;
            var targetActivity = instruction.TargetActivity;

            if (IsEvent((ActivityImpl)sourceActivity) && IsEvent((ActivityImpl)targetActivity))
            {
                var sourceType = sourceActivity.Properties.Get(BpmnProperties.Type);
                var targetType = targetActivity.Properties.Get(BpmnProperties.Type);

                if (!sourceType.Equals(targetType))
                {
                    report.AddFailure("Events are not of the same type (" + sourceType + " != " + targetType + ")");
                }
            }
        }
        public virtual void Validate(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var ancestorScopeInstruction = GetClosestPreservedAncestorScopeMigrationInstruction(instruction,
                                                                                                instructions);
            ScopeImpl targetScope = (ScopeImpl)instruction.TargetActivity;

            if ((ancestorScopeInstruction != null) && (targetScope != null) &&
                (targetScope != targetScope.ProcessDefinition))
            {
                ScopeImpl parentInstanceTargetScope = (ScopeImpl)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 + "'");
                }
            }
        }
Пример #12
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(IValidatingMigrationInstruction instruction,
                                     ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report)
        {
            var targetActivity = instruction.TargetActivity;

            var flowScopeWalker = new FlowScopeWalker(targetActivity.FlowScope);
            var 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.");
            }
        }
Пример #13
0
 protected internal virtual void AddFailure(IValidatingMigrationInstruction 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 + ")");
 }