notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/ssp/SSPTaskNotificationService.java
private NotificationResponse mapToNotificationResponse(PortletRequest request, ResponseEntity<String> response) {
        Configuration config = Configuration.builder().options(
                Option.DEFAULT_PATH_LEAF_TO_NULL
        ).build();
        ReadContext readContext = JsonPath
                .using(config)
                .parse(response.getBody());

        // check the status embedded in the response too...
        String success = readContext.read(SUCCESS_QUERY);
        // grr. SSP returns this as a string...
        if (!"true".equalsIgnoreCase(success)) {
            String error = readContext.read(MESSAGE_QUERY);
            return notificationError(error);
        }

        // read the actual tasks...
        Object rows = readContext.read(ROWS_QUERY);
        if (!(rows instanceof JSONArray)) {
            throw new RuntimeException("Expected 'rows' to be an array of tasks");
        }

        String source = getNotificationSource(request);

        List<NotificationEntry> list = new ArrayList<>();
        for (int i = 0; i < ((JSONArray)rows).size(); i++) {
            NotificationEntry entry = mapNotificationEntry(readContext, i, source);
            if (entry != null) {
                attachActions(request, entry);
                list.add(entry);
            }
        }

        // build the notification response...
        NotificationResponse notification = new NotificationResponse();
        if (!list.isEmpty()) {
            NotificationCategory category = getNotificationCategory(request);
            category.addEntries(list);

            notification.setCategories(Arrays.asList(category));
        }

        return notification;
    }
private NotificationResponse mapToNotificationResponse(PortletRequest request, ResponseEntity<String> response) {
        Configuration config = Configuration.builder().options(
                Option.DEFAULT_PATH_LEAF_TO_NULL
        ).build();
        ReadContext readContext = JsonPath
                .using(config)
                .parse(response.getBody());

        // check the status embedded in the response too...
        String success = readContext.read(SUCCESS_QUERY);
        // grr. SSP returns this as a string...
        if (!"true".equalsIgnoreCase(success)) {
            String error = readContext.read(MESSAGE_QUERY);
            return notificationError(error);
        }

        // read the actual tasks...
        Object rows = readContext.read(ROWS_QUERY);
        if (!(rows instanceof JSONArray)) {
            throw new RuntimeException("Expected 'rows' to be an array of tasks");
        }

        String source = getNotificationSource(request);

        List<NotificationEntry> list = new ArrayList<>();
        for (int i = 0; i < ((JSONArray)rows).size(); i++) {
            NotificationEntry entry = mapNotificationEntry(readContext, i, source);
            if (entry != null) {
                attachActions(request, entry);
                list.add(entry);
            }
        }

        // build the notification response...
        NotificationResponse notification = new NotificationResponse();
        if (!list.isEmpty()) {
            NotificationCategory category = getNotificationCategory(request);
            category.addEntries(list);

            notification.setCategories(Arrays.asList(category));
        }

        return notification;
    }
private NotificationResponse mapToNotificationResponse ( PortletRequest request , ResponseEntity < String > response ) { Configuration config = Configuration . builder ( ) . options ( Option . DEFAULT_PATH_LEAF_TO_NULL ) . build ( ) ; ReadContext readContext = JsonPath . using ( config ) . parse ( response . getBody ( ) ) ; // check the status embedded in the response too... String success = readContext . read ( SUCCESS_QUERY ) ; // grr. SSP returns this as a string... if ( ! "true" . equalsIgnoreCase ( success ) ) { String error = readContext . read ( MESSAGE_QUERY ) ; return notificationError ( error ) ; } // read the actual tasks... Object rows = readContext . read ( ROWS_QUERY ) ; if ( ! ( rows instanceof JSONArray ) ) { throw new RuntimeException ( "Expected 'rows' to be an array of tasks" ) ; } String source = getNotificationSource ( request ) ; List < NotificationEntry > list = new ArrayList <> ( ) ; for ( int i = 0 ; i < ( ( JSONArray ) rows ) . size ( ) ; i ++ ) { NotificationEntry entry = mapNotificationEntry ( readContext , i , source ) ; if ( entry != null ) { attachActions ( request , entry ) ; list . add ( entry ) ; } } // build the notification response... NotificationResponse notification = new NotificationResponse ( ) ; if ( ! list . isEmpty ( ) ) { NotificationCategory category = getNotificationCategory ( request ) ; category . addEntries ( list ) ; notification . setCategories ( Arrays . asList ( category ) ) ; } return notification ; }
Map and SSP Response to a NotificationResponse.

@param request the portlet request
@param response the response from the REST call to SSP
@return the mapped notification response
Map and SSP Response to a NotificationResponse .