예제 #1
0
        public IDatastore LoadDataFromSource(DesignerItemBase sourceItem, IDatastore dataStore, ReportProgressMethod reportProgressMethod)
        {
            IModule     sourceObject     = objectResolver.GetModule(sourceItem.ID, sourceItem.ModuleDescription.ModuleType);
            IConnection connectionObject = objectResolver.GetConnection(sourceItem.ID);

            if (connectionObject == null)
            {
                if (runLog != null)
                {
                    string label = String.IsNullOrEmpty(sourceItem.ItemLabel) ? "-- No Label --" : sourceItem.ItemLabel;
                    throw new Exception("No connection was selected for the source '" + label + "'.");
                }
                dataStore = null;
            }

            ItemLog itemLog = ItemLog.CreateNew(sourceItem.ID, sourceItem.ItemLabel, sourceItem.ModuleDescription.ModuleType.Name, null);

            if (runLog != null)
            {
                var databaseInterface = SqliteWrapper.GetSqliteWrapper(runLog.RunLogPath, sourceItem.ID, sourceItem.ItemLabel);
                itemLog.DatabasePath = runLog.RunLogPath + "\\" + databaseInterface.GetDatabaseName();
                parentItemLog.SubFlowLogs.Add(itemLog);
            }

            ((IDataSource)sourceObject).LoadData(connectionObject, dataStore, reportProgressMethod);

            itemLog.EndTime = DateTime.Now;

            return(dataStore);
        }
예제 #2
0
        public List <DesignerItemBase> GetPredecessorNodes(DesignerItemBase designerItem)
        {
            var incomingConnectionSourceIds = GetIncomingConnections(designerItem).Select(t => t.SourceID);
            var predecessorNodes            = DesignerItems.Where(t => incomingConnectionSourceIds.Contains(t.ID));

            return(predecessorNodes.ToList());
        }
예제 #3
0
        private ItemWorker InitializeItemWorker(DesignerItemBase designerItem, StepConfigurationBase stepConfiguration)
        {
            designerItem.State = ItemState.Initialized;

            ItemWorker itemWorker = new ItemWorker(designerItem, stepConfiguration);

            itemWorker.BackgroundWorker = new System.ComponentModel.BackgroundWorker();
            itemWorker.BackgroundWorker.WorkerReportsProgress = true;
            itemWorker.BackgroundWorker.DoWork             += bgw_DoWork;
            itemWorker.BackgroundWorker.ProgressChanged    += BackgroundWorker_ProgressChanged;
            itemWorker.BackgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;

            return(itemWorker);
        }
        public void TraverseUpwards(DesignerItemBase item)
        {
            if (!ExecutionPlan.Contains(item))
            {
                ExecutionPlan.Add(item);
            }

            var predessorItems = flowGraph.GetPredecessorNodes(item);

            foreach (var predessorItem in predessorItems)
            {
                TraverseUpwards(predessorItem);
            }
        }
예제 #5
0
        public IDatastore WriteToTarget(DesignerItemBase targetItem, IDatastore dataStore, ReportProgressMethod reportProgressMethod)
        {
            IModule            targetModule      = objectResolver.GetModule(targetItem.ID, targetItem.ModuleDescription.ModuleType);
            IConnection        connectionObject  = objectResolver.GetConnection(targetItem.ID);
            IDatabaseInterface databaseInterface = SqliteWrapper.GetSqliteWrapper(runLog.RunLogPath, targetItem.ID, targetItem.ItemLabel);

            ItemLog itemLog = ItemLog.CreateNew(targetItem.ID, targetItem.ItemLabel, targetItem.ModuleDescription.ModuleType.Name, runLog.RunLogPath + "\\" + databaseInterface.GetDatabaseName());

            ((IDataTarget)targetModule).WriteData(connectionObject, databaseInterface, dataStore, reportProgressMethod);

            itemLog.EndTime = DateTime.Now;
            parentItemLog.SubFlowLogs.Add(itemLog);

            return(dataStore);
        }
예제 #6
0
        public IDatastore ExecuteDesignerItem(DesignerItemBase designerItem, List <IDatastore> dataStores, ReportProgressMethod reportProgressMethod)
        {
            switch (designerItem.ModuleDescription.Attributes.ModuleType)
            {
            case ModuleType.Source:
                return(LoadDataFromSource(designerItem, dataStores.First(), reportProgressMethod));

            case ModuleType.Transformation:
                return(TransformData(designerItem, dataStores, reportProgressMethod));

            case ModuleType.Target:
                return(WriteToTarget(designerItem, dataStores.First(), reportProgressMethod));

            default:
                throw new Exception("ModuleType " + designerItem.ModuleDescription.Attributes.ModuleType + " has no execution implemented");
            }
        }
예제 #7
0
        public void ExecuteItem(DesignerItemBase item, RunLog runLog)
        {
            var incomingConnections = FlowGraph.GetIncomingConnections(item);
            var outgoingConnections = FlowGraph.GetOutgoingConnections(item);

            List <IDatastore> dataStores = new List <IDatastore>();

            if (item.ModuleDescription.Attributes.ModuleType == ModuleType.Source)
            {
                var dataStore = InitializeDatastore();
                dataStores.Add(dataStore);
            }
            else
            {
                foreach (var incomingConnection in incomingConnections.OrderBy(t => t.SinkConnectorName))
                {
                    dataStores.Add(DataStreams[incomingConnection]);
                    DataStreams.Remove(incomingConnection);
                }
            }

            var returnedDataStore = moduleExecution.ExecuteDesignerItem(item, dataStores, ReportProgressMethod);

            for (int i = 0; i < outgoingConnections.Count; i++)
            {
                if (i == 0)
                {
                    DataStreams.Add(outgoingConnections[i], returnedDataStore);
                }
                else
                {
                    var targetDatastore = InitializeDatastore();
                    DatastoreHelper.CopyDatastore(returnedDataStore, targetDatastore);
                    DataStreams.Add(outgoingConnections[i], targetDatastore);
                }
            }
        }
예제 #8
0
        public IDatastore TransformData(DesignerItemBase transformationItem, List <IDatastore> dataStores, ReportProgressMethod reportProgressMethod)
        {
            var transformationItemConfiguration = objectResolver.LoadItemConfiguration(transformationItem.ID) as TransformationConfiguration;

            IConnection transformationConnectionObject = null;

            if (transformationItemConfiguration.SelectedConnectionConfigurationId.Equals(Guid.Empty) == false)
            {
                transformationConnectionObject = objectResolver.GetConnection(transformationItemConfiguration.SelectedConnectionConfigurationId);
            }
            foreach (var dataStore in dataStores)
            {
                dataStore.ApplyFilter(transformationItemConfiguration.DataFilter);
            }

            IModule transformationObject = objectResolver.GetModule(transformationItem.ID, transformationItem.ModuleDescription.ModuleType);

            if (transformationObject is IDataTransformation)
            {
                ((IDataTransformation)transformationObject).TransformData(transformationConnectionObject, null, dataStores.First(), reportProgressMethod);
                return(dataStores.First());
            }
            else if (transformationObject is IDataMerge)
            {
                if (dataStores.Count != 2)
                {
                    throw new Exception("Make sure to connect exactly two incoming datasources on JoinRecords transformations!");
                }
                var mergedStore = ((IDataMerge)transformationObject).TransformData(transformationConnectionObject, null, dataStores[0], dataStores[1], reportProgressMethod);
                return(mergedStore);
            }
            else
            {
                throw new Exception("Tranformation does not implement a valid Tranformation-Interface!");
            }
        }
예제 #9
0
 public ItemWorker(DesignerItemBase designerItem, StepConfigurationBase configuration)
 {
     this.DesignerItem  = designerItem;
     this.Configuration = configuration;
 }
 public int SaveDesignerItem(DesignerItemBase designerItem)
 {
     return(SaveItem(designerItem));
 }
예제 #11
0
        public List <ConnectionBase> GetOutgoingConnections(DesignerItemBase designerItem)
        {
            var outgoingConnections = DesignerConnections.Where(t => t.SourceID == designerItem.ID);

            return(outgoingConnections.ToList());
        }
예제 #12
0
        public List <ConnectionBase> GetIncomingConnections(DesignerItemBase designerItem)
        {
            var incomingConnections = DesignerConnections.Where(t => t.SinkID == designerItem.ID);

            return(incomingConnections.ToList());
        }