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

        /*
         * A notification may specify it's own duration as an attribute;
         * if it doesn't, there is a default from the (portlet) publication record.
         */

        final PortletPreferences prefs = req.getPreferences();

        // This is the default
        String hideDurationHours = prefs.getValue(
                HideNotificationServiceDecorator.HIDE_DURATION_HOURS_PREFERENCE, null);

        // Duration specified on the entry itself will trump
        final Map<String,List<String>> attributes = entry.getAttributesMap();
        if (attributes.containsKey(HIDE_DURATION_HOURS_ATTRIBUTE_NAME)) {
            final List<String> values = attributes.get(HIDE_DURATION_HOURS_ATTRIBUTE_NAME);
            if (values.size() != 0) {
                hideDurationHours = values.get(0);  // First is the only one that matters
            }
        }

        final long rslt = hideDurationHours != null
                ? Long.parseLong(hideDurationHours) * MILLIS_IN_ONE_HOUR
                : HideNotificationServiceDecorator.HIDE_DURATION_NONE;
        logger.debug("Calculated calculateHideDurationMillis={} for entry with id='{}', title='{}'",
                                rslt, entry.getId(), entry.getTitle());

        return rslt;

    }
long calculateHideDurationMillis(final NotificationEntry entry, final PortletRequest req) {

        /*
         * A notification may specify it's own duration as an attribute;
         * if it doesn't, there is a default from the (portlet) publication record.
         */

        final PortletPreferences prefs = req.getPreferences();

        // This is the default
        String hideDurationHours = prefs.getValue(
                HideNotificationServiceDecorator.HIDE_DURATION_HOURS_PREFERENCE, null);

        // Duration specified on the entry itself will trump
        final Map<String,List<String>> attributes = entry.getAttributesMap();
        if (attributes.containsKey(HIDE_DURATION_HOURS_ATTRIBUTE_NAME)) {
            final List<String> values = attributes.get(HIDE_DURATION_HOURS_ATTRIBUTE_NAME);
            if (values.size() != 0) {
                hideDurationHours = values.get(0);  // First is the only one that matters
            }
        }

        final long rslt = hideDurationHours != null
                ? Long.parseLong(hideDurationHours) * MILLIS_IN_ONE_HOUR
                : HideNotificationServiceDecorator.HIDE_DURATION_NONE;
        logger.debug("Calculated calculateHideDurationMillis={} for entry with id='{}', title='{}'",
                                rslt, entry.getId(), entry.getTitle());

        return rslt;

    }
long calculateHideDurationMillis ( final NotificationEntry entry , final PortletRequest req ) { /*
         * A notification may specify it's own duration as an attribute;
         * if it doesn't, there is a default from the (portlet) publication record.
         */ final PortletPreferences prefs = req . getPreferences ( ) ; // This is the default String hideDurationHours = prefs . getValue ( HideNotificationServiceDecorator . HIDE_DURATION_HOURS_PREFERENCE , null ) ; // Duration specified on the entry itself will trump final Map < String , List < String > > attributes = entry . getAttributesMap ( ) ; if ( attributes . containsKey ( HIDE_DURATION_HOURS_ATTRIBUTE_NAME ) ) { final List < String > values = attributes . get ( HIDE_DURATION_HOURS_ATTRIBUTE_NAME ) ; if ( values . size ( ) != 0 ) { hideDurationHours = values . get ( 0 ) ; // First is the only one that matters } } final long rslt = hideDurationHours != null ? Long . parseLong ( hideDurationHours ) * MILLIS_IN_ONE_HOUR : HideNotificationServiceDecorator . HIDE_DURATION_NONE ; logger . debug ( "Calculated calculateHideDurationMillis={} for entry with id='{}', title='{}'" , rslt , entry . getId ( ) , entry . getTitle ( ) ) ; return rslt ; }
/* package-private
/ * package - private