Search in sources :

Example 1 with ProblemWrapper

use of jetbrains.buildServer.server.rest.data.problem.ProblemWrapper in project teamcity-rest by JetBrains.

the class InvestigationFinder method getPrefilteredItems.

@NotNull
@Override
public ItemHolder<InvestigationWrapper> getPrefilteredItems(@NotNull final Locator locator) {
    final String problemDimension = locator.getSingleDimensionValue(PROBLEM_DIMENSION);
    if (problemDimension != null) {
        final ProblemWrapper problem = myProblemFinder.getItem(problemDimension);
        return getItemHolder(problem.getInvestigations());
    }
    final String testDimension = locator.getSingleDimensionValue(TEST_DIMENSION);
    if (testDimension != null) {
        final STest test = myTestFinder.getItem(testDimension);
        return getItemHolder(getInvestigationWrappers(test));
    }
    final String buildTypeDimension = locator.getSingleDimensionValue(BUILD_TYPE);
    if (buildTypeDimension != null) {
        final SBuildType buildType = myBuildTypeFinder.getBuildType(null, buildTypeDimension, false);
        return getItemHolder(getInvestigationWrappersForBuildType(buildType));
    }
    @Nullable User user = null;
    final String investigatorDimension = locator.getSingleDimensionValue(ASSIGNEE);
    if (investigatorDimension != null) {
        user = myUserFinder.getItem(investigatorDimension);
    }
    final String assignmentProjectDimension = locator.getSingleDimensionValue(ASSIGNMENT_PROJECT);
    if (assignmentProjectDimension != null) {
        @NotNull final SProject project = myProjectFinder.getItem(assignmentProjectDimension);
        return getItemHolder(getInvestigationWrappersForProject(project, user));
    }
    final String affectedProjectDimension = locator.getSingleDimensionValue(AFFECTED_PROJECT);
    if (affectedProjectDimension != null) {
        @NotNull final SProject project = myProjectFinder.getItem(affectedProjectDimension);
        return getItemHolder(getInvestigationWrappersForProjectWithSubprojects(project, user));
    }
    if (user != null) {
        return getItemHolder(getInvestigationWrappersForProjectWithSubprojects(myProjectFinder.getRootProject(), user));
    }
    locator.markUnused(ASSIGNEE);
    return getItemHolder(getInvestigationWrappersForProjectWithSubprojects(myProjectFinder.getRootProject(), null));
}
Also used : User(jetbrains.buildServer.users.User) SBuildType(jetbrains.buildServer.serverSide.SBuildType) ProblemWrapper(jetbrains.buildServer.server.rest.data.problem.ProblemWrapper) STest(jetbrains.buildServer.serverSide.STest) SProject(jetbrains.buildServer.serverSide.SProject) NotNull(org.jetbrains.annotations.NotNull) Nullable(org.jetbrains.annotations.Nullable) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ProblemWrapper (jetbrains.buildServer.server.rest.data.problem.ProblemWrapper)1 SBuildType (jetbrains.buildServer.serverSide.SBuildType)1 SProject (jetbrains.buildServer.serverSide.SProject)1 STest (jetbrains.buildServer.serverSide.STest)1 User (jetbrains.buildServer.users.User)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1