Esempio n. 1
0
        /// <summary>
        /// Gets the dependencies for a specific model elements.
        /// </summary>
        /// <param name="modelElements">List of model elements to get the dependencies for.</param>
        /// <param name="options">Options.</param>
        /// <returns>List of dependencies.</returns>
        public DependenciesData GetDependencies(List <ModelElement> modelElements, DependenciesRetrivalOptions options)
        {
            DependenciesData data = new DependenciesData();
            List <IDependenciesItemsProvider> discardProviders = new List <IDependenciesItemsProvider>();

            GetDependencies(modelElements, options, data);
            return(data);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the dependencies for a specific model elements.
        /// </summary>
        /// <param name="modelElements">List of model elements to get the dependencies for.</param>
        /// <param name="options">Options.</param>
        /// <param name="dependenciesData">Data to add found dependencies to.</param>
        /// <returns>List of dependencies.</returns>
        public virtual DependenciesData GetDependencies(List <ModelElement> modelElements, DependenciesRetrivalOptions options, DependenciesData dependenciesData)
        {
            foreach (ModelElement modelElement in modelElements)
            {
                IDomainModelOwnable dmo = modelElement as IDomainModelOwnable;
                if (dmo == null)
                {
                    continue;
                }

                DomainClassInfo info = modelElement.GetDomainClass();
                foreach (DomainRoleInfo roleInfo in info.AllDomainRolesPlayed)
                {
                    if (roleInfo.DomainModel.Id == CoreDomainModel.DomainModelId)
                    {
                        continue;
                    }

                    if (options.ShouldExcludeDomainRelationship(roleInfo.DomainRelationship.Id, roleInfo.DomainModel.Id))
                    {
                        continue;
                    }

                    foreach (DependencyItemCategory category in GetAllCategories())
                    {
                        if (roleInfo.IsSource && category != DependencyItemCategory.Embedding &&
                            category != DependencyItemCategory.Referencing)
                        {
                            continue;
                        }

                        if (!roleInfo.IsSource && category != DependencyItemCategory.Embedded &&
                            category != DependencyItemCategory.Referenced)
                        {
                            continue;
                        }

                        if (dmo.Store.DomainDataAdvDirectory.IsEmbeddingRelationship(roleInfo.DomainRelationship.Id))
                        {
                            if (category != DependencyItemCategory.Embedded && category != DependencyItemCategory.Embedding)
                            {
                                continue;
                            }
                        }
                        else if (category == DependencyItemCategory.Embedded || category == DependencyItemCategory.Embedding)
                        {
                            continue;
                        }

                        // add origin dependency
                        dependenciesData.OriginDependencies.Add(new DependencyOriginItem(modelElement.Id, roleInfo.DomainRelationship, roleInfo));

                        // get link instances
                        System.Collections.ObjectModel.ReadOnlyCollection <ElementLink> links = DomainRoleInfo.GetElementLinks <ElementLink>(modelElement, roleInfo.Id);
                        if (links.Count > 0)
                        {
                            foreach (ElementLink link in links)
                            {
                                if (category == DependencyItemCategory.Embedding || category == DependencyItemCategory.Referencing)
                                {
                                    if (options.ShouldExcludeDomainClass(DomainRoleInfo.GetTargetRolePlayer(link)))
                                    {
                                        continue;
                                    }
                                }
                                else
                                if (options.ShouldExcludeDomainClass(DomainRoleInfo.GetSourceRolePlayer(link)))
                                {
                                    continue;
                                }

                                if (options.ShouldExcludeDomainRelationship(link))
                                {
                                    continue;
                                }

                                DependencyItem item = new DependencyItem(link, category, roleInfo.DomainRelationship, roleInfo);
                                dependenciesData.ActiveDependencies.Add(item);
                            }
                        }
                    }
                }
            }

            return(dependenciesData);
        }
 /// <summary>
 /// Gets the dependencies for a specific model element.
 /// </summary>
 /// <param name="dependenciesData">Dependencies data to add new dependency and origin items to.</param>
 /// <param name="modelElement">Model element to get the dependencies for.</param>
 public abstract void GetDependencies(DependenciesData dependenciesData, ModelElement modelElement);
 /// <summary>
 /// Gets the dependencies for a specific model element.
 /// </summary>
 /// <param name="dependenciesData">Dependencies data to add new dependency and origin items to.</param>
 /// <param name="modelElement">Model element to get the dependencies for.</param>
 /// <param name="options">Options</param>
 public abstract void GetDependencies(DependenciesData dependenciesData, ModelElement modelElement, DependenciesRetrivalOptions options);