/**
   * Implementation of command pattern. Will be called by ScheduledInvocationManager for delayed
   * announcement notifications
   *
   * @param opaqueContext reference (context) for message
   */
  public void execute(String opaqueContext) {
    // get the message
    final Reference ref = entityManager.newReference(opaqueContext);

    // needed to access the message
    enableSecurityAdvisorToGetAnnouncement();

    final AnnouncementMessage msg = (AnnouncementMessage) ref.getEntity();
    final AnnouncementMessageHeader hdr = (AnnouncementMessageHeader) msg.getAnnouncementHeader();

    // read the notification options
    final String notification = msg.getProperties().getProperty("notificationLevel");

    int noti = NotificationService.NOTI_OPTIONAL;
    if ("r".equals(notification)) {
      noti = NotificationService.NOTI_REQUIRED;
    } else if ("n".equals(notification)) {
      noti = NotificationService.NOTI_NONE;
    }

    final Event delayedNotificationEvent =
        eventTrackingService.newEvent("annc.schInv.notify", msg.getReference(), true, noti);
    //		eventTrackingService.post(event);

    NotificationEdit notify = notificationService.addTransientNotification();

    super.notify(notify, delayedNotificationEvent);

    // since we build the notification by accessing the
    // message within the super class, can't remove the
    // SecurityAdvisor until this point
    // done with access, need to remove from stack
    disableSecurityAdvisor();
  }
Exemplo n.º 2
0
  // sakai2 -- add init and destroy methods
  public void init() {

    m_relativeAccessPoint = REFERENCE_ROOT;

    NotificationEdit edit = notificationService.addTransientNotification();

    edit.setFunction(EVENT_SYLLABUS_POST_NEW);
    edit.addFunction(EVENT_SYLLABUS_POST_CHANGE);
    edit.addFunction(EVENT_SYLLABUS_DELETE_POST);
    edit.addFunction(EVENT_SYLLABUS_READ);
    edit.addFunction(EVENT_SYLLABUS_DRAFT_NEW);
    edit.addFunction(EVENT_SYLLABUS_DRAFT_CHANGE);

    edit.setResourceFilter(getAccessPoint(true));

    edit.setAction(new SiteEmailNotificationSyllabus());

    EntityManager.registerEntityProducer(this, REFERENCE_ROOT);
  }