001/*
002 * SonarQube, open source software quality management tool.
003 * Copyright (C) 2008-2013 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * SonarQube is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * SonarQube is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.api.issue;
021
022import org.sonar.api.component.Component;
023import org.sonar.api.rules.Rule;
024import org.sonar.api.user.User;
025import org.sonar.api.utils.Paging;
026
027import javax.annotation.CheckForNull;
028
029import java.util.Collection;
030import java.util.List;
031
032/**
033 * @since 3.6
034 */
035public interface IssueQueryResult {
036  /**
037   * Non-null paginated list of issues.
038   */
039  List<Issue> issues();
040
041  /**
042   * Returns the first issue in the list.
043   * @throws IllegalStateException if the list is empty.
044   */
045  Issue first();
046
047  /**
048   * Returns the rule associated to the given issue.
049   */
050  Rule rule(Issue issue);
051
052  /**
053   * The rules involved in the paginated {@link #issues()}.
054   */
055  Collection<Rule> rules();
056
057  Component component(Issue issue);
058
059  /**
060   * The components involved in the paginated {@link #issues()}.
061   */
062  Collection<Component> components();
063
064  Component project(Issue issue);
065
066  /**
067   * The projects involved in the paginated {@link #issues()}.
068   */
069  Collection<Component> projects();
070
071  @CheckForNull
072  ActionPlan actionPlan(Issue issue);
073
074  /**
075   * The action plans involved in the paginated {@link #issues()}.
076   */
077  Collection<ActionPlan> actionPlans();
078
079  /**
080   * The users involved in the paginated {@link #issues()}, for example people who added a comment, reported an issue
081   * or are assigned to issues.
082   */
083  Collection<User> users();
084
085  /**
086   * Returns the user with the given login. Users that are not returned by {@link #users()} are ignored.
087   */
088  @CheckForNull
089  User user(String login);
090
091  /**
092   * Non-null data about paging of issues
093   */
094  Paging paging();
095
096  /**
097   * True if too many issues have been found. In this case results are truncated.
098   */
099  boolean maxResultsReached();
100}