protected virtual void SetControllerFactory(PipelineArgs args) { var kernelFactory = new NinjectKernelFactory(); var ninjectControllerFactory = new NinjectControllerFactory(kernelFactory.Create()); var sitecoreControllerFactory = new SitecoreControllers.SitecoreControllerFactory(ninjectControllerFactory); ControllerBuilder.Current.SetControllerFactory(sitecoreControllerFactory); }
/// <summary> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> public virtual void Process(PipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Order order = args.CustomData["order"] as Order; if (order == null) { return; } BusinessCatalogSettings businnesCatalogSettings = Context.Entity.GetConfiguration<BusinessCatalogSettings>(); Item companyMasterData = Sitecore.Context.Database.SelectSingleItem(businnesCatalogSettings.CompanyMasterDataLink); if (companyMasterData == null) { return; } string queryString = string.Format("orderid={0}&mode=mail", order.OrderNumber); Item saleDepartment = companyMasterData.Children["Sale"]; var saleParams = new { Recipient = saleDepartment["Email"] }; IMail mailProvider = Context.Entity.Resolve<IMail>(); mailProvider.SendMail("Order Mail To Admin", saleParams, queryString); }
public void Process(PipelineArgs args) { if (Context.ClientPage.IsEvent) { return; } var current = HttpContext.Current; if (current == null) { return; } var page = current.Handler as Page; if (page == null) { return; } Assert.IsNotNull(page.Header, "Content Editor <head> tag is missing runat='value'"); var array = new [] { "/sitecore modules/Shell/MarkdownField/js/showdown.js" }; foreach (var text in array) { page.Header.Controls.Add(new LiteralControl("<script type='text/javascript' language='javascript' src='{0}'></script>".FormatWith(new object[]{ text }))); } }
/// <summary> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> public virtual void Process(PipelineArgs args) { Assert.ArgumentNotNull(args, "args"); ShoppingCart shoppingCart = Context.Entity.GetInstance<ShoppingCart>(); PaymentProvider paymentProvider = Context.Entity.Resolve<PaymentProvider>(shoppingCart.PaymentSystem.Code); PaymentUrlResolver paymentUrlResolver = new PaymentUrlResolver(); PaymentArgs paymentArgs = new PaymentArgs { ShoppingCart = shoppingCart, PaymentUrls = paymentUrlResolver.Resolve(), }; StringBuilder description = new StringBuilder(); foreach (ShoppingCartLine shoppingCartLine in shoppingCart.ShoppingCartLines) { description.Append(shoppingCartLine.Product.Title); description.Append(", "); } paymentArgs.Description = description.ToString().Trim().TrimEnd(','); paymentProvider.Invoke(shoppingCart.PaymentSystem, paymentArgs); args.AbortPipeline(); }
public void Process(PipelineArgs args) { RouteTable.Routes.MapRoute( name: "Feature.Accounts.Api", url: "api/accounts/{action}", defaults:new {controller = "Accounts"}); }
/// <summary> /// Processes this instance. /// </summary> /// <param name="pipelineArgs">The pipeline args.</param> public void Process(PipelineArgs pipelineArgs) { CoreProcessor processor = new CoreProcessor(); bool isFakeProcessor = string.IsNullOrEmpty(this.processorDefinition.Type) && string.IsNullOrEmpty(this.processorDefinition.TypeReference); if (!isFakeProcessor) { XmlDocument medium = new XmlDocument(); using (XmlReader reader = this.processorDefinition.ProcessorElement.CreateReader()) { medium.Load(reader); } processor.Initialize(medium.DocumentElement); } EventHandler<RuntimeProcessorCallEventArgs> beforePipelineCalled = BeforePipelineProcessorCalled; if (beforePipelineCalled != null) { beforePipelineCalled(this, new RuntimeProcessorCallEventArgs(this.pipelineName, this.pipelineDomain, this.processorIndex, this.processorDefinition, pipelineArgs)); } if (!isFakeProcessor) { processor.Invoke(new object[] { pipelineArgs }); } EventHandler<RuntimeProcessorCallEventArgs> afterPipelineCalled = AfterPipelineProcessorCalled; if (afterPipelineCalled != null) { afterPipelineCalled(this, new RuntimeProcessorCallEventArgs(this.pipelineName, this.pipelineDomain, this.processorIndex, this.processorDefinition, pipelineArgs)); } }
/// <summary> /// Processes the specified args. /// </summary> /// <param name="args">The args.</param> public void Process(PipelineArgs args) { IUnityContainer container = args.CustomData["UnityContainer"] as IUnityContainer; ShopContextFactory factory = container.Resolve<ShopContextFactory>(); container.RegisterType<ContextSwitcherDataSourceBase, ContentContextSwitcherDataSource>(new InjectionConstructor(factory)); }
public void Process(PipelineArgs args) { if (Tracker.IsActive && Tracker.Current.Contact.Identifiers.IdentificationLevel != ContactIdentificationLevel.Known) { Tracker.Current.Session.Identify(this.UserName); } }
public void Process(PipelineArgs args) { Assert.ArgumentNotNull((object)args, "args"); IInsertRenderingArgs insertRenderingArgs = args as IInsertRenderingArgs; if (insertRenderingArgs == null) return; Item renderingItem = insertRenderingArgs.RenderingItem; Assert.IsNotNull((object)renderingItem, "renderingItem"); string placeholderKey = insertRenderingArgs.PlaceholderKey; Assert.IsNotNullOrEmpty(placeholderKey, "placeholderKey"); string lastPart = StringUtil.GetLastPart(placeholderKey, '/', placeholderKey); string[] arrKey = lastPart.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); string lastPartKey = arrKey[0]; RenderingDefinition renderingDefinition = new RenderingDefinition() { ItemID = renderingItem.ID.ToString(), Placeholder = lastPartKey }; if (insertRenderingArgs.Datasource != null) renderingDefinition.Datasource = insertRenderingArgs.Datasource.ID.ToString(); Assert.IsNotNull((object)insertRenderingArgs.Device, "device"); this.InsertRenderingAt(insertRenderingArgs.Device, renderingDefinition, insertRenderingArgs.Position, insertRenderingArgs.AllowedRenderingsIds, arrKey[1]); insertRenderingArgs.Result = new RenderingReference(renderingDefinition, insertRenderingArgs.Language, insertRenderingArgs.ContentDatabase); }
public virtual void Process(PipelineArgs args) { if (PipelineRun != null) { PipelineRun(this, new PipelineRunEventArgs(this.PipelineName, args)); } }
public void Process(PipelineArgs args) { RouteTable.Routes.MapRoute("Feature.Accounts.Api", "api/accounts/{action}", new { controller = "Accounts" }); }
public void Process(PipelineArgs args) { var servicesConfig = GlobalConfiguration.Configuration; var container = new Container(new IoC.Registry()); servicesConfig.DependencyResolver = new StructureMapDependencyResolver(container); }
/// <summary> /// Runs the processor. /// </summary> /// <param name="args">The arguments.</param> public virtual void Process(PipelineArgs args) { Assert.ArgumentNotNull(args, "args"); User user = args.CustomData["user"] as User; if (user == null) { Log.Error("The user is null", this); return; } GeneralSettings generalSettings = Context.Entity.GetConfiguration<GeneralSettings>(); StringList roles = new StringList(generalSettings.DefaultCustomerRoles); foreach (string role in roles) { if (Roles.RoleExists(role)) { user.Roles.Add(Role.FromName(role)); } else { Log.Warn(string.Format("Role: '{0}' does not exist", role), this); } } }
public void Process(PipelineArgs args) { if (Context.ClientPage.IsEvent) { return; } var context = HttpContext.Current; if (context == null) { return; } var page = context.Handler as Page; if (page == null) { return; } Assert.IsNotNull(page.Header, "Content Editor <head> tag is missing runat='value'"); var scripts = new[] { "/sitecore/shell/Controls/Lib/Scriptaculous/Scriptaculous.js", "/sitecore/shell/Controls/Lib/Scriptaculous/builder.js", "/sitecore/shell/Controls/Lib/Scriptaculous/effects.js", "/sitecore/shell/Controls/Lib/Scriptaculous/dragdrop.js", "/sitecore/shell/Controls/Lib/Scriptaculous/slider.js" }; foreach (var script in scripts) { page.Header.Controls.Add(new LiteralControl("<script type='text/javascript' language='javascript' src='{0}'></script>".FormatWith(script))); } }
protected virtual void MapRoutes(PipelineArgs args, RouteCollection routes) { var routeBase = Settings.GetSetting("Sitecore8.WebAPI.RouteBase", "api/"); routes.MapHttpRoute( "ProductService-Get", routeBase + "products/{id}", new { controller = "Product", action = "Get" }, new { id = @"^\d+$" } ); routes.MapHttpRoute( "ProductService-GetAll", routeBase + "products", new { controller = "Product", action = "GetAll" } ); routes.MapHttpRoute( "TaxonomyService-GetCategories", routeBase + "taxonomy/categories", new { controller = "Taxonomy", action = "GetCategories" } ); routes.MapHttpRoute( "TaxonomyService-GetOptions", routeBase + "taxonomy/categories/{parentID}", new { controller = "Taxonomy", action = "GetOptions" } ); routes.MapHttpRoute( "TaxonomyService-TagItem", routeBase + "taxonomy/tagItem/{itemID}", new { controller = "Taxonomy", action = "TagItem" } ); }
public void Process(PipelineArgs args) { Log.Info(this, "Initializing URL Rewrite."); try { using (new SecurityDisabler()) { // cache all of the rules foreach (var db in Factory.GetDatabases().Where(e => e.HasContentItem)) { var rulesEngine = new RulesEngine(db); rulesEngine.GetCachedInboundRules(); } // make sure that the page event has been deployed DeployEventIfNecessary(); } } catch (Exception ex) { Hi.UrlRewrite.Log.Error(this, ex, "Exception during initialization."); } }
public void Process(PipelineArgs args) { RouteTable.Routes.MapRoute( name: "Api", url: "api/{controller}/{action}"); //GlobalConfiguration.Configure(WebApiConfig.Register); }
public void Process(PipelineArgs args) { if (MongoRestoreSettings.RestoreMongoDatabases && !this.mongoRestoreService.IsRestored("analytics")) { this.mongoRestoreService.RestoreDatabases(); } }
public void Process(PipelineArgs args) { RouteTable.Routes.MapRoute("Feature.Demo.Api", "api/demo/{action}", new { controller = "Demo" }); }
public virtual void InitAuthenticationProvider(PipelineArgs args) { AuthenticationManager.Provider.Name.Returns("mock"); var user = User.FromName(@"sitecore\Anonymous", false); AuthenticationManager.Provider.GetActiveUser().Returns(user); }
public void Process(PipelineArgs args) { RouteTable.Routes.MapRoute( name: "Feature.Demo.Api", url: "api/demo/{action}", defaults: new { controller = "Demo" }); }
public void Process(PipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (CDNSettings.Enabled) { MediaManager.Provider = new CDNMediaProvider(); } }
public void Process(PipelineArgs args) { var config = GlobalConfiguration.Configuration; config.EnableSystemDiagnosticsTracing(); config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html")); }
public void Process(PipelineArgs args) { IUnityContainer container = (IUnityContainer)args.CustomData["UnityContainer"]; container.RegisterType<ProductRepositoryBase, InMemoryProductRepository>(); GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerActivator), new UnityControllerActivator(container)); }
public void Process(PipelineArgs args) { var castedArgs = args as GetRenderingDatasourceArgs; if (castedArgs != null) { castedArgs.Prototype = Item; } }
public PipelineRunEventArgs(string pipelineName, PipelineArgs pipelineArgs) { Assert.ArgumentNotNullOrEmpty(pipelineName, "pipelineName"); Assert.ArgumentNotNull(pipelineArgs, "pipelineArgs"); this.PipelineName = pipelineName; this.PipelineArgs = pipelineArgs; }
public void Process(PipelineArgs args) { // map our API calls this.MapRoutes(args, RouteTable.Routes); // In case you want to use AttributeRouting //this.MapRoutes(args, GlobalConfiguration.Configuration); }
/// <summary> /// Called by initialize pipeline to register the remote event handler /// </summary> /// <param name="args">Pipeline arguments</param> public void Process(PipelineArgs args) { Assert.ArgumentNotNull((object)args, "args"); Log.Debug("EventRegistry - BEGIN", this); EventManager.Subscribe<WrappedEvent>(new Action<WrappedEvent>(this.HandleRemoteEvent)); Log.Debug("EventRegistry - END", this); }
public void Process(PipelineArgs args) { GlobalConfiguration.Configuration.Routes.Add("api", new HttpRoute("api/{controller}/{action}")); GlobalConfiguration.Configure(config => config.MapHttpAttributeRoutes()); GlobalConfiguration.Configure(ReplaceControllerSelector); }
/// <summary> /// The process. /// </summary> /// <param name="args"> /// The args. /// </param> public void Process(PipelineArgs args) { if (!Context.IsUnitTesting) { RouteConfig.RegisterRoutes(RouteTable.Routes); WebApiConfig.Register(GlobalConfiguration.Configuration); } }
public virtual void Process(PipelineArgs args) { RouteTable.Routes.MapHttpRoute("ApiGenerator", "api/generator/{definition}/{path}", new { controller = "ApiGenerator", action = "Generate" }); }
public virtual void Process(PipelineArgs args) { this.RegisterRoutes(RouteTable.Routes); }
/// <summary> /// Determines whether the specified args is suspicious. /// </summary> /// <param name="args">The args.</param> /// <returns> /// <c>true</c> if the specified args is suspicious; otherwise, <c>false</c>. /// </returns> protected virtual bool IsSuspicious(PipelineArgs args) { HashSet <string> hashSet = args.CustomData[OrderStateCode.Suspicious] as HashSet <string>; return(hashSet != null && hashSet.Any()); }
/// <summary> /// The entry point for the pipeline processor /// </summary> /// <param name="args">The arguments for the pipeline</param> public virtual void Process(PipelineArgs args) { this.SetControllerFactory(args); }
public void Process(PipelineArgs args) { CorePipeline.Run("startMongoDb", new PipelineArgs()); }
public override void Process(PipelineArgs args) { OnStart(); }
public void Process(PipelineArgs args) { GlobalConfiguration.Configure(Exm.WebApiConfig.Register); }
public void Process(PipelineArgs args) { //RouteTable.Routes.MapMvcAttributeRoutes(); GlobalConfiguration.Configure(Configure); }
public void Process(PipelineArgs args) { _contact.EnsureIndexExists(); }
public void Process(PipelineArgs args) { this.serviceProvider.StartMessageBus <ContactMessageBus>(); }
public void Process(PipelineArgs args) { Log.Info("Sitecore.Foundation.SitecoreExtensions: Running CustomThreadPool.Process method", this); setMinThreads(); Log.Info("Sitecore.Foundation.SitecoreExtensions: Done running CustomThreadPool.Process method", this); }
public void Process(PipelineArgs args) { }
public virtual void Process(PipelineArgs args) { MvcSettings.RegisterObject <XmlBasedRenderingParser>(() => new CustomXmlBasedRenderingParser()); }
public void Process(PipelineArgs args) { RouteConfig.RegisterRoutes(RouteTable.Routes); }
public void Process(PipelineArgs args) { //Log.Info("Sitecore is starting", this); //RouteConfig.RegisterRoutes(RouteTable.Routes); }
public void Process(PipelineArgs args) { GlobalConfiguration.Configure(Configure); }
public void Process(PipelineArgs args) { this.RegisterHttpRoutes(RouteTable.Routes); }
protected IEnumerable <string> GetSuspiciousSubStates(PipelineArgs args) { return(args.CustomData[OrderStateCode.Suspicious] as HashSet <string> ?? new HashSet <string>()); }
public virtual void Process(PipelineArgs args) { JobManager jobMgr = new JobManager(); jobMgr.ScheduleJobs(); }
public void Process(PipelineArgs args) { SetCampaignFieldValue(); }
private async Task Register(PipelineArgs arg) { CertificateHttpClientHandlerModifierOptions options = CertificateHttpClientHandlerModifierOptions.Parse("StoreName=My;StoreLocation=LocalMachine;FindType=FindByThumbprint;FindValue=" + Constants.XConnectThumbprint); var certificateModifier = new CertificateHttpClientHandlerModifier(options); List <IHttpClientModifier> clientModifiers = new List <IHttpClientModifier>(); var timeoutClientModifier = new TimeoutHttpClientModifier(new TimeSpan(0, 0, 20)); clientModifiers.Add(timeoutClientModifier); var collectionClient = new CollectionWebApiClient(new Uri(Constants.XConnectInstance + "/odata"), clientModifiers, new[] { certificateModifier }); var searchClient = new SearchWebApiClient(new Uri(Constants.XConnectInstance + "/odata"), clientModifiers, new[] { certificateModifier }); var configurationClient = new ConfigurationWebApiClient(new Uri(Constants.XConnectInstance + "/configuration"), clientModifiers, new[] { certificateModifier }); var cfg = new XConnectClientConfiguration( new XdbRuntimeModel(ProductTrackingModel.Model), collectionClient, searchClient, configurationClient); foreach (var interactionEvent in arg.ProcessingResult.Interaction.Interaction.Events) { if (interactionEvent.CustomValues != null && interactionEvent.CustomValues.Count > 0) { var name = interactionEvent.CustomValues["name"].Split(' '); var firstName = name[0] != null ? name[0] : "Not Available"; var lastName = name.Length > 1 ? name[1] : "Not Available"; var twitterHandle = interactionEvent.CustomValues["twitterhandle"]; var twitterHandleCreated = Convert.ToDateTime(interactionEvent.CustomValues["twitterhandlecreated"]); var numberOfFollowers = Convert.ToInt32(interactionEvent.CustomValues["followerscount"]); var tweetfulltext = interactionEvent.CustomValues["tweetfulltext"]; var hashtag = interactionEvent.CustomValues["hashtags"]; await cfg.InitializeAsync(); using (var client = new XConnectClient(cfg)) { try { ContactIdentifier contactIdentifier = new ContactIdentifier("twitter", twitterHandle, ContactIdentifierType.Known); // Let's just save this for later //TODO: If time check for existing user. Identifier = contactIdentifier.Identifier; Contact contact = new Contact(contactIdentifier); //TODO Get from args custom values "Name". If space save first and last PersonalInformation personalInfo = new PersonalInformation() { FirstName = firstName, LastName = lastName }; // TODO get from args TwitterAccountInfo visitorInfo = new TwitterAccountInfo() { TwitterHandle = twitterHandle, TwitterStartDate = twitterHandleCreated, NumberOfFollowers = numberOfFollowers, VerifiedTwitterHandle = false }; client.AddContact(contact); client.SetFacet(contact, TwitterAccountInfo.DefaultFacetKey, visitorInfo); client.SetFacet(contact, PersonalInformation.DefaultFacetKey, personalInfo); var interaction = new Interaction(contact, InteractionInitiator.Contact, arg.ProcessingResult.Interaction.Interaction.ChannelId, ""); // GUID should be from a channel item in Sitecore //TODO Get from args var productTweet = new ProductTweet(); productTweet.Tweet = tweetfulltext; productTweet.ProductHashtag = hashtag; productTweet.TwitterHandle = twitterHandle; ITextAnalyticsClient cogClient = new TextAnalyticsClient(new ApiKeyServiceClientCredentials()) { Endpoint = "https://westus.api.cognitive.microsoft.com" }; SentimentBatchResult result = cogClient.SentimentAsync( new MultiLanguageBatchInput( new List <MultiLanguageInput>() { new MultiLanguageInput("en", new Guid().ToString(), productTweet.Tweet) })).Result; if (result != null && result.Documents.Any()) { var firstDocument = result.Documents.First(); if (firstDocument != null) { productTweet.Sentiment = firstDocument.Score; } } interaction.Events.Add(new ProductReviewOutcome(productTweet, DateTime.UtcNow)); client.AddInteraction(interaction); await client.SubmitAsync(); } catch (XdbExecutionException ex) { // Deal with exception Logger.LogInformation("Tres Divas Twitter Interactions EnrichmentPipelineProcessor: ", ex); } } } } }
public void Process(PipelineArgs args) { Assert.ArgumentNotNull(args, "args"); MyCachingCounters.Initialize(); }
public virtual void Process(PipelineArgs args) { MediaManager.Cache = new OptimizingMediaCache(new MediaOptimizer()); }
public void Process(PipelineArgs args) { Log.Info("Sitecore is loading Cognitive Services Routes", this); RouteConfig.RegisterRoutes(RouteTable.Routes); }
public virtual void Process(PipelineArgs args) { ViewEngines.Engines.Add(DependencyResolver.Current.GetService <SitecoreNitroNetViewEngine>()); }
protected virtual void RegisterRoutes(System.Web.Routing.RouteCollection routes, PipelineArgs args) { MapSearchController(routes); }
public virtual void Process(PipelineArgs args) { Register(); }
public void Process(PipelineArgs args) { GlassMapperSc.Start(); }
public override PipelineResult <InstallPipelineContext> Execute(PipelineArgs <InstallPipelineContext> args) { // Theme Color Picker var currentColorPicker = _dataTypeService.GetDataType(VendrCheckoutConstants.DataTypes.Guids.ThemeColorPickerGuid); if (currentColorPicker == null) { if (_propertyEditors.TryGet(Constants.PropertyEditors.Aliases.ColorPicker, out IDataEditor editor)) { var dataType = CreateDataType(editor, x => { x.Key = VendrCheckoutConstants.DataTypes.Guids.ThemeColorPickerGuid; x.Name = "[Vendr Checkout] Theme Color Picker"; x.DatabaseType = ValueStorageType.Nvarchar; x.Configuration = new ColorPickerConfiguration { Items = VendrCheckoutConstants.ColorMap.Select((kvp, idx) => new ValueListConfiguration.ValueListItem { Id = idx, Value = "{\"value\":\"" + kvp.Key + "\", \"label\":\"" + kvp.Value + "\"}" }).ToList(), UseLabel = false }; }); _dataTypeService.Save(dataType); } } else { currentColorPicker.Configuration = new ColorPickerConfiguration { Items = VendrCheckoutConstants.ColorMap.Select((kvp, idx) => new ValueListConfiguration.ValueListItem { Id = idx, Value = "{\"value\":\"" + kvp.Key + "\", \"label\":\"" + kvp.Value + "\"}" }).ToList(), UseLabel = false }; _dataTypeService.Save(currentColorPicker); } // Step Picker var stepPickerItems = new List <ValueListConfiguration.ValueListItem> { new ValueListConfiguration.ValueListItem { Id = 1, Value = "Information" }, new ValueListConfiguration.ValueListItem { Id = 2, Value = "ShippingMethod" }, new ValueListConfiguration.ValueListItem { Id = 3, Value = "PaymentMethod" }, new ValueListConfiguration.ValueListItem { Id = 4, Value = "Review" }, new ValueListConfiguration.ValueListItem { Id = 5, Value = "Payment" }, new ValueListConfiguration.ValueListItem { Id = 6, Value = "Confirmation" } }; var currentStepPicker = _dataTypeService.GetDataType(VendrCheckoutConstants.DataTypes.Guids.StepPickerGuid); if (currentStepPicker == null) { if (_propertyEditors.TryGet(Constants.PropertyEditors.Aliases.DropDownListFlexible, out IDataEditor editor)) { var dataType = CreateDataType(editor, x => { x.Key = VendrCheckoutConstants.DataTypes.Guids.StepPickerGuid; x.Name = "[Vendr Checkout] Step Picker"; x.DatabaseType = ValueStorageType.Nvarchar; x.Configuration = new DropDownFlexibleConfiguration { Items = stepPickerItems, Multiple = false }; }); _dataTypeService.Save(dataType); } } else { currentStepPicker.Configuration = new DropDownFlexibleConfiguration { Items = stepPickerItems, Multiple = false }; _dataTypeService.Save(currentStepPicker); } // Continue the pipeline return(Ok()); }
public void Process(PipelineArgs args) { AutoMapperConfiguration.Configure(); }