/// <summary> /// Triggers this notification rule whether a <see cref="ElementSchema"/> is added. /// </summary> /// <param name="e">The provided data for this event.</param> public override void ElementAdded(ElementAddedEventArgs e) { Guard.NotNull(() => e, e); var element = (ExtensionPointSchema)e.ModelElement; if (!element.Store.TransactionManager.CurrentTransaction.IsSerializing) { if (element.Owner == null) { var relationship = (ViewHasExtensionPoints)DomainRelationshipInfo.FindEmbeddingElementLink(element); if (relationship != null) { relationship.WithTransaction(r => { r.Cardinality = Runtime.Cardinality.ZeroToMany; }); } } else { var relationship = (ElementHasExtensionPoints)DomainRelationshipInfo.FindEmbeddingElementLink(element); if (relationship != null) { relationship.WithTransaction(r => { r.Cardinality = Runtime.Cardinality.ZeroToMany; }); } } } }
/// <summary> /// Verifies if the current item can be moved down or not. /// </summary> /// <returns>True if the current item can be moved down. False otherwise.</returns> public virtual bool CanMoveDown() { if (this.Parent == null || this.ElementLink == null || this.Element == null || this.DomainRoleId == System.Guid.Empty) { return(false); } int index = -1; bool bFound = false; DomainRelationshipInfo info = this.ElementLink.GetDomainRelationship(); for (int i = 0; i < this.Parent.Children.Count; i++) { if (this.Parent.Children[i].ElementLink.GetDomainRelationship() == info) { index++; if (bFound) { return(true); } if (this.Parent.Children[i].ElementLink == this.ElementLink) { bFound = true; } } } return(false); }
/// <summary> /// Returns the customizable element container of the given element (if any). /// </summary> public static CustomizableElementSchema GetParentCustomizationElement(this ModelElement element) { var parentElement = DomainRelationshipInfo.FindEmbeddingElement(element); var parent = parentElement as CustomizableElementSchema; return(parent); }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="domainRelationshipInfo">Relationship domain class info.</param> /// <param name="sourceRoleId">RoleId of the source role player. </param> public UnaryRoleEditorViewModel(ViewModelStore viewModelStore, DomainRelationshipInfo domainRelationshipInfo, Guid sourceRoleId) : base(viewModelStore, domainRelationshipInfo, sourceRoleId) { deleteElementCommand = new DelegateCommand(DeleteElementCommand_Executed); editElementCommand = new DelegateCommand(EditElementCommand_Executed); navigateToElementCommand = new DelegateCommand(NavigateToElementCommand_Executed); }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="domainRelationshipInfo">Relationship domain class info.</param> /// <param name="sourceRoleId">RoleId of the source role player. </param> public MultipleRoleEditorViewModel(ViewModelStore viewModelStore, DomainRelationshipInfo domainRelationshipInfo, Guid sourceRoleId) : base(viewModelStore, domainRelationshipInfo, sourceRoleId) { deleteElementCommand = new DelegateCommand(DeleteElementCommand_Executed); addElementCommand = new DelegateCommand(AddElementCommand_Executed); navigateToElementCommand = new DelegateCommand(NavigateToElementCommand_Executed); }
/// <summary> /// Update source and target dependency parts. /// </summary> protected virtual void UpdateParts() { if (this.MainElement == null) { return; } DomainClassInfo elementInfo = this.MainElement.GetDomainClass(); Dictionary <Guid, GraphicalDependencyShape> sParts = new Dictionary <Guid, GraphicalDependencyShape>(); Dictionary <Guid, GraphicalDependencyShape> tParts = new Dictionary <Guid, GraphicalDependencyShape>(); ReadOnlyCollection <ElementLink> links = DomainRoleInfo.GetAllElementLinks(this.MainElement); foreach (ElementLink link in links) { DomainRelationshipInfo info = link.GetDomainRelationship(); if (this.Store.DomainDataAdvDirectory.IsReferenceIncludedInModel(info.Id)) { if (DomainRoleInfo.GetSourceRolePlayer(link) == this.MainElement) { UpdatePart(elementInfo.Id, tParts, true, link, info); } else { UpdatePart(elementInfo.Id, sParts, false, link, info); } } } }
private ModelElement GetTargetOfRelationship(DomainRelationshipInfo info, ElementLink elementLink) { if (elementLink == null) { return(null); } return(DomainRoleInfo.GetTargetRolePlayer(elementLink)); }
protected override void Initialize() { base.Initialize(); List <Guid> relationshipOrder; ParentChildrenMapping[this.ModelData.CurrentModelContext.ModelContextId].TryGetValue(this.ElementInfo.Id, out relationshipOrder); if (relationshipOrder != null) { foreach (Guid relationshipDCId in relationshipOrder) { DomainRelationshipInfo relationshipInfo = this.Store.DomainDataDirectory.GetDomainRelationship(relationshipDCId); if (DoHookUpEvents) { DomainRelationshipAdvancedInfo advancedInfo = this.Store.DomainDataAdvDirectory.GetRelationshipInfo(relationshipDCId); //if (!advancedInfo.TargetRoleIsUIBrowsable || !advancedInfo.TargetRoleIsGenerated) //if (!advancedInfo.SourceRoleIsUIBrowsable || !advancedInfo.SourceRoleIsGenerated) if (!advancedInfo.SourceRoleIsUIBrowsable) { continue; } // Subscribe to add and delete element events this.EventManager.GetEvent <ModelElementLinkAddedEvent>().Subscribe( this.Store.DomainDataDirectory.GetDomainRelationship(relationshipInfo.Id), true, this.Element.Id, new System.Action <ElementAddedEventArgs>(OnChildElementAdded)); this.EventManager.GetEvent <ModelElementLinkDeletedEvent>().Subscribe( this.Store.DomainDataDirectory.GetDomainRelationship(relationshipInfo.Id), true, this.Element.Id, new System.Action <ElementDeletedEventArgs>(OnChildElementDeleted)); // Subscribe to role player change events this.EventManager.GetEvent <ModelRolePlayerChangedEvent>().Subscribe( this.Store.DomainDataDirectory.GetDomainRelationship(relationshipInfo.Id), true, this.Element.Id, new System.Action <RolePlayerChangedEventArgs>(OnRolePlayerChanged)); this.EventManager.GetEvent <ModelRolePlayerMovedEvent>().Subscribe( this.Store.DomainDataDirectory.GetDomainRelationship(relationshipInfo.Id), this.Element.Id, new System.Action <RolePlayerOrderChangedEventArgs>(OnRolePlayerMoved)); } // element link order this.ElementLinkOrder.Add(relationshipInfo.Id); System.Collections.ObjectModel.ReadOnlyCollection <ElementLink> links = DomainRoleInfo.GetElementLinks <ElementLink>(this.Element, GetSourceDomainRole(relationshipInfo).Id); foreach (ElementLink link in links) { BaseModelElementTreeViewModel vm = AddChildElement(link, DomainRoleInfo.GetTargetRolePlayer(link), true); vm.RelationshipInfo = relationshipInfo; vm.ElementInfo = GetTargetDomainRole(relationshipInfo).RolePlayer; } } } }
private ModelElement FindEmbeddingElement() { var mel = this as ModelElement; if (mel == null) { return(null); } return(DomainRelationshipInfo.FindEmbeddingElement(mel)); }
private DomainRoleInfo GetTargetDomainRole(DomainRelationshipInfo info) { for (int i = 0; i < info.DomainRoles.Count; i++) { if (!info.DomainRoles[i].IsSource) { return(info.DomainRoles[i]); } } throw new InvalidOperationException("Couldn't find target domain role in info " + info.Name); }
/// <summary> /// Unsubscribes from a specific event. /// </summary> /// <param name="domainRelationshipInfo">DomainRelationshipInfo specifying when to notify the observer.</param> /// <param name="elementId">ElementId of the element specifying when to notify.</param> /// <param name="action">Action to call on the observer.</param> public void Unsubscribe(DomainRelationshipInfo domainRelationshipInfo, Guid elementId, Action <ElementAddedEventArgs> action) { #region dictionaryById lock (dictionaryById) { Guid domainClassId = domainRelationshipInfo.Id; if (dictionaryById.Keys.Contains(domainClassId)) { if (dictionaryById[domainClassId].Keys.Contains(elementId)) { IEventSubscription eventSubscription = dictionaryById[domainClassId][elementId].Cast <EventSubscription <ElementAddedEventArgs> >().FirstOrDefault(evt => evt.Action == action); if (eventSubscription != null) { dictionaryById[domainClassId][elementId].Remove(eventSubscription); if (dictionaryById[domainClassId][elementId].Count == 0) { dictionaryById[domainClassId].Remove(elementId); } } if (dictionaryById[domainClassId].Count == 0) { dictionaryById.Remove(domainClassId); } } } // process descendants foreach (DomainRelationshipInfo info in domainRelationshipInfo.AllDescendants) { domainClassId = info.Id; if (dictionaryById.Keys.Contains(domainClassId)) { if (dictionaryById[domainClassId].Keys.Contains(elementId)) { IEventSubscription eventSubscription = dictionaryById[domainClassId][elementId].Cast <EventSubscription <ElementAddedEventArgs> >().FirstOrDefault(evt => evt.Action == action); if (eventSubscription != null) { dictionaryById[domainClassId][elementId].Remove(eventSubscription); if (dictionaryById[domainClassId][elementId].Count == 0) { dictionaryById[domainClassId].Remove(elementId); } } if (dictionaryById[domainClassId].Count == 0) { dictionaryById.Remove(domainClassId); } } } } } #endregion }
/// <summary> /// Get source domain role. /// </summary> /// <param name="info">Relationship info.</param> /// <returns>Source domain role.</returns> public static DomainRoleInfo GetSourceDomainRole(DomainRelationshipInfo info) { for (int i = 0; i < info.DomainRoles.Count; i++) { if (info.DomainRoles[i].IsSource) { return(info.DomainRoles[i]); } } throw new InvalidOperationException("Couldn't find source domain role in info " + info.Name); }
/// <summary> /// Called by the Action when the user releases the mouse. /// If we are still on the same compartment but in a different list item, /// move the starting item to the position of the current one. /// </summary> /// <param name="dragFrom"></param> /// <param name="e"></param> internal static void DoMouseUpForShape <TElement>(ModelElement dragFrom, DiagramMouseEventArgs e) where TElement : ModelElement { // Original or "from" item: TElement dragFromElement = dragFrom as TElement; // Current or "to" item: TElement dragToElement = e.HitDiagramItem.RepresentedElements.OfType <TElement>().FirstOrDefault(); if (dragFromElement != null && dragToElement != null) { // Find the common parent model element, and the relationship links: ElementLink parentToLink = GetEmbeddingLink(dragToElement); ElementLink parentFromLink = GetEmbeddingLink(dragFromElement); if (parentToLink != parentFromLink && parentFromLink != null && parentToLink != null) { // Get the static relationship and role (= end of relationship): DomainRelationshipInfo relationshipFrom = parentFromLink.GetDomainRelationship(); DomainRoleInfo parentFromRole = relationshipFrom.DomainRoles[0]; // Get the node in which the element is embedded, usually the element displayed in the shape: ModelElement parentFrom = parentFromLink.LinkedElements[0]; // Same again for the target: DomainRelationshipInfo relationshipTo = parentToLink.GetDomainRelationship(); DomainRoleInfo parentToRole = relationshipTo.DomainRoles[0]; ModelElement parentTo = parentToLink.LinkedElements[0]; // Mouse went down and up in same parent and same compartment: if (parentTo == parentFrom && relationshipTo == relationshipFrom) { // Find index of target position: int newIndex = 0; var elementLinks = parentToRole.GetElementLinks(parentTo); foreach (ElementLink link in elementLinks) { if (link == parentToLink) { break; } newIndex++; } if (newIndex < elementLinks.Count) { using (Transaction t = parentFrom.Store.TransactionManager.BeginTransaction("Move list item")) { parentFromLink.MoveToIndex(parentFromRole, newIndex); t.Commit(); } } } } } }
private GraphicalDependencyShape CreateHostShape(ElementLink link, DomainRelationshipInfo info) { GraphicalDependencyShape shape = new GraphicalDependencyShape(this.Store); shape.RelationshipName = info.DisplayName; shape.Element = link; shape.SetLocation(new PointD(5, 5)); shape.RelationshipTypeId = info.Id; this.Diagram.Children.Add(shape); return(shape); }
/// <summary> /// Called by the Action when the user releases the mouse. /// If we are still on the same compartment but in a different list item, /// move the starting item to the position of the current one. /// </summary> /// <param name="dragFrom"></param> /// <param name="e"></param> public void DoMouseUp(ModelElement dragFrom, DiagramMouseEventArgs e) { // Original or "from" item: #pragma warning disable IDE0019 // Use pattern matching ModelAttribute dragFromElement = dragFrom as ModelAttribute; #pragma warning restore IDE0019 // Use pattern matching // Current or "to" item: ModelAttribute dragToElement = e.HitDiagramItem.RepresentedElements.OfType <ModelAttribute>().FirstOrDefault(); if (dragFromElement != null && dragToElement != null) { // Find the common parent model element, and the relationship links: ElementLink parentToLink = GetEmbeddingLink(dragToElement); ElementLink parentFromLink = GetEmbeddingLink(dragFromElement); if (parentToLink != parentFromLink && parentFromLink != null && parentToLink != null) { // Get the static relationship and role (= end of relationship): DomainRelationshipInfo relationshipFrom = parentFromLink.GetDomainRelationship(); DomainRoleInfo parentFromRole = relationshipFrom.DomainRoles[0]; // Get the node in which the element is embedded, usually the element displayed in the shape: #pragma warning disable IDE0019 // Use pattern matching ModelClass parentFrom = parentFromLink.LinkedElements[0] as ModelClass; #pragma warning restore IDE0019 // Use pattern matching // Same again for the target: DomainRelationshipInfo relationshipTo = parentToLink.GetDomainRelationship(); DomainRoleInfo parentToRole = relationshipTo.DomainRoles[0]; // Mouse went down and up in same parent and same compartment: if (parentFrom != null && parentToLink.LinkedElements[0] is ModelClass parentTo && parentTo == parentFrom && relationshipTo == relationshipFrom) { // Find index of target position: int newIndex = parentToRole.GetElementLinks(parentTo).IndexOf(parentToLink); if (newIndex >= 0) { using (Transaction t = parentFrom.Store.TransactionManager.BeginTransaction("Move list item")) { parentFromLink.MoveToIndex(parentFromRole, newIndex); // HACK //parentTo.SetFlagValues(); t.Commit(); } } } } } }
protected virtual IList <ModelElement> GetRelatedElements(ModelElement element) { List <ModelElement> elementList = new List <ModelElement>(); List <ModelElement> elementLinks = IncludeLinks ? new List <ModelElement>() : null; // All the links to this element needs to be examined to determine whether we should continue copying process or not // Find all the links connect to this element (or elementLink since it's legal to have element link to be a roleplayer as well...) foreach (DomainRoleInfo domainRole in element.GetDomainClass().AllDomainRolesPlayed) { // this function supports demand loading ReadOnlyCollection <ElementLink> links = domainRole.GetElementLinks(element); foreach (ElementLink eachElemLink in links) { if (eachElemLink.GetType() != typeof(PresentationViewsSubject)) { DomainRelationshipInfo domainRelInfo = eachElemLink.GetDomainRelationship(); if (Filter.ShouldVisitRelationship(this, element, domainRole, domainRelInfo, eachElemLink) == VisitorFilterResult.Yes) { if (IncludeLinks) { elementLinks.Add(eachElemLink); } IList <DomainRoleInfo> domainRoles = domainRelInfo.DomainRoles; for (int i = 0; i < domainRoles.Count; i++) { DomainRoleInfo role = domainRoles[i]; ModelElement rolePlayer = role.GetRolePlayer(eachElemLink); // Find each roleplayer and add them to the queue list if ((rolePlayer != element) && !Visited(rolePlayer) && (Filter.ShouldVisitRolePlayer(this, element, eachElemLink, role, rolePlayer) == VisitorFilterResult.Yes)) { elementList.Add(rolePlayer); } } } } } } if (IncludeLinks) { elementList.AddRange(elementLinks); } elementList.TrimExcess(); return(elementList); }
/// <summary> /// Verifies if the given reference link belongs to the domain model (can be reached from the domain model element). /// </summary> /// <param name="modelLinkDCId">Model link domain class Id.</param> /// <param name="modelContextId">Model context Id.</param> /// <returns>True if the refrence link belongs to the domain model. False otherwise.</returns> public bool IsReferenceIncludedInModel(Guid modelContextId, Guid modelLinkDCId) { DomainRelationshipInfo info = this.Store.DomainDataDirectory.FindDomainRelationship(modelLinkDCId); if (IsIncludedInModel(modelContextId, DomainModelElement.GetSourceDomainRole(info).RolePlayer.Id)) { return(true); } if (IsIncludedInModel(modelContextId, DomainModelElement.GetTargetDomainRole(info).RolePlayer.Id)) { return(true); } return(false); }
/// <summary> /// Constuctor. /// </summary> /// <param name="viewModelStore">The store this view model belongs to.</param> /// <param name="domainRelationshipInfo">Relationship domain class info.</param> /// <param name="sourceRoleId">RoleId of the source role player. </param> protected RoleEditorViewModel(ViewModelStore viewModelStore, DomainRelationshipInfo domainRelationshipInfo, Guid sourceRoleId) : base(viewModelStore) { this.domainRelationshipInfo = domainRelationshipInfo; if (domainRelationshipInfo.DomainRoles[0].Id == sourceRoleId) { sourceDomainRoleInfo = domainRelationshipInfo.DomainRoles[0]; targetDomainRoleInfo = domainRelationshipInfo.DomainRoles[1]; } else { sourceDomainRoleInfo = domainRelationshipInfo.DomainRoles[1]; targetDomainRoleInfo = domainRelationshipInfo.DomainRoles[0]; } this.isDefaultValuesSourceDynamic = true; this.Sort = SortByName; }
private List <ModelElement> GetSourceAndTargetOfRelationship(DomainRelationshipInfo info, ElementLink elementLink) { List <ModelElement> lst = new List <ModelElement>(); ModelElement m = GetSourceOfRelationship(info, elementLink); if (m != null) { lst.Add(m); } ModelElement n = GetTargetOfRelationship(info, elementLink); if (n != null) { lst.Add(n); } return(lst); }
/// <summary> /// Subscribe to the event. The observer will be notified, whenever a element link of /// the given domain relationship type (which does include all descendants) with the specified /// element in a role is included in the specific event. /// </summary> /// <param name="domainRelationshipInfo">DomainRelationshipInfo specifying when to notify the observer.</param> /// <param name="elementId">ElementId of the element specifying when to notify.</param> /// <param name="action">Action to call on the observer.</param> public void Subscribe(DomainRelationshipInfo domainRelationshipInfo, Guid elementId, Action <ElementAddedEventArgs> action) { IDelegateReference actionReference = new DelegateReference(action, false); IDelegateReference filterReference = new DelegateReference(new Predicate <ElementAddedEventArgs>(delegate { return(true); }), true); IEventSubscription subscription = new EventSubscription <ElementAddedEventArgs>(actionReference, filterReference); #region dictionaryById lock (dictionarySource) { Guid domainClassId = domainRelationshipInfo.Id; if (!dictionaryById.Keys.Contains(domainClassId)) { dictionaryById.Add(domainClassId, new Dictionary <Guid, List <IEventSubscription> >()); } if (!dictionaryById[domainClassId].Keys.Contains(elementId)) { dictionaryById[domainClassId].Add(elementId, new List <IEventSubscription>()); } dictionaryById[domainClassId][elementId].Add(subscription); // process descendants foreach (DomainClassInfo info in domainRelationshipInfo.AllDescendants) { domainClassId = info.Id; if (!dictionaryById.Keys.Contains(domainClassId)) { dictionaryById.Add(domainClassId, new Dictionary <Guid, List <IEventSubscription> >()); } if (!dictionaryById[domainClassId].Keys.Contains(elementId)) { dictionaryById[domainClassId].Add(elementId, new List <IEventSubscription>()); } dictionaryById[domainClassId][elementId].Add(subscription); } } #endregion }
/// <summary> /// Opens the window. /// /// This override registers listeners for the Add and Remove store events. /// Store events are called after the end of a store transaction (or an undo/redo) and are /// used to keep things outside the store synchronized with changes inside the store. /// See http://msdn.microsoft.com/library/bb126250.aspx /// /// This method is a convenient place to register listeners, because all the links /// in the model and diagram have been set up after loading from file. /// An alternative place is DocData.OnDocumentLoaded(). /// </summary> /// <returns></returns> protected override bool LoadView() { bool result = base.LoadView(); if (result) { ComponentModel root = this.DocData.ModelingDocStore.Store.ElementDirectory.FindElements <ComponentModel>().FirstOrDefault(); IVsWindowFrame frame = this.ServiceProvider.GetService(typeof(IVsWindowFrame)) as IVsWindowFrame; if (frame != null) { frame.SetProperty((int)__VSFPROPID.VSFPROPID_EditorCaption, ": " + root.Name); } } #region Store event handler registration Store store = this.DocData.Store; // Store events are added to the various properties of the EMD: EventManagerDirectory emd = store.EventManagerDirectory; // Store events are registered per domain class, not per instance. After a listener is // registered with a class, it is called for every change to any instance of the class: DomainClassInfo componentClass = store.DomainDataDirectory.FindDomainClass(typeof(Component)); emd.ElementAdded.Add(componentClass, new EventHandler <ElementAddedEventArgs>(AddComponent)); emd.ElementDeleted.Add(componentClass, new EventHandler <ElementDeletedEventArgs>(RemoveComponent)); DomainRelationshipInfo commentLinkInfo = store.DomainDataDirectory.FindDomainRelationship(typeof(CommentsReferenceComponents)); emd.ElementDeleted.Add(commentLinkInfo, new EventHandler <ElementDeletedEventArgs>(RemoveCommentLink)); // Do the initial parts list: container.SetUpFormFromModel(); #endregion Store event handlers. return(result); }
/// <summary> /// Moves the current item down. /// </summary> public virtual void MoveDown() { int index = -1; DomainRelationshipInfo info = this.ElementLink.GetDomainRelationship(); for (int i = 0; i < this.Parent.Children.Count; i++) { if (this.Parent.Children[i].ElementLink.GetDomainRelationship() == info) { index++; if (this.Parent.Children[i].ElementLink == this.ElementLink) { using (Transaction t = this.Store.TransactionManager.BeginTransaction("move down")) { this.ElementLink.MoveToIndex(info.DomainRoles[0], index + 1); t.Commit(); } return; } } } }
private bool VisitRolePlayers(ElementLink link) { bool keepVisiting = true; DomainRelationshipInfo domainRelInfo = link.GetDomainRelationship(); IList <DomainRoleInfo> domainRoles = domainRelInfo.DomainRoles; for (int i = 0; i < domainRoles.Count && keepVisiting; i++) { DomainRoleInfo role = domainRoles[i]; // Since GetRolePlayer will do demand-loading, we first need to test here whether // role supports demand loading and if it is, don't load if not asked to. if (this.BypassDemandLoading) { Moniker rolePlayerMoniker = role.GetRolePlayerMoniker(link); if (rolePlayerMoniker != null && rolePlayerMoniker.ModelElement == null) { // skip this role if it's not resolved yet continue; } } ModelElement rolePlayer = role.GetRolePlayer(link); // Find each roleplayer and add them to the queue list // RolePlayer might be null if it is an unresolved moniker if ((rolePlayer != link) && (rolePlayer != null) && !Visited(rolePlayer) && (Filter.ShouldVisitRolePlayer(this, link, link, role, rolePlayer) == VisitorFilterResult.Yes)) { keepVisiting = DoVisitElement(rolePlayer); } } return(keepVisiting); }
public virtual VisitorFilterResult ShouldVisitRelationship( ElementWalker walker, ModelElement sourceElement, DomainRoleInfo sourceRoleInfo, DomainRelationshipInfo domainRelationshipInfo, ElementLink targetRelationship) { Guard.ArgumentNotNull(sourceElement, "sourceElement"); Guard.ArgumentNotNull(domainRelationshipInfo, "domainRelationshipInfo"); Guard.ArgumentNotNull(targetRelationship, "targetRelationship"); if(!(sourceElement is ShapeElement)) { foreach(DomainRoleInfo info in domainRelationshipInfo.DomainRoles) { if(info.GetRolePlayer(targetRelationship) == sourceElement) { return VisitorFilterResult.Yes; } } } return VisitorFilterResult.DoNotCare; }
private void ProcessInitializationInfo(Guid modelContextId, Guid domainClassId, List <Guid> processedClasses) { EmbeddingRelationshipOrderInfo info; this.embRelationshipOrderDictionary.TryGetValue(domainClassId, out info); if (info != null) { parentChildrenMapping[modelContextId].Add(domainClassId, new List <Guid>()); parentChildrenMapping[modelContextId][domainClassId].AddRange(info.EmbeddingRelationships); parentChildrenCMMapping[modelContextId].Add(domainClassId, new List <Guid>()); parentChildrenCMMapping[modelContextId][domainClassId].AddRange(info.EmbeddingRelationshipsTargetIncludedSubmodel); for (int i = 0; i < info.EmbeddingRelationships.Length; i++) { DomainRelationshipInfo rInfo = this.Store.DomainDataDirectory.GetDomainRelationship(info.EmbeddingRelationships[i]); DomainClassInfo cInfo = DomainModelElement.GetTargetDomainRole(rInfo).RolePlayer; if (!processedClasses.Contains(cInfo.Id)) { processedClasses.Add(cInfo.Id); ProcessInitializationInfo(modelContextId, cInfo.Id, processedClasses); } foreach (DomainClassInfo dInfo in cInfo.AllDescendants) { if (!processedClasses.Contains(dInfo.Id)) { processedClasses.Add(dInfo.Id); ProcessInitializationInfo(modelContextId, dInfo.Id, processedClasses); } } } } }
public virtual VisitorFilterResult ShouldVisitRelationship( ElementWalker walker, ModelElement sourceElement, DomainRoleInfo sourceRoleInfo, DomainRelationshipInfo domainRelationshipInfo, ElementLink targetRelationship) { Guard.ArgumentNotNull(sourceElement, "sourceElement"); Guard.ArgumentNotNull(domainRelationshipInfo, "domainRelationshipInfo"); Guard.ArgumentNotNull(targetRelationship, "targetRelationship"); if (!(sourceElement is ShapeElement)) { foreach (DomainRoleInfo info in domainRelationshipInfo.DomainRoles) { if (info.GetRolePlayer(targetRelationship) == sourceElement) { return(VisitorFilterResult.Yes); } } } return(VisitorFilterResult.DoNotCare); }
/// <summary> /// Unregister from events although they are weak. /// </summary> protected override void OnDispose() { if (DoHookUpEvents) { List <Guid> relationshipOrder; ParentChildrenMapping[this.ModelData.CurrentModelContext.ModelContextId].TryGetValue(this.ElementInfo.Id, out relationshipOrder); if (relationshipOrder != null) { foreach (Guid relationshipDCId in relationshipOrder) { DomainRelationshipInfo relationshipInfo = this.Store.DomainDataDirectory.GetDomainRelationship(relationshipDCId); // Subscribe to add and delete element events this.EventManager.GetEvent <ModelElementLinkAddedEvent>().Unsubscribe( this.Store.DomainDataDirectory.GetDomainRelationship(relationshipInfo.Id), true, this.Element.Id, new System.Action <ElementAddedEventArgs>(OnChildElementAdded)); this.EventManager.GetEvent <ModelElementLinkDeletedEvent>().Unsubscribe( this.Store.DomainDataDirectory.GetDomainRelationship(relationshipInfo.Id), true, this.Element.Id, new System.Action <ElementDeletedEventArgs>(OnChildElementDeleted)); // Subscribe to role player change events this.EventManager.GetEvent <ModelRolePlayerChangedEvent>().Unsubscribe( this.Store.DomainDataDirectory.GetDomainRelationship(relationshipInfo.Id), true, this.Element.Id, new System.Action <RolePlayerChangedEventArgs>(OnRolePlayerChanged)); this.EventManager.GetEvent <ModelRolePlayerMovedEvent>().Unsubscribe( this.Store.DomainDataDirectory.GetDomainRelationship(relationshipInfo.Id), this.Element.Id, new System.Action <RolePlayerOrderChangedEventArgs>(OnRolePlayerMoved)); } } } base.OnDispose(); }
/// <summary> /// Adds a proto link to the current element. /// </summary> /// <param name="protoLink">Proto link representation of the element link that is to be added.</param> /// <param name="groupMerger"> /// Group merger class used to track id mapping, merge errors/warnings and /// postprocess merging by rebuilding reference relationships. /// </param> public virtual void ModelMerge(ModelProtoLink protoLink, ModelProtoGroupMerger groupMerger) { if (protoLink.IsTargetIncludedSubmodel && !String.IsNullOrEmpty(protoLink.DomainFilePath)) { // TODO ... /* * string file = protoLink.DomainFilePath; * IParentModelElement parent = this.GetDomainModelServices().ElementParentProvider.GetParentModelElement(this); * if (parent == null) * throw new System.ArgumentNullException("Parent of element " + this.ToString() + " can not be null"); * * string path = parent.DomainFilePath; * string vModellDirectory = new System.IO.FileInfo(path).DirectoryName; * string curPath = vModellDirectory + System.IO.Path.DirectorySeparatorChar + path; * * // load model * using (Transaction transaction = this.Store.TransactionManager.BeginTransaction("Set referenced model")) * { * // TODO load. * /* * global::Tum.VModellXT.VModellXTDocumentData data = global::Tum.VModellXT.VModellXTDocumentData.Instance as global::Tum.VModellXT.VModellXTDocumentData; * global::Tum.VModellXT.VModell referenceModel = data.ModelContextVModellXT.LoadInternal(file) as global::Tum.VModellXT.VModell; * model.VModell = referenceModel; */ /* * transaction.Commit(); * } * * return; */ return; } DomainRelationshipInfo linkDomainInfo = null; if (protoLink != null) { linkDomainInfo = this.Partition.DomainDataDirectory.GetDomainRelationship(protoLink.DomainClassId); } else { // try getting the linkDomainInfo from name DomainClassInfo elementDomainInfo = this.GetDomainClass(); foreach (DomainRoleInfo info in elementDomainInfo.AllDomainRolesPlayed) { if (info.IsSource) { if (!this.Store.DomainDataAdvDirectory.IsEmbeddingRelationship(info.DomainRelationship.Id) && !this.Store.DomainDataAdvDirectory.IsAbstractRelationship(info.DomainRelationship.Id)) { if (protoLink.Name == info.DomainRelationship.Name && linkDomainInfo == null) { linkDomainInfo = this.Partition.DomainDataDirectory.GetDomainRelationship(info.DomainRelationship.Id); } } } } } if (linkDomainInfo == null) { groupMerger.MergeResult.AddMessage(new ValidationMessage(ModelValidationMessageIds.ModelMergeElementLinkDomainTypeMissingId, ModelValidationViolationType.Error, "Element link can not be created as the corresponding domain type is missing.")); return; } ReferenceRelationshipAdvancedInfo advancedInfo = this.Store.DomainDataAdvDirectory.GetRelationshipInfo(linkDomainInfo.Id) as ReferenceRelationshipAdvancedInfo; if (advancedInfo == null) { throw new InvalidOperationException("Relationship advanced info not found for " + linkDomainInfo.Name); } // see if this element is taking part in this role bool bTakesPart = false; ModelProtoRolePlayer sourceRolePlayer = protoLink.GetSourceRolePlayer(this.Store.DefaultPartition); ModelProtoElement sourceProtoElement = groupMerger.GetElementById(sourceRolePlayer.RolePlayerId); System.Guid mappedSourceIdTP = System.Guid.Empty; if (sourceProtoElement != null) { mappedSourceIdTP = groupMerger.GetIdMapping(sourceRolePlayer.RolePlayerId); if (mappedSourceIdTP == this.Id) { bTakesPart = true; } } if (advancedInfo.PropagatesCopyOnDeniedElement) { if (!bTakesPart && mappedSourceIdTP == System.Guid.Empty) { if (this.Id == sourceRolePlayer.RolePlayerId) { bTakesPart = true; } } } if (bTakesPart) { bool bExists = true; if (this.Store.ElementDirectory.FindElement(protoLink.ElementId) == null) { bExists = false; } if (bExists && groupMerger.ProtoGroup.Operation == ModelProtoGroupOperation.Move) { groupMerger.MergeResult.AddMessage(new ValidationMessage(ModelValidationMessageIds.ModelMergeElementLinkExistsOnMoveId, ModelValidationViolationType.Error, "Element link exists although the operation = Move.")); } #region Target // see if target element was copied ModelProtoRolePlayer targetRolePlayer = protoLink.GetTargetRolePlayer(this.Store.DefaultPartition); ModelProtoElement targetProtoElement = groupMerger.GetElementById(targetRolePlayer.RolePlayerId); Guid mappedTargetId = Guid.Empty; if (targetProtoElement != null) { mappedTargetId = groupMerger.GetIdMapping(targetRolePlayer.RolePlayerId); } if (advancedInfo.PropagatesCopyOnDeniedElement) { if (mappedTargetId == System.Guid.Empty) { // try creating relationship to existing element mappedTargetId = targetRolePlayer.RolePlayerId; } } if (mappedTargetId == System.Guid.Empty) { // log warning groupMerger.MergeResult.AddMessage(new ValidationMessage(ModelValidationMessageIds.ModelMergeLinkElementNotCopiedId, ModelValidationViolationType.Error, "Referenced model element was not copied. Relationship: " + linkDomainInfo.Name)); } else { ModelElement targetElement = this.Store.ElementDirectory.FindElement(mappedTargetId); if (targetElement == null) { // log error groupMerger.MergeResult.AddMessage(new ValidationMessage(ModelValidationMessageIds.ModelMergeLinkElementNotFoundId, ModelValidationViolationType.Error, "Referenced model element was not found. Relationship: " + linkDomainInfo.Name)); } else { bool bContinue = true; // check cardinalities, so we don't violate them by additing a new relationship if (advancedInfo.SourceRoleMultiplicity == Multiplicity.One || advancedInfo.SourceRoleMultiplicity == Multiplicity.ZeroOne) { if (DomainRoleInfo.GetLinkedElement(this, advancedInfo.SourceRoleId) != null) { // log warning groupMerger.MergeResult.AddMessage(new ValidationMessage(ModelValidationMessageIds.ModelMergeLinkCreationViolatesMultiplicityId, ModelValidationViolationType.Error, "Can not create relationship because one already exists. Relationship: " + linkDomainInfo.Name)); bContinue = false; } } if (advancedInfo.TargetRoleMultiplicity == Multiplicity.One || advancedInfo.TargetRoleMultiplicity == Multiplicity.ZeroOne) { if (DomainRoleInfo.GetLinkedElement(this, advancedInfo.TargetRoleId) != null) { // log warning groupMerger.MergeResult.AddMessage(new ValidationMessage(ModelValidationMessageIds.ModelMergeLinkCreationViolatesMultiplicityId, ModelValidationViolationType.Error, "Can not create relationship because one already exists. Relationship: " + linkDomainInfo.Name)); bContinue = false; } } if (bContinue) { // create property assignments PropertyAssignment[] propertyAssignemnts = protoLink.GetPropertyAssignments(this.Store.DefaultPartition, this.GetDomainModelServices().ElementIdProvider.GenerateNewKey()); // create role assignments RoleAssignment[] roleAssignments = new RoleAssignment[2]; roleAssignments[0] = new RoleAssignment(advancedInfo.SourceRoleId, this); roleAssignments[1] = new RoleAssignment(advancedInfo.TargetRoleId, targetElement); // create new relationship this.Store.ElementFactory.CreateElementLink(linkDomainInfo, propertyAssignemnts, roleAssignments); } } } #endregion } }
/// <summary> /// Constructor. /// </summary> /// <param name="elementLink">Relationship instance.</param> /// <param name="category">Category of the dependency item.</param> /// <param name="relationshipInfo">Relationship info.</param> /// <param name="roleInfo">Role info.</param> public DependencyItem(ElementLink elementLink, DependencyItemCategory category, DomainRelationshipInfo relationshipInfo, DomainRoleInfo roleInfo) : base(elementLink.Id, relationshipInfo, roleInfo) { this.elementLink = elementLink; this.itemCategory = category; }
/// <summary> /// Calls <see cref="MultiShapeUtility.ShouldVisitOnDelete"/> to determine if the relationship should be visited /// and to reconfigure any links /// </summary> /// <param name="walker">The current <see cref="ElementWalker"/></param> /// <param name="sourceElement">The <see cref="ModelElement"/> being deleted</param> /// <param name="sourceRoleInfo">The role information</param> /// <param name="domainRelationshipInfo">The relationship information</param> /// <param name="targetRelationship">The other <see cref="ModelElement"/> in the relationship</param> /// <returns>Whether to visit the relationship</returns> public override VisitorFilterResult ShouldVisitRelationship(ElementWalker walker, ModelElement sourceElement, DomainRoleInfo sourceRoleInfo, DomainRelationshipInfo domainRelationshipInfo, ElementLink targetRelationship) { if (MultiShapeUtility.ShouldVisitOnDelete(walker, sourceElement, sourceRoleInfo, domainRelationshipInfo, targetRelationship)) { return(base.ShouldVisitRelationship(walker, sourceElement, sourceRoleInfo, domainRelationshipInfo, targetRelationship)); } else { return(VisitorFilterResult.Never); } }
/// <summary> /// Evaluates the given payload and retrieves active subscribers. /// </summary> /// <param name="args">Payload, that is beeing published.</param> /// <returns>List of actions to call.</returns> private List <Action <object[]> > PruneAndReturnStrategies(ElementDeletedEventArgs args) { List <Action <object[]> > returnList = new List <Action <object[]> >(); #region dictionarySource lock (dictionarySource) { Guid domainClassId = args.DomainClass.Id; if (dictionarySource.Keys.Contains(domainClassId)) { DomainRelationshipInfo info = args.ModelElement.GetDomainClass() as DomainRelationshipInfo; ModelElement modelElement = GetSourceOfRelationship(info, args.ModelElement as ElementLink); if (modelElement != null) { if (dictionarySource[domainClassId].Keys.Contains(modelElement.Id)) { List <IEventSubscription> subscriptions = dictionarySource[domainClassId][modelElement.Id]; for (var i = subscriptions.Count - 1; i >= 0; i--) { Action <object[]> listItem = subscriptions[i].GetExecutionStrategy(); if (listItem == null) { // Prune from main list. Log? subscriptions.RemoveAt(i); } else { returnList.Add(listItem); } } if (subscriptions.Count == 0) { dictionarySource[domainClassId].Remove(modelElement.Id); } } } if (dictionarySource[domainClassId].Count == 0) { dictionarySource.Remove(domainClassId); } } // continue with descendants foreach (DomainRelationshipInfo relInfo in args.DomainClass.AllDescendants) { domainClassId = relInfo.Id; if (dictionarySource.Keys.Contains(domainClassId)) { DomainRelationshipInfo info = args.ModelElement.GetDomainClass() as DomainRelationshipInfo; ModelElement modelElement = GetSourceOfRelationship(info, args.ModelElement as ElementLink); if (modelElement != null) { if (dictionarySource[domainClassId].Keys.Contains(modelElement.Id)) { List <IEventSubscription> subscriptions = dictionarySource[domainClassId][modelElement.Id]; for (var i = subscriptions.Count - 1; i >= 0; i--) { Action <object[]> listItem = subscriptions[i].GetExecutionStrategy(); if (listItem == null) { // Prune from main list. Log? subscriptions.RemoveAt(i); } else { returnList.Add(listItem); } } if (subscriptions.Count == 0) { dictionarySource[domainClassId].Remove(modelElement.Id); } } } if (dictionarySource[domainClassId].Count == 0) { dictionarySource.Remove(domainClassId); } } } } #endregion #region dictionaryTarget lock (dictionaryTarget) { Guid domainClassId = args.DomainClass.Id; if (dictionaryTarget.Keys.Contains(domainClassId)) { DomainRelationshipInfo info = args.ModelElement.GetDomainClass() as DomainRelationshipInfo; ModelElement modelElement = GetTargetOfRelationship(info, args.ModelElement as ElementLink); if (modelElement != null) { if (dictionaryTarget[domainClassId].Keys.Contains(modelElement.Id)) { List <IEventSubscription> subscriptions = dictionaryTarget[domainClassId][modelElement.Id]; for (var i = subscriptions.Count - 1; i >= 0; i--) { Action <object[]> listItem = subscriptions[i].GetExecutionStrategy(); if (listItem == null) { // Prune from main list. Log? subscriptions.RemoveAt(i); } else { returnList.Add(listItem); } } if (subscriptions.Count == 0) { dictionaryTarget[domainClassId].Remove(modelElement.Id); } } } if (dictionaryTarget[domainClassId].Count == 0) { dictionaryTarget.Remove(domainClassId); } } // continue with descendants foreach (DomainRelationshipInfo relInfo in args.DomainClass.AllDescendants) { domainClassId = relInfo.Id; if (dictionaryTarget.Keys.Contains(domainClassId)) { DomainRelationshipInfo info = args.ModelElement.GetDomainClass() as DomainRelationshipInfo; ModelElement modelElement = GetTargetOfRelationship(info, args.ModelElement as ElementLink); if (modelElement != null) { if (dictionaryTarget[domainClassId].Keys.Contains(modelElement.Id)) { List <IEventSubscription> subscriptions = dictionaryTarget[domainClassId][modelElement.Id]; for (var i = subscriptions.Count - 1; i >= 0; i--) { Action <object[]> listItem = subscriptions[i].GetExecutionStrategy(); if (listItem == null) { // Prune from main list. Log? subscriptions.RemoveAt(i); } else { returnList.Add(listItem); } } if (subscriptions.Count == 0) { dictionaryTarget[domainClassId].Remove(modelElement.Id); } } } if (dictionaryTarget[domainClassId].Count == 0) { dictionaryTarget.Remove(domainClassId); } } } } #endregion return(returnList); }
private DomainRoleInfo GetSourceDomainRole(DomainRelationshipInfo info) { for (int i = 0; i < info.DomainRoles.Count; i++) if (info.DomainRoles[i].IsSource) return info.DomainRoles[i]; throw new InvalidOperationException("Couldn't find source domain role in info " + info.Name); }
/// <summary> /// Get target domain role. /// </summary> /// <param name="info">Relationship info.</param> /// <returns>Target domain role.</returns> public static DomainRoleInfo GetTargetDomainRole(DomainRelationshipInfo info) { for (int i = 0; i < info.DomainRoles.Count; i++) if (!info.DomainRoles[i].IsSource) return info.DomainRoles[i]; throw new InvalidOperationException("Couldn't find target domain role in info " + info.Name); }
/// <summary> /// Calls <see cref="MultiShapeUtility.ShouldVisitOnDelete"/> to determine if the relationship should be visited /// and to reconfigure any links /// </summary> /// <param name="walker">The current <see cref="ElementWalker"/></param> /// <param name="sourceElement">The <see cref="ModelElement"/> being deleted</param> /// <param name="sourceRoleInfo">The role information</param> /// <param name="domainRelationshipInfo">The relationship information</param> /// <param name="targetRelationship">The other <see cref="ModelElement"/> in the relationship</param> /// <returns>Whether to visit the relationship</returns> public override VisitorFilterResult ShouldVisitRelationship(ElementWalker walker, ModelElement sourceElement, DomainRoleInfo sourceRoleInfo, DomainRelationshipInfo domainRelationshipInfo, ElementLink targetRelationship) { if (MultiShapeUtility.ShouldVisitOnDelete(walker, sourceElement, sourceRoleInfo, domainRelationshipInfo, targetRelationship)) { return base.ShouldVisitRelationship(walker, sourceElement, sourceRoleInfo, domainRelationshipInfo, targetRelationship); } else { return VisitorFilterResult.Never; } }
/// <summary> /// Included relative and nested shapes in a default copy closure. /// The core design surface model does not do this in VS2010. /// </summary> public override VisitorFilterResult ShouldVisitRelationship(ElementWalker walker, ModelElement sourceElement, DomainRoleInfo sourceRoleInfo, DomainRelationshipInfo domainRelationshipInfo, ElementLink targetRelationship) { Guid roleId = sourceRoleInfo.Id; if (roleId == ParentShapeHasRelativeChildShapes.ParentShapeDomainRoleId || roleId == ParentShapeContainsNestedChildShapes.ParentShapeDomainRoleId) { return(VisitorFilterResult.Yes); } return(base.ShouldVisitRelationship(walker, sourceElement, sourceRoleInfo, domainRelationshipInfo, targetRelationship)); }
/// <summary> /// Constructor. /// </summary> /// <param name="relationshipInfo">Relationship info.</param> /// <param name="roleInfo">Role info.</param> /// <param name="elementId">Element id.</param> public DependencyOriginItem(Guid elementId, DomainRelationshipInfo relationshipInfo, DomainRoleInfo roleInfo) { this.elementId = elementId; this.relationshipInfo = relationshipInfo; this.roleInfo = roleInfo; }
/// <summary> /// Unsubscribes from a specific event. /// </summary> /// <param name="domainRelationshipInfo">Domain relationship info specifying when to unsubscribe.</param> /// <param name="bSourceRole"></param> /// <param name="elementId">Role player id specifying when to unsubscribe.</param> /// <param name="action">Action identifying what to unsubscribe.</param> public void Unsubscribe(DomainRelationshipInfo domainRelationshipInfo, bool bSourceRole, Guid elementId, Action <RolePlayerChangedEventArgs> action) { #region dictionarySource if (bSourceRole) { lock (dictionarySource) { Guid domainClassId = domainRelationshipInfo.Id; if (dictionarySource.Keys.Contains(domainClassId)) { if (dictionarySource[domainClassId].Keys.Contains(elementId)) { IEventSubscription eventSubscription = dictionarySource[domainClassId][elementId].Cast <EventSubscription <RolePlayerChangedEventArgs> >().FirstOrDefault(evt => evt.Action == action); if (eventSubscription != null) { dictionarySource[domainClassId][elementId].Remove(eventSubscription); if (dictionarySource[domainClassId][elementId].Count == 0) { dictionarySource[domainClassId].Remove(elementId); } } if (dictionarySource[domainClassId].Count == 0) { dictionarySource.Remove(domainClassId); } } } // process descendants foreach (DomainRelationshipInfo info in domainRelationshipInfo.AllDescendants) { domainClassId = info.Id; if (dictionarySource.Keys.Contains(domainClassId)) { if (dictionarySource[domainClassId].Keys.Contains(elementId)) { IEventSubscription eventSubscription = dictionarySource[domainClassId][elementId].Cast <EventSubscription <RolePlayerChangedEventArgs> >().FirstOrDefault(evt => evt.Action == action); if (eventSubscription != null) { dictionarySource[domainClassId][elementId].Remove(eventSubscription); if (dictionarySource[domainClassId][elementId].Count == 0) { dictionarySource[domainClassId].Remove(elementId); } } if (dictionarySource[domainClassId].Count == 0) { dictionarySource.Remove(domainClassId); } } } } } } #endregion #region dictionaryTarget if (!bSourceRole) { lock (dictionaryTarget) { Guid domainClassId = domainRelationshipInfo.Id; if (dictionaryTarget.Keys.Contains(domainClassId)) { if (dictionaryTarget[domainClassId].Keys.Contains(elementId)) { IEventSubscription eventSubscription = dictionaryTarget[domainClassId][elementId].Cast <EventSubscription <RolePlayerChangedEventArgs> >().FirstOrDefault(evt => evt.Action == action); if (eventSubscription != null) { dictionaryTarget[domainClassId][elementId].Remove(eventSubscription); if (dictionaryTarget[domainClassId][elementId].Count == 0) { dictionaryTarget[domainClassId].Remove(elementId); } } if (dictionaryTarget[domainClassId].Count == 0) { dictionaryTarget.Remove(domainClassId); } } } // process descendants foreach (DomainRelationshipInfo info in domainRelationshipInfo.AllDescendants) { domainClassId = info.Id; if (dictionaryTarget.Keys.Contains(domainClassId)) { if (dictionaryTarget[domainClassId].Keys.Contains(elementId)) { IEventSubscription eventSubscription = dictionaryTarget[domainClassId][elementId].Cast <EventSubscription <RolePlayerChangedEventArgs> >().FirstOrDefault(evt => evt.Action == action); if (eventSubscription != null) { dictionaryTarget[domainClassId][elementId].Remove(eventSubscription); if (dictionaryTarget[domainClassId][elementId].Count == 0) { dictionaryTarget[domainClassId].Remove(elementId); } } if (dictionaryTarget[domainClassId].Count == 0) { dictionaryTarget.Remove(domainClassId); } } } } } } #endregion }
/// <summary> /// Included relative and nested shapes in a default copy closure. /// The core design surface model does not do this in VS2010. /// </summary> public override VisitorFilterResult ShouldVisitRelationship(ElementWalker walker, ModelElement sourceElement, DomainRoleInfo sourceRoleInfo, DomainRelationshipInfo domainRelationshipInfo, ElementLink targetRelationship) { Guid roleId = sourceRoleInfo.Id; if (roleId == ParentShapeHasRelativeChildShapes.ParentShapeDomainRoleId || roleId == ParentShapeContainsNestedChildShapes.ParentShapeDomainRoleId) { return VisitorFilterResult.Yes; } return base.ShouldVisitRelationship(walker, sourceElement, sourceRoleInfo, domainRelationshipInfo, targetRelationship); }