public ProjectDto getProject(String id) { if (cache.isCached(id)) { return cache.tryGetCached(id); } ProjectInfo info = null; try { info = caller.waitOrCall(() -> api.projects().name(id).get()); } catch (Exception e) { logger.error(Logging.prepare("getProject", id), e); } if (info != null) { ProjectDto project = new ProjectDto(info.id, info.name); if (info.parent != null && downloadParents) { ProjectDto parent = getProject(info.parent); project.parentId = Optional.of(parent.id); } project = repo.add(project); // getProjectBranches(project); // getApprovals(project); cache.cache(project); return project; } return null; }
public void prepare() { cache.restore(repo.getAllProjects()); }