public RunnerHelper(IFeedRuleService feedRuleService, IFeedGeneratorIndigoCategoryService feedGeneratorIndigoCategoryService, IFeedCmsProductArchiveEntryService feedCmsProductArciveEntryService, ILogger log)
 {
     _feedRuleService = feedRuleService;
     _feedGeneratorIndigoCategoryService = feedGeneratorIndigoCategoryService;
     _feedCmsProductArciveEntryService   = feedCmsProductArciveEntryService;
     _log = log;
 }
示例#2
0
 public RunnerHelper(IFeedRuleService feedRuleService, IFeedGeneratorIndigoCategoryService feedGeneratorIndigoCategoryService, IFeedCmsProductArchiveEntryService feedCmsProductArciveEntryService, ILogger log, bool allowRuleOptimizations, bool allowRuleEntryRemovals, bool allowIEnumerableRuleEvaluations)
 {
     _feedRuleService = feedRuleService;
     _feedGeneratorIndigoCategoryService = feedGeneratorIndigoCategoryService;
     _feedCmsProductArciveEntryService   = feedCmsProductArciveEntryService;
     _log = log;
     _allowRuleOptimizations          = allowRuleOptimizations;
     _allowRuleEntryRemovals          = allowRuleEntryRemovals;
     _allowIEnumerableRuleEvaluations = allowIEnumerableRuleEvaluations;
 }
示例#3
0
        public void Initialize(IExecutionLogLogger executionLogLogger, int feedId)
        {
            _executionLogLogger = executionLogLogger;

            // Instantiate the IFeedGeneratorIndigoCategoryService
            _feedGeneratorCategoryService = new FeedGeneratorIndigoCategoryService(_indigoCategoryService, _googleCategoryService, Log);

            // First get rules associated with this feed
            _runnerFeed = new GooglePlaFeedRuleHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArciveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
            _runnerFeed.Initialize(GooglePlaFeedId, false, null, executionLogLogger.GetExecutionStartTime(), GoogleRunFeedType.Google);
        }
        public void Initialize(IExecutionLogLogger executionLogLogger, int plaFeedId, bool isIncremental, DateTime?fromTime, DateTime?effectiveFromTime, DateTime executionTime)
        {
            _executionLogLogger = executionLogLogger;
            _isIncrementalRun   = isIncremental;
            _effectiveFromTime  = effectiveFromTime;

            // Instantiate the IFeedGeneratorIndigoCategoryService
            _feedGeneratorCategoryService = new FeedGeneratorIndigoCategoryService(_indigoCategoryService, _googleCategoryService, Log);

            // First get rules associated with this feed
            _runnerFeedRulesHelper = new GooglePlaFeedRuleHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArchiveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
            _runnerFeedRulesHelper.Initialize(plaFeedId, isIncremental, fromTime, executionTime, GoogleRunFeedType.Google);
        }
        public void Initialize(IExecutionLogLogger executionLogLogger, int feedId, bool isIncremental, DateTime?fromTime, DateTime?effectiveFromTime, DateTime executionTime)
        {
            _executionLogLogger = executionLogLogger;
            _isIncrementalRun   = isIncremental;
            _fromTime           = fromTime;
            _effectiveFromTime  = effectiveFromTime;
            _feedId             = feedId;

            // Instantiate the IFeedGeneratorIndigoCategoryService
            _feedGeneratorCategoryService = new FeedGeneratorIndigoCategoryService(_indigoCategoryService, _googleCategoryService, Log);
            _runnerHelper = new RunnerHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArciveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
            _runnerHelper.Initialize(feedId, _isIncrementalRun, _fromTime, executionTime);
        }
        public void Initialize(IExecutionLogLogger executionLogLogger, int plaFeedId, bool isIncremental, DateTime?fromTime, DateTime?effectiveFromTime, DateTime executionTime, bool isPseudoFullRun)
        {
            _executionLogLogger = executionLogLogger;
            _isIncrementalRun   = isIncremental;
            _isPseudoFullRun    = isPseudoFullRun;
            _effectiveFromTime  = effectiveFromTime;

            // Instantiate the IFeedGeneratorIndigoCategoryService
            _feedGeneratorCategoryService = new FeedGeneratorIndigoCategoryService(_indigoCategoryService, _googleCategoryService, Log);

            // Instantiate the "caching" cms data services
            _feedCmsProductArchiveEntryService     = new FeedGeneratorCmsDataService(_feedCmsProductArchiveEntryServiceShared, null);
            _pastFeedCmsProductArchiveEntryService = new FeedGeneratorCmsDataService(_feedCmsProductArchiveEntryServiceShared, fromTime);

            // First get rules associated with this feed
            _productDataService = new ProductDataService(null, _feedGeneratorCategoryService, _feedRuleService, _feedCmsProductArchiveEntryService, _feedGeneratorCategoryService, _pastFeedCmsProductArchiveEntryService);
        }
        public void Initialize(IExecutionLogLogger executionLogLogger, IExecutionLogLogger secondaryExecutionLogger, int feedId, int?secondaryRunId)
        {
            _executionLogLogger          = executionLogLogger;
            _executionLogLoggerSecondary = secondaryExecutionLogger;
            _feedId = feedId;

            // Instantiate the IFeedGeneratorIndigoCategoryService
            _feedGeneratorCategoryService = new FeedGeneratorIndigoCategoryService(_indigoCategoryService, _googleCategoryService, Log);

            // First get rules associated with this feed
            _runnerFeed = new GooglePlaFeedRuleHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArciveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
            _runnerFeed.Initialize(feedId, false, null, executionLogLogger.GetExecutionStartTime(), GoogleRunFeedType.Google);
            if (secondaryRunId.HasValue)
            {
                _runMode             = RunMode.PrimaryAndSecondary;
                _runnerFeedSecondary = new GooglePlaFeedRuleHelper(_feedRuleService, _feedGeneratorCategoryService, _feedCmsProductArciveEntryService, Log, AllowRuleOptimizations, AllowRuleEntryRemovals, AllowIEnumerableRuleEvaluations);
                _runnerFeedSecondary.Initialize(secondaryRunId.Value, false, null, executionLogLogger.GetExecutionStartTime(), GoogleRunFeedType.Yahoo);
            }
        }
示例#8
0
        public static IIndigoBreadcrumbCategory GetFeedGeneratorIndigoCategory(IFeedGeneratorIndigoCategoryService feedGeneratorIndigoCategoryService, IDataReader reader, StringDictionary dict, string catalog, ILogger log)
        {
            var    feedSectionType  = GetFeedSectionType(catalog);
            var    browseCategories = new List <int>();
            string recordType       = null;

            if (dict.ContainsKey("gProductType"))
            {
                browseCategories = reader[dict["gProductType"]].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToList();
            }

            if (feedSectionType == FeedSectionType.Gifts)
            {
                recordType = reader[dict["recordType"]].ToString();
            }

            return(GetFeedGeneratorIndigoCategory(feedGeneratorIndigoCategoryService, feedSectionType, browseCategories,
                                                  recordType));
        }
示例#9
0
        public static bool Write(KeyValuePair <FeedGenerationFileLineItem, FeedGenerationFileItemRange[]> lineItemEntry,
                                 Action <FeedGenerationFileLineItem, FeedGenerationFileItemRange, IEnumerable <AbstractFileFeedWriter> > writeRangeFile,
                                 ILogger log, IExecutionLogLogger executionLogLogger, IFeedGeneratorIndigoCategoryService feedGeneratorIndigoCategoryService,
                                 bool isIncrementalRun)
        {
            Parallel.ForEach(lineItemEntry.Value, Constants.ParallelOptions, fileItemRange =>
            {
                var commonContext = new FeedWriterContext.CommonContext
                {
                    FeedGeneratorIndigoCategoryService = feedGeneratorIndigoCategoryService,
                    FileItemRange      = fileItemRange,
                    LineItem           = lineItemEntry.Key,
                    Log                = log,
                    ExecutionLogLogger = executionLogLogger,
                    IsIncrementalRun   = isIncrementalRun
                };

                var writerList = new List <AbstractFileFeedWriter>();

                ((Language[])Enum.GetValues(typeof(Language))).ForEach(
                    language =>
                {
                    var inputContext = new InputContext {
                        CommonContext = commonContext, Language = language
                    };

                    new AbstractFileFeedWriter[]
                    {
                        // Add new Writers here.

                        new ProductFileFeedWriter(inputContext),
                        new CustomAttributeFileFeedWriter(inputContext),
                        new ProductToCategoryFileFeedWriter(inputContext)
                    }

                    .ForEach(writerList.Add);
                });

                try
                {
                    writeRangeFile(lineItemEntry.Key, fileItemRange, writerList);
                    writerList.ForEach(writer => executionLogLogger.AddFileGenerationUpdate(writer.Context.Path, true));
                }
                catch (Exception ex)
                {
                    log.Error(string.Format("static AbstractFileFeedWriter.Write"), ex);
                    _hasError = true;

                    writerList.ForEach(writer => executionLogLogger.AddFileGenerationUpdate(writer.Context.Path, false));

                    if (isIncrementalRun || !Constants.AllowItemErrorsInFiles)
                    {
                        throw;
                    }
                }
                finally
                {
                    writerList.ForEach(writer => writer.Dispose());

                    writerList.ForEach(writer => writer.Context.Log.InfoFormat(
                                           "{0} completed. Processed record count {1}. Error record count {2}, deleted/skipped record count {3}",
                                           writer.Identifier, writer._processedRecordCount, writer._errorRecordCount,
                                           writer._skippedRecordCount));
                }
            });

            return(_hasError);
        }
示例#10
0
 private static IIndigoBreadcrumbCategory GetFeedGeneratorIndigoCategory(IFeedGeneratorIndigoCategoryService feedGeneratorIndigoCategoryService, FeedSectionType feedSectionType,
                                                                         List <int> browseCategories, string recordType)
 {
     return(feedGeneratorIndigoCategoryService.GetDefaultIndigoBreadcrumb(feedSectionType, browseCategories, recordType));
 }