UserSession userSession = UserSession.get();
if (userSession.isLoggedIn()) {
userLogins.add(userSession.login());
}
DbSession session = dbClient.openSession(false);
try {
List<DefaultIssueComment> comments = issueChangeDao.selectCommentsByIssues(session, issueKeys);
for (DefaultIssueComment issueComment : comments) {
userLogins.add(issueComment.userLogin());
commentsByIssues.put(issueComment.issueKey(), issueComment);
}
usersByLogin = getUsersByLogin(userLogins);
List<ComponentDto> fileDtos = dbClient.componentDao().getByUuids(session, componentUuids);
List<ComponentDto> subProjectDtos = dbClient.componentDao().findSubProjectsByComponentUuids(session, componentUuids);
componentDtos.addAll(fileDtos);
componentDtos.addAll(subProjectDtos);
for (ComponentDto component: componentDtos) {
projectUuids.add(component.projectUuid());
}
projectDtos = dbClient.componentDao().getByUuids(session, projectUuids);
componentDtos.addAll(projectDtos);
for (ComponentDto componentDto : componentDtos) {
componentsByUuid.put(componentDto.uuid(), componentDto);
}
projectsByComponentUuid = getProjectsByComponentUuid(componentDtos, projectDtos);
writeProjects(json, projectDtos);
writeComponents(json, componentDtos, projectsByComponentUuid);
} finally {
session.close();
}
Map<String, ActionPlan> actionPlanByKeys = getActionPlanByKeys(actionPlanKeys);
writeIssues(result, commentsByIssues, usersByLogin, actionPlanByKeys, componentsByUuid, projectsByComponentUuid,