@ Override public NotificationResponse fetch ( PortletRequest req ) { PortletPreferences preferences = req . getPreferences ( ) ; String enabled = preferences . getValue ( SSP_NOTIFICATIONS_ENABLED , "false" ) ; if ( ! "true" . equalsIgnoreCase ( enabled ) ) { return new NotificationResponse ( ) ; } String personId = getPersonId ( req ) ; if ( personId == null ) { // Not all students will have active SSP records, // so if no entry is found in SSP, just return an // empty response set. return new NotificationResponse ( ) ; } String urlFragment = getActiveTaskUrl ( ) ; SSPApiRequest < String > request = new SSPApiRequest <> ( urlFragment , String . class ) . addUriParameter ( "personId" , personId ) ; ResponseEntity < String > response ; try { response = sspApi . doRequest ( request ) ; } catch ( Exception e ) { log . error ( "Error reading SSP Notifications: " + e . getMessage ( ) ) ; return notificationError ( e . getMessage ( ) ) ; } if ( response . getStatusCode ( ) . series ( ) != HttpStatus . Series . SUCCESSFUL ) { log . error ( "Error reading SSP Notifications: " + response ) ; return notificationError ( response . getBody ( ) ) ; } NotificationResponse notification = mapToNotificationResponse ( req , response ) ; return notification ; }
Fetch the set of SSP tasks for the uPortal user .