@SuppressWarnings("deprecation") @Test void testUseNotAnalyzedFieldCompound() { Attribute attribute = when(mock(Attribute.class).getDataType()).thenReturn(COMPOUND).getMock(); assertThrows(MolgenisQueryException.class, () -> queryGenerator.useNotAnalyzedField(attribute)); }
boolean useNotAnalyzedField(Attribute attr) { AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: return false; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return true; case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: return useNotAnalyzedField(attr.getRefEntity().getIdAttribute()); case COMPOUND: throw new MolgenisQueryException(new IllegalAttributeTypeException(attrType)); default: throw new UnexpectedEnumException(attrType); } }
BaseQueryClauseGenerator implements QueryClauseGenerator { boolean useNotAnalyzedField(Attribute attr) { AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: return false; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return true; case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: return useNotAnalyzedField(attr.getRefEntity().getIdAttribute()); case COMPOUND: throw new MolgenisQueryException(new IllegalAttributeTypeException(attrType)); default: throw new UnexpectedEnumException(attrType); } } }
BaseQueryClauseGenerator implements QueryClauseGenerator { boolean useNotAnalyzedField(Attribute attr) { AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: return false; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return true; case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: return useNotAnalyzedField(attr.getRefEntity().getIdAttribute()); case COMPOUND: throw new MolgenisQueryException(new IllegalAttributeTypeException(attrType)); default: throw new UnexpectedEnumException(attrType); } } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); }
BaseQueryClauseGenerator implements QueryClauseGenerator { boolean useNotAnalyzedField(Attribute attr) { AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: return false; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return true; case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: return useNotAnalyzedField(attr.getRefEntity().getIdAttribute()); case COMPOUND: throw new MolgenisQueryException(new IllegalAttributeTypeException(attrType)); default: throw new UnexpectedEnumException(attrType); } } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); @Override Operator getOperator(); @Override QueryBuilder createQueryClause(QueryRule queryRule, EntityType entityType); }
BaseQueryClauseGenerator implements QueryClauseGenerator { boolean useNotAnalyzedField(Attribute attr) { AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: case DATE: case DATE_TIME: case DECIMAL: case INT: case LONG: return false; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return true; case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: return useNotAnalyzedField(attr.getRefEntity().getIdAttribute()); case COMPOUND: throw new MolgenisQueryException(new IllegalAttributeTypeException(attrType)); default: throw new UnexpectedEnumException(attrType); } } BaseQueryClauseGenerator(DocumentIdGenerator documentIdGenerator, Operator operator); @Override Operator getOperator(); @Override QueryBuilder createQueryClause(QueryRule queryRule, EntityType entityType);  }