Пример #1
0
        /// <summary>
        /// Gets the services, which are specific to the current domain model that the given element belongs to.
        /// </summary>
        /// <param name="m">Element.</param>
        /// <returns>DomainModel services</returns>
        public IDomainModelServices GetDomainModelServices(IDomainModelOwnable m)
        {
            if (m == null)
            {
                return(GetDomainModelServices());
            }

            return(m.GetDomainModelServices());
            //return this.ModelData.GetDomainModelServices(m);
        }
        /// <summary>
        /// Verifies if a specific model relationship should be excluded or not.
        /// </summary>
        /// <param name="elementLink">Model relationship to verify</param>
        /// <returns>True if the specified relationship should be excluded; False otherwise.</returns>
        public virtual bool ShouldExcludeDomainRelationship(ElementLink elementLink)
        {
            if (bUseExcludedDomainClasses || bUseIncludedDomainClasses || bUseExcludedDomainModels || bUseIncludedDomainModels)
            {
                Guid t = elementLink.GetDomainClass().Id;
                if (bUseExcludedDomainRelationships)
                {
                    if (this.excludedDomainRelationships.Contains(t))
                    {
                        return(true);
                    }
                }

                if (bUseIncludedDomainRelationships)
                {
                    if (!this.includedDomainRelationships.Contains(t))
                    {
                        return(true);
                    }
                }

                if (bUseExcludedDomainModels)
                {
                    IDomainModelOwnable o = elementLink as IDomainModelOwnable;
                    if (this.excludedDomainModels.Contains(o.GetDomainModelTypeId()))
                    {
                        return(true);
                    }
                }

                if (bUseIncludedDomainModels)
                {
                    IDomainModelOwnable o = elementLink as IDomainModelOwnable;
                    if (!this.includedDomainModels.Contains(o.GetDomainModelTypeId()))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        /// <summary>
        /// Verifies if a specific model element should be excluded or not.
        /// </summary>
        /// <param name="modelElement">Model element to verify</param>
        /// <returns>True if the specified element should be excluded; False otherwise.</returns>
        public virtual bool ShouldExcludeDomainClass(ModelElement modelElement)
        {
            if (bUseExcludedDomainClasses || bUseIncludedDomainClasses || bUseExcludedDomainModels || bUseIncludedDomainModels)
            {
                Guid t = modelElement.GetDomainClass().Id;
                if (bUseExcludedDomainClasses)
                {
                    if (this.excludedDomainClasses.Contains(t))
                    {
                        return(true);
                    }
                }

                if (bUseIncludedDomainClasses)
                {
                    if (!this.includedDomainClasses.Contains(t))
                    {
                        return(true);
                    }
                }

                if (bUseExcludedDomainModels)
                {
                    IDomainModelOwnable o = modelElement as IDomainModelOwnable;
                    if (this.excludedDomainModels.Contains(o.GetDomainModelTypeId()))
                    {
                        return(true);
                    }
                }

                if (bUseIncludedDomainModels)
                {
                    IDomainModelOwnable o = modelElement as IDomainModelOwnable;
                    if (!this.includedDomainModels.Contains(o.GetDomainModelTypeId()))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #4
0
 /// <summary>
 /// Gets the services, which are specific to the current domain model that the given element belongs to.
 /// </summary>
 /// <param name="element">Element.</param>
 /// <returns>DomainModel services</returns>
 public abstract IDomainModelServices GetDomainModelServices(IDomainModelOwnable element);
Пример #5
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 services, which are specific to the current domain model that the given element belongs to.
        /// </summary>
        /// <param name="m">Element.</param>
        /// <returns>DomainModel services</returns>
        public IDomainModelServices GetDomainModelServices(IDomainModelOwnable m)
        {
            if (m == null)
                return GetDomainModelServices();

            return m.GetDomainModelServices();
            //return this.ModelData.GetDomainModelServices(m);
        }
Пример #7
0
 /// <summary>
 /// Gets the services, which are specific to the current domain model that the given element belongs to.
 /// </summary>
 /// <param name="element">Element.</param>
 /// <returns>DomainModel services</returns>
 public abstract IDomainModelServices GetDomainModelServices(IDomainModelOwnable element);