private void onEvent(NexusDao dao, HasNexusEvent e) throws SQLException { NexusEvent event = e.event; String repositoryId = event.guid.replaceAll( "^" + quote(server.url.toASCIIString()) + "/content/repositories/([-a-zA-Z0-9]*)/.*", "$1"); if (repositoryId.length() == 0) { return; } Option<NexusRepositoryDto> r = dao.findRepository(server.uuid, repositoryId); if (r.isNone()) { return; } NexusRepositoryDto repository = r.some(); Option<ArtifactDto> a = dao.findArtifact(repository.uuid, event.artifactId); UUID uuid; if (a.isNone()) { System.out.println("New artifact: " + event.artifactId); uuid = dao.insertArtifact(repository.uuid, event.artifactId); } else { ArtifactDto artifact = a.some(); // System.out.println("Updated artifact: " + event.artifactId); uuid = artifact.uuid; } if (e instanceof NewSnapshotEvent) { NewSnapshotEvent newSnapshotEvent = (NewSnapshotEvent) e; dao.insertNewSnapshotEvent( uuid, event.guid, event.creator, event.date, newSnapshotEvent.snapshotTimestamp, newSnapshotEvent.buildNumber, newSnapshotEvent.url.toASCIIString()); } else if (e instanceof NewReleaseEvent) { NewReleaseEvent nre = (NewReleaseEvent) e; dao.insertNewReleaseEvent( uuid, event.guid, event.creator, event.date, nre.url.toASCIIString()); } else { System.out.println("Unknown event type: " + event.getClass().getName()); } }