use of jetbrains.buildServer.tags.TagsManager in project teamcity-rest by JetBrains.
the class BuildRequest method addTagsToBuild.
/**
* Adds a set of tags to a build
*
* @param buildLocator build locator
*/
@POST
@Path("/{buildLocator}/tags/")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Add tags to the matching build.", nickname = "addTagsToBuild")
public Tags addTagsToBuild(@ApiParam(format = LocatorName.BUILD) @PathParam("buildLocator") String buildLocator, Tags tags, @QueryParam("fields") String fields) {
BuildPromotion build = myBuildFinder.getBuildPromotion(null, buildLocator);
final TagsManager tagsManager = myBeanContext.getSingletonService(TagsManager.class);
final List<TagData> tagsPosted = tags.getFromPosted(myBeanContext.getSingletonService(UserFinder.class));
tagsManager.addTagDatas(build, tagsPosted);
return new Tags(tagsPosted, new Fields(fields), myBeanContext);
}
use of jetbrains.buildServer.tags.TagsManager in project teamcity-rest by JetBrains.
the class BuildQueueRequest method addTags.
/**
* Adds a set of tags to a build
*
* @param buildLocator build locator
*/
@POST
@Path("/{buildLocator}/tags/")
@Consumes({ "application/xml", "application/json" })
@ApiOperation(value = "Add tags to the matching build.", nickname = "addTagsToBuild")
public void addTags(@ApiParam(format = LocatorName.BUILD) @PathParam("buildLocator") String buildLocator, Tags tags, @Context HttpServletRequest request) {
BuildPromotion buildPromotion = myBuildPromotionFinder.getItem(Locator.createLocator(buildLocator, getBuildPromotionLocatorDefaults(), null).getStringRepresentation());
final TagsManager tagsManager = myBeanContext.getSingletonService(TagsManager.class);
tagsManager.addTagDatas(buildPromotion, tags.getFromPosted(myBeanContext.getSingletonService(UserFinder.class)));
}
use of jetbrains.buildServer.tags.TagsManager in project teamcity-rest by JetBrains.
the class BuildQueueRequest method replaceTags.
/**
* Replaces build's tags.
*
* @param buildLocator build locator
*/
@PUT
@Path("/{buildLocator}/tags/")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "replaceTags", hidden = true)
public Tags replaceTags(@ApiParam(format = LocatorName.BUILD_QUEUE) @PathParam("buildLocator") String buildLocator, @ApiParam(format = LocatorName.TAG) @QueryParam("locator") String tagLocator, Tags tags, @QueryParam("fields") String fields, @Context HttpServletRequest request) {
BuildPromotion buildPromotion = myBuildPromotionFinder.getItem(Locator.createLocator(buildLocator, getBuildPromotionLocatorDefaults(), null).getStringRepresentation());
final TagFinder tagFinder = new TagFinder(myBeanContext.getSingletonService(UserFinder.class), buildPromotion);
final TagsManager tagsManager = myBeanContext.getSingletonService(TagsManager.class);
tagsManager.removeTagDatas(buildPromotion, tagFinder.getItems(tagLocator, TagFinder.getDefaultLocator()).myEntries);
tagsManager.addTagDatas(buildPromotion, tags.getFromPosted(myBeanContext.getSingletonService(UserFinder.class)));
return new Tags(tagFinder.getItems(null, TagFinder.getDefaultLocator()).myEntries, new Fields(fields), myBeanContext);
}
Aggregations