Пример #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
            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);
                        }
                    }
                }
            }
            /// <summary>
            /// Make sure we have our tracker attached to all loaded models.
            /// </summary>
            /// <param name="element">An ORMModel element</param>
            /// <param name="store">The context store</param>
            /// <param name="notifyAdded">The listener to notify if elements are added during fixup</param>
            protected sealed override void ProcessElement(ORMModel element, Store store, INotifyElementAdded notifyAdded)
            {
                AbstractionModel oil = AbstractionModelIsForORMModel.GetAbstractionModel(element);

                if (oil == null)
                {
                    // UNDONE: DelayValidateModel currently deletes and recreates any existing
                    // bridge relationship, so there is no point deleting it up front, we'll
                    // just retrieve it later. Also note that DelayValidateModel does not call notifyAdded.
                    DelayValidateModel(element);
                    oil = AbstractionModelIsForORMModel.GetAbstractionModel(element);
                    if (oil != null)
                    {
                        notifyAdded.ElementAdded(oil, true);
                    }
                }
                else
                {
                    AbstractionModelGenerationSetting generationSetting;
                    bool regenerateForVersion   = null == (generationSetting = GenerationSettingTargetsAbstractionModel.GetGenerationSetting(oil)) || generationSetting.AlgorithmVersion != CurrentAlgorithmVersion;
                    bool excludedBridgedElement = false;
                    ORMElementGateway.Initialize(
                        element,
                        regenerateForVersion ? (ORMElementGateway.NotifyORMElementExcluded) null :
                        delegate(ORMModelElement modelElement)
                    {
                        if (excludedBridgedElement)
                        {
                            return;
                        }
                        ObjectType objectType;
                        FactType factType;
                        // Note that the types we're checking here are synchronized with the ORMElementGateway.ExclusionAdded method
                        if (null != (objectType = modelElement as ObjectType))
                        {
                            if (null != ConceptTypeIsForObjectType.GetLinkToConceptType(objectType) ||
                                null != InformationTypeFormatIsForValueType.GetLinkToInformationTypeFormat(objectType))
                            {
                                excludedBridgedElement = true;
                            }
                        }
                        else if (null != (factType = modelElement as FactType))
                        {
                            if (null != FactTypeMapsTowardsRole.GetLinkToTowardsRole(factType) ||
                                ConceptTypeChildHasPathFactType.GetLinksToConceptTypeChild(factType).Count != 0)
                            {
                                excludedBridgedElement = true;
                            }
                        }
                    });
                    if (regenerateForVersion || excludedBridgedElement)
                    {
                        // Something is very wrong, regenerate (does not regenerate the excluded elements we already have)
                        DelayValidateModel(element);
                    }
                }
            }
Пример #4
0
 private static void SignificantObjectTypeChange(ObjectType objectType)
 {
     if (objectType != null &&
         !objectType.IsDeleted &&
         !ORMElementGateway.IsElementExcluded(objectType))
     {
         FrameworkDomainModel.DelayValidateElement(objectType, SignificantObjectTypeChangeDelayed);
     }
 }
Пример #5
0
 private static void SignificantUniquenessConstraintChange(UniquenessConstraint constraint)
 {
     if (constraint != null &&
         !constraint.IsDeleted &&
         !ORMElementGateway.IsElementExcluded(constraint))
     {
         FrameworkDomainModel.DelayValidateElement(constraint, SignificantUniquenessConstraintChangeDelayed);
     }
 }
Пример #6
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);
     }
 }
Пример #7
0
            private static void SignificantObjectTypeChangeDelayed(ModelElement element)
            {
                ObjectType objectType;
                ORMModel   model;

                if (!element.IsDeleted &&
                    null != (model = (objectType = (ObjectType)element).Model) &&
                    !ORMElementGateway.IsElementExcluded(objectType))
                {
                    AddTransactedModelElement(objectType, ModelElementModification.ORMElementChanged);
                    FrameworkDomainModel.DelayValidateElement(model, DelayValidateModel);
                }
            }
Пример #8
0
            private static void SignificantUniquenessConstraintChangeDelayed(ModelElement element)
            {
                UniquenessConstraint constraint;
                ORMModel             model;

                if (!element.IsDeleted &&
                    null != (model = (constraint = (UniquenessConstraint)element).Model) &&
                    !ORMElementGateway.IsElementExcluded(constraint))
                {
                    AddTransactedModelElement(constraint, ModelElementModification.ORMElementChanged);
                    FrameworkDomainModel.DelayValidateElement(model, DelayValidateModel);
                }
            }