Beispiel #1
0
        public void Load()
        {
            foreach (var entityElement in _entities)
            {
                var entity  = _process.Entities.First(e => e.Alias == entityElement.Alias);
                var factory = new TransformOperationFactory(_process, entity.Name);

                //fields can have prefixes and are limited to literal parameters (parameters with name and value provided in configuration)
                foreach (var f in entityElement.Fields)
                {
                    var alias = Common.GetAlias(f, true, entityElement.Prefix);
                    var field = _process.GetField(entity.Alias, alias);

                    if (entity.TrimAll && field.Input && field.SimpleType.Equals("string"))
                    {
                        field.Transforms.Insert(0, "trim");
                        entity.OperationsAfterAggregation.Add(new TrimOperation(field.Alias, field.Alias, " "));
                    }

                    foreach (var t in f.Transforms)
                    {
                        field.Transforms.Add(t.Method.ToLower());
                        var reader = new FieldParametersReader(new DefaultFactory(_process.Logger));
                        if (t.BeforeAggregation)
                        {
                            entity.OperationsBeforeAggregation.Add(factory.Create(field, t, reader.Read(t)));
                        }
                        if (t.AfterAggregation)
                        {
                            entity.OperationsAfterAggregation.Add(factory.Create(field, t, reader.Read(t)));
                        }
                        AddBranches(t.Branches, entity, field, reader);
                    }
                }

                // calculated fields do not have prefixes, and have access to all or some of an entity's parameters
                foreach (var cf in entityElement.CalculatedFields)
                {
                    var field = _process.GetField(entity.Alias, cf.Alias);

                    foreach (var t in cf.Transforms)
                    {
                        var reader = new EntityTransformParametersReader(entity, _process.Logger);

                        if (t.BeforeAggregation)
                        {
                            entity.OperationsBeforeAggregation.Add(factory.Create(field, t, reader.Read(t)));
                        }
                        if (t.AfterAggregation)
                        {
                            entity.OperationsAfterAggregation.Add(factory.Create(field, t, reader.Read(t)));
                        }
                        AddBranches(t.Branches, entity, field, reader);
                    }
                }
            }
        }
        public void Load() {
            foreach (var entityElement in _entities) {

                var entity = _process.Entities.First(e => e.Alias == entityElement.Alias);
                var factory = new TransformOperationFactory(_process, entity.Name);

                //fields can have prefixes and are limited to literal parameters (parameters with name and value provided in configuration)
                foreach (var f in entityElement.Fields) {

                    var alias = Common.GetAlias(f, true, entityElement.Prefix);
                    var field = _process.GetField(entity.Alias, alias);

                    if (entity.TrimAll && field.Input && field.SimpleType.Equals("string")) {
                        field.Transforms.Insert(0, "trim");
                        entity.OperationsAfterAggregation.Add(new TrimOperation(field.Alias, field.Alias, " "));
                    }

                    foreach (var t in f.Transforms) {
                        field.Transforms.Add(t.Method.ToLower());
                        var reader = new FieldParametersReader(new DefaultFactory(_process.Logger));
                        if (t.BeforeAggregation) {
                            entity.OperationsBeforeAggregation.Add(factory.Create(field, t, reader.Read(t)));
                        }
                        if (t.AfterAggregation) {
                            entity.OperationsAfterAggregation.Add(factory.Create(field, t, reader.Read(t)));
                        }
                        AddBranches(t.Branches, entity, field, reader);
                    }
                }

                // calculated fields do not have prefixes, and have access to all or some of an entity's parameters
                foreach (var cf in entityElement.CalculatedFields) {

                    var field = _process.GetField(entity.Alias, cf.Alias);

                    foreach (var t in cf.Transforms) {
                        var reader = new EntityTransformParametersReader(entity, _process.Logger);

                        if (t.BeforeAggregation) {
                            entity.OperationsBeforeAggregation.Add(factory.Create(field, t, reader.Read(t)));
                        }
                        if (t.AfterAggregation) {
                            entity.OperationsAfterAggregation.Add(factory.Create(field, t, reader.Read(t)));
                        }
                        AddBranches(t.Branches, entity, field, reader);
                    }
                }
            }
        }