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);
}
Aggregations