Search in sources :

Example 1 with MuteData

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

the class MuteRequest method deleteInstance.

/**
 * Comment is read from the body as an experimental approach
 */
@DELETE
@Path("/{muteLocator}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Unmute the matching test.", nickname = "unmuteTest")
public void deleteInstance(@ApiParam(format = LocatorName.MUTE) @PathParam("muteLocator") String locatorText, String comment) {
    MuteInfo item = myMuteFinder.getItem(locatorText);
    MuteData muteData = new MuteData(item.getScope(), StringUtil.isEmpty(comment) ? null : comment, item.getTests(), item.getBuildProblemIds().stream().map(i -> i.longValue()).collect(Collectors.toList()), myServiceLocator);
    muteData.unmute();
}
Also used : MuteInfo(jetbrains.buildServer.serverSide.mute.MuteInfo) MuteData(jetbrains.buildServer.server.rest.data.problem.MuteData) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with MuteData

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

the class MuteRequest method createInstances.

/**
 * Experimental use only!
 */
@POST
@Path("/multiple")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Mute multiple tests.", nickname = "muteMultipleTests")
public Mutes createInstances(Mutes mutes, @QueryParam("fields") String fields) {
    List<MuteData> postedEntities = mutes.getFromPosted(myServiceLocator);
    // muting after getting objects to report any deserialize errors before
    List<MuteInfo> results = postedEntities.stream().map(muteData -> muteData.mute()).collect(Collectors.toList());
    return new Mutes(results, null, new Fields(fields), myBeanContext);
}
Also used : MuteInfo(jetbrains.buildServer.serverSide.mute.MuteInfo) Fields(jetbrains.buildServer.server.rest.model.Fields) LocatorName(jetbrains.buildServer.server.rest.swagger.constants.LocatorName) Context(javax.ws.rs.core.Context) ServiceLocator(jetbrains.buildServer.ServiceLocator) MuteFinder(jetbrains.buildServer.server.rest.data.mutes.MuteFinder) ApiParam(io.swagger.annotations.ApiParam) ApiUrlBuilder(jetbrains.buildServer.server.rest.ApiUrlBuilder) PagedSearchResult(jetbrains.buildServer.server.rest.data.PagedSearchResult) MuteData(jetbrains.buildServer.server.rest.data.problem.MuteData) Collectors(java.util.stream.Collectors) MuteInfo(jetbrains.buildServer.serverSide.mute.MuteInfo) ApiOperation(io.swagger.annotations.ApiOperation) HttpServletRequest(javax.servlet.http.HttpServletRequest) List(java.util.List) javax.ws.rs(javax.ws.rs) Mutes(jetbrains.buildServer.server.rest.model.problem.Mutes) StringUtil(jetbrains.buildServer.util.StringUtil) Api(io.swagger.annotations.Api) Mute(jetbrains.buildServer.server.rest.model.problem.Mute) UriInfo(javax.ws.rs.core.UriInfo) BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) NotNull(org.jetbrains.annotations.NotNull) PagerData(jetbrains.buildServer.server.rest.model.PagerData) Fields(jetbrains.buildServer.server.rest.model.Fields) MuteData(jetbrains.buildServer.server.rest.data.problem.MuteData) Mutes(jetbrains.buildServer.server.rest.model.problem.Mutes) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)2 MuteData (jetbrains.buildServer.server.rest.data.problem.MuteData)2 MuteInfo (jetbrains.buildServer.serverSide.mute.MuteInfo)2 Api (io.swagger.annotations.Api)1 ApiParam (io.swagger.annotations.ApiParam)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 javax.ws.rs (javax.ws.rs)1 Context (javax.ws.rs.core.Context)1 UriInfo (javax.ws.rs.core.UriInfo)1 ServiceLocator (jetbrains.buildServer.ServiceLocator)1 ApiUrlBuilder (jetbrains.buildServer.server.rest.ApiUrlBuilder)1 PagedSearchResult (jetbrains.buildServer.server.rest.data.PagedSearchResult)1 MuteFinder (jetbrains.buildServer.server.rest.data.mutes.MuteFinder)1 Fields (jetbrains.buildServer.server.rest.model.Fields)1 PagerData (jetbrains.buildServer.server.rest.model.PagerData)1 Mute (jetbrains.buildServer.server.rest.model.problem.Mute)1 Mutes (jetbrains.buildServer.server.rest.model.problem.Mutes)1 LocatorName (jetbrains.buildServer.server.rest.swagger.constants.LocatorName)1