notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/jpa/JpaNotificationService.java
private NotificationResponse prepareResponse(Set<JpaEntry> entries, String username) {

        Map<String,NotificationCategory> categories = new HashMap<>();
        for (JpaEntry entry : entries) {

            // Choose a category title
            final String categryTitle = !StringUtils.isBlank(entry.getCategory())
                    ? entry.getCategory()
                    : messages.getMessage(UNCATEGORIZED_MESSAGE_CODE, null, 
                            UNCATEGORIZED_DEFAULT_MESSAGE, Locale.getDefault());

            // Obtain the category object matching the title
            NotificationCategory category = categories.get(categryTitle);
            if (category == null) {
                category = new NotificationCategory();
                category.setTitle(categryTitle);
                categories.put(categryTitle, category);
            }

            // Prepare a NotificationEntry
            NotificationEntry y = prepareEntry(entry, username);
            if (y != null) {
                category.addEntries(Collections.singletonList(y));
            }

        }

        // Create & load the response
        final List<NotificationCategory> cList = new ArrayList<>(categories.values());
        final List<NotificationError> eList = Collections.emptyList();  // Anything here?

        return new NotificationResponse(cList, eList);

    }
private NotificationResponse prepareResponse(Set<JpaEntry> entries, String username) {

        Map<String,NotificationCategory> categories = new HashMap<>();
        for (JpaEntry entry : entries) {

            // Choose a category title
            final String categryTitle = !StringUtils.isBlank(entry.getCategory())
                    ? entry.getCategory()
                    : messages.getMessage(UNCATEGORIZED_MESSAGE_CODE, null, 
                            UNCATEGORIZED_DEFAULT_MESSAGE, Locale.getDefault());

            // Obtain the category object matching the title
            NotificationCategory category = categories.get(categryTitle);
            if (category == null) {
                category = new NotificationCategory();
                category.setTitle(categryTitle);
                categories.put(categryTitle, category);
            }

            // Prepare a NotificationEntry
            NotificationEntry y = prepareEntry(entry, username);
            if (y != null) {
                category.addEntries(Collections.singletonList(y));
            }

        }

        // Create & load the response
        final List<NotificationCategory> cList = new ArrayList<>(categories.values());
        final List<NotificationError> eList = Collections.emptyList();  // Anything here?

        return new NotificationResponse(cList, eList);

    }
private NotificationResponse prepareResponse ( Set < JpaEntry > entries , String username ) { Map < String , NotificationCategory > categories = new HashMap <> ( ) ; for ( JpaEntry entry : entries ) { // Choose a category title final String categryTitle = ! StringUtils . isBlank ( entry . getCategory ( ) ) ? entry . getCategory ( ) : messages . getMessage ( UNCATEGORIZED_MESSAGE_CODE , null , UNCATEGORIZED_DEFAULT_MESSAGE , Locale . getDefault ( ) ) ; // Obtain the category object matching the title NotificationCategory category = categories . get ( categryTitle ) ; if ( category == null ) { category = new NotificationCategory ( ) ; category . setTitle ( categryTitle ) ; categories . put ( categryTitle , category ) ; } // Prepare a NotificationEntry NotificationEntry y = prepareEntry ( entry , username ) ; if ( y != null ) { category . addEntries ( Collections . singletonList ( y ) ) ; } } // Create & load the response final List < NotificationCategory > cList = new ArrayList <> ( categories . values ( ) ) ; final List < NotificationError > eList = Collections . emptyList ( ) ; // Anything here? return new NotificationResponse ( cList , eList ) ; }
/*
Implementation
/ * Implementation