Search in sources :

Example 1 with MigratePullRequestStatusRequest

use of io.pivotal.cla.service.MigratePullRequestStatusRequest in project pivotal-cla by pivotalsoftware.

the class AdminLinkClaController method updatePullRequestStatuses.

@RequestMapping(value = "/admin/cla/link/migrate", method = RequestMethod.POST)
public String updatePullRequestStatuses(@AuthenticationPrincipal User user, @ModelAttribute UpdatePullRequestStatusesForm updatePullRequestStatusesForm, HttpServletRequest request) throws Exception {
    String claName = updatePullRequestStatusesForm.getClaName();
    String urlEncodedClaName = URLEncoder.encode(claName, "UTF-8");
    UrlBuilder signClaUrlBldr = UrlBuilder.fromRequest(request);
    String signClaUrl = signClaUrlBldr.path("/sign/" + urlEncodedClaName).build();
    UrlBuilder aboutUrlBldr = UrlBuilder.fromRequest(request);
    String aboutUrl = aboutUrlBldr.path("/about").build();
    UrlBuilder baseSyncUrlBldr = UrlBuilder.fromRequest(request);
    String baseSyncUrl = baseSyncUrlBldr.path("/sync/" + urlEncodedClaName).build();
    MigratePullRequestStatusRequest migratePullRequests = MigratePullRequestStatusRequest.builder().accessToken(user.getAccessToken()).commitStatusUrl(signClaUrl).repositoryIds(updatePullRequestStatusesForm.getRepositories()).faqUrl(aboutUrl).baseSyncUrl(baseSyncUrl).build();
    claService.migratePullRequestStatus(updatePullRequestStatusesForm.getClaName(), migratePullRequests);
    return "redirect:/admin/cla/link";
}
Also used : MigratePullRequestStatusRequest(io.pivotal.cla.service.MigratePullRequestStatusRequest) UrlBuilder(io.pivotal.cla.mvc.util.UrlBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

UrlBuilder (io.pivotal.cla.mvc.util.UrlBuilder)1 MigratePullRequestStatusRequest (io.pivotal.cla.service.MigratePullRequestStatusRequest)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1