Exemplo n.º 1
0
 public void startNextSpeaker() {
   if (mCurrentStage != null) {
     mTickTimer.purge();
     mCurrentStage.start(mTickTimer);
     mAlertManager.hideNotification(); // Hide if already showing
     mAlertManager.showNotification(mCurrentStage);
   }
 }
Exemplo n.º 2
0
  private void updateEpgIndex() {
    Date updated = new Date();
    // Update the index with new programs now:
    Configuration lineupConfiguration = ConfigurationService.getConfiguration("lineups");
    List<String> lineups = (List<String>) lineupConfiguration.getList("lineups.lineup.id");

    EpgIndexer indexer =
        new EpgIndexer(
            alertManager.getLuceneIndex(),
            alertManager.getCompositeIndex(),
            alertManager.getEpg(),
            lineups);
    indexer.updateEpgIndex(alertManager.getLastEpgUpdate());
    alertManager.setLastEpgUpdate(updated);
  }
Exemplo n.º 3
0
 public void stop() {
   if (getDebateStatus() == DebateStatus.speaking) {
     if (mCurrentStage != null) {
       mAlertManager.hideNotification();
       mCurrentStage.cancel();
     }
   }
 }
Exemplo n.º 4
0
  public void release() {
    if (mAlertManager != null) {
      mAlertManager.hideNotification();
    }

    mCurrentStage = null;

    mTickTimer.cancel();
    mTickTimer.purge();
    mTickTimer = null;

    mStages = null;
  }
Exemplo n.º 5
0
  private void checkProgramAlerts() throws IOException {
    ChunkedResults<ProgramAlert> results = ProgramAlert.getAll();
    if (log.isDebugEnabled())
      log.debug("CheckAlertsThread starting to check ProgramAlerts for pending");
    results.beforeFirst();
    while (results.next() && isActive()) {
      ProgramAlert programAlert = results.get();
      if (programAlert.isDeleted() || programAlert.isDisabled()) {
        if (log.isDebugEnabled()) log.debug("program alert is deleted or disabled");
        continue;
      }
      User user = programAlert.getUser();
      if (user == null) {
        if (log.isDebugEnabled()) log.debug("program alert is implicitly deleted (user is null)");
        programAlert.setDeleted(true);
        programAlert.save();
        continue;
      }
      Transaction transaction = HibernateUtil.currentSession().beginTransaction();
      try {
        alertManager.checkIfPending(programAlert);
        transaction.commit();
      } catch (Throwable t) {
        log.error("Error checking program alerts. Rolling back transaction.", t);
        transaction.rollback();
      }
    }
    if (log.isDebugEnabled())
      log.debug(
          "CheckAlertsThread done with check ProgramAlerts for pending. Now deleting marked deleted ProgramAlerts.");

    // Now that we aren't looping on ProgramAlerts, I should be able to safely
    // delete all of the ProgramAlerts flagged as deleted without screwing up
    // paging through results as above.
    Transaction transaction = HibernateUtil.currentSession().beginTransaction();
    try {
      log.debug("deleting marked-deleted program alerts");
      ProgramAlert.deleteAllMarkedDeleted();
      log.debug("deleted marked-deleted program alerts");
    } finally {
      transaction.commit();
    }
  }
Exemplo n.º 6
0
  public void reset() {
    // Stop current stage timer, if on
    if (mCurrentStage != null) {
      mCurrentStage.cancel();
    }
    mCurrentStage = null;
    mTickTimer.purge();
    mTickTimer.cancel();
    mTickTimer = new Timer();

    mAlertManager.hideNotification();

    ListIterator<AlarmChain> stageIterator = mStages.listIterator();
    while (stageIterator.hasNext()) {
      AlarmChain stage = stageIterator.next();
      stage.cancel();
      stageIterator.set(stage.newCopy());
    }

    mStageIterator = mStages.iterator();
  }
Exemplo n.º 7
0
 public CheckAlertsThread() {
   super("Check Alerts Thread");
   isActive = true;
   alertManager = AlertManager.getInstance();
 }
Exemplo n.º 8
0
 /**
  * search for keyword matches on future programs
  *
  * @throws ParseException
  * @throws IOException
  */
 private void checkKeywordAlerts() {
   alertManager.setEpgUpdated(true);
   // Let's the AlertManager know that we have to check the EPG
   // against KeywordAlerts, but we want the KeywordAlertsThread to do it.
 }