/**
* @param res glossary to be deleted
*/
public void deleteGlossary(OLATResourceable res) {
// first remove all references
ReferenceManager refM = ReferenceManager.getInstance();
List repoRefs = refM.getReferencesTo(res);
for (Iterator iter = repoRefs.iterator(); iter.hasNext();) {
ReferenceImpl ref = (ReferenceImpl) 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
OLATResourceImpl courseResource = ref.getSource();
//ICourse course = CourseFactory.loadCourse(courseResource);
ICourse course = CourseFactory.openCourseEditSession(courseResource.getResourceableId());
CourseConfig cc = course.getCourseEnvironment().getCourseConfig();
cc.setGlossarySoftKey(null);
CourseFactory.setCourseConfig(course.getResourceableId(), cc);
CourseFactory.closeCourseEditSession(course.getResourceableId(),true);
// remove reference from the references table
refM.delete(ref);
}
}
// now remove the resource itself
FileResourceManager.getInstance().deleteFileResource(res);
}