private boolean longValueExists(User searcher, String fieldName, Long longValue) { NameResolver<?> resolver = configurationManager.getNameResolver(fieldName.toLowerCase()); return resolver.idExists(longValue); }
public MessageSet validateValues(User searcher, String fieldName, List<QueryLiteral> rawValues) { final PossibleValuesHolder possibleValuesHolder = new PossibleValuesHolder(); final MessageSet messages = new MessageSetImpl(); for (QueryLiteral rawValue : rawValues) { if (rawValue.getStringValue() != null) { if (!stringValueExists( possibleValuesHolder, searcher, fieldName, rawValue.getStringValue())) { if (operandResolver.isFunctionOperand(rawValue.getSourceOperand())) { messages.addErrorMessage( getI18n(searcher) .getText( "jira.jql.clause.no.value.for.name.from.function", rawValue.getSourceOperand().getName(), fieldName)); } else { messages.addErrorMessage( getI18n(searcher) .getText( "jira.jql.clause.no.value.for.name", fieldName, rawValue.getStringValue())); } } } else if (rawValue.getLongValue() != null) { if (stringValueExists( possibleValuesHolder, searcher, fieldName, rawValue.getLongValue().toString())) { return messages; } if (!configurationManager.supportsIdSearching(fieldName.toLowerCase())) { if (operandResolver.isFunctionOperand(rawValue.getSourceOperand())) { messages.addErrorMessage( getI18n(searcher) .getText( "jira.jql.clause.no.value.for.name.from.function", rawValue.getSourceOperand().getName(), fieldName)); } else { messages.addErrorMessage( getI18n(searcher) .getText( "jira.jql.history.clause.not.string", rawValue.getSourceOperand().getName(), fieldName)); } } else { if (!longValueExists(searcher, fieldName, rawValue.getLongValue())) { if (operandResolver.isFunctionOperand(rawValue.getSourceOperand())) { messages.addErrorMessage( getI18n(searcher) .getText( "jira.jql.clause.no.value.for.name.from.function", rawValue.getSourceOperand().getName(), fieldName)); } else { messages.addErrorMessage( getI18n(searcher) .getText( "jira.jql.clause.no.value.for.id", fieldName, rawValue.getLongValue().toString())); } } } } } return messages; }