Search in sources :

Example 21 with BeanContext

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

the class VcsRootRequest method addRoot.

@POST
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Add a new VCS root.", nickname = "addVcsRoot")
public VcsRoot addRoot(VcsRoot vcsRootDescription, @QueryParam("fields") String fields) {
    checkVcsRootDescription(vcsRootDescription);
    BeanContext ctx = new BeanContext(myDataProvider.getBeanFactory(), myServiceLocator, myApiUrlBuilder);
    // todo: TeamCity openAPI: not consistent methods for creating VCS root with/without id
    final SVcsRoot newVcsRoot = getVcsRootProject(vcsRootDescription, ctx).createVcsRoot(vcsRootDescription.vcsName, vcsRootDescription.name, vcsRootDescription.properties.getMap());
    if (vcsRootDescription.id != null) {
        newVcsRoot.setExternalId(vcsRootDescription.id);
    }
    if (vcsRootDescription.modificationCheckInterval != null) {
        newVcsRoot.setModificationCheckInterval(vcsRootDescription.modificationCheckInterval);
    }
    newVcsRoot.schedulePersisting("A new VCS root created");
    return new VcsRoot(newVcsRoot, new Fields(fields), myBeanContext);
}
Also used : BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) SVcsRoot(jetbrains.buildServer.vcs.SVcsRoot) Fields(jetbrains.buildServer.server.rest.model.Fields) VcsRoot(jetbrains.buildServer.server.rest.model.change.VcsRoot) SVcsRoot(jetbrains.buildServer.vcs.SVcsRoot) 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