public static EntityCommit createEntity(Commit gitCommit, GenericDao dao) {
if (gitCommit == null) {
return null;
}
EntityCommit commit = getCommitByURL(gitCommit.getUrl(), dao);
if (commit == null) {
commit = new EntityCommit();
}
commit.setMineredAt(new Date());
commit.setAuthor(CommitUserServices.createEntity(gitCommit.getAuthor(), dao));
commit.setCommitter(CommitUserServices.createEntity(gitCommit.getCommitter(), dao));
commit.setCommentCount(gitCommit.getCommentCount());
commit.setMessage(gitCommit.getMessage());
// createParents(commit, gitCommit.getParents(), gitRepo, dao);
commit.setSha(gitCommit.getSha());
// commit.setTree(TreeServices.createTreeEntity(gitCommit.getTree(), gitRepo, dao));
commit.setUrl(gitCommit.getUrl());
if (commit.getId() == null || commit.getId().equals(0l)) {
dao.insert(commit);
} else {
dao.edit(commit);
}