Search in sources :

Example 6 with BeanContext

use of jetbrains.buildServer.server.rest.util.BeanContext in project teamcity-rest by JetBrains.

the class BuildTypeRequest method serveBuildField.

@GET
@Path("/{btLocator}/builds/{buildLocator}/{field}")
@Produces("text/plain")
@ApiOperation(value = "serveBuildField", hidden = true)
public String serveBuildField(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @ApiParam(format = LocatorName.BUILD) @PathParam("buildLocator") String buildLocator, @PathParam("field") String field) {
    SBuildType buildType = myBuildTypeFinder.getBuildType(null, buildTypeLocator, false);
    BuildPromotion build = myBuildFinder.getBuildPromotion(buildType, buildLocator);
    return Build.getFieldValue(build, field, new BeanContext(myFactory, myServiceLocator, myApiUrlBuilder));
}
Also used : BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) ApiOperation(io.swagger.annotations.ApiOperation)

Example 7 with BeanContext

use of jetbrains.buildServer.server.rest.util.BeanContext in project teamcity-rest by JetBrains.

the class BuildTypeRequest method replaceArtifactDep.

@PUT
@Path("/{btLocator}/artifact-dependencies/{artifactDepLocator}")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Update an artifact dependency of the matching build configuration.", nickname = "replaceArtifactDependency")
public PropEntityArtifactDep replaceArtifactDep(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @PathParam("artifactDepLocator") String artifactDepLocator, @QueryParam("fields") String fields, PropEntityArtifactDep description) {
    final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
    final SArtifactDependency newDependency = description.replaceIn(buildType.getSettingsEx(), getArtifactDependency(buildType, artifactDepLocator), myServiceLocator);
    buildType.persist("Artifact dependency replaced");
    return new PropEntityArtifactDep(newDependency, buildType.getSettingsEx(), new Fields(fields), new BeanContext(myFactory, myServiceLocator, myApiUrlBuilder));
}
Also used : BuildTypeOrTemplate(jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate) BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) SArtifactDependency(jetbrains.buildServer.serverSide.artifacts.SArtifactDependency) ApiOperation(io.swagger.annotations.ApiOperation)

Example 8 with BeanContext

use of jetbrains.buildServer.server.rest.util.BeanContext in project teamcity-rest by JetBrains.

the class BuildTypeRequest method addSnapshotDep.

/**
 * Creates new snapshot dependency. 'id' attribute is ignored in the submitted descriptor.
 * Reports error if new dependency cannot be created (e.g. another dependency on the specified build configuration already exists).
 */
@POST
@Path("/{btLocator}/snapshot-dependencies")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Add a snapshot dependency to the matching build configuration.", nickname = "addSnapshotDependencyToBuildType")
public PropEntitySnapshotDep addSnapshotDep(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @QueryParam("fields") String fields, PropEntitySnapshotDep description) {
    final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
    Dependency createdDependency = description.addTo(buildType.getSettingsEx(), myServiceLocator);
    buildType.persist("Snapshot dependency added");
    return new PropEntitySnapshotDep(createdDependency, buildType.getSettingsEx(), new Fields(fields), new BeanContext(myFactory, myServiceLocator, myApiUrlBuilder));
}
Also used : BuildTypeOrTemplate(jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate) BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) Dependency(jetbrains.buildServer.serverSide.dependency.Dependency) SArtifactDependency(jetbrains.buildServer.serverSide.artifacts.SArtifactDependency) ApiOperation(io.swagger.annotations.ApiOperation)

Example 9 with BeanContext

use of jetbrains.buildServer.server.rest.util.BeanContext in project teamcity-rest by JetBrains.

the class BuildTypeRequest method addArtifactDep.

@POST
@Path("/{btLocator}/artifact-dependencies")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Add an artifact dependency to the matching build configuration.", nickname = "addArtifactDependencyToBuildType")
public PropEntityArtifactDep addArtifactDep(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @QueryParam("fields") String fields, PropEntityArtifactDep description) {
    final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
    final SArtifactDependency result = description.addTo(buildType.getSettingsEx(), myServiceLocator);
    buildType.persist("Artifact dependency added");
    return new PropEntityArtifactDep(result, buildType.getSettingsEx(), new Fields(fields), new BeanContext(myFactory, myServiceLocator, myApiUrlBuilder));
}
Also used : BuildTypeOrTemplate(jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate) BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) SArtifactDependency(jetbrains.buildServer.serverSide.artifacts.SArtifactDependency) ApiOperation(io.swagger.annotations.ApiOperation)

Example 10 with BeanContext

use of jetbrains.buildServer.server.rest.util.BeanContext in project teamcity-rest by JetBrains.

the class BuildTypeRequest method setVCSLabelingOptions.

/**
 * Sets VCS labeling settings
 * Experimental support only
 * @deprecated VCS labeling configuration is moved to build features settings.
 */
@PUT
@ApiOperation(value = "setVCSLabelingOptions", hidden = true)
@Path("/{btLocator}/vcsLabeling")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
public VCSLabelingOptions setVCSLabelingOptions(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, VCSLabelingOptions options) {
    final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
    options.applyTo(buildType, new BeanContext(myFactory, myServiceLocator, myApiUrlBuilder));
    buildType.persist("VCS labeling settings changed");
    return new VCSLabelingOptions();
}
Also used : BuildTypeOrTemplate(jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate) BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

BeanContext (jetbrains.buildServer.server.rest.util.BeanContext)21 ApiOperation (io.swagger.annotations.ApiOperation)12 BuildTypeOrTemplate (jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate)10 SArtifactDependency (jetbrains.buildServer.serverSide.artifacts.SArtifactDependency)6 BeanFactory (jetbrains.buildServer.server.rest.util.BeanFactory)5 ApiUrlBuilder (jetbrains.buildServer.server.rest.ApiUrlBuilder)4 Test (org.testng.annotations.Test)4 PathTransformer (jetbrains.buildServer.server.rest.PathTransformer)3 Dependency (jetbrains.buildServer.serverSide.dependency.Dependency)3 File (java.io.File)2 FakeHttpServletRequest (jetbrains.buildServer.controllers.fakes.FakeHttpServletRequest)2 BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)2 Build (jetbrains.buildServer.server.rest.model.build.Build)2 TestOccurrences (jetbrains.buildServer.server.rest.model.problem.TestOccurrences)2 TestFor (jetbrains.buildServer.util.TestFor)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 Logger (com.intellij.openapi.diagnostic.Logger)1 ApiModelProperty (io.swagger.annotations.ApiModelProperty)1 Collections (java.util.Collections)1 List (java.util.List)1