Search in sources :

Example 1 with BuildProblemImpl

use of jetbrains.buildServer.serverSide.impl.problems.BuildProblemImpl in project teamcity-rest by JetBrains.

the class Build method getProblemOccurrences.

@XmlElement(name = "problemOccurrences")
public ProblemOccurrences getProblemOccurrences() {
    return ValueWithDefault.decideDefault(myFields.isIncluded("problemOccurrences", false), () -> {
        final List<BuildProblem> problemOccurrences = ProblemOccurrenceFinder.getProblemOccurrences(myBuildPromotion);
        if (problemOccurrences.size() == 0)
            return null;
        int newProblemsCount = 0;
        int mutedProblemsCount = 0;
        for (BuildProblem problem : problemOccurrences) {
            if (problem.isMutedInBuild())
                mutedProblemsCount++;
            final Boolean isNew = ((BuildProblemImpl) problem).isNew();
            if (isNew != null && isNew)
                newProblemsCount++;
        }
        final Fields problemOccurrencesFields = myFields.getNestedField("problemOccurrences");
        final List<BuildProblem> problems = ValueWithDefault.decideDefault(problemOccurrencesFields.isIncluded("problemOccurrence", false), problemOccurrences);
        return new ProblemOccurrences(problems, problemOccurrences.size(), null, null, newProblemsCount, null, mutedProblemsCount, ProblemOccurrenceRequest.getHref(myBuildPromotion), null, problemOccurrencesFields, myBeanContext);
    });
}
Also used : ProblemOccurrences(jetbrains.buildServer.server.rest.model.problem.ProblemOccurrences) BuildProblem(jetbrains.buildServer.serverSide.problems.BuildProblem) BuildProblemImpl(jetbrains.buildServer.serverSide.impl.problems.BuildProblemImpl) XmlElement(javax.xml.bind.annotation.XmlElement)

Aggregations

XmlElement (javax.xml.bind.annotation.XmlElement)1 ProblemOccurrences (jetbrains.buildServer.server.rest.model.problem.ProblemOccurrences)1 BuildProblemImpl (jetbrains.buildServer.serverSide.impl.problems.BuildProblemImpl)1 BuildProblem (jetbrains.buildServer.serverSide.problems.BuildProblem)1