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;
}
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);
}
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;
}
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);
}
}
}
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();
}
Aggregations