@Test void mapQueryRuleAttributeSearch() { QueryRule queryRule = mock(QueryRule.class); when(queryRule.getField()).thenReturn("attr"); when(queryRule.getValue()).thenReturn("val"); Attribute attribute = mock(Attribute.class); when(attribute.getDataType()).thenReturn(STRING); when(documentIdGenerator.generateId(attribute)).thenReturn("attr"); EntityType entityType = mock(EntityType.class); when(entityType.getAttributeByName("attr")).thenReturn(attribute); QueryBuilder queryBuilder = queryClauseSearchGenerator.mapQueryRule(queryRule, entityType); QueryBuilder expectedQueryBuilder = QueryBuilders.matchQuery("attr", "val"); assertQueryBuilderEquals(expectedQueryBuilder, queryBuilder); }
QueryBuilder mapQueryRule(QueryRule queryRule, EntityType entityType) { if (queryRule.getValue() == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (queryRule.getField() == null) { return createQueryClauseSearchAll(queryRule); } else { return createQueryClauseSearchAttribute(queryRule, entityType); } }
QueryClauseSearchGenerator extends BaseQueryClauseGenerator { QueryBuilder mapQueryRule(QueryRule queryRule, EntityType entityType) { if (queryRule.getValue() == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (queryRule.getField() == null) { return createQueryClauseSearchAll(queryRule); } else { return createQueryClauseSearchAttribute(queryRule, entityType); } } }
QueryClauseSearchGenerator extends BaseQueryClauseGenerator { QueryBuilder mapQueryRule(QueryRule queryRule, EntityType entityType) { if (queryRule.getValue() == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (queryRule.getField() == null) { return createQueryClauseSearchAll(queryRule); } else { return createQueryClauseSearchAttribute(queryRule, entityType); } } QueryClauseSearchGenerator(DocumentIdGenerator documentIdGenerator); }
QueryClauseSearchGenerator extends BaseQueryClauseGenerator { QueryBuilder mapQueryRule(QueryRule queryRule, EntityType entityType) { if (queryRule.getValue() == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (queryRule.getField() == null) { return createQueryClauseSearchAll(queryRule); } else { return createQueryClauseSearchAttribute(queryRule, entityType); } } QueryClauseSearchGenerator(DocumentIdGenerator documentIdGenerator);  }
QueryClauseSearchGenerator extends BaseQueryClauseGenerator { QueryBuilder mapQueryRule(QueryRule queryRule, EntityType entityType) { if (queryRule.getValue() == null) { throw new MolgenisQueryException(QUERY_VALUE_CANNOT_BE_NULL_MSG); } if (queryRule.getField() == null) { return createQueryClauseSearchAll(queryRule); } else { return createQueryClauseSearchAttribute(queryRule, entityType); } } QueryClauseSearchGenerator(DocumentIdGenerator documentIdGenerator);   }