public MessageSet validate( final User searcher, final FunctionOperand functionOperand, final TerminalClause terminalClause) { final MessageSet messageSet; I18nHelper i18n = getI18n(); if (functionOperand.getArgs().size() == 0 && searcher == null) { messageSet = new MessageSetImpl(); messageSet.addErrorMessage( i18n.getText("jira.jql.function.anonymous.disallowed", getFunctionName())); } else { MessageSet messages = validateNumberOfArgs(functionOperand, i18n); if (!messages.hasAnyErrors()) { if (functionOperand.getArgs().size() == 1) { final String username = functionOperand.getArgs().get(0); if (userUtil.getUserObject(username) == null) { messages.addErrorMessage( i18n.getText(getUserNotFoundMessageKey(), functionOperand.getName(), username)); } } } return messages; } return messageSet; }
public List<QueryLiteral> getValues( final QueryCreationContext queryCreationContext, final FunctionOperand functionOperand, final TerminalClause terminalClause) { com.atlassian.jira.util.dbc.Assertions.notNull("queryCreationContext", queryCreationContext); User user; if (functionOperand.getArgs().size() == 1) { final String username = functionOperand.getArgs().get(0); user = userUtil.getUserObject(username); } else { user = queryCreationContext.getQueryUser(); } if (user == null) { return Collections.emptyList(); } return getFunctionValuesList(queryCreationContext, functionOperand, user); }