use of org.olat.course.nodes.projectbroker.datamodel.ProjectBroker in project openolat by klemens.
the class ProjectBrokerManagerImpl method getOrLoadProjectBoker.
// /////////////////
// Private Methods
// /////////////////
private ProjectBroker getOrLoadProjectBoker(final Long projectBrokerId) {
// 1. check if alreday a projectBroker is in the cache
ProjectBroker projectBroker = projectCache.get(projectBrokerId.toString());
if (projectBroker == null) {
logDebug("find no projectBroker in the cache => create a new one projectBrokerId=" + projectBrokerId);
StringBuilder sb = new StringBuilder();
sb.append("select distinct project from ").append(ProjectImpl.class.getName()).append(" as project ").append(" left join fetch project.projectGroup pGroup").append(" left join fetch pGroup.baseGroup bGroup").append(" where project.projectBroker.key=:projectBrokerKey");
List<Project> projectList = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Project.class).setParameter("projectBrokerKey", projectBrokerId).getResultList();
projectBroker = getProjectBroker(projectBrokerId);
projectBroker.setProjects(projectList);
projectCache.put(projectBrokerId.toString(), projectBroker);
}
return projectBroker;
}
Aggregations