/// <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); }
public CurrencyRateStorage(UserConnection userConnection, EntitySchema schema) { userConnection.CheckArgumentNull(nameof(userConnection)); schema.CheckArgumentNull(nameof(schema)); UserConnection = userConnection; CurrencyRateSchema = schema; }
/// <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)); }
public Dictionary <string, string> GetHintList(string subjectName, string hintText) { subjectName.CheckArgumentNullOrEmpty(nameof(subjectName)); _hintEntityEntitySchema = UserConnection.EntitySchemaManager.FindInstanceByName(subjectName); _hintEntityEntitySchema.CheckArgumentNull(nameof(_hintEntityEntitySchema)); if (_hintEntityEntitySchema.PrimaryDisplayColumn == null) { return(null); } _hintQuery = new EntitySchemaQuery(_hintEntityEntitySchema); _hintQuery.PrimaryQueryColumn.IsAlwaysSelect = true; _hintQuery.AddColumn(_hintEntityEntitySchema.PrimaryDisplayColumn.Name).OrderByAsc(); var nameColumn = _hintEntityEntitySchema.Columns.FindByName("Name"); if (nameColumn != null) { _hintQuery.AddColumn(nameColumn.Name); } var typeColumn = GetTypedColumnForHintQuery(); if (typeColumn != null) { _hintQuery.AddColumn(typeColumn.Name); } var folderTypeColumn = _hintEntityEntitySchema.Columns.FindByName("FolderType"); if (folderTypeColumn != null) { _hintQuery.AddColumn(folderTypeColumn.Name); } AddSysWorkspaceFilterToHintQuery(); AddIsMaxVersionFilterToHintQuery(); AddIsTagPropertyToHintQuery(); AddhintTextFilterToHintQuery(hintText); var options = new EntitySchemaQueryOptions { PageableDirection = PageableSelectDirection.First, PageableRowCount = 21, PageableConditionValues = new Dictionary <string, object>() }; var entityCollection = _hintQuery.GetEntityCollection(UserConnection, options); var hintCollection = new Dictionary <string, string>(); foreach (var entity in entityCollection) { if (_hintEntityEntitySchema.Name == "VwSysProcess") { if (hintCollection.ContainsKey(entity.PrimaryDisplayColumnValue)) { hintCollection[entity.PrimaryDisplayColumnValue] = null; } else { hintCollection.Add(entity.PrimaryDisplayColumnValue, entity.GetTypedColumnValue <string>(nameColumn.Name)); } } else { string hintData = ""; Guid hintId = entity.PrimaryColumnValue; if (typeColumn != null) { var result = new { value = hintId, typeId = entity.GetTypedColumnValue <string>(typeColumn.ColumnValueName) }; hintData = JsonConvert.SerializeObject(result); } else if (folderTypeColumn != null) { var primaryDisplayValue = entity.PrimaryDisplayColumnValue; var result = new { value = hintId, displayValue = primaryDisplayValue, sectionFilter = new { value = hintId, displayValue = primaryDisplayValue, folderType = new { value = entity.GetTypedColumnValue <Guid>(folderTypeColumn.ColumnValueName) }, folderId = hintId } }; hintData = JsonConvert.SerializeObject(result); } else { hintData = hintId.ToString(); } hintCollection[entity.PrimaryDisplayColumnValue] = hintData; } } return(hintCollection); }