Package org.olat.resource.references

Examples of org.olat.resource.references.ReferenceManager


  /**
   * @see org.olat.repository.handlers.RepositoryHandler#readyToDelete(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
   */
  public boolean readyToDelete(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
    ReferenceManager refM = ReferenceManager.getInstance();
    String referencesSummary = refM.getReferencesToSummary(res, ureq.getLocale());
    if (referencesSummary != null) {
      Translator translator = new PackageTranslator(PACKAGE, ureq.getLocale());
      wControl.setError(translator.translate("details.delete.error.references",
          new String[] { referencesSummary }));
      return false;
View Full Code Here


   * @see org.olat.repository.handlers.RepositoryHandler#readyToDelete(org.olat.core.id.OLATResourceable,
   *      org.olat.core.gui.UserRequest,
   *      org.olat.core.gui.control.WindowControl)
   */
  public boolean readyToDelete(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
    ReferenceManager refM = ReferenceManager.getInstance();
    String referencesSummary = refM.getReferencesToSummary(res, ureq.getLocale());
    if (referencesSummary != null) {
      Translator translator = Util.createPackageTranslator(RepositoryManager.class, ureq.getLocale());
      wControl.setError(translator.translate("details.delete.error.references", new String[] { referencesSummary }));
      return false;
    }
View Full Code Here

   */
  public static void deleteCourse(OLATResourceable res) {
    PersistingCourseImpl course = (PersistingCourseImpl) loadCourse(res);

    // find all references to course
    ReferenceManager refM = ReferenceManager.getInstance();
    List refs = refM.getReferences(course);
    for (Iterator iter = refs.iterator(); iter.hasNext();) {
      ReferenceImpl ref = (ReferenceImpl) iter.next();
      refM.delete(ref);
    }
    // call cleanupOnDelet for nodes
    Visitor visitor = new NodeDeletionVisitor(course);
    TreeVisitor tv = new TreeVisitor(visitor, course.getRunStructure().getRootNode(), true);
    tv.visitAll();
View Full Code Here

      File fSourceTaskfoldernodesFolder = new File(FolderConfig.getCanonicalRoot()
          + TACourseNode.getTaskFoldersPathRelToFolderRoot(sourceCourse.getCourseEnvironment()));
      if (fSourceTaskfoldernodesFolder.exists()) FileUtils.copyDirToDir(fSourceTaskfoldernodesFolder, fTargetCourseBasePath, false);

      // update references
      ReferenceManager refM = ReferenceManager.getInstance();
      List refs = refM.getReferences(sourceCourse);
      for (Iterator iter = refs.iterator(); iter.hasNext();) {
        ReferenceImpl ref = (ReferenceImpl) iter.next();
        refM.addReference(targetCourse, ref.getTarget(), ref.getUserdata());
      }
      CourseGroupManager sourceCgm = sourceCourse.getCourseEnvironment().getCourseGroupManager();
      CourseGroupManager targetCgm = targetCourse.getCourseEnvironment().getCourseGroupManager();
      targetCgm.createCourseGroupmanagementAsCopy(sourceCgm, sourceCourse.getCourseTitle());
    }
View Full Code Here

   * Deletes the reference from a course to a shared folder.
   *
   * @param entry - the course that holds a reference to a sharedfolder
   */
  public static void deleteRefTo(ICourse course) {
    ReferenceManager refM = ReferenceManager.getInstance();
    List repoRefs = refM.getReferences(course);
    for (Iterator iter = repoRefs.iterator(); iter.hasNext();) {
      ReferenceImpl ref = (ReferenceImpl) iter.next();
      if (ref.getUserdata().equals(SHAREDFOLDERREF)) {
        refM.delete(ref);
        return;
      }
    }
  }
View Full Code Here

  /**
   * @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);
  }
View Full Code Here

   * Delete references to resourceables of node with ident courseNodeIdent.
   *
   * @param courseNode
   */
  private void deleteRefs(CourseNode courseNode) {
    ReferenceManager refM = ReferenceManager.getInstance();
    List courseRefs = refM.getReferences(course);
    for (Iterator iter = courseRefs.iterator(); iter.hasNext();) {
      ReferenceImpl ref = (ReferenceImpl) iter.next();
      if (!ref.getUserdata().equals(courseNode.getIdent())) continue;
      refM.delete(ref);
      break;
    }
  }
View Full Code Here

   * @see org.olat.repository.handlers.RepositoryHandler#readyToDelete(org.olat.resource.OLATResourceable,
   *      org.olat.core.gui.UserRequest,
   *      org.olat.core.gui.control.WindowControl)
   */
  public boolean readyToDelete(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
    ReferenceManager refM = ReferenceManager.getInstance();
    String referencesSummary = refM.getReferencesToSummary(res, ureq.getLocale());
    if (referencesSummary != null) {
      Translator translator = new PackageTranslator(PACKAGE, ureq.getLocale());
      wControl.setError(translator.translate("details.delete.error.references",
          new String[] { referencesSummary }));
      return false;
View Full Code Here

  /**
   * @see org.olat.repository.handlers.RepositoryHandler#readyToDelete(org.olat.core.id.OLATResourceable org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
   */
  public boolean readyToDelete(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
    ReferenceManager refM = ReferenceManager.getInstance();
    String referencesSummary = refM.getReferencesToSummary(res, ureq.getLocale());
    if (referencesSummary != null) {
      Translator translator = new PackageTranslator(PACKAGE, ureq.getLocale());
      wControl.setError(translator.translate("details.delete.error.references",
          new String[] { referencesSummary }));
      return false;
View Full Code Here

            lri = LoggingResourceable.wrapNonOlatResource(StringResourceableType.glossarySoftKey, glossarySoftKey, glossarySoftKey);
          }
          ThreadLocalUserActivityLogger.log(cglosCtr.getLoggingAction(), getClass(), lri);
          if(changedCourseConfig.getGlossarySoftKey()==null) {
            // update references
            ReferenceManager refM = ReferenceManager.getInstance();
            List repoRefs = refM.getReferences(course);
            for (Iterator iter = repoRefs.iterator(); iter.hasNext();) {
              ReferenceImpl ref = (ReferenceImpl) iter.next();
              if (ref.getUserdata().equals(GlossaryManager.GLOSSARY_REPO_REF_IDENTIFYER)) {
                refM.delete(ref);
                continue;
              }
            }
          } else if(changedCourseConfig.getGlossarySoftKey()!=null) {
            // update references
View Full Code Here

TOP

Related Classes of org.olat.resource.references.ReferenceManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.