Examples of CoursePropertyManager


Examples of org.olat.course.properties.CoursePropertyManager

   * @return the loaded forum
   */
  private Forum loadOrCreateForum(final UserCourseEnvironment userCourseEnv) {
    updateModuleConfigDefaults(false);       
    final ForumManager fom = ForumManager.getInstance();
    final CoursePropertyManager cpm = userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    final CourseNode thisCourseNode = this;
    Forum theForum = null;
   
    Codepoint.codepoint(FOCourseNode.class, "findCourseNodeProperty")
    Property forumKeyProp = cpm.findCourseNodeProperty(thisCourseNode, null, null, FORUM_KEY);
    //System.out.println("System.out.println - findCourseNodeProperty");
    if(forumKeyProp!=null) {
      // Forum does already exist, load forum with key from properties
      Long forumKey = forumKeyProp.getLongValue();
      theForum = fom.loadForum(forumKey);
      if (theForum == null) { throw new OLATRuntimeException(FOCourseNode.class, "Tried to load forum with key " + forumKey.longValue() + " in course "
        + userCourseEnv.getCourseEnvironment().getCourseResourceableId() + " for node " + thisCourseNode.getIdent()
        + " as defined in course node property but forum manager could not load forum.", null); }
    } else {
      //creates resourceable from FOCourseNode.class and the current node id as key
      OLATResourceable courseNodeResourceable = OresHelper.createOLATResourceableInstance(FOCourseNode.class, new Long(this.getIdent()));
      Codepoint.codepoint(FOCourseNode.class, "beforeDoInSync");   
      //System.out.println("System.out.println - beforeDoInSync");
      //o_clusterOK by:ld
      theForum = CoordinatorManager.getCoordinator().getSyncer().doInSync(courseNodeResourceable, new SyncerCallback<Forum>(){
        public Forum execute() {
        Forum forum = null;
        Long forumKey;             
        Codepoint.codepoint(FOCourseNode.class,"doInSync");
        //System.out.println("Codepoint - doInSync");
        Property forumKeyProperty = cpm.findCourseNodeProperty(thisCourseNode, null, null, FORUM_KEY);       
        if (forumKeyProperty == null) {
          // First call of forum, create new forum and save forum key as property         
          forum = fom.addAForum();
          forumKey = forum.getKey();
          forumKeyProperty = cpm.createCourseNodePropertyInstance(thisCourseNode, null, null, FORUM_KEY, null, forumKey, null, null);
          cpm.saveProperty(forumKeyProperty)
          //System.out.println("Forum added");
        } else {
          // Forum does already exist, load forum with key from properties
          forumKey = forumKeyProperty.getLongValue();
          forum = fom.loadForum(forumKey);
View Full Code Here

Examples of org.olat.course.properties.CoursePropertyManager

  /**
   *
   * @see org.olat.course.nodes.CourseNode#archiveNodeData(java.util.Locale, org.olat.course.ICourse, java.io.File, java.lang.String)
   */
  public void archiveNodeData(Locale locale, ICourse course, File exportDirectory, String charset) {
    CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
    if(forumKeyProperty != null){
      Long forumKey = forumKeyProperty.getLongValue();
      String forumName = Formatter.makeStringFilesystemSave(this.getShortTitle());

      // append export timestamp to avoid overwriting previous export
View Full Code Here

Examples of org.olat.course.properties.CoursePropertyManager

  /**
   * @see org.olat.course.nodes.CourseNode#informOnDelete(org.olat.core.gui.UserRequest,
   *      org.olat.course.ICourse)
   */
  public String informOnDelete(Locale locale, ICourse course) {
    CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
    Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
    if (forumKeyProperty == null) return null; // no forum created yet
    return new PackageTranslator(PACKAGE_FO, locale).translate("warn.forumdelete");
  }
View Full Code Here

Examples of org.olat.course.properties.CoursePropertyManager

    // mark the subscription to this node as deleted
    SubscriptionContext forumSubContext = CourseModule.createTechnicalSubscriptionContext(course.getCourseEnvironment(), this);
    NotificationsManager.getInstance().delete(forumSubContext);

    // delete the forum, if there is one (is created on demand only)
    CoursePropertyManager cpm = PersistingCoursePropertyManager.getInstance(course);
    Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
    if (forumKeyProperty == null) return; // no forum created yet
    Long forumKey = forumKeyProperty.getLongValue();
    ForumManager.getInstance().deleteForum(forumKey); // delete the forum
    cpm.deleteProperty(forumKeyProperty); // delete the property
  }
View Full Code Here

Examples of org.olat.course.properties.CoursePropertyManager

    SearchResourceContext courseNodeResourceContext = new SearchResourceContext(repositoryResourceContext);
    courseNodeResourceContext.setBusinessControlFor(courseNode);
    courseNodeResourceContext.setTitle(courseNode.getShortTitle());
    courseNodeResourceContext.setDescription(courseNode.getLongTitle());
   
    CoursePropertyManager coursePropMgr = course.getCourseEnvironment().getCoursePropertyManager();
    DialogPropertyElements elements = dialogElmsMgr.findDialogElements(coursePropMgr, courseNode);
    List<DialogElement> list = new ArrayList<DialogElement>();
    if (elements != null) list = elements.getDialogPropertyElements();
    // loop over all dialog elements
    for (Iterator<DialogElement> iter = list.iterator(); iter.hasNext();) {
View Full Code Here

Examples of org.olat.course.properties.CoursePropertyManager

    }

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

Examples of org.olat.course.properties.CoursePropertyManager

  public static CourseEnvironment getPreviewCourseEnvironment(boolean isCoach, boolean isCourseAdmin, ICourse course) {
    //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

Examples of org.olat.course.properties.CoursePropertyManager

    ExportUtil.writeContentToFile(getExportFilename(), exportContent, exportDirectory, WebappHelper.getDefaultCharset());
  }
 
  @Override
  public Controller importNode(File importDirectory, ICourse course, boolean unattendedImport, UserRequest ureq, WindowControl wControl) {
    CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    if(getChecklistKey(cpm) != null) deleteChecklistKeyConf(cpm);
   
    File importFile = new File(importDirectory, getExportFilename());
    String importContent = FileUtils.load(importFile, WebappHelper.getDefaultCharset());
    if(importContent == null || importContent.isEmpty()) {
View Full Code Here

Examples of org.olat.course.properties.CoursePropertyManager

    // invalid node id's return still a valid double
    // TODO fg: check with editor tree model DONE: the above checks ensure only
    // valid node references
    // if (node == null) return new Double(Double.NEGATIVE_INFINITY);

    CoursePropertyManager pm = getUserCourseEnv().getCourseEnvironment().getCoursePropertyManager();
    Identity identity = getUserCourseEnv().getIdentityEnvironment().getIdentity();

    Property firstTime = pm.findCourseNodeProperty(node, identity, null, ENCourseNode.PROPERTY_INITIAL_ENROLLMENT_DATE);

    if (firstTime != null) {
      String firstTimeMillis = firstTime.getStringValue();
      return Double.valueOf(firstTimeMillis);
    } else {
View Full Code Here

Examples of org.olat.course.properties.CoursePropertyManager

    courseNodeResourceContext.setBusinessControlFor(courseNode);
    courseNodeResourceContext.setTitle(courseNode.getShortTitle());
    courseNodeResourceContext.setDescription(courseNode.getLongTitle());
      
    // go further, index my projects
    CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    Long projectBrokerId = ProjectBrokerManagerFactory.getProjectBrokerManager().getProjectBrokerId(cpm, courseNode);
    List<Project> projects = ProjectBrokerManagerFactory.getProjectBrokerManager().getProjectListBy(projectBrokerId);
    for (Iterator<Project> iterator = projects.iterator(); iterator.hasNext();) {
      Project project = iterator.next();
      Document document = ProjectBrokerProjectDocument.createDocument(courseNodeResourceContext, project);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.