コード例 #1
0
 /**
  * @param value the query literal; must not be null or the empty literal.
  * @return a list of ids of issue types represented by this literal; never null.
  */
 List<String> getIds(final QueryLiteral value) {
   if (value.getStringValue() != null) {
     return resolver.getIndexedValues(value.getStringValue());
   } else if (value.getLongValue() != null) {
     return resolver.getIndexedValues(value.getLongValue());
   } else {
     throw new IllegalStateException("Invalid query literal.");
   }
 }
コード例 #2
0
 /**
  * @param searcher the user performing the search
  * @param clause the clause
  * @return a set of Strings representing the ids of the statuses; never null.
  */
 Set<String> getIds(final User searcher, final TerminalClause clause) {
   final List<QueryLiteral> literals =
       jqlOperandResolver.getValues(searcher, clause.getOperand(), clause);
   Set<String> ids = new HashSet<String>();
   if (literals != null) {
     for (QueryLiteral literal : literals) {
       if (literal.getLongValue() != null) {
         ids.addAll(issueConstantInfoResolver.getIndexedValues(literal.getLongValue()));
       } else if (literal.getStringValue() != null) {
         ids.addAll(issueConstantInfoResolver.getIndexedValues(literal.getStringValue()));
       } else if (literal.isEmpty()) {
         // empty literals would generate a Global context, but this does not impact on other
         // contexts
       }
     }
   }
   return ids;
 }
コード例 #3
0
  private List<IssueSecurityLevel> _getIssueSecurityLevels(
      User searcher, boolean overrideSecurity, List<QueryLiteral> rawValues) {
    notNull("rawValues", rawValues);
    List<IssueSecurityLevel> matchingLevels = new ArrayList<IssueSecurityLevel>();

    for (QueryLiteral rawValue : rawValues) {
      notNull("rawValue", rawValue);
      if (rawValue.getStringValue() != null) {
        matchingLevels.addAll(
            getIssueSecurityLevelsForString(searcher, overrideSecurity, rawValue.getStringValue()));
      } else if (rawValue.getLongValue() != null) {
        matchingLevels.addAll(
            getIssueSecurityLevelsForLong(searcher, overrideSecurity, rawValue.getLongValue()));
      } else if (rawValue.isEmpty()) {
        // we somehow got an Empty literal - use null to represent this
        matchingLevels.add(null);
      }
    }

    return matchingLevels;
  }
コード例 #4
0
 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;
 }