Example #1
0
        private void PopulateFromStagingTable()
        {
            var stagingTableName = DatabaseUtils.GetQualifiedTableName(
                PublicStagingSchema.StagingSchemaName, EntityUtils.ToCtTableName(Entity.Event));

            string federatedEventIdCol = EntityUtils.GetFederatedFieldName("event_id");

            var s = new SqlBuilder();

            s.AppendFormat("select {0}, day_of_week, start_time, end_time from {1}", federatedEventIdCol, stagingTableName);
            s.AppendFormat(
                "where {0} in ('{1}', '{2}')",
                HistorySchema.HistoryStatusColumnName,
                HistorySchema.HistoryStatusInsert,
                HistorySchema.HistoryStatusUpdate);

            DatabaseUtils.EnumerateResults(_connectionString, s.ToString(), _timeoutSecs, r =>
            {
                var times = new EventStartEndTime
                {
                    Start     = (DateTime)r["start_time"],
                    End       = (DateTime)r["end_time"],
                    DayOfWeek = Utils.ConvertFromCt7DayOfWeek((int)r["day_of_week"])
                };

                var eventId = (long)r[federatedEventIdCol];
                _eventTimes.Add(eventId, times);
            });
        }
Example #2
0
        public void AddConsolidatedOrFederatedIdMapping(DataStoreConfiguration c, Entity e, string publicColName)
        {
            var fldName = c.Consolidation.Get(e).None
               ? EntityUtils.GetFederatedFieldName(publicColName)
               : EntityUtils.GetConsolidatedFieldName(publicColName);

            var m = new ColumnMappingStandard(publicColName, fldName);

            _mappings.Add(m);
        }
Example #3
0
        public void AddResourceIdColumnMapping(string publicResIdColName, string publicResTypeColName)
        {
            var m = new ColumnMappingResourceId(
                publicResIdColName,
                publicResTypeColName,
                EntityUtils.GetFederatedFieldName(publicResIdColName),
                EntityUtils.GetConsolidatedFieldName(publicResIdColName));

            _mappings.Add(m);
        }
Example #4
0
        private void PopulateFromStagingTable(Entity et, ResourceNameCache cache, DataStoreConfiguration c)
        {
            var idFldName = c.Consolidation.Get(et).None
               ? EntityUtils.GetFederatedFieldName(EntityUtils.GetIdFldName(et))
               : ConsolidationTypeUtils.GetConsolidatedFieldName(EntityUtils.GetIdFldName(et));

            var tableName = DatabaseUtils.GetQualifiedTableName(
                PublicStagingSchema.StagingSchemaName, EntityUtils.ToCtTableName(et));

            PopulateFromTable(et, cache, tableName, idFldName, true);
        }
Example #5
0
        protected void RegisterFederatedIdCol(string colName, Entity e, string entityDefColName = null)
        {
            if (!ColumnExists(colName))
            {
                throw new ApplicationException(string.Format("Column does not exist: {0}", colName));
            }

            var def = new FederationDefinition
            {
                Entity                  = e,
                OriginalColName         = colName,
                FederationIdColName     = EntityUtils.GetFederatedFieldName(colName),
                EntityDefinitionColName = entityDefColName
            };

            _federatedIdCols.Add(def);
        }
Example #6
0
 private string GetFederatedOrConsolidatedIdColName(DataStoreConfiguration c, Entity e, string idColName)
 {
     return(c.Consolidation.Get(e).None
        ? EntityUtils.GetFederatedFieldName(idColName)
        : EntityUtils.GetConsolidatedFieldName(idColName));
 }
Example #7
0
        public void AddFederatedIdMapping(string publicColName)
        {
            var m = new ColumnMappingStandard(publicColName, EntityUtils.GetFederatedFieldName(publicColName));

            _mappings.Add(m);
        }