Пример #1
0
            private static void SignificantFactTypeChangeDelayed(ModelElement element)
            {
                FactType factType;
                ORMModel model;

                if (!element.IsDeleted &&
                    !ORMElementGateway.IsElementExcluded(factType = (FactType)element) &&
                    null != (model = factType.Model))
                {
                    Objectification objectification = factType.Objectification;
                    if (objectification != null)
                    {
                        LinkedElementCollection <FactType> impliedFactTypes = objectification.ImpliedFactTypeCollection;
                        int impliedFactTypeCount = impliedFactTypes.Count;
                        for (int i = 0; i < impliedFactTypeCount; ++i)
                        {
                            FactType impliedFactType = impliedFactTypes[i];
                            AddTransactedModelElement(impliedFactType, ModelElementModification.ORMElementChanged);
                        }
                        if (impliedFactTypeCount == 1)
                        {
                            AddTransactedModelElement(factType, ModelElementModification.ORMElementChanged);
                        }
                    }
                    else
                    {
                        AddTransactedModelElement(factType, ModelElementModification.ORMElementChanged);
                    }
                    FrameworkDomainModel.DelayValidateElement(model, DelayValidateModel);
                }
            }
Пример #2
0
 /// <summary>
 /// Implements IModelErrorOwner.DelayValidateErrors
 /// </summary>
 protected new void DelayValidateErrors()
 {
     if (FrameworkDomainModel.DelayValidateElement(this, DelayValidateRanges))
     {
         OnTextChanged();
     }
 }
Пример #3
0
 /// <summary>
 /// ChangeRule: typeof(FactType)
 /// </summary>
 private static void FactTypeNameChangedRule(ElementPropertyChangedEventArgs e)
 {
     if (e.DomainProperty.Id == FactType.NameChangedDomainPropertyId)
     {
         FrameworkDomainModel.DelayValidateElement(e.ModelElement, DelayValidateUnaryBinarization);
     }
 }
Пример #4
0
            private static void FactTypeConstraintPatternChangedDelayed(ModelElement element)
            {
                FactType factType;
                ORMModel model;

                if (!element.IsDeleted &&
                    null != (model = (factType = (FactType)element).Model) &&
                    !ORMElementGateway.IsElementExcluded(factType))
                {
                    // If we're not previously mapped, then we will have been added at this point
                    FactTypeMapsTowardsRole mapToRole = FactTypeMapsTowardsRole.GetLinkToTowardsRole(factType);
                    if (mapToRole != null)
                    {
                        MappingMandatoryPattern startMandatoryPattern = mapToRole.MandatoryPattern;
                        if (mapToRole.SynchronizeMappingPatterns())
                        {
                            MappingMandatoryPattern endMandatoryPattern = mapToRole.MandatoryPattern;
                            if (endMandatoryPattern != startMandatoryPattern)
                            {
                                foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild(factType))
                                {
                                    ValidateMandatory(child, startMandatoryPattern, endMandatoryPattern);
                                }
                            }
                        }
                        else
                        {
                            AddTransactedModelElement(factType, ModelElementModification.ORMElementChanged);
                            FrameworkDomainModel.DelayValidateElement(model, DelayValidateModel);
                        }
                    }
                }
            }
Пример #5
0
 private static void ValidateConceptTypeChildNameChanged(ConceptTypeChild child)
 {
     if (null != child)
     {
         FrameworkDomainModel.DelayValidateElement(child, DelayValidateConceptTypeChildNameChanged);
     }
 }
Пример #6
0
 private static void ValidateConceptTypeNameChanged(ConceptType conceptType)
 {
     if (null != conceptType)
     {
         FrameworkDomainModel.DelayValidateElement(conceptType, DelayValidateConceptTypeNameChanged);
     }
 }
Пример #7
0
 private static void ValidateSchemaNamesChanged(Schema schema)
 {
     if (null != schema)
     {
         FrameworkDomainModel.DelayValidateElement(schema, DelayValidateSchemaNamesChanged);
     }
 }
Пример #8
0
 private static void ValidateTableNameChanged(Table table)
 {
     if (null != table)
     {
         FrameworkDomainModel.DelayValidateElement(table, DelayValidateTableNameChanged);
     }
 }
Пример #9
0
 /// <summary>
 /// RolePlayerPositionChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.FactTypeHasReadingOrder)
 /// </summary>
 private static void ReadingOrderReorderedRule(RolePlayerOrderChangedEventArgs e)
 {
     if (e.SourceDomainRole.Id == FactTypeHasReadingOrder.FactTypeDomainRoleId)
     {
         FrameworkDomainModel.DelayValidateElement(e.SourceElement, UpdateChildNamesForFactTypeDelayed);
     }
 }
Пример #10
0
        /// <summary>
        /// DeletingRule: typeof(UniquenessConstraintIncludesColumn)
        /// If a uniqueness constraint column is being removed, then remove the corresponding column
        /// in any reference constraints that target the columns in the uniqueness constraint.
        /// </summary>
        private static void UniquenessConstraintColumnDeleting(ElementDeletingEventArgs e)
        {
            UniquenessConstraintIncludesColumn link   = (UniquenessConstraintIncludesColumn)e.ModelElement;
            UniquenessConstraint uniquenessConstraint = link.UniquenessConstraint;

            if (!uniquenessConstraint.IsDeleting)
            {
                bool haveIndex = false;
                int  index     = -1;
                foreach (ReferenceConstraint referenceConstraint in uniquenessConstraint.ReferenceConstraintCollection)
                {
                    if (!haveIndex)
                    {
                        haveIndex = true;
                        index     = UniquenessConstraintIncludesColumn.GetLinksToColumnCollection(uniquenessConstraint).IndexOf(link);
                    }
                    LinkedElementCollection <ColumnReference> columnRefs = referenceConstraint.ColumnReferenceCollection;
                    if (index < columnRefs.Count && columnRefs[index].TargetColumn == link.Column)                     // Sanity check
                    {
                        columnRefs.RemoveAt(index);
                    }
                    else
                    {
                        // Something is off, delay validate this later
                        ReferenceConstraintTargetsTable tableLink = ReferenceConstraintTargetsTable.GetLinkToTargetTable(referenceConstraint);
                        if (tableLink != null)
                        {
                            FrameworkDomainModel.DelayValidateElement(tableLink, DelayValidateTargetUniquenessConstraint);
                        }
                    }
                }
            }
        }
Пример #11
0
        /// <summary>
        /// RolePlayerChangeRule: typeof(Microsoft.VisualStudio.Modeling.Diagrams.LinkConnectsToNode)
        /// External constraint shapes can only be drawn if they show all of their
        /// links, so automatically remove them if a link is moved off the constraint
        /// shape.
        /// </summary>
        private static void VerifyConnectedShapeShapeRolePlayerChangedRule(RolePlayerChangedEventArgs e)
        {
            ShapeElement shape;

            if (e.DomainRole.Id == LinkConnectsToNode.NodesDomainRoleId &&
                ((LinkConnectsToNode)e.ElementLink).Link is ExternalConstraintLink &&
                null != (shape = e.OldRolePlayer as ShapeElement))
            {
                ExternalConstraintShape constraintShape;
                FactTypeShape           factTypeShape;
                if (null != (constraintShape = shape as ExternalConstraintShape))
                {
                    FrameworkDomainModel.DelayValidateElement(constraintShape, DelayValidateExternalConstraintShapeFullyConnected);
                }
                else if (null != (factTypeShape = MultiShapeUtility.ResolvePrimaryShape(shape) as FactTypeShape))
                {
                    FrameworkDomainModel.DelayValidateElement(factTypeShape, DelayValidateFactTypeShapeSize);
                    if (null != (shape = e.NewRolePlayer as ShapeElement) &&
                        null != (factTypeShape = MultiShapeUtility.ResolvePrimaryShape(shape) as FactTypeShape))
                    {
                        FrameworkDomainModel.DelayValidateElement(factTypeShape, DelayValidateFactTypeShapeSize);
                    }
                }
            }
        }
Пример #12
0
 /// <summary>
 /// ChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ObjectType)
 /// This method calls the DelayValidateElement method when the name of an ObjectType has been changed.
 /// </summary>
 private static void ExtensionObjectTypeChangeRule(ElementPropertyChangedEventArgs e)
 {
     if (e.DomainProperty.Id == ObjectType.NameDomainPropertyId)
     {
         FrameworkDomainModel.DelayValidateElement(e.ModelElement, DelayValidateObjectTypeHasMeaningfulNameError);
     }
 }
Пример #13
0
 private static void RebuildAbstractionModel(AbstractionModel model)
 {
     if (model != null &&
         !model.IsDeleted)
     {
         FrameworkDomainModel.DelayValidateElement(model, RebuildForAbstractionModelDelayed);
     }
 }
Пример #14
0
        /// <summary>
        /// AddRule: typeof(UnaryRoleHasCardinalityConstraint)
        /// </summary>
        private static void UnaryRoleCardinalityAddedRule(ElementAddedEventArgs e)
        {
            UnaryRoleHasCardinalityConstraint roleCardinalityLink = (UnaryRoleHasCardinalityConstraint)e.ModelElement;

            AddDelayedValidation(roleCardinalityLink.CardinalityConstraint);
            // Validate unary-only requirement after unary binarization is complete
            FrameworkDomainModel.DelayValidateElement(roleCardinalityLink, DelayValidateRoleCardinalityUnaryOnly);
        }
Пример #15
0
            /// <summary>
            /// DeleteRule: typeof(ConstraintRoleSequenceHasRole)
            /// </summary>
            private static void ConstraintRoleSequenceHasRoleDeletedRule(ElementDeletedEventArgs e)
            {
                FactType factType = (e.ModelElement as ConstraintRoleSequenceHasRole).Role.FactType;

                if (factType != null && !factType.IsDeleted)
                {
                    FrameworkDomainModel.DelayValidateElement(factType, DelayValidateUnaryBinarization);
                }
            }
Пример #16
0
 private static void SignificantUniquenessConstraintChange(UniquenessConstraint constraint)
 {
     if (constraint != null &&
         !constraint.IsDeleted &&
         !ORMElementGateway.IsElementExcluded(constraint))
     {
         FrameworkDomainModel.DelayValidateElement(constraint, SignificantUniquenessConstraintChangeDelayed);
     }
 }
Пример #17
0
            /// <summary>
            /// AddRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ReadingOrderHasReading)
            /// </summary>
            private static void ReadingAddedRule(ElementAddedEventArgs e)
            {
                FactType factType;

                if (null != (factType = ((ReadingOrderHasReading)e.ModelElement).ReadingOrder.FactType))
                {
                    FrameworkDomainModel.DelayValidateElement(factType, UpdateChildNamesForFactTypeDelayed);
                }
            }
Пример #18
0
            /// <summary>
            /// DeleteRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.FactTypeHasReadingOrder)
            /// </summary>
            private static void ReadingOrderDeletedRule(ElementDeletedEventArgs e)
            {
                FactType factType;

                if (!(factType = ((FactTypeHasReadingOrder)e.ModelElement).FactType).IsDeleted)
                {
                    FrameworkDomainModel.DelayValidateElement(factType, UpdateChildNamesForFactTypeDelayed);
                }
            }
Пример #19
0
 private static void SignificantObjectTypeChange(ObjectType objectType)
 {
     if (objectType != null &&
         !objectType.IsDeleted &&
         !ORMElementGateway.IsElementExcluded(objectType))
     {
         FrameworkDomainModel.DelayValidateElement(objectType, SignificantObjectTypeChangeDelayed);
     }
 }
Пример #20
0
            private static void ValidateAssociatedColumnsIsNullable(ConceptTypeChild child)
            {
                bool canBeNullable = !child.IsMandatory;

                foreach (Column column in ColumnHasConceptTypeChild.GetColumn(child))
                {
                    FrameworkDomainModel.DelayValidateElement(column, ValidateColumnIsNullableDelayed);
                }
            }
Пример #21
0
            /// <summary>
            /// AddRule: typeof(ObjectTypePlaysRole)
            /// </summary>
            private static void ObjectTypePlaysRoleAddedRule(ElementAddedEventArgs e)
            {
                ObjectTypePlaysRole link = e.ModelElement as ObjectTypePlaysRole;
                FactType            factType;

                if (null != (factType = link.PlayedRole.FactType))
                {
                    FrameworkDomainModel.DelayValidateElement(factType, DelayValidateUnaryBinarization);
                }
            }
Пример #22
0
 private static void AddDelayedValidation(CardinalityConstraint constraint)
 {
     if (!constraint.IsDeleted)
     {
         if (FrameworkDomainModel.DelayValidateElement(constraint, DelayValidateRanges))
         {
             constraint.OnTextChanged();
         }
     }
 }
Пример #23
0
            /// <summary>
            /// RolePlayerPositionChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ReadingOrderHasReading)
            /// </summary>
            private static void ReadingReorderedRule(RolePlayerOrderChangedEventArgs e)
            {
                FactType factType;

                if (e.SourceDomainRole.Id == ReadingOrderHasReading.ReadingOrderDomainRoleId &&
                    null != (factType = ((ReadingOrder)e.SourceElement).FactType))
                {
                    FrameworkDomainModel.DelayValidateElement(factType, UpdateChildNamesForFactTypeDelayed);
                }
            }
Пример #24
0
            /// <summary>
            /// ChangeRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.Role)
            /// </summary>
            private static void RoleChangedRule(ElementPropertyChangedEventArgs e)
            {
                FactType factType;

                if (e.DomainProperty.Id == Role.NameDomainPropertyId &&
                    null != (factType = ((Role)e.ModelElement).FactType))
                {
                    FrameworkDomainModel.DelayValidateElement(factType, UpdateChildNamesForFactTypeDelayed);
                }
            }
Пример #25
0
 /// <summary>
 /// The constraint pattern for a <see cref="FactType"/> may have changed
 /// </summary>
 private static void FactTypeConstraintPatternChanged(FactType factType)
 {
     if (factType != null &&
         !factType.IsDeleted &&
         null != factType.Model &&
         !ORMElementGateway.IsElementExcluded(factType))
     {
         FrameworkDomainModel.DelayValidateElement(factType, FactTypeConstraintPatternChangedDelayed);
     }
 }
Пример #26
0
        /// <summary>
        /// RolePlayerPositionChangeRule: typeof(SetComparisonConstraintHasRoleSequence)
        /// Validate subtype subset constraint patterns when role sequences are reordered.
        /// </summary>
        private static void LimitSubtypeSetComparisonConstraintSequenceReorderRule(RolePlayerOrderChangedEventArgs e)
        {
            SubsetConstraint constraint;

            if (e.SourceDomainRole.Id == SetComparisonConstraintHasRoleSequence.ExternalConstraintDomainRoleId &&
                null != (constraint = e.SourceElement as SubsetConstraint))
            {
                FrameworkDomainModel.DelayValidateElement(constraint, DelayValidateSupertypeSubsetPattern);
            }
        }
Пример #27
0
 /// <summary>
 /// AddRule: typeof(UniquenessConstraintIncludesColumn)
 /// Verify any related <see cref="ReferenceConstraint"/> when a new
 /// column is added to a uniqueness constraint. The reference constraint
 /// needs to be deleted if the calling code has not made a matching modification
 /// by the end of the transaction.
 /// </summary>
 private static void UniquenessConstraintColumnAdded(ElementAddedEventArgs e)
 {
     foreach (ReferenceConstraint referenceConstraint in ReferenceConstraintTargetsUniquenessConstraint.GetReferenceConstraintCollection(((UniquenessConstraintIncludesColumn)e.ModelElement).UniquenessConstraint))
     {
         ReferenceConstraintTargetsTable tableLink = ReferenceConstraintTargetsTable.GetLinkToTargetTable(referenceConstraint);
         if (tableLink != null)
         {
             FrameworkDomainModel.DelayValidateElement(tableLink, DelayValidateTargetUniquenessConstraint);
         }
     }
 }
Пример #28
0
            /// <summary>
            /// DeleteRule: typeof(ORMSolutions.ORMArchitect.Core.ObjectModel.ReadingOrderHasReading)
            /// </summary>
            private static void ReadingDeletedRule(ElementDeletedEventArgs e)
            {
                ReadingOrder order;
                FactType     factType;

                if (!(order = ((ReadingOrderHasReading)e.ModelElement).ReadingOrder).IsDeleted &&
                    null != (factType = order.FactType))
                {
                    FrameworkDomainModel.DelayValidateElement(factType, UpdateChildNamesForFactTypeDelayed);
                }
            }
Пример #29
0
 /// <summary>
 /// RolePlayerPositionChangeRule: typeof(ORMSolutions.ORMArchitect.RelationalModels.ConceptualDatabase.TableContainsColumn)
 /// </summary>
 private static void ColumnOrderChangedRule(RolePlayerOrderChangedEventArgs e)
 {
     if (e.SourceDomainRole.Id == TableContainsColumn.TableDomainRoleId)
     {
         Table table = (Table)e.SourceElement;
         if (table.ColumnOrder == ColumnOrdering.Custom)
         {
             FrameworkDomainModel.DelayValidateElement(table, DelayValidateCustomizeColumnPositions);
         }
     }
 }
Пример #30
0
        /// <summary>
        /// AddRule: typeof(Microsoft.VisualStudio.Modeling.Diagrams.LinkConnectsToNode)
        /// Make sure connected fact type shapes properly display their role bars
        /// </summary>
        private static void VerifyedConnectedShapeAddedRule(ElementAddedEventArgs e)
        {
            LinkConnectsToNode connectLink = (LinkConnectsToNode)e.ModelElement;
            FactTypeShape      factTypeShape;

            if (connectLink.Link is ExternalConstraintLink &&
                null != (factTypeShape = connectLink.Nodes as FactTypeShape))
            {
                FrameworkDomainModel.DelayValidateElement(factTypeShape, DelayValidateFactTypeShapeSize);
            }
        }