Search in sources :

Example 66 with Project

use of org.olat.course.nodes.projectbroker.datamodel.Project in project openolat by klemens.

the class ProjectBrokerManagerImpl method getCoachedProjectsOf.

@Override
public List<Project> getCoachedProjectsOf(Identity identity, Long projectBrokerId) {
    List<Project> myProjects = new ArrayList<Project>();
    List<Project> allProjects = getProjectListBy(projectBrokerId);
    // TODO: for better performance should be done with sql query instead of a loop
    for (Iterator<Project> iterator = allProjects.iterator(); iterator.hasNext(); ) {
        Project project = iterator.next();
        if (businessGroupService.hasRoles(identity, project.getProjectGroup(), GroupRoles.coach.name())) {
            myProjects.add(project);
        }
    }
    return myProjects;
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) ArrayList(java.util.ArrayList)

Example 67 with Project

use of org.olat.course.nodes.projectbroker.datamodel.Project in project openolat by klemens.

the class ProjectBrokerManagerImpl method deleteProject.

/**
 * Delete a project and delete project-groups related to this project.
 * This method is cluster-save.
 * @see org.olat.course.nodes.projectbroker.service.ProjectBrokerManager#deleteProject(org.olat.course.nodes.projectbroker.datamodel.Project)
 */
public void deleteProject(final Project project, final boolean deleteGroup, final CourseEnvironment courseEnv, final CourseNode cNode) {
    logDebug("start deleteProject project=" + project);
    final Long projectBrokerId = project.getProjectBroker().getKey();
    OLATResourceable projectBrokerOres = OresHelper.createOLATResourceableInstance(this.getClass(), projectBrokerId);
    CoordinatorManager.getInstance().getCoordinator().getSyncer().doInSync(projectBrokerOres, new SyncerExecutor() {

        public void execute() {
            Project reloadedProject = (Project) dbInstance.loadObject(project, true);
            // delete first candidate-group, project-group will be deleted after deleting project
            SecurityGroup candidateGroup = reloadedProject.getCandidateGroup();
            if ((courseEnv != null) && (cNode != null)) {
                deleteAllAttachmentFilesOfProject(reloadedProject, courseEnv, cNode);
                deleteAllDropboxFilesOfProject(reloadedProject, courseEnv, cNode);
                deleteAllReturnboxFilesOfProject(reloadedProject, courseEnv, cNode);
            }
            dbInstance.deleteObject(reloadedProject);
            logInfo("deleteSecurityGroup(project.getCandidateGroup())=" + candidateGroup.getKey());
            securityManager.deleteSecurityGroup(candidateGroup);
            // invalide with removing from cache
            projectCache.remove(projectBrokerId.toString());
        }
    });
    if (deleteGroup) {
        logDebug("start deleteProjectGroupFor project=" + project);
        projectGroupManager.deleteProjectGroupFor(project);
    }
    logDebug("DONE deleteProjectGroupFor project=" + project);
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) OLATResourceable(org.olat.core.id.OLATResourceable) SyncerExecutor(org.olat.core.util.coordinate.SyncerExecutor) SecurityGroup(org.olat.basesecurity.SecurityGroup)

Example 68 with Project

use of org.olat.course.nodes.projectbroker.datamodel.Project in project openolat by klemens.

the class ProjectGroupManagerImpl method hasProjectBrokerAnyCandidates.

@Override
public boolean hasProjectBrokerAnyCandidates(Long projectBrokerId) {
    List<Project> projectList = projectBrokerManager.getProjectListBy(projectBrokerId);
    for (Iterator<Project> iterator = projectList.iterator(); iterator.hasNext(); ) {
        Project project = iterator.next();
        List<Identity> candidates = securityManager.getIdentitiesOfSecurityGroup(project.getCandidateGroup());
        if (!candidates.isEmpty()) {
            return true;
        }
    }
    return false;
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) Identity(org.olat.core.id.Identity)

Example 69 with Project

use of org.olat.course.nodes.projectbroker.datamodel.Project in project openolat by klemens.

the class ProjectGroupManagerImpl method acceptAllCandidates.

@Override
public void acceptAllCandidates(Long projectBrokerId, Identity actionIdentity, boolean autoSignOut, boolean isAcceptSelectionManually) {
    // loop over all project
    List<Project> projectList = projectBrokerManager.getProjectListBy(projectBrokerId);
    for (Iterator<Project> iterator = projectList.iterator(); iterator.hasNext(); ) {
        Project project = iterator.next();
        List<Identity> candidates = securityManager.getIdentitiesOfSecurityGroup(project.getCandidateGroup());
        if (!candidates.isEmpty()) {
            log.audit("ProjectBroker: Accept ALL candidates, project=" + project);
            acceptCandidates(candidates, project, actionIdentity, autoSignOut, isAcceptSelectionManually);
        }
    }
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) Identity(org.olat.core.id.Identity)

Example 70 with Project

use of org.olat.course.nodes.projectbroker.datamodel.Project in project openolat by klemens.

the class ProjectBrokerExportGenerator method createCourseResultsOverviewTable.

/**
 * The results from assessable nodes are written to one row per user into an excel-sheet. An
 * assessable node will only appear if it is producing at least one of the
 * following variables: score, passed, attempts, comments.
 *
 * @param identities
 * @param myNodes
 * @param course
 * @param locale
 * @return String
 */
public static String createCourseResultsOverviewTable(CourseNode courseNode, ICourse course, Locale locale) {
    Translator translator = Util.createPackageTranslator(ProjectBrokerControllerFactory.class, locale);
    StringBuilder table = new StringBuilder();
    ProjectBrokerModuleConfiguration moduleConfig = new ProjectBrokerModuleConfiguration(courseNode.getModuleConfiguration());
    ProjectBrokerManager projectBrokerManager = CoreSpringFactory.getImpl(ProjectBrokerManager.class);
    // load project-list
    CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    Long projectBrokerId = projectBrokerManager.getProjectBrokerId(cpm, courseNode);
    if (projectBrokerId != null) {
        List<Project> projects = projectBrokerManager.getProjectListBy(projectBrokerId);
        // build table-header
        table.append(createHeaderLine(translator, moduleConfig));
        // loop over all projects
        for (Project project : projects) {
            table.append(createProjectDataLine(translator, project, moduleConfig, translator));
        }
    } else {
        log.debug("projectBrokerId is null, courseNode=" + courseNode + " , course=" + course);
    }
    return table.toString();
}
Also used : Project(org.olat.course.nodes.projectbroker.datamodel.Project) Translator(org.olat.core.gui.translator.Translator) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Aggregations

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