notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/action/hide/HideAction.java
boolean isEntrySnoozed(NotificationEntry entry, PortletRequest req) {

        // An id is required for hide behavior
        if (StringUtils.isBlank(entry.getId())) {
            return false;
        }

        boolean rslt = false;  // default (clearly)

        final long snoozeDurationMillis = calculateHideDurationMillis(entry, req);

        // An entry with a negative snooze duration cannot be snoozed
        if (snoozeDurationMillis > HideNotificationServiceDecorator.HIDE_DURATION_NONE) {
            final JpaServices jpaServices = (JpaServices) SpringContext.getApplicationContext().getBean("jpaServices");
            final List<EventDTO> history = jpaServices.getHistory(entry, req.getRemoteUser());
            logger.debug("List<EventDTO> within getNotificationsBySourceAndCustomAttribute contains {} elements", history.size());

            // Review the history...
            for (EventDTO event : history) {
                switch (event.getState()) {
                    case SNOOZED:
                        logger.debug("Found a SNOOZED event:  {}", event);
                        // Nice, but it only counts if it isn't expired...
                        if (event.getTimestamp().getTime() + snoozeDurationMillis > System.currentTimeMillis()) {
                            rslt = true;
                        }
                        break;
                    case ISSUED:
                        logger.debug("Found an ISSUED event:  {}", event);
                        // Re-issuing a notification un-snoozes it...
                        rslt = false;
                        break;
                    default:
                        // We don't care about any other events in the SNOOZED evaluation...
                        break;
                }
            }
        }


        logger.debug("Returning SNOOZED='{}' for the following notification:  {}", rslt, entry);
        return rslt;

    }
boolean isEntrySnoozed(NotificationEntry entry, PortletRequest req) {

        // An id is required for hide behavior
        if (StringUtils.isBlank(entry.getId())) {
            return false;
        }

        boolean rslt = false;  // default (clearly)

        final long snoozeDurationMillis = calculateHideDurationMillis(entry, req);

        // An entry with a negative snooze duration cannot be snoozed
        if (snoozeDurationMillis > HideNotificationServiceDecorator.HIDE_DURATION_NONE) {
            final JpaServices jpaServices = (JpaServices) SpringContext.getApplicationContext().getBean("jpaServices");
            final List<EventDTO> history = jpaServices.getHistory(entry, req.getRemoteUser());
            logger.debug("List<EventDTO> within getNotificationsBySourceAndCustomAttribute contains {} elements", history.size());

            // Review the history...
            for (EventDTO event : history) {
                switch (event.getState()) {
                    case SNOOZED:
                        logger.debug("Found a SNOOZED event:  {}", event);
                        // Nice, but it only counts if it isn't expired...
                        if (event.getTimestamp().getTime() + snoozeDurationMillis > System.currentTimeMillis()) {
                            rslt = true;
                        }
                        break;
                    case ISSUED:
                        logger.debug("Found an ISSUED event:  {}", event);
                        // Re-issuing a notification un-snoozes it...
                        rslt = false;
                        break;
                    default:
                        // We don't care about any other events in the SNOOZED evaluation...
                        break;
                }
            }
        }


        logger.debug("Returning SNOOZED='{}' for the following notification:  {}", rslt, entry);
        return rslt;

    }
boolean isEntrySnoozed ( NotificationEntry entry , PortletRequest req ) { // An id is required for hide behavior if ( StringUtils . isBlank ( entry . getId ( ) ) ) { return false ; } boolean rslt = false ; // default (clearly) final long snoozeDurationMillis = calculateHideDurationMillis ( entry , req ) ; // An entry with a negative snooze duration cannot be snoozed if ( snoozeDurationMillis > HideNotificationServiceDecorator . HIDE_DURATION_NONE ) { final JpaServices jpaServices = ( JpaServices ) SpringContext . getApplicationContext ( ) . getBean ( "jpaServices" ) ; final List < EventDTO > history = jpaServices . getHistory ( entry , req . getRemoteUser ( ) ) ; logger . debug ( "List<EventDTO> within getNotificationsBySourceAndCustomAttribute contains {} elements" , history . size ( ) ) ; // Review the history... for ( EventDTO event : history ) { switch ( event . getState ( ) ) { case SNOOZED : logger . debug ( "Found a SNOOZED event:  {}" , event ) ; // Nice, but it only counts if it isn't expired... if ( event . getTimestamp ( ) . getTime ( ) + snoozeDurationMillis > System . currentTimeMillis ( ) ) { rslt = true ; } break ; case ISSUED : logger . debug ( "Found an ISSUED event:  {}" , event ) ; // Re-issuing a notification un-snoozes it... rslt = false ; break ; default : // We don't care about any other events in the SNOOZED evaluation... break ; } } } logger . debug ( "Returning SNOOZED='{}' for the following notification:  {}" , rslt , entry ) ; return rslt ; }
/* package-private
/ * package - private