public SyndEntry buildEntry(NexusArtifactEvent event) { SyndEntry entry = new SyndEntryImpl(); entry.setTitle(buildTitle(event)); entry.setLink(buildLink(event)); entry.setPublishedDate(buildPublishDate(event)); entry.setAuthor(buildAuthor(event)); entry.setDescription(buildDescription(event)); return entry; }
protected SyndContent buildDescription(NexusArtifactEvent event) { SyndContent content = new SyndContentImpl(); content.setType(MediaType.TEXT_PLAIN.toString()); StringBuilder msg = new StringBuilder(); if (event.getMessage() != null) { msg.append(event.getMessage()); msg.append(' '); } msg.append(buildDescriptionMsgItem(event)); msg.append(buildDescriptionMsgAction(event)); msg.append(buildDescriptionMsgAuthor(event)); msg.append(buildDescriptionMsgAddress(event)); content.setValue(msg.toString()); return content; }
protected String getRepositoryName(NexusArtifactEvent event) { String repoId = event.getNexusItemInfo().getRepositoryId(); try { Repository repository = getRepositoryRegistry().getRepository(repoId); return repository.getName(); } catch (NoSuchRepositoryException e) { // that's fine, no need to yell, old timeline entries might correspond to long-time removed reposes return repoId; } }
protected String buildDescriptionMsgAuthor(NexusArtifactEvent event) { final String author = buildAuthor(event); if (author != null) { return "Action was initiated by user \"" + author + "\".\n"; } return ""; }
protected Gav buildGAV(final NexusArtifactEvent event) { if (event.getNexusItemInfo() == null) { return null; } try { final Repository repo = getRepositoryRegistry().getRepository(event.getNexusItemInfo().getRepositoryId()); if (MavenRepository.class.isAssignableFrom(repo.getClass())) { return ((MavenRepository) repo).getGavCalculator().pathToGav(event.getNexusItemInfo().getPath()); } return null; } catch (NoSuchRepositoryException e) { log.debug( "Feed entry contained invalid repository id " + event.getNexusItemInfo().getRepositoryId(), e); return null; } }