public void scanOrganization(GHOrganization org) {
try {
ObjectNode n = mapper.createObjectNode();
n.put("url", org.getUrl().toString());
if (org.getHtmlUrl() != null) {
n.put("htmlUrl", org.getHtmlUrl().toString());
}
n.put("name", org.getLogin());
n.put("displayName", org.getName());
String cypher = "merge (o:GitHubOrg {url:{url}}) set o+={props},o.updateTs=timestamp() return o";
getProjector().getNeoRxClient().execCypher(cypher, "url", n.path("url").asText(), "props", n);
} catch (IOException e) {
throw new MercatorException(e);
}
try {
org.getRepositories().values().forEach(repo -> {
scanRepository(repo);
String cypher = "match (o:GitHubOrg {url:{orgUrl}}), (r:GitHubRepo {url:{repoUrl}}) merge (o)-[x:CONTAINS]->(r) set x.updateTs=timestamp()";
getProjector().getNeoRxClient().execCypher(cypher, "orgUrl", org.getUrl().toString(), "repoUrl",
repo.getUrl().toString());
});
} catch (IOException e) {
throw new MercatorException(e);
}
}