Example #1
0
        /// <summary>
        /// Initializes the specified EntitySchemaQuery filters.
        /// </summary>
        /// <param name="userConnection">User connection.</param>
        /// <param name="processActivity">Process activity.</param>
        /// <param name="entitySchema">Entity schema.</param>
        /// <param name="esq">Instance of the EntitySchemaQuery class.</param>
        /// <param name="dataSourceFilters">Serialized filters.</param>
        public static void SpecifyESQFilters(UserConnection userConnection, ProcessActivity processActivity,
                                             EntitySchema entitySchema, EntitySchemaQuery esq, string dataSourceFilters)
        {
            userConnection.CheckArgumentNull("userConnection");
            processActivity.CheckArgumentNull("processActivity");
            entitySchema.CheckArgumentNull("entitySchema");
            esq.CheckArgumentNull("esq");
            if (string.IsNullOrEmpty(dataSourceFilters))
            {
                return;
            }
            IEntitySchemaQueryFilterItem esqFilter;
            var userConnectionArgument             = new ConstructorArgument("userConnection", userConnection);
            var processDataContractFilterConverter = ClassFactory
                                                     .Get <IProcessDataContractFilterConverter>(userConnectionArgument);

            if (processDataContractFilterConverter.GetIsDataContractFilter(dataSourceFilters))
            {
                ServiceConfig.Initialize();
                esqFilter = processDataContractFilterConverter.ConvertToEntitySchemaQueryFilterItem(esq,
                                                                                                    processActivity.Owner, dataSourceFilters);
            }
            else
            {
                DataSourceFilterCollection filterCollection = ConvertToProcessDataSourceFilterCollection(userConnection,
                                                                                                         entitySchema, processActivity, dataSourceFilters);
                esqFilter = filterCollection.ToEntitySchemaQueryFilterCollection(esq);
            }
            esq.Filters.Add(esqFilter);
        }
Example #2
0
        /// <summary>
        /// Converts a set of filters to process format.
        /// </summary>
        /// <param name="userConnection">User connection.</param>
        /// <param name="entitySchema">Entity schema.</param>
        /// <param name="processActivity">Process activity.</param>
        /// <param name="dataSourceFilters">Serialized filters.</param>
        /// <returns>Set of filters in the process format.</returns>
        public static string ConvertToProcessDataSourceFilters(UserConnection userConnection, EntitySchema entitySchema,
                                                               ProcessActivity processActivity, string dataSourceFilters)
        {
            userConnection.CheckArgumentNull("userConnection");
            entitySchema.CheckArgumentNull("entitySchema");
            processActivity.CheckArgumentNull("processActivity");
            dataSourceFilters.CheckArgumentNullOrEmpty("dataSourceFilters");
            var userConnectionArgument            = new ConstructorArgument("userConnection", userConnection);
            var processDataSourceFiltersConverter = ClassFactory
                                                    .Get <IProcessDataSourceFiltersConverter>(userConnectionArgument);

            return(processDataSourceFiltersConverter.ConvertToProcessDataSourceFilters(processActivity,
                                                                                       entitySchema.UId, dataSourceFilters));
        }