com.atlassian.event.api.EventListener Java Examples
The following examples show how to use
com.atlassian.event.api.EventListener.
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: GroovioliListener.java From jira-groovioli with BSD 2-Clause "Simplified" License | 6 votes |
@EventListener public void onIssueEvent(IssueEvent issueEvent) { List<String> scripts = listenerDataManager.getScripts(EventType.ISSUE, issueEvent.getProject().getId()); for (final String script : scripts) { final Map<String, Object> parameters = new HashMap<>(); parameters.put("changeLog", issueEvent.getChangeLog()); parameters.put("eventComment", issueEvent.getComment()); parameters.put("eventWorklog", issueEvent.getWorklog()); parameters.put("issue", issueEvent.getIssue()); parameters.put("eventTypeId", issueEvent.getEventTypeId()); parameters.put("eventUser", issueEvent.getUser()); parameters.put("log", log); executorService.execute(new Runnable() { @Override public void run() { try { scriptManager.executeScript(script, parameters); } catch (ScriptException ex) { log.error("Listener error", ex); } } }); } }
Example #2
Source File: LivingDocSettingsListener.java From livingdoc-confluence with GNU General Public License v3.0 | 6 votes |
@EventListener public void configurationEvent(GlobalSettingsChangedEvent event) { final String oldBaseUrl = event.getOldSettings().getBaseUrl(); final String newBaseUrl = event.getNewSettings().getBaseUrl(); if (livingDocServerConfigurationActivator.isServerSetupComplete() && livingDocServerConfigurationActivator.isReady() && !oldBaseUrl.equals(newBaseUrl)) { for (Space space : livingDocConfluenceManager.getSpaceManager().getAllSpaces()) { try { Repository repositoryUid = livingDocConfluenceManager.getHomeRepository(space.getKey()); Repository repository = livingDocConfluenceManager.getPersistenceService().getRegisteredRepository(repositoryUid); repository.setBaseUrl(newBaseUrl); repository.setBaseRepositoryUrl(RepositoryUtils.repositoryBaseUrl(newBaseUrl, space.getKey())); repository.setBaseTestUrl(RepositoryUtils.baseTestUrl(newBaseUrl, space.getKey())); livingDocConfluenceManager.getPersistenceService().updateRepositoryRegistration(repository); log.debug(String.format("LivingDoc repository %s (%s): baseUrl was updated to %s", repository.getName(), space.getKey(), newBaseUrl)); } catch (LivingDocServerException ldExc) { log.error(ldExc.getMessage(), ldExc); } } } }
Example #3
Source File: TeamcityPullrequestEventListener.java From TeamcityTriggerHook with GNU Lesser General Public License v3.0 | 6 votes |
@EventListener public void onPullRequestRescoped(final PullRequestRescopedEvent event) throws IOException, JSONException { final String previousFromHash = event.getPreviousFromHash(); final String currentFromHash = event.getPullRequest().getFromRef().getLatestCommit(); if (currentFromHash.equals(previousFromHash)) { return; } final PullRequest pr = event.getPullRequest(); final Repository repo = pr.getFromRef().getRepository(); final Optional<Settings> settings = this.settingsService.getSettings(repo); if(!settings.isPresent()) { return; } try { TeamcityLogger.logMessage(settings.get(), "Run PullRequest Rescoped Event : " + pr.getFromRef().getDisplayId()); TriggerBuildFromPullRequest(pr, false); } catch (final IOException | JSONException ex) { TeamcityLogger.logMessage(settings.get(), "PullRequest Rescoped Event Failed: " + ex.getMessage() + " " + pr.getFromRef().getDisplayId()); } }
Example #4
Source File: TeamcityPullrequestEventListener.java From TeamcityTriggerHook with GNU Lesser General Public License v3.0 | 6 votes |
@EventListener public void onPullRequestParticipantsUpdatedEvent(final PullRequestParticipantsUpdatedEvent event) throws IOException, JSONException { final PullRequest pr = event.getPullRequest(); final Set<PullRequestParticipant> reviewers = pr.getReviewers(); final Repository repo = pr.getFromRef().getRepository(); final Optional<Settings> settings = this.settingsService.getSettings(repo); if(!settings.isPresent()) { return; } if (event.getAddedParticipants().size() > 0 && reviewers.size() > 0) { // trigger only when number of participations is 2 or higher (author + reviewer) try { TriggerBuildFromPullRequest(event.getPullRequest(), true); } catch (final IOException | JSONException ex) { TeamcityLogger.logMessage(settings.get(), "PullRequest Reviwer update event failed: " + ex.getMessage()); } } }
Example #5
Source File: TeamcityPullrequestEventListener.java From TeamcityTriggerHook with GNU Lesser General Public License v3.0 | 6 votes |
@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()); } }
Example #6
Source File: MetricListener.java From jira-prometheus-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@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(), eventType, getCurrentUser()); } }
Example #7
Source File: LivingDocPageListener.java From livingdoc-confluence with GNU General Public License v3.0 | 5 votes |
@EventListener public void spaceRemoveEvent(SpaceRemoveEvent event) throws LivingDocServerException { String spaceKey = event.getSpace().getKey(); try{ Repository repository = ld.getHomeRepository(spaceKey); ld.getPersistenceService().removeRepository(repository.getUid()); }catch(LivingDocServerException ldse){ log.error("error removing repository für space "+ spaceKey,ldse); } }
Example #8
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@EventListener public void onLoginFailedEvent(LoginFailedEvent loginFailedEvent) { String username = loginFailedEvent.getUsername(); if (username == null) { username = ""; } String ip = loginFailedEvent.getRemoteIP(); if (ip == null) { ip = ""; } metricCollector.userLoginFailedCounter(username, ip); }
Example #9
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@EventListener public void onLogoutEvent(LogoutEvent logoutEvent) { String username = logoutEvent.getUsername(); if (username == null) { username = ""; } String ip = logoutEvent.getRemoteIP(); if (ip == null) { ip = ""; } metricCollector.userLogoutCounter(username, ip); }
Example #10
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@EventListener public void onLoginEvent(LoginEvent loginEvent) { String username = loginEvent.getUsername(); if (username == null) { username = ""; } String ip = loginEvent.getRemoteIP(); if (ip == null) { ip = ""; } metricCollector.userLoginCounter(username, ip); }
Example #11
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@EventListener public void onSpaceCreateEvent(SpaceCreateEvent spaceCreateEvent) { String username = AuthenticatedUserThreadLocal.getUsername(); if (username == null) { username = ""; } metricCollector.spaceCreateCounter(username); }
Example #12
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@EventListener public void onSpaceRemoveEvent(SpaceRemoveEvent spaceRemoveEvent) { String username = AuthenticatedUserThreadLocal.getUsername(); if (username == null) { username = ""; } metricCollector.spaceDeleteCounter(username); }
Example #13
Source File: LivingDocPageListener.java From livingdoc-confluence with GNU General Public License v3.0 | 5 votes |
@EventListener public void pageUpdateEvent(PageUpdateEvent event) throws LivingDocServerException { log.debug("Updating specification"); Page oldPage = (Page)event.getOriginalPage(); Page newPage = event.getPage(); if (newPage != null && oldPage != null && (!newPage.getTitle().equals(oldPage.getTitle()) || !newPage.getBodyAsString().equals(oldPage.getBodyAsString()))) { boolean oldPageIsExecutable = containsPageMacro(oldPage); boolean newPageIsExecutable = containsPageMacro(newPage); try { Specification oldSpecification = Specification.newInstance(oldPage.getTitle()); oldSpecification.setRepository(ld.getHomeRepository(newPage.getSpace().getKey())); Specification newSpecification = Specification.newInstance(newPage.getTitle()); newSpecification.setRepository(ld.getHomeRepository(newPage.getSpace().getKey())); if (!newPageIsExecutable) { removeSpecification(newPage); } else if (!oldPageIsExecutable) { ld.getPersistenceService().createSpecification(newSpecification); } else { ld.getPersistenceService().updateSpecification(oldSpecification, newSpecification); } log.debug("Successfully updated specification"); } catch (LivingDocServerException e) { removeSpecificationSafe(oldPage); } } }
Example #14
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@EventListener public void onLabelRemoveEvent(LabelRemoveEvent labelRemoveEvent) { if (labelRemoveEvent.getLabelled() instanceof AbstractPage) { Labelable labelled = labelRemoveEvent.getLabelled(); Namespace namespace = labelRemoveEvent.getLabel().getNamespace(); String visibility = namespace != null ? namespace.getVisibility() : ""; String prefix = namespace != null ? namespace.getPrefix() : ""; String source = labelled instanceof Page ? "page" : "blogpost"; metricCollector.labelRemoveCounter(visibility, prefix, source, ((AbstractPage) labelled).getSpaceKey()); } }
Example #15
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@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); }
Example #16
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@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); }
Example #17
Source File: MetricListener.java From prom-confluence-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@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()); } }
Example #18
Source File: LdapDirectorySynchronizationRequiredEventListener.java From adam with GNU Lesser General Public License v3.0 | 5 votes |
@EventListener public void handleLogin(@Nonnull LoginEvent event) { final String username = event.getUsername(); try { _synchronizer.synchronize(username); } catch (final Exception e) { LOG.warn("The user '" + username + " could not be synchronized. This means that this user could be out of date.", e); } }
Example #19
Source File: IndexerEventListener.java From stash-codesearch-plugin with Apache License 2.0 | 5 votes |
@EventListener public void refChangeListener(RepositoryRefsChangedEvent event) { Repository repository = event.getRepository(); for (RefChange change : event.getRefChanges()) { if (change.getType() == RefChangeType.DELETE) { updater.submitAsyncReindex(repository, change.getRefId(), 0); } else if (repositoryServiceManager.getBranchMap(repository) .containsKey(change.getRefId())) { updater.submitAsyncUpdate(repository, change.getRefId(), 0); } } }
Example #20
Source File: MetricListener.java From jira-prometheus-exporter with BSD 2-Clause "Simplified" License | 5 votes |
@EventListener public void onIssueViewEvent(IssueViewEvent issueViewEvent) { Issue issue = issueManager.getIssueObject(issueViewEvent.getId()); if (issue != null) { metricCollector.issueViewCounter(issue.getProjectObject().getKey(), getCurrentUser()); } }
Example #21
Source File: ConveyorListener.java From adam with GNU Lesser General Public License v3.0 | 4 votes |
@EventListener public void handles(@SuppressWarnings("UnusedParameters") @Nonnull DummyEvent event) {}
Example #22
Source File: LivingDocPageListener.java From livingdoc-confluence with GNU General Public License v3.0 | 4 votes |
@EventListener public void pageTrashedEvent(PageTrashedEvent event) { removeSpecificationSafe(event.getPage()); }
Example #23
Source File: LivingDocPageListener.java From livingdoc-confluence with GNU General Public License v3.0 | 4 votes |
@EventListener public void pageRemoveEvent(PageRemoveEvent event) { removeSpecificationSafe(event.getPage()); }
Example #24
Source File: IndexerEventListener.java From stash-codesearch-plugin with Apache License 2.0 | 4 votes |
@EventListener public void repositoryDeletedListener(RepositoryDeletedEvent event) { updater.reindexRepository( event.getRepository().getProject().getKey(), event.getRepository().getSlug()); }
Example #25
Source File: LivingDocServerConfigurationActivator.java From livingdoc-confluence with GNU General Public License v3.0 | 4 votes |
@EventListener public void pluginDisableEvent(PluginDisableEvent event) { disableLivingDocPlugin(); }
Example #26
Source File: LivingDocServerConfigurationActivator.java From livingdoc-confluence with GNU General Public License v3.0 | 4 votes |
@EventListener public void pluginEnableEvent(PluginEnableEvent event) throws LivingDocServerException { enableLivingDocPlugin(); }
Example #27
Source File: LivingDocServerConfigurationActivator.java From livingdoc-confluence with GNU General Public License v3.0 | 4 votes |
@EventListener public void pluginUninstallEvent(PluginUninstallEvent event) { disableLivingDocPlugin(); // Remove the stored configuration. removeValue(LivingDocServerConfiguration.class); }
Example #28
Source File: LivingDocServerConfigurationActivator.java From livingdoc-confluence with GNU General Public License v3.0 | 4 votes |
@EventListener public void pluginInstallEvent(PluginInstallEvent event) throws LivingDocServerException { enableLivingDocPlugin(); }
Example #29
Source File: LivingDocServerConfigurationActivator.java From livingdoc-confluence with GNU General Public License v3.0 | 4 votes |
@EventListener public void pluginFrameworkStartedEvent(PluginFrameworkStartedEvent event) throws LivingDocServerException { log.info(getClass().getName() + "#" + event.getClass().getName()); log.info(String.format("*** Starting LivingDoc-Confluence-Plugin (v%s) ***", LivingDocServer.VERSION)); enableLivingDocPlugin(); }
Example #30
Source File: PullRequestListener.java From pr-harmony with GNU General Public License v3.0 | 4 votes |
@EventListener public void prApprovalListener(PullRequestParticipantStatusUpdatedEvent event) { asyncProcessor.dispatch(new ApprovalTaskProcessor(event.getPullRequest())); }