private static KeyValuePair <MapKey, IEnumerable <PropertyTypePredefined> > MultipleEntry(
     ReconcileProperty reconcileProperty,
     ItemTypePredefined itemTypePredefined,
     params PropertyTypePredefined[] propertyTypePredefineds)
 {
     return(new KeyValuePair <MapKey, IEnumerable <PropertyTypePredefined> >(new MapKey(reconcileProperty, itemTypePredefined), propertyTypePredefineds));
 }
 public static bool IsProjectOrFolderArtifactType(this ItemTypePredefined predefinedType)
 {
     return(predefinedType == ItemTypePredefined.BaselineFolder ||
            predefinedType == ItemTypePredefined.PrimitiveFolder ||
            predefinedType == ItemTypePredefined.Project ||
            predefinedType == ItemTypePredefined.CollectionFolder);
 }
 public static bool IsDiagramConnector(this ItemTypePredefined itemTypePredefined)
 {
     return(itemTypePredefined == ItemTypePredefined.BPConnector ||
            itemTypePredefined == ItemTypePredefined.DDConnector ||
            itemTypePredefined == ItemTypePredefined.GDConnector ||
            itemTypePredefined == ItemTypePredefined.SBConnector ||
            itemTypePredefined == ItemTypePredefined.UIConnector ||
            itemTypePredefined == ItemTypePredefined.UCDConnector);
 }
 public static bool IsDiagramShape(this ItemTypePredefined itemTypePredefined)
 {
     return(itemTypePredefined == ItemTypePredefined.BPShape ||
            itemTypePredefined == ItemTypePredefined.DDShape ||
            itemTypePredefined == ItemTypePredefined.GDShape ||
            itemTypePredefined == ItemTypePredefined.SBShape ||
            itemTypePredefined == ItemTypePredefined.UIShape ||
            itemTypePredefined == ItemTypePredefined.UCDShape);
 }
 public static bool IsDiagram(this ItemTypePredefined itemTypePredefined)
 {
     return(itemTypePredefined == ItemTypePredefined.BusinessProcess ||
            itemTypePredefined == ItemTypePredefined.DomainDiagram ||
            itemTypePredefined == ItemTypePredefined.GenericDiagram ||
            itemTypePredefined == ItemTypePredefined.Storyboard ||
            itemTypePredefined == ItemTypePredefined.UIMockup ||
            itemTypePredefined == ItemTypePredefined.UseCaseDiagram);
 }
 public static bool CanContainSubartifacts(this ItemTypePredefined itemTypePredefined)
 {
     return(itemTypePredefined == ItemTypePredefined.BusinessProcess ||
            itemTypePredefined == ItemTypePredefined.DomainDiagram ||
            itemTypePredefined == ItemTypePredefined.GenericDiagram ||
            itemTypePredefined == ItemTypePredefined.Glossary ||
            itemTypePredefined == ItemTypePredefined.Process ||
            itemTypePredefined == ItemTypePredefined.Storyboard ||
            itemTypePredefined == ItemTypePredefined.UIMockup ||
            itemTypePredefined == ItemTypePredefined.UseCase ||
            itemTypePredefined == ItemTypePredefined.UseCaseDiagram);
 }
        public bool IsInternalSystemProperty(PropertyTypePredefined propertyTypePredefined,
                                             ItemTypePredefined itemTypePredefined)
        {
            if (propertyTypePredefined == PropertyTypePredefined.Description)
            {
                return(false);
            }

            return
                (_typePredefineds.Where(pair => pair.Value.Contains(propertyTypePredefined))
                 .Select(pair => pair.Key)
                 .All(mapKey => mapKey.Item2 != null && mapKey.Item2 != itemTypePredefined));
        }
        private async Task ExecuteItemTypeTests(ItemTypePredefined itemTypePredefined)
        {
            // arrange
            var parameters = new SemanticSearchSuggestionParameters(1, 1);

            _artifactRepository.Setup(a => a.GetArtifactBasicDetails(It.IsAny <int>(), It.IsAny <int>(), null))
            .ReturnsAsync(new ArtifactBasicDetails()
            {
                PrimitiveItemTypePredefined = (int)itemTypePredefined
            });

            // act
            await _semanticSearchService.GetSemanticSearchSuggestions(parameters, null);
        }
示例#9
0
        public IEnumerable <int> FilterByBaseType(IEnumerable <int> artifactIds, ItemTypePredefined baseType)
        {
            foreach (var artifactId in artifactIds)
            {
                SqlItemInfo itemInfo;
                ArtifactStates.TryGetValue(artifactId, out itemInfo);

                if (itemInfo == null || itemInfo.PrimitiveItemTypePredefined != baseType)
                {
                    continue;
                }

                yield return(artifactId);
            }
        }
示例#10
0
        private Icon GetDefaultIcon(ItemTypePredefined predefined, string color, bool isPrimitiveType = false)
        {
            var iconContent = _metadataRepository.GetSvgIconContent(predefined, color, isPrimitiveType);

            if (iconContent == null)
            {
                throw new ResourceNotFoundException("Artifact type icon Content not found.", ErrorCodes.ResourceNotFound);
            }

            return(new Icon
            {
                Content = iconContent,
                IsSvg = true
            });
        }
        public static bool IsPrimitiveArtifactType(this ItemTypePredefined artifactType)
        {
            // not artifact
            if (((int)ItemTypePredefined.GroupMask & (int)artifactType) != (int)ItemTypePredefined.PrimitiveArtifactGroup)
            {
                return(false);
            }

            if ((artifactType == ItemTypePredefined.PrimitiveArtifactGroup) || (artifactType == ItemTypePredefined.Project) || (artifactType == ItemTypePredefined.Baseline))
            {
                return(false);
            }

            return(true);
        }
 public static bool IsAvailableForSensitivityCalculations(this ItemTypePredefined itemTypePredefined)
 {
     return(itemTypePredefined == ItemTypePredefined.Actor ||
            itemTypePredefined == ItemTypePredefined.BusinessProcess ||
            itemTypePredefined == ItemTypePredefined.DomainDiagram ||
            itemTypePredefined == ItemTypePredefined.Document ||
            itemTypePredefined == ItemTypePredefined.PrimitiveFolder ||
            itemTypePredefined == ItemTypePredefined.GenericDiagram ||
            itemTypePredefined == ItemTypePredefined.Glossary ||
            itemTypePredefined == ItemTypePredefined.Process ||
            itemTypePredefined == ItemTypePredefined.Storyboard ||
            itemTypePredefined == ItemTypePredefined.TextualRequirement ||
            itemTypePredefined == ItemTypePredefined.UIMockup ||
            itemTypePredefined == ItemTypePredefined.UseCase ||
            itemTypePredefined == ItemTypePredefined.UseCaseDiagram);
 }
 public static bool CanHaveDocumentReferences(this ItemTypePredefined itemTypePredefined)
 {
     return(itemTypePredefined == ItemTypePredefined.Actor ||
            itemTypePredefined == ItemTypePredefined.BaselineFolder ||
            itemTypePredefined == ItemTypePredefined.BusinessProcess ||
            itemTypePredefined == ItemTypePredefined.DomainDiagram ||
            itemTypePredefined == ItemTypePredefined.PrimitiveFolder ||
            itemTypePredefined == ItemTypePredefined.GenericDiagram ||
            itemTypePredefined == ItemTypePredefined.Glossary ||
            itemTypePredefined == ItemTypePredefined.Process ||
            itemTypePredefined == ItemTypePredefined.Storyboard ||
            itemTypePredefined == ItemTypePredefined.TextualRequirement ||
            itemTypePredefined == ItemTypePredefined.UIMockup ||
            itemTypePredefined == ItemTypePredefined.UseCase ||
            itemTypePredefined == ItemTypePredefined.UseCaseDiagram);
 }
        public IEnumerable <PropertyTypePredefined> GetPropertyTypePredefined(ReconcileProperty reconcileProperty,
                                                                              ItemTypePredefined baseItemTypePredefined)
        {
            IEnumerable <PropertyTypePredefined> propertyTypePredefined;

            if (_typePredefineds.TryGetValue(new MapKey(reconcileProperty, baseItemTypePredefined), out propertyTypePredefined))
            {
                return(propertyTypePredefined);
            }

            if (_typePredefineds.TryGetValue(new MapKey(reconcileProperty, null), out propertyTypePredefined))
            {
                return(propertyTypePredefined);
            }

            return(Enumerable.Empty <PropertyTypePredefined>());
        }
        public static ProjectSection GetProjectSection(this ItemTypePredefined itemTypePredefined)
        {
            if (itemTypePredefined.IsRegularArtifactType())
            {
                return(ProjectSection.Artifacts);
            }
            if (itemTypePredefined.IsBaselinesAndReviewsGroupType())
            {
                return(ProjectSection.BaselinesAndReviews);
            }
            if (itemTypePredefined.IsCollectionsGroupType())
            {
                return(ProjectSection.Collections);
            }

            return(ProjectSection.Unknown);
        }
 public static bool IsAvailableForImpactAnalysis(this ItemTypePredefined itemTypePredefined)
 {
     return(itemTypePredefined == ItemTypePredefined.Actor ||
            itemTypePredefined == ItemTypePredefined.BusinessProcess ||
            itemTypePredefined == ItemTypePredefined.DomainDiagram ||
            itemTypePredefined == ItemTypePredefined.Document ||
            itemTypePredefined == ItemTypePredefined.PrimitiveFolder ||
            itemTypePredefined == ItemTypePredefined.GenericDiagram ||
            itemTypePredefined == ItemTypePredefined.Glossary ||
            itemTypePredefined == ItemTypePredefined.Process ||
            itemTypePredefined == ItemTypePredefined.Storyboard ||
            itemTypePredefined == ItemTypePredefined.TextualRequirement ||
            itemTypePredefined == ItemTypePredefined.UIMockup ||
            itemTypePredefined == ItemTypePredefined.UseCase ||
            itemTypePredefined == ItemTypePredefined.UseCaseDiagram ||
            IsSubArtifactType(itemTypePredefined));
 }
示例#17
0
        public byte[] GetSvgIconContent(ItemTypePredefined predefined, string color = null, bool isPrimitiveType = false)
        {
            var iconSvgFileName = GetIconSvgFileName(predefined, isPrimitiveType);

            if (iconSvgFileName == null)
            {
                return(null);
            }

            var resourceStream = LoadSvgResourceImage(iconSvgFileName);

            using (resourceStream)
            {
                var svgDocument = XDocument.Load(resourceStream);
                if (string.IsNullOrEmpty(color))
                {
                    return(Encoding.UTF8.GetBytes(svgDocument.ToString()));
                }
                return(Encoding.UTF8.GetBytes(AddFillAttribute(svgDocument, color).ToString()));
            }
        }
示例#18
0
        private string GetIconSvgFileName(ItemTypePredefined predefined, bool isPrimitiveType = false)
        {
            if (isPrimitiveType)
            {
                if (predefined == ItemTypePredefined.CollectionFolder)
                {
                    return("collections.svg");
                }
                if (predefined == ItemTypePredefined.BaselineFolder)
                {
                    return("baseline.svg");
                }
            }

            string iconSvgFileName;

            if (!IconFileNames.TryGetValue(predefined, out iconSvgFileName))
            {
                return(null);
            }
            return(iconSvgFileName);
        }
        public IList <ReconcileProperty> GetNotDefinedReconcileProperties(ItemTypePredefined baseItemTypePredefined)
        {
            var result = new List <ReconcileProperty>();

            foreach (ReconcileProperty reconcileProperty in Enum.GetValues(typeof(ReconcileProperty)))
            {
                if (reconcileProperty == ReconcileProperty.None)
                {
                    continue;
                }
                IEnumerable <PropertyTypePredefined> propertyTypePredefined;
                if (_typeNonDefinedReconciliationProperties.TryGetValue(new MapKey(reconcileProperty, baseItemTypePredefined), out propertyTypePredefined))
                {
                    result.Add(reconcileProperty);
                }

                if (_typeNonDefinedReconciliationProperties.TryGetValue(new MapKey(reconcileProperty, null), out propertyTypePredefined))
                {
                    result.Add(reconcileProperty);
                }
            }
            return(result);
        }
        public IList <PropertyTypePredefined> GetAssociatedPropertyTypePredefined(ItemTypePredefined baseItemTypePredefined)
        {
            var result = new List <PropertyTypePredefined>();

            foreach (ReconcileProperty reconcileProperty in Enum.GetValues(typeof(ReconcileProperty)))
            {
                if (reconcileProperty == ReconcileProperty.None)
                {
                    continue;
                }
                IEnumerable <PropertyTypePredefined> propertyTypePredefined;
                if (_typePredefineds.TryGetValue(new MapKey(reconcileProperty, baseItemTypePredefined), out propertyTypePredefined))
                {
                    result.AddRange(propertyTypePredefined);
                }

                if (_typePredefineds.TryGetValue(new MapKey(reconcileProperty, null), out propertyTypePredefined))
                {
                    result.AddRange(propertyTypePredefined);
                }
            }
            return(result);
        }
 public static bool IsCollectionsGroupType(this ItemTypePredefined artifactType)
 {
     return(((int)artifactType & (int)ItemTypePredefined.CollectionArtifactGroup) != 0);
 }
 public static bool IsRegularArtifactType(this ItemTypePredefined artifactType)
 {
     return(artifactType.IsPrimitiveArtifactType() && artifactType < ItemTypePredefined.BaselineFolder);
 }
 private bool isInvalidSemanticSearchArtifactType(ItemTypePredefined itemTypePredefined)
 {
     return(!itemTypePredefined.IsRegularArtifactType() || itemTypePredefined.IsProjectOrFolderArtifactType() ||
            itemTypePredefined.IsSubArtifactType());
 }
 public bool IsWorkflowSupported(ItemTypePredefined baseArtifactTypePredefined)
 {
     return(IsWorkflowSupportedForArtifactType(baseArtifactTypePredefined));
 }
 public static bool IsWorkflowSupportedForArtifactType(ItemTypePredefined baseArtifactTypePredefined)
 {
     return(baseArtifactTypePredefined.IsRegularArtifactType());
 }
 public static bool IsCustomArtifactType(this ItemTypePredefined artifactType)
 {
     return(((int)ItemTypePredefined.GroupMask & (int)artifactType) == (int)ItemTypePredefined.CustomArtifactGroup);
 }
示例#27
0
 private ArtifactVersion FindRoot(ItemTypePredefined rootType, IEnumerable <ArtifactVersion> artifacts, int projectId)
 {
     return(artifacts.FirstOrDefault(
                av => av?.ItemTypePredefined != null && av.ParentId == projectId &&
                av.ItemTypePredefined.Value == rootType));
 }
 public static bool IsBaselinesAndReviewsGroupType(this ItemTypePredefined artifactType)
 {
     return(((int)artifactType & (int)ItemTypePredefined.BaselineArtifactGroup) != 0);
 }
 public static bool IsObsoleteGroupType(this ItemTypePredefined artifactType)
 {
     return(((int)artifactType & (int)ItemTypePredefined.ObsoleteArtifactGroup) != 0);
 }
 public static bool IsSubArtifactType(this ItemTypePredefined predefinedType)
 {
     return(((int)ItemTypePredefined.GroupMask & (int)predefinedType) == (int)ItemTypePredefined.SubArtifactGroup);
 }