Package org.olat.core.util.notifications

Examples of org.olat.core.util.notifications.SubscriptionContext


  }
 
  private void notifyFinished(UserRequest ureq) {   
    // After upload, notify the subscribers
    if (secCallback != null) {
      SubscriptionContext subsContext = secCallback.getSubscriptionContext();
      if (subsContext != null) {
        NotificationsManager.getInstance().markPublisherNews(subsContext, ureq.getIdentity());
      }
    }
    // Notify everybody
View Full Code Here


        }
       
        // after a copy or a move, notify the subscribers
        VFSSecurityCallback secCallback = VFSManager.findInheritedSecurityCallback(folderComponent.getCurrentContainer());
        if (secCallback != null) {
          SubscriptionContext subsContext = secCallback.getSubscriptionContext();
          if (subsContext != null) {
            NotificationsManager.getInstance().markPublisherNews(subsContext, ureq.getIdentity());
          }
        }
        fireEvent(ureq, new FolderEvent(move ? FolderEvent.MOVE_EVENT : FolderEvent.COPY_EVENT, fileSelection.renderAsHtml()));
View Full Code Here

   * @param cenv
   * @param wikiCourseNode
   * @return
   */
  public static SubscriptionContext createTechnicalSubscriptionContextForCourse(CourseEnvironment cenv, WikiCourseNode wikiCourseNode) {
    return new SubscriptionContext(CourseModule.getCourseTypeName(), cenv.getCourseResourceableId(), wikiCourseNode.getIdent());
  }
View Full Code Here

        // ups, nodecmd is not a message, what the heck is it then?
        Tracing.createLoggerFor(this.getClass()).warn("Could not create message ID from given nodemcd::" + nodecmd, e);
      }
    }
    // Create subscription context and run controller
    SubscriptionContext forumSubContext = CourseModule.createSubscriptionContext(userCourseEnv.getCourseEnvironment(), this);
    FOCourseNodeRunController forumC = new FOCourseNodeRunController(ureq, userCourseEnv, wControl, theForum,
        new ForumNodeForumCallback(ne, isOlatAdmin, isGuestOnly, forumSubContext), this);
    return new NodeRunConstructionResult(forumC);
  }
View Full Code Here

  /**
   * @see org.olat.course.nodes.GenericCourseNode#cleanupOnDelete(org.olat.course.ICourse)
   */
  public void cleanupOnDelete(ICourse course) {
    // 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);
View Full Code Here

    nodeEval.putAccessStatus("editarticle", editor);
  }
 
  public void cleanupOnDelete(ICourse course) {
    // mark the subscription to this node as deleted
    SubscriptionContext subsContext = WikiManager.createTechnicalSubscriptionContextForCourse(course.getCourseEnvironment(), this);
    NotificationsManager.getInstance().delete(subsContext);
 
  }
View Full Code Here

    this.course = course;
    this.subscriptionContext = setSubscriptionContext();
  }
 
  private SubscriptionContext setSubscriptionContext() {
    SubscriptionContext subsContext = null;
    if (this.caller.equals(CalendarController.CALLER_COURSE) || this.caller.equals(CalendarManager.TYPE_COURSE)) {
      if (course != null) {
        subsContext = new SubscriptionContext(OresHelper.calculateTypeName(CalendarManager.class) + "." +  CalendarManager.TYPE_COURSE, course.getResourceableId(), CalendarController.ACTION_CALENDAR_COURSE);
      } else {
        Long courseId = this.kalendarRenderWrapper.getLinkProvider().getControler().getCourseID();
        if (courseId != null) {
          this.course = CourseFactory.loadCourse(courseId);
          subsContext = new SubscriptionContext(OresHelper.calculateTypeName(CalendarManager.class) + "." +  CalendarManager.TYPE_COURSE, this.kalendarRenderWrapper.getLinkProvider().getControler().getCourseID(), CalendarController.ACTION_CALENDAR_COURSE);
        }
      }
    }
    if (caller.equals(CalendarController.CALLER_COLLAB) || this.caller.equals(CalendarManager.TYPE_GROUP)) {
      Long resId = this.kalendarRenderWrapper.getKalendarConfig().getResId();
      if (resId == null) resId = Long.parseLong(this.kalendarRenderWrapper.getKalendar().getCalendarID());
      if (resId != null) {
        this.businessGroup = BusinessGroupManagerImpl.getInstance().loadBusinessGroup(resId, true);
        if (businessGroup != null) {
          subsContext = new SubscriptionContext(OresHelper.calculateTypeName(CalendarManager.class) + "." +  CalendarManager.TYPE_GROUP, businessGroup.getResourceableId(), CalendarController.ACTION_CALENDAR_GROUP);
        }
      }
    }
    return subsContext;
  }
View Full Code Here

   * @return the subscription context to use or <code>null</code> if the
   *         identity associated to the request is not allowed to be notified
   * @see #canSubscribeForAssessmentNotification(Identity, ICourse)
   */
  protected SubscriptionContext getAssessmentSubscriptionContext(Identity ident, ICourse course) {
    SubscriptionContext sctx = null;

    if (ident == null || canSubscribeForAssessmentNotification(ident, course)) {
      // Creates a new SubscriptionContext only if not found into cache
      Long courseId = course.getResourceableId();
      synchronized (subsContexts) { //o_clusterOK by:ld - no problem to have independent subsContexts caches for each cluster node
        sctx = subsContexts.get(courseId);
        if (sctx == null) {
          // a subscription context showing to the root node (the course's root
          // node is started when clicking such a notification)
          CourseNode cn = course.getRunStructure().getRootNode();
          CourseEnvironment ce = course.getCourseEnvironment();
          //FIXME:fg:b little problem is that the assessment tool and the course are not "the same" anymore, that is you can open the same course twice in the
          // dynamic tabs by a) klicking e.g. via repo, and b via notifications link to the assementtool
          sctx = new SubscriptionContext(CourseModule.ORES_COURSE_ASSESSMENT, ce.getCourseResourceableId(), cn.getIdent());
          subsContexts.put(courseId, sctx);
        }
      }
    }

View Full Code Here

   *
   * @param course the course to signal news about
   * @param ident the identity to ignore news for
   */
  private void markPublisherNews(Identity ident, ICourse course) {
    SubscriptionContext subsContext = getAssessmentSubscriptionContext(course);
    if (subsContext != null) {
      NotificationsManager.getInstance().markPublisherNews(subsContext, ident);
    }
  }
View Full Code Here

   *
   * @see org.olat.course.nodes.CourseNode#cleanupOnDelete(org.olat.course.ICourse)
   */
  public void cleanupOnDelete(ICourse course) {
    // mark the subscription to this node as deleted
    SubscriptionContext folderSubContext = CourseModule.createTechnicalSubscriptionContext(course.getCourseEnvironment(), this);
    NotificationsManager.getInstance().delete(folderSubContext);
    // delete filesystem
    File fFolderRoot = new File(FolderConfig.getCanonicalRoot() + getFoldernodePathRelToFolderBase(course.getCourseEnvironment(), this));
    if (fFolderRoot.exists()) FileUtils.deleteDirsAndFiles(fFolderRoot, true, true);
  }
View Full Code Here

TOP

Related Classes of org.olat.core.util.notifications.SubscriptionContext

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.