public static EntityRepositoryCommit createEntity(RepositoryCommit gitRepoCommit, GenericDao dao) {
if (gitRepoCommit == null) {
return null;
}
EntityRepositoryCommit repoCommit = getRepoCommitBySHA(gitRepoCommit.getSha(), dao);
if (repoCommit == null) {
repoCommit = new EntityRepositoryCommit();
repoCommit.setMineredAt(new Date());
// createParents(repoCommit, gitRepoCommit.getParents(), gitRepo, dao);
repoCommit.setSha(gitRepoCommit.getSha());
repoCommit.setUrl(gitRepoCommit.getUrl());
dao.insert(repoCommit);
}
if (repoCommit.getCommit() == null) {
repoCommit.setCommit(CommitServices.createEntity(gitRepoCommit.getCommit(), dao));
}
if (repoCommit.getAuthor() == null) {
repoCommit.setAuthor(UserServices.createEntity(gitRepoCommit.getAuthor(), dao, false));
}
if (repoCommit.getCommitter() == null) {
repoCommit.setCommitter(UserServices.createEntity(gitRepoCommit.getCommitter(), dao, false));
}
return repoCommit;
}