/** get announcement group information */
 private static String getAnnouncementGroup(AnnouncementMessage a) {
   if (a.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW) != null
       && a.getProperties()
           .getProperty(ResourceProperties.PROP_PUBVIEW)
           .equals(Boolean.TRUE.toString())) {
     return rb.getString("Public");
   } else if (a.getAnnouncementHeader().getAccess().equals(MessageHeader.MessageAccess.CHANNEL)) {
     return rb.getString("Allgroups");
   } else {
     int count = 0;
     String allGroupString = "";
     try {
       Site site = SiteService.getSite(EntityManager.newReference(a.getReference()).getContext());
       for (Iterator i = a.getAnnouncementHeader().getGroups().iterator(); i.hasNext(); ) {
         Group aGroup = site.getGroup((String) i.next());
         if (aGroup != null) {
           count++;
           if (count > 1) {
             allGroupString = allGroupString.concat(", ").concat(aGroup.getTitle());
           } else {
             allGroupString = aGroup.getTitle();
           }
         }
       }
     } catch (IdUnusedException e) {
       // No site available.
     }
     return allGroupString;
   }
 }
  /**
   * 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();
  }