Search in sources :

Example 1 with CommiterData

use of jetbrains.buildServer.server.rest.data.change.CommiterData in project teamcity-rest by JetBrains.

the class ChangeRequest method getUniqueCommiters.

/**
 * Experimental support only!
 * @since 2021.1.1
 */
@GET
@Path("/{changeLocator}/commiters")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get unique commiters of the matching changes.", nickname = "getUniqueCommiters", hidden = true)
public Commiters getUniqueCommiters(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, @QueryParam("fields") String fields) {
    Locator patchedChangeLocator = Locator.createPotentiallyEmptyLocator(changeLocator);
    if (!patchedChangeLocator.isAnyPresent(PagerData.COUNT)) {
        String lookupLimit = TeamCityProperties.getProperty("rest.request.changes.committersLookupLimit", DEFAULT_CHANGES_LOOKUP_LIMIT_FOR_COMMITERS);
        patchedChangeLocator.setDimension(PagerData.COUNT, lookupLimit);
    }
    PagedSearchResult<SVcsModificationOrChangeDescriptor> changes = myChangeFinder.getItems(patchedChangeLocator.getStringRepresentation());
    List<CommiterData> commiters = ChangeUtil.getUniqueCommiters(changes.myEntries.stream().map(modOrDesc -> modOrDesc.getSVcsModification()));
    return new Commiters(commiters, new Fields(fields), myBeanContext);
}
Also used : CommiterData(jetbrains.buildServer.server.rest.data.change.CommiterData) Fields(jetbrains.buildServer.server.rest.model.Fields) Items(jetbrains.buildServer.server.rest.model.Items) BuildTypeFinder(jetbrains.buildServer.server.rest.data.BuildTypeFinder) BuildPromotion(jetbrains.buildServer.serverSide.BuildPromotion) SVcsModificationOrChangeDescriptor(jetbrains.buildServer.server.rest.data.change.SVcsModificationOrChangeDescriptor) LocatorName(jetbrains.buildServer.server.rest.swagger.constants.LocatorName) Issues(jetbrains.buildServer.server.rest.model.issue.Issues) ApiParam(io.swagger.annotations.ApiParam) PagedSearchResult(jetbrains.buildServer.server.rest.data.PagedSearchResult) ArrayList(java.util.ArrayList) BadRequestException(jetbrains.buildServer.server.rest.errors.BadRequestException) ApiOperation(io.swagger.annotations.ApiOperation) ChangeStatusProvider(jetbrains.buildServer.vcs.ChangeStatusProvider) HttpServletRequest(javax.servlet.http.HttpServletRequest) CommiterData(jetbrains.buildServer.server.rest.data.change.CommiterData) TestScopeTreeCollector(jetbrains.buildServer.server.rest.data.problem.scope.TestScopeTreeCollector) ChangeFinder(jetbrains.buildServer.server.rest.data.ChangeFinder) UriBuilder(javax.ws.rs.core.UriBuilder) Api(io.swagger.annotations.Api) ProblemOccurrencesTree(jetbrains.buildServer.server.rest.model.problem.scope.ProblemOccurrencesTree) SBuildType(jetbrains.buildServer.serverSide.SBuildType) ChangeStatus(jetbrains.buildServer.vcs.ChangeStatus) PagerData(jetbrains.buildServer.server.rest.model.PagerData) TestScopeTree(jetbrains.buildServer.server.rest.model.problem.scope.TestScopeTree) TeamCityProperties(jetbrains.buildServer.serverSide.TeamCityProperties) Context(javax.ws.rs.core.Context) ServiceLocator(jetbrains.buildServer.ServiceLocator) ProblemOccurrencesTreeCollector(jetbrains.buildServer.server.rest.data.problem.scope.ProblemOccurrencesTreeCollector) StringUtil(com.intellij.openapi.util.text.StringUtil) Builds(jetbrains.buildServer.server.rest.model.build.Builds) ApiUrlBuilder(jetbrains.buildServer.server.rest.ApiUrlBuilder) Locator(jetbrains.buildServer.server.rest.data.Locator) Collectors(java.util.stream.Collectors) BeanFactory(jetbrains.buildServer.server.rest.util.BeanFactory) ChangeUtil(jetbrains.buildServer.server.rest.data.change.ChangeUtil) Objects(java.util.Objects) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) Stream(java.util.stream.Stream) javax.ws.rs(javax.ws.rs) jetbrains.buildServer.server.rest.model.change(jetbrains.buildServer.server.rest.model.change) NotFoundException(jetbrains.buildServer.server.rest.errors.NotFoundException) BuildTypes(jetbrains.buildServer.server.rest.model.buildType.BuildTypes) Entries(jetbrains.buildServer.server.rest.model.Entries) UriInfo(javax.ws.rs.core.UriInfo) BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) NotNull(org.jetbrains.annotations.NotNull) SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ServiceLocator(jetbrains.buildServer.ServiceLocator) Locator(jetbrains.buildServer.server.rest.data.Locator) Fields(jetbrains.buildServer.server.rest.model.Fields) SVcsModificationOrChangeDescriptor(jetbrains.buildServer.server.rest.data.change.SVcsModificationOrChangeDescriptor) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

StringUtil (com.intellij.openapi.util.text.StringUtil)1 Api (io.swagger.annotations.Api)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiParam (io.swagger.annotations.ApiParam)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Objects (java.util.Objects)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 javax.ws.rs (javax.ws.rs)1 Context (javax.ws.rs.core.Context)1 UriBuilder (javax.ws.rs.core.UriBuilder)1 UriInfo (javax.ws.rs.core.UriInfo)1 ServiceLocator (jetbrains.buildServer.ServiceLocator)1 ApiUrlBuilder (jetbrains.buildServer.server.rest.ApiUrlBuilder)1 BuildTypeFinder (jetbrains.buildServer.server.rest.data.BuildTypeFinder)1 ChangeFinder (jetbrains.buildServer.server.rest.data.ChangeFinder)1 Locator (jetbrains.buildServer.server.rest.data.Locator)1 PagedSearchResult (jetbrains.buildServer.server.rest.data.PagedSearchResult)1