use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.
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);
}
use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.
the class ForumNodeForumCallback method cleanupOnDelete.
/**
* @see org.olat.course.nodes.GenericCourseNode#cleanupOnDelete(org.olat.course.ICourse)
*/
@Override
public void cleanupOnDelete(ICourse course) {
super.cleanupOnDelete(course);
// mark the subscription to this node as deleted
SubscriptionContext forumSubContext = CourseModule.createTechnicalSubscriptionContext(course.getCourseEnvironment(), this);
NotificationsManager.getInstance().delete(forumSubContext);
// delete the forum, if there is one (is created on demand only)
CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
if (forumKeyProperty != null) {
Long forumKey = forumKeyProperty.getLongValue();
// delete the forum
ForumManager.getInstance().deleteForum(forumKey);
// delete the property
cpm.deleteProperty(forumKeyProperty);
}
}
use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.
the class ForumNodeForumCallback method archiveNodeData.
@Override
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String charset) {
CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
if (forumKeyProperty == null) {
return false;
}
Long forumKey = forumKeyProperty.getLongValue();
if (ForumManager.getInstance().countThreadsByForumID(forumKey) <= 0) {
return false;
}
String forumName = "forum_" + Formatter.makeStringFilesystemSave(getShortTitle()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
ForumStreamedRTFFormatter rtff = new ForumStreamedRTFFormatter(exportStream, forumName, false, locale);
ForumArchiveManager.getInstance().applyFormatter(rtff, forumKey, null);
return true;
}
use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.
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.");
}
use of org.olat.course.properties.CoursePropertyManager in project openolat by klemens.
the class ProjectBrokerCourseNode method informOnDelete.
/**
* @see org.olat.course.nodes.CourseNode#informOnDelete(org.olat.core.gui.UserRequest,
* org.olat.course.ICourse)
*/
@Override
public String informOnDelete(Locale locale, ICourse course) {
Translator trans = new PackageTranslator(PACKAGE_PROJECTBROKER, locale);
CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
List<Property> list = cpm.listCourseNodeProperties(this, null, null, null);
// properties exist
if (list.size() != 0)
return trans.translate(NLS_WARN_NODEDELETE);
File fDropboxFolder = new File(FolderConfig.getCanonicalRoot() + DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), this));
// Dropbox folder contains files
if (fDropboxFolder.exists() && fDropboxFolder.list().length > 0)
return trans.translate(NLS_WARN_NODEDELETE);
File fReturnboxFolder = new File(FolderConfig.getCanonicalRoot() + ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), this));
// Returnbox folder contains files
if (fReturnboxFolder.exists() && fReturnboxFolder.list().length > 0)
return trans.translate(NLS_WARN_NODEDELETE);
// no data yet.
return null;
}
Aggregations