public ConfigurationServiceResponse PublishNotificationInfo(string groupName = null) { IDictionary <string, object> parameters = null; var systemUserConnection = UserConnection.AppConnection.SystemUserConnection; var response = new ConfigurationServiceResponse(); if (!string.IsNullOrEmpty(groupName)) { parameters = new Dictionary <string, object>(); parameters.Add("type", "byGroup"); parameters.Add("typeParameter", groupName); } try { NotificationInfoRunner runner = ClassFactory.ForceGet <NotificationInfoRunner>( typeof(NotificationInfoRunner).AssemblyQualifiedName, new ConstructorArgument("userConnection", systemUserConnection), new ConstructorArgument("parameters", parameters)); runner.Run(); } catch (Exception ex) { response.SetErrorInfo(ex); } return(response); }
/// <summary> /// Instantiates handlers for all active header properties and runs Check-methods. /// </summary> /// <param name="headerProperties">Header properties.</param> /// <returns>True if all of Check-methods returns true. /// False if at least one of Check-methods returns false.</returns> public virtual bool CheckAllHeaderProperties(string headerProperties) { var esq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "HeaderProperty"); string flagName = esq.AddColumn("Name").Name; string handlerTypeName = esq.AddColumn("Handler").Name; esq.Filters.Add(esq.CreateFilterWithParameters(FilterComparisonType.Equal, "IsActive", true)); EntityCollection headerPropertiesToCheck = esq.GetEntityCollection(UserConnection); Dictionary <string, object> propertyValues = ExtractPropertyValues(headerProperties); foreach (var headerProperty in headerPropertiesToCheck) { var propertyName = headerProperty.GetTypedColumnValue <string>(flagName); var typeName = headerProperty.GetTypedColumnValue <string>(handlerTypeName); object propertyValue; if (propertyValues.TryGetValue(propertyName.ToLower(), out propertyValue)) { Type classType = Type.GetType(typeName); if (classType != null) { string assemblyQualifiedName = classType.AssemblyQualifiedName; var handler = ClassFactory.ForceGet <IHeaderPropertyHandler>(assemblyQualifiedName); if (!handler.Check(propertyValue)) { return(false); } } } } return(true); }
protected void ReadData(IDataReader reader) { string className = reader.GetColumnValue <string>("FullClassName"); var handler = ClassFactory.ForceGet <IGeneratedWebFormProcessHandler>(className); ProcessHandlers.Add(handler); }
private INotificationInfoExecutor GetExecutor() { return(ClassFactory.ForceGet <INotificationInfoExecutor>(GetName <NotificationInfoExecutor>(), new ConstructorArgument("userConnection", _userConnection), new ConstructorArgument("repository", _repository), new ConstructorArgument("handlers", _handlers), new ConstructorArgument("parameters", _parameters))); }
/// <summary> /// Creates instance of dashboard item data. /// </summary> /// <param name="widgetType">Widget type name. Value must be set in attribute "DashboardItemDataAttribute" of specified class</param> /// <param name="dashboardName">Name of dashboard.</param> /// <param name="config">Configuration of dashboard.</param> /// <param name="timeZoneOffset">Offset in hours.</param> /// <returns>Instanceof dashboard item data.</returns> public IDashboardItemData CreateConcreteInstance(Type classType, string dashboardName, JObject config, int timeZoneOffset) { string assemblyQualifiedName = classType.AssemblyQualifiedName; return(ClassFactory.ForceGet <IDashboardItemData>(assemblyQualifiedName, new ConstructorArgument("dashboardName", dashboardName), new ConstructorArgument("config", config), new ConstructorArgument("userConnection", _userConnection), new ConstructorArgument("timeZoneOffset", timeZoneOffset))); }
/// <summary> /// Executes job. /// </summary> /// <param name="userConnection">User connection.</param> /// <param name="parameters">Parameters for instances class.</param> public void Execute(UserConnection userConnection, IDictionary <string, object> parameters) { if (IsFeatureEnabled(userConnection) == true) { NotificationInfoRunner runner = ClassFactory.ForceGet <NotificationInfoRunner>( typeof(NotificationInfoRunner).AssemblyQualifiedName, new ConstructorArgument("userConnection", userConnection), new ConstructorArgument("parameters", parameters)); runner.Run(); } }
private void InitializeClasses() { var store = ClassFactory.ForceGet <INotificationStore>(GetName <NotificationStore>()); var factory = ClassFactory.ForceGet <INotificationFactory>( GetName <NotificationFactory>(), new ConstructorArgument("userConnection", _userConnection)); _repository = ClassFactory.ForceGet <INotificationRepository>( GetName <NotificationRepository>(), new ConstructorArgument("store", store), new ConstructorArgument("factory", factory)); }
protected virtual IPushNotificationProvider CreateProviderInstance(string className, string settings) { Type classType = Type.GetType(className); IPushNotificationProvider providerInstance = null; if (classType != null) { string assemblyQualifiedName = classType.AssemblyQualifiedName; providerInstance = ClassFactory.ForceGet <IPushNotificationProvider>(assemblyQualifiedName, new ConstructorArgument("settings", settings)); } return(providerInstance); }
/// <summary> /// Method that returns instance of macros handler class. /// </summary> /// <param name="className">Name of instantiated class.</param> /// <returns>Strategy class instance.</returns> protected virtual IMacrosInvokable GetClassInstance(string className) { Type classType = Type.GetType(className); if (classType == null) { return(null); } string assemblyName = classType.AssemblyQualifiedName; var macrosInvokable = ClassFactory.ForceGet <IMacrosInvokable>(assemblyName); return(macrosInvokable); }
/// <summary> /// Method that returns instance of strategy class by name. /// </summary> /// <param name="className">Name of instantiated class.</param> /// <param name="arguments">Arguments for strategy class.</param> /// <returns>Strategy class instance.</returns> public virtual BaseTermStrategy <CaseTermInterval, CaseTermStates> GetItem(string className, Dictionary <string, object> arguments, UserConnection userConnection) { Type classType = Type.GetType(className); if (classType == null) { return(null); } string assemblyName = classType.AssemblyQualifiedName; var currentStrategy = ClassFactory.ForceGet <BaseTermStrategy <CaseTermInterval, CaseTermStates> >(assemblyName, new ConstructorArgument("userConnection", userConnection), new ConstructorArgument("args", arguments)); return(currentStrategy); }
/// <summary> /// Create instance for case rules. /// </summary> /// <param name="entity">Entity</param> public void Execute(Entity entity) { using (var dbExecutor = _userConnection.EnsureDBConnection()) { var oldValue = entity.GetTypedOldColumnValue <Guid>(StatusIdColumnName); var value = entity.GetTypedColumnValue <Guid>(StatusIdColumnName); var rulesSelect = GetRuleQuery(oldValue, value); using (IDataReader reader = rulesSelect.ExecuteReader(dbExecutor)) { while (reader.Read()) { string ruleClassName = reader.GetColumnValue <string>("ClassName"); var fullRuleTypeName = Type.GetType(ruleClassName).AssemblyQualifiedName; ICaseRuleHandler instance = ClassFactory.ForceGet <ICaseRuleHandler>(fullRuleTypeName, new ConstructorArgument("userConnection", _userConnection)); instance.Handle(entity); } } } }
/// <summary> /// Creates instance of dashboard item data for section. /// </summary> /// <param name="widgetType">Widget type name. Value must be set in attribute "DashboardItemDataAttribute" of specified class</param> /// <param name="dashboardName">Name of dashboard.</param> /// <param name="config">Configuration of dashboard.</param> /// <param name="bindingColumnValue">Value for section binding filter.</param> /// <param name="timeZoneOffset">Offset in hours.</param> /// <returns>Instanceof dashboard item data.</returns> public IDashboardItemData CreateInstance(string widgetType, string dashboardName, JObject config, string bindingColumnValue, int timeZoneOffset) { Type classType = GetClassType(widgetType); if (classType == null) { return(null); } else { return((IDashboardItemData)ClassFactory.ForceGet <IDashboardItemData>(classType.AssemblyQualifiedName, new ConstructorArgument("dashboardName", dashboardName), new ConstructorArgument("config", config), new ConstructorArgument("bindingColumnValue", bindingColumnValue), new ConstructorArgument("userConnection", _userConnection), new ConstructorArgument("timeZoneOffset", timeZoneOffset))); } }
private void InitializeHandlers() { _handlers = new List <INotificationInfoHandler>(); Assembly assembly = _userConnection.AppConnection.Workspace.WorkspaceAssembly; Type handlerType = typeof(INotificationInfoHandler); foreach (Type type in assembly.GetTypes()) { if (handlerType.IsAssignableFrom(type) && type != handlerType && type != typeof(BaseNotificationInfoHandler)) { _handlers.Add( ClassFactory.ForceGet <INotificationInfoHandler>(type.AssemblyQualifiedName, new ConstructorArgument("userConnection", _userConnection), new ConstructorArgument("parameters", _parameters)) ); } } }
/// <summary> /// Creates instance by <paramref name = "className"/>. /// </summary> /// <param name="className">Name of class.</param> /// <returns>Instance of <paramref name = "className"/>.</returns> public INotification CreateInstance(string className) { Type classType = Type.GetType(className); if (classType == null || (_userConnection.GetIsFeatureEnabled("NotificationV2") && GetIsClassMarkedAsObsolete(classType))) { return(null); } string assemblyQualifiedName = classType.AssemblyQualifiedName; try { return(ClassFactory.ForceGet <INotification>(assemblyQualifiedName, new ConstructorArgument("userConnection", _userConnection))); } catch (Exception ex) { _log.Error(ex.Message, ex); } return(null); }
private EmailWithMacrosManager CreateManagerInstace(string managerName) { return(ClassFactory.ForceGet <EmailWithMacrosManager>(managerName, new ConstructorArgument("userConnection", UserConnection))); }