public static EntityIssue createEntity(Issue gitIssue, EntityRepository repository, GenericDao dao) {
if (gitIssue == null) {
return null;
}
EntityIssue issue = getIssueByIdIssue(gitIssue.getId(), dao);
if (issue == null) {
issue = new EntityIssue();
}
issue.setMineredAt(new Date());
issue.setIdIssue(gitIssue.getId());
issue.setClosedAt(gitIssue.getClosedAt());
issue.setCreatedAt(gitIssue.getCreatedAt());
issue.setUpdatedAt(gitIssue.getUpdatedAt());
issue.setNumber(gitIssue.getNumber());
issue.setCommentsCount(gitIssue.getComments());
LabelServices.addLabels(issue, gitIssue.getLabels(), dao);
issue.setMilestone(MilestoneServices.createEntity(gitIssue.getMilestone(), repository, dao));
issue.setBody(JsfUtil.filterChar(gitIssue.getBody()));
issue.setBodyHtml(gitIssue.getBodyHtml());
issue.setBodyText(gitIssue.getBodyText());
issue.setHtmlUrl(gitIssue.getHtmlUrl());
issue.setStateIssue(gitIssue.getState());
issue.setTitle(JsfUtil.filterChar(gitIssue.getTitle()));
issue.setUrl(gitIssue.getUrl());
issue.setAssignee(UserServices.createEntity(gitIssue.getAssignee(), dao, false));
issue.setUserIssue(UserServices.createEntity(gitIssue.getUser(), dao, false));
if (issue.getId() == null || issue.getId().equals(0l)) {
dao.insert(issue);
} else {
dao.edit(issue);
}