Search in sources :

Example 1 with BuildsFilterWithBuildExcludes

use of jetbrains.buildServer.server.rest.data.build.BuildsFilterWithBuildExcludes in project teamcity-rest by JetBrains.

the class BuildFinder method getBuilds.

/**
 * Finds builds by the specified criteria within specified range
 * This is slow!
 *
 * @param buildsFilter the filter for the builds to find
 * @return the builds found
 */
private List<SBuild> getBuilds(@NotNull final BuildsFilter buildsFilter) {
    final ArrayList<SBuild> result = new ArrayList<SBuild>();
    // todo: sort and ensure there are no duplicates
    result.addAll(BuildsFilterProcessor.getMatchingRunningBuilds(buildsFilter, myServiceLocator.getSingletonService(BuildsManager.class)));
    final Integer originalCount = buildsFilter.getCount();
    if (originalCount == null || result.size() < originalCount) {
        final BuildsFilter patchedBuildsFilter = new BuildsFilterWithBuildExcludes(buildsFilter, result);
        if (originalCount != null) {
            patchedBuildsFilter.setCount(originalCount - result.size());
        }
        result.addAll(BuildsFilterProcessor.getMatchingFinishedBuilds(patchedBuildsFilter, myServiceLocator.getSingletonService(BuildHistory.class)));
    }
    return result;
}
Also used : BuildsFilterWithBuildExcludes(jetbrains.buildServer.server.rest.data.build.BuildsFilterWithBuildExcludes) GenericBuildsFilter(jetbrains.buildServer.server.rest.data.build.GenericBuildsFilter) BuildsFilter(jetbrains.buildServer.server.rest.data.build.BuildsFilter)

Aggregations

BuildsFilter (jetbrains.buildServer.server.rest.data.build.BuildsFilter)1 BuildsFilterWithBuildExcludes (jetbrains.buildServer.server.rest.data.build.BuildsFilterWithBuildExcludes)1 GenericBuildsFilter (jetbrains.buildServer.server.rest.data.build.GenericBuildsFilter)1