We are now ready to implement the Search Results panel. We will do this by enhancing the Search Timecards activity diagram in two stages. The first stage will introduce the results table and the second stage will introduce the navigation to the Timecard Details page. The modified activity diagram for stage one is shown below:
Notice that we have added a page variable called timecardSummaries, which is a collection of TimecardSummaryVO objects. This page variable will be tagged to tell AndroMDA to render it as a table. Follow one of the links below to add the page variable to your model.
We now need to enhance our SearchController to fill in this page variable with search results. For this to happen, we need to do two things:
Now let's ask AndroMDA to generate code for the modified Search Timecards functionality:
Next we need to modify the SearchController to initialize the timecardSummaries page variable with search results. To do this, open the file SearchControllerImpl.java and add the code shown below in bold:
// license-header java merge-point package org.andromda.timetracker.web.timecardsearch; ... import org.andromda.timetracker.vo.TimecardSearchCriteriaVO; import org.andromda.timetracker.vo.TimecardSummaryVO; import org.andromda.timetracker.vo.UserVO; public class SearchControllerImpl extends SearchController { ... public final void populateSearchScreen(...) throws Exception { ... // Populate submitter and approver dropdowns form.setSubmitterBackingList(userList, "id", "username"); form.setApproverBackingList(userList, "id", "username"); // Populate timecard summaries TimecardSearchCriteriaVO criteria = new TimecardSearchCriteriaVO( form.getSubmitter(), form.getApprover(), form.getStatus(), form.getStartDateMinimum(), form.getStartDateMaximum()); Collection<TimecardSummaryVO> timecards = getTimeTrackingService().findTimecards(criteria); form.setTimecardSummaries(timecards); } }
Follow the steps below to build and deploy the application to JBoss and test it.
Below is a screen shot of the Search screen so far.
Now that the search results table is showing well, we need to add the details column that will allow us to navigate to the Timecard Details page. Click here to add this column.