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