Search in sources :

Example 36 with ProjectBroker

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;
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) ProjectBroker(org.olat.course.nodes.projectbroker.datamodel.ProjectBroker) ProjectImpl(org.olat.course.nodes.projectbroker.datamodel.ProjectImpl)

Aggregations

ProjectBroker (org.olat.course.nodes.projectbroker.datamodel.ProjectBroker)36 Project (org.olat.course.nodes.projectbroker.datamodel.Project)30 Test (org.junit.Test)14 OLATResourceable (org.olat.core.id.OLATResourceable)8 ArrayList (java.util.ArrayList)6 ProjectBrokerManager (org.olat.course.nodes.projectbroker.service.ProjectBrokerManager)6 ProjectGroupManager (org.olat.course.nodes.projectbroker.service.ProjectGroupManager)6 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)6 PersistingCoursePropertyManager (org.olat.course.properties.PersistingCoursePropertyManager)6 XStream (com.thoughtworks.xstream.XStream)4 File (java.io.File)4 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)4 Identity (org.olat.core.id.Identity)4 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)4 OLATResourceableDeletedEvent (org.olat.core.util.resource.OLATResourceableDeletedEvent)4 VFSItem (org.olat.core.util.vfs.VFSItem)4 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)4 ProjectImpl (org.olat.course.nodes.projectbroker.datamodel.ProjectImpl)4 BusinessGroup (org.olat.group.BusinessGroup)4 BusinessGroupService (org.olat.group.BusinessGroupService)4