use of net.nemerosa.ontrack.extension.issues.IssueServiceExtension in project ontrack by nemerosa.
the class IndexationServiceImpl method indexIssues.
private void indexIssues(SVNRepository repository, SVNLogEntry logEntry) {
// Is the repository associated with any issue service?
ConfiguredIssueService configuredIssueService = repository.getConfiguredIssueService();
if (configuredIssueService != null) {
IssueServiceExtension issueServiceExtension = configuredIssueService.getIssueServiceExtension();
IssueServiceConfiguration issueServiceConfiguration = configuredIssueService.getIssueServiceConfiguration();
// Revision information to scan
long revision = logEntry.getRevision();
String message = logEntry.getMessage();
// Cache for issues
Set<String> revisionIssues = new HashSet<>();
// Gets all issues from the message
Set<String> issues = issueServiceExtension.extractIssueKeysFromMessage(issueServiceConfiguration, message);
// For each issue in the message
issues.stream().filter(issueKey -> !revisionIssues.contains(issueKey)).forEach(issueKey -> {
revisionIssues.add(issueKey);
logger.info(String.format(" Indexing revision %d <-> %s", revision, issueKey));
// Indexes this issue
issueRevisionDao.link(repository.getId(), revision, issueKey);
});
}
}
Aggregations