Пример #1
0
        public static void BuildMapTypes(
            EventTypeRepositoryImpl repo,
            IDictionary<string, ConfigurationCommonEventTypeMap> mapTypeConfigurations,
            IDictionary<string, Properties> mapTypes,
            IDictionary<string, IDictionary<string, object>> nestableMapEvents,
            BeanEventTypeFactory beanEventTypeFactory,
            ImportService importService)
        {
            var creationOrder = EventTypeRepositoryUtil.GetCreationOrder(mapTypes.Keys, nestableMapEvents.Keys, mapTypeConfigurations);
            foreach (var mapName in creationOrder) {
                if (repo.GetTypeByName(mapName) != null) {
                    continue;
                }

                var mapConfig = mapTypeConfigurations.Get(mapName);
                if (mapTypes.TryGetValue(mapName, out var propertiesUnnested)) {
                    var propertyTypes = CreatePropertyTypes(propertiesUnnested, importService);
                    var propertyTypesCompiled = EventTypeUtility.CompileMapTypeProperties(propertyTypes, repo);
                    AddNestableMapType(mapName, propertyTypesCompiled, mapConfig, repo, beanEventTypeFactory, repo);
                }

                if (nestableMapEvents.TryGetValue(mapName, out var propertiesNestable)) {
                    var propertiesNestableCompiled = EventTypeUtility.CompileMapTypeProperties(propertiesNestable, repo);
                    AddNestableMapType(mapName, propertiesNestableCompiled, mapConfig, repo, beanEventTypeFactory, repo);
                }
            }
        }
        public static void BuildOATypes(
            EventTypeRepositoryImpl repo,
            IDictionary<string, ConfigurationCommonEventTypeObjectArray> objectArrayTypeConfigurations,
            IDictionary<string, IDictionary<string, object>> nestableObjectArrayNames,
            BeanEventTypeFactory beanEventTypeFactory,
            ImportService importService)
        {
            var creationOrder = EventTypeRepositoryUtil.GetCreationOrder(
                EmptySet<string>.Instance,
                nestableObjectArrayNames.Keys,
                objectArrayTypeConfigurations);

            foreach (var objectArrayName in creationOrder) {
                if (repo.GetTypeByName(objectArrayName) != null) {
                    continue;
                }

                var objectArrayConfig = objectArrayTypeConfigurations.Get(objectArrayName);
                var propertyTypes = nestableObjectArrayNames.Get(objectArrayName);
                propertyTypes = ResolveClassesForStringPropertyTypes(propertyTypes, importService);
                var propertyTypesCompiled = EventTypeUtility.CompileMapTypeProperties(propertyTypes, repo);

                AddNestableObjectArrayType(objectArrayName, propertyTypesCompiled, objectArrayConfig, beanEventTypeFactory, repo);
            }
        }
Пример #3
0
        public void TestSort()
        {
            var setOne = new LinkedHashSet <string>();

            setOne.Add("a");
            setOne.Add("b_sub");
            var setTwo = new LinkedHashSet <string>();

            setOne.Add("b_super");
            setOne.Add("y");

            var configs = new Dictionary <string, ConfigurationCommonEventTypeWithSupertype>();
            ConfigurationCommonEventTypeWithSupertype config = new ConfigurationCommonEventTypeWithSupertype();

            config.SuperTypes = Collections.SingletonSet("b_super");
            configs["b_sub"]  = config;

            var result = EventTypeRepositoryUtil.GetCreationOrder(setOne, setTwo, configs);

            Assert.AreEqual("[\"a\", \"b_super\", \"y\", \"b_sub\"]", result.RenderAny());
        }