private boolean processNotification(Notification notification,BigInteger historyId,Metric metric,Alert alert,EntityManager em){
  if (!shouldEvaluateNotification(notification,historyId)) {
    return true;
  }
  String logMessage=null;
  if (notification.isActive() && notification.getFiredTrigger() != null) {
    Long triggerFiredTime=getTriggerFiredDatapointTime(notification.getFiredTrigger(),metric);
    if (triggerFiredTime == null) {
      clearNotification(notification.getFiredTrigger(),metric,historyId,notification,em,alert);
    }
  }
  try {
    if (!notification.onCooldown()) {
      for (      Trigger trigger : notification.getTriggers()) {
        boolean triggerFired=evaluateTrigger(trigger,metric,historyId,notification,em,alert);
        if (triggerFired) {
          break;
        }
      }
    }
 else {
      logMessage=MessageFormat.format("The notification {0} is on cooldown until {1}.",notification.getName(),getDateMMDDYYYY(notification.getCooldownExpiration()));
      _logger.info(logMessage);
      appendMessageNUpdateHistory(historyId,logMessage,null,0,0);
    }
  }
 catch (  Exception ex) {
    logMessage=MessageFormat.format("Exception occured while processing the notification: {0}. Reason: {1}",notification.getName(),ex.toString());
    _logger.warn("Exception occured while processing the notification: {}. Reason: {}",notification,ex.toString());
    appendMessageNUpdateHistory(historyId,logMessage,null,0,0);
    return false;
  }
  return true;
}

private boolean processNotification ( Notification notification , BigInteger historyId , Metric metric , Alert alert , EntityManager em ) { if ( ! shouldEvaluateNotification ( notification , historyId ) ) { return true ; } String logMessage = null ; if ( notification . isActive ( ) && notification . getFiredTrigger ( ) != null ) { Long triggerFiredTime = getTriggerFiredDatapointTime ( notification . getFiredTrigger ( ) , metric ) ; if ( triggerFiredTime == null ) { clearNotification ( notification . getFiredTrigger ( ) , metric , historyId , notification , em , alert ) ; } } try { if ( ! notification . onCooldown ( ) ) { for ( Trigger trigger : notification . getTriggers ( ) ) { boolean triggerFired = evaluateTrigger ( trigger , metric , historyId , notification , em , alert ) ; if ( triggerFired ) { break ; } } } else { logMessage = MessageFormat . format ( "The notification {0} is on cooldown until {1}." , notification . getName ( ) , getDateMMDDYYYY ( notification . getCooldownExpiration ( ) ) ) ; _logger . info ( logMessage ) ; appendMessageNUpdateHistory ( historyId , logMessage , null , 0 , 0 ) ; } } catch ( Exception ex ) { logMessage = MessageFormat . format ( "Exception occured while processing the notification: {0}. Reason: {1}" , notification . getName ( ) , ex . toString ( ) ) ; _logger . warn ( "Exception occured while processing the notification: {}. Reason: {}" , notification , ex . toString ( ) ) ; appendMessageNUpdateHistory ( historyId , logMessage , null , 0 , 0 ) ; return false ; } return true ; }
evaluates all triggers associated with the notification and updates the job history .
