notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/jpa/action/CompleteOnRedirectAction.java
@Override
    public void invoke(final ActionRequest req, final ActionResponse res) throws IOException {
        JpaNotificationService jpaService = (JpaNotificationService) SpringContext.getApplicationContext().getBean("jpaNotificationService");

        final NotificationEntry entry = getTarget();
        Map<NotificationState, Date> stateMap = entry.getStates();
        if (stateMap != null && !stateMap.containsKey(NotificationState.COMPLETED)) {
            jpaService.addEntryState(req, entry.getId(), NotificationState.COMPLETED);
        }

        res.sendRedirect(entry.getUrl());
    }
@Override
    public void invoke(final ActionRequest req, final ActionResponse res) throws IOException {
        JpaNotificationService jpaService = (JpaNotificationService) SpringContext.getApplicationContext().getBean("jpaNotificationService");

        final NotificationEntry entry = getTarget();
        Map<NotificationState, Date> stateMap = entry.getStates();
        if (stateMap != null && !stateMap.containsKey(NotificationState.COMPLETED)) {
            jpaService.addEntryState(req, entry.getId(), NotificationState.COMPLETED);
        }

        res.sendRedirect(entry.getUrl());
    }
@ Override public void invoke ( final ActionRequest req , final ActionResponse res ) throws IOException { JpaNotificationService jpaService = ( JpaNotificationService ) SpringContext . getApplicationContext ( ) . getBean ( "jpaNotificationService" ) ; final NotificationEntry entry = getTarget ( ) ; Map < NotificationState , Date > stateMap = entry . getStates ( ) ; if ( stateMap != null && ! stateMap . containsKey ( NotificationState . COMPLETED ) ) { jpaService . addEntryState ( req , entry . getId ( ) , NotificationState . COMPLETED ) ; } res . sendRedirect ( entry . getUrl ( ) ) ; }
When invoke is called, a configured notification state is set for the entry if it has not already been set.
{@link JpaNotificationService} and {@link CacheNotificationService} are used here to add the entry state and clear
the cache for the user.  This class is not managed by Spring, so these objects must be obtained using the
Spring context that {@code SpringContext} provides.

@param req
@param res
@throws IOException
When invoke is called a configured notification state is set for the entry if it has not already been set . { @link JpaNotificationService } and { @link CacheNotificationService } are used here to add the entry state and clear the cache for the user . This class is not managed by Spring so these objects must be obtained using the Spring context that { @code SpringContext } provides .