本文整理汇总了Java中com.atlassian.event.api.EventListener类的典型用法代码示例。如果您正苦于以下问题:Java EventListener类的具体用法?Java EventListener怎么用?Java EventListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventListener类属于com.atlassian.event.api包,在下文中一共展示了EventListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onIssueEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onIssueEvent(final IssueEvent issueEvent) {
try {
final Long eventTypeID = issueEvent.getEventTypeId();
final Issue issue = issueEvent.getIssue();
if (!eventTypeID.equals(EventType.ISSUE_CREATED_ID)) {
logger.debug("=== ISSUE EVENT ===");
logger.debug(String.format("Event Type ID: %s", eventTypeID));
logger.debug(String.format("Issue: %s", issue));
final String propertyKey = hubIssueTrackerPropertyHandler.createEntityPropertyKey(issue);
final EntityProperty hubIssueUrlProperty = getHubIssueTrackerUrlProperty(propertyKey, issue);
if (hubIssueUrlProperty == null) {
logger.debug(String.format("Hub Issue Tracker URL not present. No further processing for issue: %s", issue));
} else {
final PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
executorService.submit(createTask(issue, eventTypeID, jiraServices, settings, propertyKey, hubIssueUrlProperty));
}
}
} catch (final Exception ex) {
logger.error("An unexpected error occurred processing issue event ", ex);
}
}
示例2: onBuildStatusSetEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onBuildStatusSetEvent(BuildStatusSetEvent event) throws IOException
{
executorService.submit(() -> {
BuildStatusEvent buildStatusEvent = new BuildStatusEvent();
buildStatusEvent.setCommit(event.getCommitId());
buildStatusEvent.setStatus(event.getBuildStatus().getState().toString());
buildStatusEvent.setUrl(event.getBuildStatus().getUrl());
IndexedCommit commit = commitIndex.getCommit(event.getCommitId());
if (commit != null) {
for (Repository repo : commit.getRepositories()){
buildStatusEvent.setRepository(Models.createRepository(repo, applicationPropertiesService));
sendEvents(buildStatusEvent, repo, EventType.BUILD_STATUS);
}
}
});
}
示例3: onUserEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onUserEvent(UserEvent userEvent) {
int eventType = userEvent.getEventType();
switch (eventType) {
case UserEventType.USER_LOGIN:
String username;
ApplicationUser user = userEvent.getUser();
username = user.getName();
if (!Utilities.isPaired(username, model)) {
return;
}
status(username);
break;
case UserEventType.USER_LOGOUT:
Utilities.redirectTo("");
break;
}
}
示例4: pullRequestListener
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void pullRequestListener(PullRequestMergeActivityEvent pullRequestMergeActivityEvent) {
Repository targetRepo = pullRequestMergeActivityEvent.getPullRequest().getToRef().getRepository();
PullRequest pullRequest = pullRequestMergeActivityEvent.getPullRequest();
RepositoryHook repositoryHook = repositoryHookService.getByKey(targetRepo, REPO_HOOK_KEY);
if (repositoryHook.isEnabled() && pullRequestMergeActivityEvent.getActivity().getAction().equals(PullRequestAction.MERGED)) {
Settings settings = repositoryHookService.getSettings(targetRepo, REPO_HOOK_KEY);
String bypassKeyword = settings.getString(PullRequestMergeRulesCheck.SETTING_KEY_BYPASS_KEYWORD);
String apiToken = settings.getString(PullRequestMergeRulesCheck.SETTING_KEY_HIPCHAT_API_TOKEN);
String roomId = settings.getString(PullRequestMergeRulesCheck.SETTING_KEY_HIPCHAT_ROOM_ID);
if (StringUtils.containsIgnoreCase(pullRequest.getTitle(), bypassKeyword)
&& isHipChatConfigured(settings)) {
String message = String.format("<b>%s</b> bypassed merge checks for pull request <b>#%d</b> in <b>%s/%s</b> <br/>%s",
pullRequestMergeActivityEvent.getUser().getDisplayName(),
pullRequest.getId(),
targetRepo.getProject().getKey(),
targetRepo.getSlug(),
pullRequest.getTitle());
HipChatClient client = new HipChatClient(apiToken);
client.sendRoomNotification(new HipChatNotification(message, roomId, HipChatNotification.Color.RED));
}
}
}
示例5: onPullRequestOpenedEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onPullRequestOpenedEvent(PullRequestOpenedEvent event) {
PullRequestRef ref = event.getPullRequest().getFromRef();
if (ref.getDisplayId().toLowerCase().contains("bugfix/")) {
TriggerBuildFromPullRequest(ref, "usePrFrombugFix", "bugFixRule");
}
if (ref.getDisplayId().toLowerCase().contains("feature/")) {
TriggerBuildFromPullRequest(ref, "usePrFromFeature", "featureRule");
}
if (ref.getDisplayId().toLowerCase().contains("hotfix/")) {
TriggerBuildFromPullRequest(ref, "usePrFromhotFix", "hotFixRule");
}
}
开发者ID:TrimbleSolutionsCorporation,项目名称:TeamcityTriggerHook,代码行数:17,代码来源:TeamcityPullrequestEventListener.java
示例6: onPullRequestRescoped
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onPullRequestRescoped(PullRequestRescopedEvent event) {
PullRequestRef ref = event.getPullRequest().getFromRef();
String previousFromHash = event.getPreviousFromHash();
String currentFromHash = ref.getLatestCommit();
if (currentFromHash.equals(previousFromHash)) {
return;
}
if (ref.getDisplayId().toLowerCase().contains("bugfix/")) {
TriggerBuildFromPullRequest(ref, "usePrFrombugFix", "bugFixRule");
}
if (ref.getDisplayId().toLowerCase().contains("feature/")) {
TriggerBuildFromPullRequest(ref, "usePrFromFeature", "featureRule");
}
if (ref.getDisplayId().toLowerCase().contains("hotfix/")) {
TriggerBuildFromPullRequest(ref, "usePrFromhotFix", "hotFixRule");
}
}
开发者ID:TrimbleSolutionsCorporation,项目名称:TeamcityTriggerHook,代码行数:23,代码来源:TeamcityPullrequestEventListener.java
示例7: listenToPullRequestEvents
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
/**
* Ensures all repositories with pull requests have a configuration, and all pull requests have a configuration.
*
* @param pre
*/
@EventListener
public void listenToPullRequestEvents(PullRequestEvent pre) {
PullRequest pr = pre.getPullRequest();
Repository repo = pr.getToRef().getRepository();
if (pr.getId() == null) {
log.debug("Got NULL PR_ID, ignoring until PR is fully materialized");
return;
}
try {
log.trace("Ensuring DisapprovalConfiguration exists for REPO " + repo.getId());
cpm.getDisapprovalConfiguration(repo);
log.trace("Ensuring PullRequestDisapproval exists for PR " + pr.getId());
cpm.getPullRequestDisapproval(pr);
} catch (Exception e) {
log.error("Undeclared exception: ", e);
return;
}
}
示例8: openPullRequest
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void openPullRequest(PullRequestOpenedEvent pushEvent)
{
PullRequestData prd = new PullRequestData(pushEvent.getPullRequest());
boolean isDisableAutomaticBuildByDefault = PluginSettingsHelper.isDisableAutomaticBuildByDefault(prd.slug,settings);
if (isDisableAutomaticBuildByDefault) {
PluginSettingsHelper.enableAutomaticBuildFlag(prd.projectKey, prd.slug, prd.pullRequestId, settings);
return;
}
boolean triggerBuildOnCreate = PluginSettingsHelper.isTriggerBuildOnCreate(prd.slug,settings);
if (triggerBuildOnCreate) {
scheduleJobTrigger(pushEvent, prd);
}
}
示例9: reopenPullRequest
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void reopenPullRequest(PullRequestReopenedEvent pushEvent)
{
PullRequestData prd = new PullRequestData(pushEvent.getPullRequest());
boolean isDisableAutomaticBuildByDefault = PluginSettingsHelper.isDisableAutomaticBuildByDefault(prd.slug,settings);
if (isDisableAutomaticBuildByDefault) {
PluginSettingsHelper.enableAutomaticBuildFlag(prd.projectKey, prd.slug, prd.pullRequestId, settings);
return;
}
boolean automaticBuildDisabled = PluginSettingsHelper.isAutomaticBuildDisabled(prd.projectKey,prd.slug,prd.pullRequestId,settings);
boolean triggerBuildOnReopen = PluginSettingsHelper.isTriggerBuildOnReopen(prd.slug,settings);
if (triggerBuildOnReopen && !automaticBuildDisabled) {
scheduleJobTrigger(pushEvent, prd);
}
}
示例10: listenForComments
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void listenForComments(PullRequestCommentEvent event) {
try {
final PullRequest pr = event.getPullRequest();
final Repository repo = pr.getToRef().getRepository();
final RepositoryConfiguration rc = cpm
.getRepositoryConfigurationForRepository(repo);
if (!rc.getCiEnabled()) {
log.debug("Pull Request " + pr.toString()
+ " ignored, CI not enabled for target repo "
+ repo.toString());
return;
}
Comment c = event.getComment();
if (c.getText().contains(OVERRIDE_STRING)) {
log.debug("Pull Request override set to true for PR "
+ pr.toString());
cpm.setPullRequestMetadata(pr, null, null, true);
}
} catch (SQLException e) {
log.error("Error getting repository configuration", e);
}
}
示例11: onIssueEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onIssueEvent(IssueEvent issueEvent) {
Issue issue = issueEvent.getIssue();
if (issue != null) {
String eventType = "";
try {
eventType = eventTypeManager.getEventType(issueEvent.getEventTypeId()).getName();
} catch (IllegalArgumentException e) {
}
eventTypeManager.getEventType(issueEvent.getEventTypeId());
metricCollector.issueUpdateCounter(issue.getProjectObject().getKey(), issue.getKey(), eventType, getCurrentUser());
}
}
示例12: onIssueViewEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onIssueViewEvent(IssueViewEvent issueViewEvent) {
Issue issue = issueManager.getIssueObject(issueViewEvent.getId());
if (issue != null) {
metricCollector.issueViewCounter(issue.getProjectObject().getKey(), issue.getKey(), getCurrentUser());
}
}
示例13: onLabelAddEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onLabelAddEvent(LabelAddEvent labelAddEvent) {
if (labelAddEvent.getLabelled() instanceof AbstractPage) {
Labelable labelled = labelAddEvent.getLabelled();
Namespace namespace = labelAddEvent.getLabel().getNamespace();
String visibility = namespace != null ? namespace.getVisibility() : "";
String prefix = namespace != null ? namespace.getPrefix() : "";
String source = labelled instanceof Page ? "page" : "blogpost";
metricCollector.labelAddCounter(visibility, prefix, source, ((AbstractPage) labelled).getSpaceKey());
}
}
示例14: onLabelCreateEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onLabelCreateEvent(LabelCreateEvent labelCreateEvent) {
Namespace namespace = labelCreateEvent.getLabel().getNamespace();
String visibility = namespace != null ? namespace.getVisibility() : "";
String prefix = namespace != null ? namespace.getPrefix() : "";
metricCollector.labelCreateCounter(visibility, prefix);
}
示例15: onLabelDeleteEvent
import com.atlassian.event.api.EventListener; //导入依赖的package包/类
@EventListener
public void onLabelDeleteEvent(LabelDeleteEvent labelDeleteEvent) {
Namespace namespace = labelDeleteEvent.getLabel().getNamespace();
String visibility = namespace != null ? namespace.getVisibility() : "";
String prefix = namespace != null ? namespace.getPrefix() : "";
metricCollector.labelDeleteCounter(visibility, prefix);
}