コード例 #1
0
ファイル: Debate.java プロジェクト: ftechz/Debating-Timer
 public void startNextSpeaker() {
   if (mCurrentStage != null) {
     mTickTimer.purge();
     mCurrentStage.start(mTickTimer);
     mAlertManager.hideNotification(); // Hide if already showing
     mAlertManager.showNotification(mCurrentStage);
   }
 }
コード例 #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);
  }
コード例 #3
0
ファイル: Debate.java プロジェクト: ftechz/Debating-Timer
 public void stop() {
   if (getDebateStatus() == DebateStatus.speaking) {
     if (mCurrentStage != null) {
       mAlertManager.hideNotification();
       mCurrentStage.cancel();
     }
   }
 }
コード例 #4
0
ファイル: Debate.java プロジェクト: ftechz/Debating-Timer
  public void release() {
    if (mAlertManager != null) {
      mAlertManager.hideNotification();
    }

    mCurrentStage = null;

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

    mStages = null;
  }
コード例 #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();
    }
  }
コード例 #6
0
ファイル: Debate.java プロジェクト: ftechz/Debating-Timer
  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();
  }
コード例 #7
0
 public CheckAlertsThread() {
   super("Check Alerts Thread");
   isActive = true;
   alertManager = AlertManager.getInstance();
 }
コード例 #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.
 }