Package org.olat.resource.references

Examples of org.olat.resource.references.ReferenceImpl


 
  public QTIEditorMainController(List referencees, UserRequest ureq, WindowControl wControl, FileResource fileResource) {
    super(ureq, wControl);

    for(Iterator iter = referencees.iterator(); iter.hasNext(); ) {
      ReferenceImpl ref = (ReferenceImpl)iter.next();
      if ("CourseModule".equals(ref.getSource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(ref.getSource().getResourceableId());
        CourseNode courseNode = course.getEditorTreeModel().getCourseNode(ref.getUserdata());
        String repositorySoftKey = (String) courseNode.getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
        Long repKey = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repositorySoftKey, true).getKey();
        List<QTIResult> results = QTIResultManager.getInstance().selectResults(course.getResourceableId(), courseNode.getIdent(), repKey, 1);
        this.restrictedEdit = ((CoordinatorManager.getCoordinator().getLocker().isLocked(course, null)) || (results != null && results.size() > 0)) ? true : false;
      }
View Full Code Here


    changeEmail.addEmailTo(cl);

    StringBuilder result = new StringBuilder();
    result.append(translate("qti.restricted.leading"));
    for (Iterator iter = referencees.iterator(); iter.hasNext();) {
      ReferenceImpl element = (ReferenceImpl) iter.next();
      // FIXME:discuss:possible performance/cache problem
      if ("CourseModule".equals(element.getSource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(element.getSource().getResourceableId());

        // the course owners

        RepositoryEntry entry = rm.lookupRepositoryEntry(course, false);
        String courseTitle = course.getCourseTitle();
        SecurityGroup owners = entry.getOwnerGroup();
        List stakeHoldersIds = ManagerFactory.getManager().getIdentitiesOfSecurityGroup(owners);

        // add stakeholders as group
        cl = new ContactList(courseTitle);
        cl.addAllIdentites(stakeHoldersIds);
        changeEmail.addEmailTo(cl);

        StringBuilder stakeHolders = new StringBuilder();
        User user = ((Identity) stakeHoldersIds.get(0)).getUser();
        Locale loc = ureq.getLocale();
        stakeHolders.append(user.getProperty(UserConstants.FIRSTNAME, loc)).append(" ").append(user.getProperty(UserConstants.LASTNAME, loc));
        for (int i = 1; i < stakeHoldersIds.size(); i++) {
          user = ((Identity) stakeHoldersIds.get(i)).getUser();
          stakeHolders.append(", ").append(user.getProperty(UserConstants.FIRSTNAME, loc)).append(" ").append(user.getProperty(UserConstants.LASTNAME, loc));
        }

        CourseNode cn = course.getEditorTreeModel().getCourseNode(element.getUserdata());
        String courseNodeTitle = cn.getShortTitle();
        result.append(translate("qti.restricted.course", courseTitle));
        result.append(translate("qti.restricted.node", courseNodeTitle));
        result.append(translate("qti.restricted.owners", stakeHolders.toString()));
      }
View Full Code Here

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

      // 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

   */
  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

  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);
View Full Code Here

   */
  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

          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) {
View Full Code Here

TOP

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

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.