<commit_before>﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Models.ContentEditing;

namespace Umbraco.Web.Models.Mapping
{
   
    internal class PropertyTypeGroupResolver : ValueResolver<IContentType, IEnumerable<PropertyTypeGroupDisplay>>
    {
        private readonly ApplicationContext _applicationContext;
        private readonly Lazy<PropertyEditorResolver> _propertyEditorResolver;

        public PropertyTypeGroupResolver(ApplicationContext applicationContext, Lazy<PropertyEditorResolver> propertyEditorResolver)
        {
            _applicationContext = applicationContext;
            _propertyEditorResolver = propertyEditorResolver;
        }


        protected override IEnumerable<PropertyTypeGroupDisplay> ResolveCore(IContentType source)
        {
            var groups = new Dictionary<int,PropertyTypeGroupDisplay>();

            //for storing generic properties
            var genericProperties = new List<PropertyTypeDisplay>();

            
            //iterate through all composite types
            foreach (var ct in source.ContentTypeComposition)
            {
                //process each tab
                foreach(var tab in ct.CompositionPropertyGroups){
                    var group = new PropertyTypeGroupDisplay() { Id = tab.Id, Inherited = true, Name = tab.Name, SortOrder = tab.SortOrder };
                    group.ContentTypeId = ct.Id;
                    group.ParentTabContentTypes = new[] { ct.Id };
                    group.ParentTabContentTypeNames = new[] { ct.Name };

                    if (tab.ParentId.HasValue)
                        group.ParentGroupId = tab.ParentId.Value;

                    group.Properties = MapProperties(tab.PropertyTypes, ct, tab.Id, true);
                    groups.Add(tab.Id, group);
                }
<commit_msg>Change propertyresolver to use IContentTypeComposition<commit_after>﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Models.ContentEditing;

namespace Umbraco.Web.Models.Mapping
{

    internal class PropertyTypeGroupResolver : ValueResolver<IContentTypeComposition, IEnumerable<PropertyTypeGroupDisplay>>
    {
        private readonly ApplicationContext _applicationContext;
        private readonly Lazy<PropertyEditorResolver> _propertyEditorResolver;

        public PropertyTypeGroupResolver(ApplicationContext applicationContext, Lazy<PropertyEditorResolver> propertyEditorResolver)
        {
            _applicationContext = applicationContext;
            _propertyEditorResolver = propertyEditorResolver;
        }


        protected override IEnumerable<PropertyTypeGroupDisplay> ResolveCore(IContentTypeComposition source)
        {
            var groups = new Dictionary<int,PropertyTypeGroupDisplay>();

            //for storing generic properties
            var genericProperties = new List<PropertyTypeDisplay>();

            
            //iterate through all composite types
            foreach (var ct in source.ContentTypeComposition)
            {
                //process each tab
                foreach(var tab in ct.CompositionPropertyGroups){
                    var group = new PropertyTypeGroupDisplay() { Id = tab.Id, Inherited = true, Name = tab.Name, SortOrder = tab.SortOrder };
                    group.ContentTypeId = ct.Id;
                    group.ParentTabContentTypes = new[] { ct.Id };
                    group.ParentTabContentTypeNames = new[] { ct.Name };

                    if (tab.ParentId.HasValue)
                        group.ParentGroupId = tab.ParentId.Value;

                    group.Properties = MapProperties(tab.PropertyTypes, ct, tab.Id, true);
                    groups.Add(tab.Id, group);
                }

{'fraction_non_alphanumeric': 0.07272727272727272, 'fraction_numerical': 0.0, 'mean_word_length': 2.5155440414507773, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2979459', 'n_tokens_mistral': 990, 'n_tokens_neox': 944, 'n_words': 222}