com.atlassian.bitbucket.event.pull.PullRequestOpenedEvent Java Examples

The following examples show how to use com.atlassian.bitbucket.event.pull.PullRequestOpenedEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TeamcityPullrequestEventListener.java    From TeamcityTriggerHook with GNU Lesser General Public License v3.0 6 votes vote down vote up
@EventListener
public void onPullRequestOpenedEvent(final PullRequestOpenedEvent event) throws IOException, JSONException {
  final PullRequest pr = event.getPullRequest();
  final Repository repo = pr.getFromRef().getRepository();
  final Optional<Settings> settings = this.settingsService.getSettings(repo);
  
  if(!settings.isPresent()) {
    return;
  }
  
  try {
    TriggerBuildFromPullRequest(pr, false);
  } catch (final IOException | JSONException ex) {
    TeamcityLogger.logMessage(settings.get(), "PullRequest Opened Event Failed: " + ex.getMessage());
  }
}