/** @param res glossary to be deleted */ @Override public void deleteGlossary(final OLATResourceable res) { // first remove all references final List repoRefs = referenceManager.getReferencesTo(res); for (final Iterator iter = repoRefs.iterator(); iter.hasNext(); ) { final Reference ref = (Reference) iter.next(); if (ref.getUserdata().equals(GLOSSARY_REPO_REF_IDENTIFYER)) { // remove the reference from the course configuration // TODO:RH:improvement: this should use a callback method or send a general delete // event so that the course can take care of this rather than having it // here hardcoded final OLATResourceImpl courseResource = ref.getSource(); // ICourse course = CourseFactory.loadCourse(courseResource); final ICourse course = CourseFactory.openCourseEditSession(courseResource.getResourceableId()); final CourseConfig cc = course.getCourseEnvironment().getCourseConfig(); cc.setGlossarySoftKey(null); CourseFactory.setCourseConfig(course.getResourceableId(), cc); CourseFactory.closeCourseEditSession(course.getResourceableId(), true); // remove reference from the references table referenceManager.delete(ref); } } // now remove the resource itself FileResourceManager.getInstance().deleteFileResource(res); }
/** * Index a forum in a course. * * @param parentResourceContext * @param course * @param courseNode * @param indexWriter * @throws IOException */ private void doIndexForum( final SearchResourceContext parentResourceContext, final ICourse course, final CourseNode courseNode, final OlatFullIndexer indexWriter) throws IOException, InterruptedException { if (log.isDebugEnabled()) { log.debug("Index Course Forum..."); } final ForumService fom = getForumService(); final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager(); final PropertyImpl forumKeyProperty = cpm.findCourseNodeProperty(courseNode, null, null, FOCourseNode.FORUM_KEY); // Check if forum-property exist if (forumKeyProperty != null) { final Long forumKey = forumKeyProperty.getLongValue(); final Forum forum = fom.loadForum(forumKey); // SearchResourceContext forumSearchResourceContext = new // SearchResourceContext(parentResourceContext); // forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFORUM); // TODO:chg: Must be an other Class e.g. // CourseRunMainController parentResourceContext.setDocumentType(TYPE); parentResourceContext.setDocumentContext( course.getResourceableId() + " " + courseNode.getIdent() + " " + forumKey); doIndexAllMessages(parentResourceContext, forum, indexWriter); } }
public PreviewCourseEnvironment( final ICourse course, final Date simulatedDateTime, final CoursePropertyManager cpm, final CourseGroupManager cgm, final UserNodeAuditManager auditman, final AssessmentManager am) { super(); this.course = course; this.title = course.getCourseTitle(); this.courseFolderContainer = course.getCourseFolderContainer(); this.courseBaseContainer = course.getCourseBaseContainer(); this.runStructure = course.getEditorTreeModel().createStructureForPreview(); this.resourceablId = course.getResourceableId(); this.simulatedDateTime = simulatedDateTime.getTime(); this.coursePropertyManager = cpm; this.courseGroupManager = cgm; this.auditManager = auditman; this.assessmentManager = am; }