private static void UpdateNamesForObjectTypeDelayed(ModelElement element) { if (!element.IsDeleted) { ObjectType objectType = (ObjectType)element; string objectTypeName = objectType.Name; ConceptType conceptType = ConceptTypeIsForObjectType.GetConceptType(objectType); LinkedElementCollection <FactType> pathFactTypes; int factTypeCount; RoleBase towardsRole; RoleBase oppositeRole; if (null != conceptType) { // Precheck name to minimize downstream calls, the property change // will check itself. if (conceptType.Name != objectTypeName) { conceptType.Name = objectTypeName; foreach (ConceptTypeReferencesConceptType reference in ConceptTypeReferencesConceptType.GetLinksToReferencingConceptTypeCollection(conceptType)) { pathFactTypes = ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(reference); if (0 != (factTypeCount = pathFactTypes.Count) && null != (towardsRole = FactTypeMapsTowardsRole.GetTowardsRole(pathFactTypes[factTypeCount - 1])) && null != (oppositeRole = towardsRole.OppositeRole)) { reference.OppositeName = ResolveRoleName(oppositeRole); } } foreach (ConceptTypeReferencesConceptType reference in ConceptTypeReferencesConceptType.GetLinksToReferencedConceptTypeCollection(conceptType)) { pathFactTypes = ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(reference); if (0 != (factTypeCount = pathFactTypes.Count) && null != (towardsRole = FactTypeMapsTowardsRole.GetTowardsRole(pathFactTypes[factTypeCount - 1]))) { reference.Name = ResolveRoleName(towardsRole); } } } } InformationTypeFormat informationTypeFormat = InformationTypeFormatIsForValueType.GetInformationTypeFormat(objectType); if (null != informationTypeFormat) { if (informationTypeFormat.Name != objectTypeName) { informationTypeFormat.Name = objectTypeName; foreach (InformationType informationType in InformationType.GetLinksToConceptTypeCollection(informationTypeFormat)) { pathFactTypes = ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(informationType); if (0 != (factTypeCount = pathFactTypes.Count) && null != (towardsRole = FactTypeMapsTowardsRole.GetTowardsRole(pathFactTypes[factTypeCount - 1])) && null != (oppositeRole = towardsRole.OppositeRole)) { informationType.Name = ResolveRoleName(oppositeRole); } } } } } }
/// <summary> /// DeleteRule: typeof(InformationTypeFormatIsForValueType) /// </summary> private static void InformationTypeFormatBridgeDetachedRule(ElementDeletedEventArgs e) { InformationTypeFormat format = ((InformationTypeFormatIsForValueType)e.ModelElement).InformationTypeFormat; if (!format.IsDeleted && TestRebuildAbstractionModel(format.Model)) { AddTransactedModelElement(format, ModelElementModification.AbstractionElementDetached); } }
/// <summary> /// Generates the <see cref="InformationTypeFormat"/> objects and adds them to the model. /// </summary> private void GenerateInformationTypeFormats() { ORMModel model = this.ORMModel; IEnumerable<ObjectType> modelValueTypes = model.ValueTypeCollection; AbstractionModel oialModel = this.AbstractionModel; // For each ValueType in the model... foreach (ObjectType valueType in modelValueTypes) { if (ShouldIgnoreObjectType(valueType)) { continue; } // Create InformationTypeFormat. PropertyAssignment namePropertyAssignment = new PropertyAssignment(InformationTypeFormat.NameDomainPropertyId, valueType.Name); InformationTypeFormat informationTypeFormat = new InformationTypeFormat(Store, namePropertyAssignment); InformationTypeFormatIsForValueType informationTypeFormatIsForValueType = new InformationTypeFormatIsForValueType(informationTypeFormat, valueType); // TODO: information type format data types // Add it to the model. oialModel.InformationTypeFormatCollection.Add(informationTypeFormat); } }