Search in sources :

Example 66 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class PreviewConfigHelper method getPreviewCourseEnvironment.

public static CourseEnvironment getPreviewCourseEnvironment(boolean isCoach, boolean isCourseAdmin, ICourse course) {
    // generateEnvironment();
    final RepositoryEntry courseResource = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    final CourseGroupManager cgm = new PreviewCourseGroupManager(courseResource, new ArrayList<BusinessGroup>(), new ArrayList<BGArea>(), isCoach, isCourseAdmin);
    final UserNodeAuditManager auditman = new PreviewAuditManager();
    final AssessmentManager am = new PreviewAssessmentManager();
    final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
    final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
    final String title = course.getCourseTitle();
    final CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
    CourseEnvironment previewCourseEnvironment = new PreviewCourseEnvironment(title, runStructure, new Date(), course.getCourseFolderContainer(), course.getCourseBaseContainer(), course.getResourceableId(), cpm, cgm, auditman, am, courseConfig);
    return previewCourseEnvironment;
}
Also used : CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) BusinessGroup(org.olat.group.BusinessGroup) AssessmentManager(org.olat.course.assessment.AssessmentManager) RepositoryEntry(org.olat.repository.RepositoryEntry) Date(java.util.Date) CourseConfig(org.olat.course.config.CourseConfig) UserNodeAuditManager(org.olat.course.auditing.UserNodeAuditManager) BGArea(org.olat.group.area.BGArea) Structure(org.olat.course.Structure) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 67 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class ModifyCourseEvent method deleteCourse.

/**
 * Delete a course including its course folder and all references to resources
 * this course holds.
 *
 * @param res
 */
public static void deleteCourse(RepositoryEntry entry, OLATResource res) {
    final long start = System.currentTimeMillis();
    log.info("deleteCourse: starting to delete course. res=" + res);
    PersistingCourseImpl course = null;
    try {
        course = (PersistingCourseImpl) loadCourse(res);
    } catch (CorruptedCourseException e) {
        log.error("Try to delete a corrupted course, I make want I can.");
    }
    // call cleanupOnDelete for nodes
    if (course != null) {
        Visitor visitor = new NodeDeletionVisitor(course);
        TreeVisitor tv = new TreeVisitor(visitor, course.getRunStructure().getRootNode(), true);
        tv.visitAll();
    }
    // delete assessment notifications
    OLATResourceable assessmentOres = OresHelper.createOLATResourceableInstance(CourseModule.ORES_COURSE_ASSESSMENT, res.getResourceableId());
    NotificationsManager.getInstance().deletePublishersOf(assessmentOres);
    // delete all course notifications
    NotificationsManager.getInstance().deletePublishersOf(res);
    // delete calendar subscription
    clearCalenderSubscriptions(res, course);
    // the course folder which is deleted right after)
    if (course != null) {
        CourseConfigManagerImpl.getInstance().deleteConfigOf(course);
    }
    CoreSpringFactory.getImpl(TaskExecutorManager.class).delete(res);
    // delete course group- and rightmanagement
    CourseGroupManager courseGroupManager = PersistingCourseGroupManager.getInstance(res);
    courseGroupManager.deleteCourseGroupmanagement();
    // delete all remaining course properties
    CoursePropertyManager propertyManager = PersistingCoursePropertyManager.getInstance(res);
    propertyManager.deleteAllCourseProperties();
    // delete course calendar
    CoreSpringFactory.getImpl(ImportToCalendarManager.class).deleteCourseImportedCalendars(res);
    CoreSpringFactory.getImpl(CalendarManager.class).deleteCourseCalendar(res);
    // delete IM messages
    CoreSpringFactory.getImpl(InstantMessagingService.class).deleteMessages(res);
    // delete tasks
    CoreSpringFactory.getImpl(GTAManager.class).deleteAllTaskLists(entry);
    // cleanup cache
    removeFromCache(res.getResourceableId());
    // TODO: ld: broadcast event: DeleteCourseEvent
    // Everything is deleted, so we could get rid of course logging
    // with the change in user audit logging - which now all goes into a DB
    // we no longer do this though!
    // delete course directory
    VFSContainer fCourseBasePath = getCourseBaseContainer(res.getResourceableId());
    VFSStatus status = fCourseBasePath.deleteSilently();
    boolean deletionSuccessful = (status == VFSConstants.YES || status == VFSConstants.SUCCESS);
    log.info("deleteCourse: finished deletion. res=" + res + ", deletion successful: " + deletionSuccessful + ", duration: " + (System.currentTimeMillis() - start) + " ms.");
}
Also used : TaskExecutorManager(org.olat.core.commons.services.taskexecutor.TaskExecutorManager) CourseGroupManager(org.olat.course.groupsandrights.CourseGroupManager) PersistingCourseGroupManager(org.olat.course.groupsandrights.PersistingCourseGroupManager) TreeVisitor(org.olat.core.util.tree.TreeVisitor) Visitor(org.olat.core.util.tree.Visitor) OLATResourceable(org.olat.core.id.OLATResourceable) VFSContainer(org.olat.core.util.vfs.VFSContainer) InstantMessagingService(org.olat.instantMessaging.InstantMessagingService) ImportToCalendarManager(org.olat.commons.calendar.manager.ImportToCalendarManager) TreeVisitor(org.olat.core.util.tree.TreeVisitor) ImportToCalendarManager(org.olat.commons.calendar.manager.ImportToCalendarManager) CalendarManager(org.olat.commons.calendar.CalendarManager) VFSStatus(org.olat.core.util.vfs.VFSStatus) GTAManager(org.olat.course.nodes.gta.GTAManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 68 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class LTIRunController method storeDataExchangeAcceptance.

/**
 * Helper to save the user accepted data exchange
 */
private void storeDataExchangeAcceptance() {
    CoursePropertyManager propMgr = this.userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    String hash = createHashFromExchangeDataProperties();
    Property prop = propMgr.createCourseNodePropertyInstance(this.courseNode, getIdentity(), null, PROP_NAME_DATA_EXCHANGE_ACCEPTED, null, null, hash, null);
    propMgr.saveProperty(prop);
}
Also used : Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 69 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class TaskController method markTaskAsSampled.

private void markTaskAsSampled(String task) {
    CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
    Property p = cpm.createCourseNodePropertyInstance(node, null, null, PROP_SAMPLED, null, null, task, null);
    cpm.saveProperty(p);
}
Also used : Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager)

Example 70 with CoursePropertyManager

use of org.olat.course.properties.CoursePropertyManager in project OpenOLAT by OpenOLAT.

the class ENCourseNode method cleanupOnDelete.

/**
 * @see org.olat.course.nodes.CourseNode#cleanupOnDelete(org.olat.course.ICourse)
 */
@Override
public void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
    cpm.deleteNodeProperties(this, PROPERTY_INITIAL_ENROLLMENT_DATE);
    cpm.deleteNodeProperties(this, PROPERTY_RECENT_ENROLLMENT_DATE);
}
Also used : CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager)

Aggregations

CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)108 Property (org.olat.properties.Property)62 PersistingCoursePropertyManager (org.olat.course.properties.PersistingCoursePropertyManager)44 Identity (org.olat.core.id.Identity)28 File (java.io.File)18 ICourse (org.olat.course.ICourse)18 ProjectBrokerManager (org.olat.course.nodes.projectbroker.service.ProjectBrokerManager)14 CourseNode (org.olat.course.nodes.CourseNode)12 Project (org.olat.course.nodes.projectbroker.datamodel.Project)12 RepositoryEntry (org.olat.repository.RepositoryEntry)12 AssessmentChangedEvent (org.olat.course.assessment.AssessmentChangedEvent)10 UserNodeAuditManager (org.olat.course.auditing.UserNodeAuditManager)10 ProjectGroupManager (org.olat.course.nodes.projectbroker.service.ProjectGroupManager)10 BusinessGroup (org.olat.group.BusinessGroup)10 XStream (com.thoughtworks.xstream.XStream)8 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)8 TaskExecutorManager (org.olat.core.commons.services.taskexecutor.TaskExecutorManager)8 PackageTranslator (org.olat.core.gui.translator.PackageTranslator)8 Translator (org.olat.core.gui.translator.Translator)8 SyncerExecutor (org.olat.core.util.coordinate.SyncerExecutor)8