private Collection getAllRelevantIssueTypeObjects() {
    if (allRelevantIssueTypeObjects == null) {
      if (subTaskManager.isSubTasksEnabled()) {
        allRelevantIssueTypeObjects = constantsManager.getAllIssueTypeObjects();
      } else {
        allRelevantIssueTypeObjects = constantsManager.getRegularIssueTypeObjects();
      }
    }

    return allRelevantIssueTypeObjects;
  }
  public void testHeadingMarkupForResolutionGV() {

    final IssueConstant issueConstant = createMock(IssueConstant.class);

    expect(issueConstant.getNameTranslation()).andStubReturn("theNameTranslated");
    expect(issueConstant.getDescTranslation()).andStubReturn("theDescTranslated");
    expect(issueConstant.getIconUrl()).andStubReturn("http://jira/icon.gif");

    replay(issueConstant);

    expect(constantsManager.getIssueConstant((GenericValue) anyObject())).andReturn(issueConstant);

    replay(constantsManager);

    String s =
        ObjectToFieldValueMapper.transform(
                "resolution", new MockGenericValue("foo"), FULL_URL, transformer)
            .getHtml();

    assertEquals(
        "<img src=\"http://jira/icon.gif\" height=\"16\" width=\"16\" alt=\"theNameTranslated\" title=\"theNameTranslated - theDescTranslated\"/><a href='"
            + FULL_URL
            + "' title='theDescTranslated'>theNameTranslated</a>",
        s);
  }
 public Collection getAllIssueTypes() throws Exception {
   if (subTaskManager.isSubTasksEnabled()) {
     return constantsManager.getAllIssueTypeObjects();
   } else {
     final ArrayList returnValues = new ArrayList(constantsManager.getRegularIssueTypeObjects());
     // Now, since subtasks are disabled we want to make sure we add any subtask issue types that
     // are already
     // selected in the custom field and make sure that the sort order is the same as when we call
     // getAllIssueTypeObjects
     final List intersection =
         new ArrayList(
             CollectionUtils.intersection(
                 constantsManager.getSubTaskIssueTypes(),
                 getCustomField().getAssociatedIssueTypes()));
     Collections.sort(intersection);
     for (final Object anIntersection : intersection) {
       final GenericValue genericValue = (GenericValue) anIntersection;
       returnValues.add(0, constantsManager.getIssueTypeObject(genericValue.getString("id")));
     }
     return returnValues;
   }
 }
Ejemplo n.º 4
0
 public void initOptionIds(Collection optionIds) {
   // Set up the options list
   this.optionIds = optionIds;
   regularOptions = new ArrayList<IssueConstantOption>();
   subTaskOptions = new ArrayList<IssueConstantOption>();
   for (final Object optionId1 : optionIds) {
     String optionId = (String) optionId1;
     final IssueType issueType = constantsManager.getIssueTypeObject(optionId);
     if (!issueType.isSubTask()) {
       regularOptions.add(new IssueConstantOption(issueType));
     } else {
       subTaskOptions.add(new IssueConstantOption(issueType));
     }
   }
 }
  public ClauseContext getClauseContext(final User searcher, final TerminalClause terminalClause) {
    final Operator operator = terminalClause.getOperator();
    if (!handlesOperator(operator)) {
      return ClauseContextImpl.createGlobalClauseContext();
    }

    final List<QueryLiteral> values =
        jqlOperandResolver.getValues(searcher, terminalClause.getOperand(), terminalClause);
    Set<String> issueTypeIds = new HashSet<String>();
    if (values != null) {
      for (QueryLiteral value : values) {
        // if we have an empty literal, the Global context will not impact on any existing contexts,
        // so do nothing
        if (!value.isEmpty()) {
          issueTypeIds.addAll(getIds(value));
        }
      }
    }

    if (!issueTypeIds.isEmpty() && isNegationOperator(operator)) {
      final Set<String> allIssueTypes = new HashSet<String>(constantsManager.getAllIssueTypeIds());
      allIssueTypes.removeAll(issueTypeIds);
      issueTypeIds = allIssueTypes;
    }

    if (issueTypeIds.isEmpty()) {
      return ClauseContextImpl.createGlobalClauseContext();
    }

    final Set<ProjectIssueTypeContext> contexts = new HashSet<ProjectIssueTypeContext>();
    for (String issueTypeId : issueTypeIds) {
      contexts.add(
          new ProjectIssueTypeContextImpl(
              AllProjectsContext.INSTANCE, new IssueTypeContextImpl(issueTypeId)));
    }

    return new ClauseContextImpl(contexts);
  }
Ejemplo n.º 6
0
 public String getStatusName(String id) {
   return constantsManager.getStatus(id).getString("name");
 }
 public GenericValue getIssueType() {
   return constantsManager.getIssueType(getIssueTypeId());
 }