private SearchQueryRule BuildSearchQueryRule(DuplicatesRuleDTO rule, List <DuplicatesColumnData> model, string schemaName)
        {
            if (rule.RuleBody == null)
            {
                return(null);
            }
            var ruleBody = rule.RuleBody;

            if (string.IsNullOrEmpty(ruleBody.RootSchemaName) || ruleBody.RootSchemaName == schemaName)
            {
                var searchQueryRule = new SearchQueryRule {
                    Filters = new List <SearchQueryFilter>()
                };
                foreach (var ruleFiler in ruleBody.Filters)
                {
                    var searchQueryFilter = BuildSearchQueryFilter(ruleFiler, model);
                    if (searchQueryFilter != null)
                    {
                        searchQueryRule.Filters.Add(searchQueryFilter);
                    }
                    else
                    {
                        return(null);
                    }
                }
                return(searchQueryRule);
            }
            return(null);
        }
Ejemplo n.º 2
0
        private DuplicatesRuleDTO GetDtoFromEntity(Entity duplicateRuleEntity)
        {
            if (duplicateRuleEntity == null)
            {
                return(null);
            }
            var duplicatesRuleDTO = new DuplicatesRuleDTO {
                IsActive         = duplicateRuleEntity.GetTypedColumnValue <bool>("IsActive"),
                UseAtSave        = duplicateRuleEntity.GetTypedColumnValue <bool>("UseAtSave"),
                RuleName         = duplicateRuleEntity.GetTypedColumnValue <string>("Name"),
                SchemaName       = duplicateRuleEntity.GetTypedColumnValue <string>(_schemaNameColumn.Name),
                SearchSchemaName = duplicateRuleEntity.GetTypedColumnValue <string>(_sourceSchemaColumn.Name)
            };

            try {
                var ruleBody = duplicateRuleEntity.GetTypedColumnValue <string>("RuleBody");
                duplicatesRuleDTO.RuleBody = (DuplicatesRuleBody)Json.Deserialize(ruleBody,
                                                                                  typeof(DuplicatesRuleBody));
            } catch (Exception ex) {
                duplicatesRuleDTO.RuleBody = null;
                _log.Error("Error during retrieving rulebody", ex);
            }
            return(duplicatesRuleDTO);
        }
Ejemplo n.º 3
0
 public bool Update(DuplicatesRuleDTO dto)
 {
     throw new NotImplementedException();
 }