@Override public void putAll(Iterator<? extends RevObject> objects, BulkOpListener listener) { // final List<RevCommit> addedCommits = Lists.newLinkedList(); final Iterator<? extends RevObject> collectingIterator = Iterators.transform( objects, (obj) -> { if (obj instanceof RevCommit) { final GraphDatabase graphDatabase = graphDb.get(); RevCommit commit = (RevCommit) obj; ObjectId commitId = commit.getId(); ImmutableList<ObjectId> parentIds = commit.getParentIds(); graphDatabase.put(commitId, parentIds); // addedCommits.add((RevCommit) input); } return obj; }); super.putAll(collectingIterator, listener); // if (!addedCommits.isEmpty()) { // GraphDatabase graphDatabase = graphDb.get(); // for (RevCommit commit : addedCommits) { // ObjectId commitId = commit.getId(); // ImmutableList<ObjectId> parentIds = commit.getParentIds(); // graphDatabase.put(commitId, parentIds); // } // } }
@Override public boolean put(RevObject object) { final boolean inserted = super.put(object); if (inserted && RevObject.TYPE.COMMIT.equals(object.getType())) { RevCommit commit = (RevCommit) object; graphDb.get().put(commit.getId(), commit.getParentIds()); } return inserted; }