Package org.olat.course

Examples of org.olat.course.Structure


    final CourseGroupManager cgm = new PreviewCourseGroupManager(groups, new ArrayList(areas), isCoach, isCourseAdmin);
    final UserNodeAuditManager auditman = new PreviewAuditManager();
    final AssessmentManager am = new PreviewAssessmentManager();
    final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
    final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
    final String title = course.getCourseTitle();

    simCourseEnv = new PreviewCourseEnvironment(title, runStructure, psf.getDate(), course.getCourseFolderContainer(), course
        .getCourseBaseContainer(),course.getResourceableId(), cpm, cgm, auditman, am);
    simIdentEnv = new IdentityEnvironment();
View Full Code Here


    //generateEnvironment();       
    final CourseGroupManager cgm = new PreviewCourseGroupManager(new ArrayList(), new ArrayList(), isCoach, isCourseAdmin);
    final UserNodeAuditManager auditman = new PreviewAuditManager();
    final AssessmentManager am = new PreviewAssessmentManager();
    final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
    final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
    final String title = course.getCourseTitle();

    CourseEnvironment previewCourseEnvironment = new PreviewCourseEnvironment(title, runStructure, new Date(), course.getCourseFolderContainer(),
        course.getCourseBaseContainer(),course.getResourceableId(), cpm, cgm, auditman, am);     
   
View Full Code Here

    Set changedNodeIds = pe.getDeletedCourseNodeIds();
    changedNodeIds.addAll(pe.getInsertedCourseNodeIds());
    changedNodeIds.addAll(pe.getModifiedCourseNodeIds());
    //
    boolean courseAssessmentChanged = false;
    Structure courseRun = course.getRunStructure();
    for (Iterator iter = changedNodeIds.iterator(); iter.hasNext();) {
      String nodeId = (String) iter.next();
      boolean wasNodeAsessable = AssessmentHelper.checkIfNodeIsAssessable(courseRun.getNode(nodeId));
      boolean isNodeAssessable = AssessmentHelper.checkIfNodeIsAssessable(course.getEditorTreeModel().getCourseNode(nodeId));
      //if node was or became assessable
      if (wasNodeAsessable || isNodeAssessable) {       
        courseAssessmentChanged = true;
        break;
View Full Code Here

  /**
   * @see org.olat.course.run.environment.CourseEnvironment#getRunStructure()
   */
  public Structure getRunStructure() {
    Structure runStructure = course.getRunStructure();
    if (runStructure == null) throw new AssertException("asked for runstructure, but icourse's runstructure is still null");
    return runStructure;
  }
View Full Code Here

     * editor model after the new runstructure is generated into ram.
     */
    editorModelDeletedNodes = new ArrayList<CourseEditorTreeNode>();
    editorModelInsertedNodes = new ArrayList<CourseEditorTreeNode>();
    editorModelModifiedNodes = new ArrayList<CourseEditorTreeNode>();
    resultingCourseRun = new Structure();
    // has side effect on the above editorModelxxxNodes and the
    // resultingCourseRun;
    calculatePublishSet(nodeIdsToPublish);
  }
View Full Code Here

     */
    // start point for node publish visitor
    CourseEditorTreeNode editorRoot = (CourseEditorTreeNode) editorTreeModel.getRootNode();

    // the active runstructure and the new created runstructure
    Structure existingCourseRun = course.getRunStructure();
    // breadth first!
    boolean visitChildrenFirst = false;
    /*
     * the tree is visited and the book keeping lists are filled. the visitor
     * itself does not delete or modify neither runstructure nor editor tree
View Full Code Here

   * @param identity
   * @param locale
   */
  void applyPublishSet(Identity identity, Locale locale) {
    // the active runstructure and the new created runstructure
    Structure existingCourseRun = course.getRunStructure();
    EventBus orec = CoordinatorManager.getCoordinator().getEventBus();
    /*
     * use book keeping lists for publish event
     */
    Set<String> deletedCourseNodeIds = new HashSet<String>();
    if (editorModelDeletedNodes.size() > 0) {
      for (Iterator<CourseEditorTreeNode> iter = editorModelDeletedNodes.iterator(); iter.hasNext();) {
        CourseEditorTreeNode cetn = iter.next();
        CourseNode cn = cetn.getCourseNode();
        deletedCourseNodeIds.add(cn.getIdent());
      }
    }
    Set<String> insertedCourseNodeIds = new HashSet<String>();
    if (editorModelInsertedNodes.size() > 0) {
      for (Iterator<CourseEditorTreeNode> iter = editorModelInsertedNodes.iterator(); iter.hasNext();) {
        CourseEditorTreeNode cetn = iter.next();
        CourseNode cn = cetn.getCourseNode();
        insertedCourseNodeIds.add(cn.getIdent());
      }
    }
    Set<String> modifiedCourseNodeIds = new HashSet<String>();
    if (editorModelModifiedNodes.size() > 0) {
      for (Iterator<CourseEditorTreeNode> iter = editorModelModifiedNodes.iterator(); iter.hasNext();) {
        CourseEditorTreeNode cetn = iter.next();
        CourseNode cn = cetn.getCourseNode();
        modifiedCourseNodeIds.add(cn.getIdent());
      }
    }
    /*
     * broadcast PRE PUBLISH event that a publish will take place
     */
    PublishEvent beforePublish = new PublishEvent(editorTreeModel.getLatestPublishTimestamp(), course, PublishEvent.EVENT_IDENTIFIER);
    beforePublish.setDeletedCourseNodeIds(deletedCourseNodeIds);
    beforePublish.setInsertedCourseNodeIds(insertedCourseNodeIds);
    beforePublish.setModifiedCourseNodeIds(modifiedCourseNodeIds);
    beforePublish.setState(PublishEvent.PRE_PUBLISH);
    // old course structure accessible
    orec.fireEventToListenersOf(beforePublish, course);
    /*
     * TODO:pb: disucss with fj: listeners could add information to
     * beforePublish event such as a right to veto or add identities who is
     * currently in the course, thus stopping the publishing author from
     * publishing! i.e. if people are in a test or something like this.... we
     * could the ask here beforePublish.accepted() and proceed only in this
     * case.
     */
    //
    /*
     * remove new nodes which were marked as delete and deletion is published.
     */
    File exportDirectory = CourseFactory.getOrCreateDataExportDirectory(identity, course.getCourseTitle());
    UserManager um = UserManager.getInstance();
    String charset = um.getUserCharset(identity);
    if (editorModelDeletedNodes.size() > 0) {
      for (Iterator<CourseEditorTreeNode> iter = editorModelDeletedNodes.iterator(); iter.hasNext();) {
        CourseEditorTreeNode cetn = iter.next();
        CourseNode cn = cetn.getCourseNode();
        CourseNode oldCn = existingCourseRun.getNode(cetn.getIdent());
        // moved node with a parent deleted (deletion published) -> oldCn ==
        // null
        if (oldCn != null) {
          if (!(cn.getIdent().equals(oldCn.getIdent()))) { throw new AssertException("deleted cn.getIdent != oldCn.getIdent"); }
        }
        cetn.removeFromParent();
        if (!cetn.isNewnode()) {
          // only clean up and archive of nodes which were already in run
          // save data, remove references
          deleteRefs(oldCn);
          oldCn.archiveNodeData(locale, course, exportDirectory, charset);
          // 2) delete all user data
          oldCn.cleanupOnDelete(course);
        }
      }
    }
    /*
     * mark modified ones as no longer dirty
     */
    if (editorModelModifiedNodes.size() > 0) {
      for (Iterator<CourseEditorTreeNode> iter = editorModelModifiedNodes.iterator(); iter.hasNext();) {
        CourseEditorTreeNode cetn = iter.next();
        CourseNode cn = cetn.getCourseNode();
        CourseNode oldCn = existingCourseRun.getNode(cetn.getIdent());
        // moved node with a parent deleted (deletion published) -> oldCn ==
        // null
        if (oldCn != null) {
          if (!(cn.getIdent().equals(oldCn.getIdent()))) { throw new AssertException("deleted cn.getIdent != oldCn.getIdent"); }
        }
        cetn.setDirty(false);
        //
        updateRefs(cn, oldCn);
      }
    }
    /*
     * mark newly published ones is no longer new and dirty
     */
    if (editorModelInsertedNodes.size() > 0) {
      for (Iterator<CourseEditorTreeNode> iter = editorModelInsertedNodes.iterator(); iter.hasNext();) {
        CourseEditorTreeNode cetn = iter.next();
        CourseNode cn = cetn.getCourseNode();
        CourseNode oldCn = existingCourseRun.getNode(cetn.getIdent());
        if (oldCn != null) { throw new AssertException("new node has an oldCN??"); }
        cetn.setDirty(false);
        cetn.setNewnode(false);
        //
        updateRefs(cn, null);
      }
    }
    /*
     * saving
     */
    long pubtimestamp = System.currentTimeMillis();
    editorTreeModel.setLatestPublishTimestamp(pubtimestamp);
    // set the new runstructure and save it.
    existingCourseRun.setRootNode(resultingCourseRun.getRootNode());
    CourseFactory.saveCourse(course.getResourceableId());
   
    /*
     * broadcast event
     */
 
View Full Code Here

   * </ul>
   */
  private List<IQTESTCourseNode> getCourseTestNodes(ICourse course) {
    List<IQTESTCourseNode> assessableNodes = new ArrayList<IQTESTCourseNode>(10);

    Structure courseStruct = course.getRunStructure();
    CourseNode rootNode = courseStruct.getRootNode();

    getCourseTestNodes(rootNode, assessableNodes);

    return assessableNodes;
  }
View Full Code Here

    ContextEntry ce = bc.popLauncherContextEntry();
    if (ce != null) {
      OLATResourceable oresNode = ce.getOLATResourceable();
      if (OresHelper.isOfType(oresNode, CourseNode.class)) {
        Long courseNodeId = oresNode.getResourceableId();
        Structure runStructure = assessedUserCourseEnvironment.getCourseEnvironment().getRunStructure();
        CourseNode courseNode = runStructure.getNode(courseNodeId.toString());
        if(courseNode instanceof AssessableCourseNode) {
          doEditNodeAssessment(ureq, (AssessableCourseNode)courseNode);
        }
      }
    }
View Full Code Here

   * @return
   */
  private List<DENCourseNode> getCourseDENNodes(ICourse course) {
    List<DENCourseNode> denNodes = new ArrayList<DENCourseNode>(10);

    Structure courseStruct = course.getRunStructure();
    CourseNode rootNode = courseStruct.getRootNode();

    getCourseDENNodes(rootNode, denNodes);
    return denNodes;
  }
View Full Code Here

TOP

Related Classes of org.olat.course.Structure

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.