protected override void PrepareFooter(Entity entity) {
            FooterText = @"      </tbody>
	</table>
  </body>
</html>
";
        }
 public FileContentsExtract(AbstractConnection fileConnection, Entity entity) {
     _fileInfo = new FileInfo(fileConnection.File);
     _output = entity.Fields.First().Alias;
     if (!_fileInfo.Exists) {
         throw new TransformalizeException(Logger, entity.Alias, "File {0} does not exist.", fileConnection.Name);
     }
 }
        public EntityInputKeysExtractDelta(Process process, Entity entity, AbstractConnection connection)
            : base(connection) {
            _entity = entity;
            _fields = _entity.PrimaryKey.WithInput().Aliases().ToArray();
            _length = _fields.Length;
            EntityName = entity.Name;

            _entity.CheckForChanges(process, connection);

            if (!_entity.HasRows) {
                Debug("No data detected in {0}.", _entity.Alias);
            }

            if (_entity.BeginAndEndAreEqual()) {
                Debug("No changes detected in {0}.", _entity.Alias);
            }

            var keyQuery = _entity.CanDetectChanges(connection.IsDatabase)
                ? connection.KeyQuery(_entity)
                : connection.KeyAllQuery(_entity);

            var sql = _entity.HasRange ?
                connection.KeyRangeQuery(_entity) :
                keyQuery;

            Debug(sql);
            _sql = sql;

        }
 public EntityInputKeysExtractAllForDelete(Entity entity, AbstractConnection connection)
     : base(connection) {
     _entity = entity;
     _connection = connection;
     _fields = _entity.PrimaryKey.WithInput().Aliases().ToArray();
     _length = _fields.Length;
     EntityName = entity.Name;
     }
Exemplo n.º 5
0
 public EntityProcess(Process process, Entity entity)
     : base(process) {
     _process = process;
     _logger = process.Logger;
     _entity = entity;
     _collectors[STANDARD_OUTPUT] = new CollectorOperation();
     PipelineExecuter = entity.PipelineThreading == PipelineThreading.SingleThreaded ? (AbstractPipelineExecuter)new SingleThreadedPipelineExecuter() : new ThreadPoolPipelineExecuter();
 }
        private IEnumerable<Relationship> ReadRelationshipToMaster(Entity rightEntity) {
            var relationships = _process.Relationships.Where(r => r.RightEntity.Equals(rightEntity)).ToList();

            if (relationships.Any() && !relationships.Any(r => r.LeftEntity.IsMaster())) {
                var leftEntity = relationships.Last().LeftEntity;
                relationships.AddRange(ReadRelationshipToMaster(leftEntity));
            }
            return relationships;
        }
        public FileExcelExtract(AbstractConnection connection, Entity entity, int top = 0) {
            _fields = entity.Fields.WithInput().ToArray();
            _fileInfo = new FileInfo(connection.File);
            _start = connection.Start;
            _end = connection.End;

            if (top > 0) {
                _end = _start + top;
            }
        }
 public EntityJoinAction(Process process, Entity entity)
     : base(process) {
     _hasVersion = entity.Version != null;
     _versionAlias = _hasVersion ? entity.Version.Alias : string.Empty;
     _versionSimpleType = _hasVersion ? entity.Version.SimpleType : string.Empty;
     _entityDelete = entity.Delete;
     _tflBatchId = entity.TflBatchId;
     _keys = entity.PrimaryKey.Aliases().ToArray();
     _firstKey = _keys[0];
 }
        public EntityOutputOperation(Entity entity) {
            OutputFields = new List<string>();

            foreach (var alias in entity.Fields.WithFileOutput().Aliases()) {
                OutputFields.Add(alias);
            }
            foreach (var alias in entity.CalculatedFields.WithFileOutput().Aliases()) {
                OutputFields.Add(alias);
            }
        }
Exemplo n.º 10
0
        private void GuardAgainstFieldOverlap(Entity entity) {

            var entityKeys = new HashSet<string>(entity.Fields.WithOutput().WithoutPrimaryKey().Aliases());
            var processKeys = new HashSet<string>(_process.Entities.SelectMany(e2 => e2.Fields.WithOutput().Aliases()));

            entityKeys.IntersectWith(processKeys);

            if (!entityKeys.Any()) return;

            var count = entityKeys.Count;
            _process.Logger.EntityWarn(entity.Name, "field overlap error in {3}.  The field{1}: {0} {2} already defined in previous entities.  You must alias (rename) these.", string.Join(", ", entityKeys), count.Plural(), count == 1 ? "is" : "are", entity.Alias);
        }
Exemplo n.º 11
0
        private void AddBranches(IEnumerable<TflBranch> branches, Entity entity, Field field, ITransformParametersReader reader) {
            foreach (var branch in branches) {
                foreach (var transform in branch.Transforms) {

                    Field f;
                    transform.RunField = branch.RunField;
                    transform.RunType = _process.TryGetField(entity.Name, transform.RunField, out f) ? f.SimpleType : "boolean";
                    transform.RunOperator = branch.RunOperator;
                    transform.RunValue = branch.RunValue;

                    var operation = new TransformOperationFactory(_process, entity.Name).Create(field, transform, reader.Read(transform));
                    entity.OperationsAfterAggregation.Add(operation);
                    if (transform.Branches.Count > 0) {
                        AddBranches(transform.Branches, entity, field, reader);
                    }
                }
            }
        }
Exemplo n.º 12
0
        public EntityKeysPartial(Process process, Entity entity) : base(process) {
            _process = process;
            _entity = entity;

            if (entity.Input.Count == 1) {
                var connection = entity.Input.First().Connection;
                if (connection.IsDatabase && !entity.HasSqlOverride()) {
                    Register(ComposeInputOperation(process, connection));
                }
            } else {
                var union = new ParallelUnionAllOperation();
                foreach (var input in entity.Input) {
                    if (input.Connection.IsDatabase && !_entity.HasSqlOverride()) {
                        union.Add(ComposeInputOperation(process, input.Connection));
                    }
                }
                Register(union);
            }
            Register(new EntityKeysDistinct(_entity));
        }
Exemplo n.º 13
0
        protected override void PrepareHeader(Entity entity) {
            foreach (Field field in entity.Fields.WithFileOutput()) {
                Headers.Add(field.Label.Equals(string.Empty) ? field.Alias : field.Label);
            }
            foreach (Field field in entity.CalculatedFields.WithFileOutput()) {
                Headers.Add(field.Label.Equals(string.Empty) ? field.Alias : field.Label);
            }
            HeaderText = string.Format(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD HTML 3.2//EN"">
<html>
  <head>
    <title>{0}</title>
    <link rel=""stylesheet"" href=""http://netdna.bootstrapcdn.com/bootswatch/3.1.1/united/bootstrap.min.css"">
    <link rel=""stylesheet"" href=""http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"">
    <script src=""http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js""></script>
  </head>
  <body>
    <table class=""table table-striped table-condensed table-hover"">
		<thead>
            <th>{1}</th>
		</thead>
		<tbody>
", entity.OutputName(), string.Join("</th><th>", Headers));
        }
 public EntityDetectDeletes(Process process, Entity entity)
     : base(process) {
     _keys = entity.PrimaryKey.Aliases().ToArray();
     _firstKey = _keys[0];
 }
Exemplo n.º 15
0
 public HtmlRowOperation(Entity entity, string htmlField)
     : base(entity) {
     _entity = entity;
     _htmlField = htmlField;
 }
 public EntityActionFilter(Process process, Entity entity, EntityAction entityAction) {
     _process = process;
     _entity = entity;
     _entityAction = entityAction;
 }
 public EntityDeleteProcess(Process process, Entity entity)
     : base(process) {
     _process = process;
     _logger = process.Logger;
     _entity = entity;
 }
Exemplo n.º 18
0
 public SortOperation(Entity entity) {
     _orderBy.AddRange(entity.Fields.Sorts());
     _orderBy.AddRange(entity.CalculatedFields.Sorts());
 }
 public EntityUpdateMaster(Process process, Entity entity) {
     _process = process;
     _entity = entity;
     EntityName = entity.Name;
     UseTransaction = false;
 }
 public EntityTransformParametersReader(Entity entity, ILogger logger)
 {
     _entity = entity;
     _logger = logger;
 }
Exemplo n.º 21
0
 public EntityDrop(Process process, Entity entity) {
     Name = "Entity Drop";
     _process = process;
     _entity = entity;
 }
Exemplo n.º 22
0
 public AliasOperation(Entity entity) {
     _fields = entity.Fields.WithAlias().ToArray();
 }
 public EntityAddTflFields(Process process, Entity entity) {
     _process = process;
     _entity = entity;
     EntityName = entity.Name;
     UseTransaction = false;
 }
Exemplo n.º 24
0
 public HtmlLoadOperation(AbstractConnection connection, Entity entity, string htmlField)
     : base(connection, entity) {
     _htmlField = htmlField;
 }
Exemplo n.º 25
0
 protected override void PrepareType(Entity entity) {
     var builder = new DelimitedClassBuilder("Tfl" + entity.OutputName()) { IgnoreEmptyLines = true, Delimiter = " ", IgnoreFirstLines = 0 };
     builder.AddField(_htmlField, typeof(string));
     Type = builder.CreateRecordClass();
 }
 public EntityKeysDistinct(Entity entity) {
     EntityName = entity.Name;
     _firstKey = entity.PrimaryKey.First().Alias;
     _keys = entity.PrimaryKey.WithInput().Aliases().ToArray();
 }
Exemplo n.º 27
0
 public FieldSqlWriter AddDeleted(Entity entity, bool forCreate = true) {
     if (!entity.Delete)
         return this;
     if (!entity.IsMaster())
         return this;
     var field = Fields.GetDeletedField(entity.Index, forCreate);
     _original[field.Alias] = field;
     _output[field.Alias] = string.Empty;
     return this;
 }
Exemplo n.º 28
0
 public EntityCreate(Process process, Entity entity) {
     Name = "Entity Create";
     _entity = entity;
     _process = process;
 }
 public SerialUnionAllOperation(Entity entity, string operationColumn = "operation") {
     OperationColumn = operationColumn;
     ProcessName = entity.ProcessName;
     EntityName = entity.Name;
 }
 public EntityKeysSaveOperation(Entity entity) {
     _entity = entity;
     EntityName = entity.Name;
 }