20.8. Summary

In this chapter you created the search system, consisting of keyword searching and category searching. Let's take a moment to review how you used Cairngorm to do it.

You used the existing CategoryVO to perform category-based searches. You did this by using the existing categories property of the ModelLocator as the data provider of a list-based component. When the user selected an item from this list, the CategoryVO held in the selectedItem property of the list was passed to a CategorySearchEvent that was then dispatched. The categoryId property of the CategoryVO was then used to find posts in the database with that categoryId.

The keyword search required only that a string containing the search terms be passed, and so did not warrant the creation of a value object.

You created KeyWordSearchEvent, CategorySearchEvent, and ClearSearchResultsEvent event classes. The KeyWordSearchEvent took in a string of search terms and passed them along to the KeyWordSearchCommand class. The CategorySearchEvent took in a CategoryVO object and passed it along to the CategorySearchCommand class. The ClearSearchResultsEvent did not need to pass any data and simply triggered the ClearSearchResultsCommand.

You created KeyWordSearchDelegate and CategorySearchDelegate delegate classes. The search function of the KeyWordSearchDelegate took in the keywords passed in as arguments by the KeyWordSearchCommand class and called the keywordSearch function of the FlexBlogDatabaseManager, passing ...

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.