For most
of the methods we??™ll look at, there is an associated UI update. Here, we need to update the list
of favorites on the screen. I could have made a separate call, triggered from the callback to the
DWR call that executed this method, to retrieve the updated list of favorites, and then update
the screen. This is rather inefficient though??”since we know we need to update the screen following
this call, why not just go ahead and return the data we??™ll need from this method and
save one round-trip? That??™s exactly what calling getFavoritesForUser() does for us here.
Much like in the RePortal.js code, you??™re going to find a fairly repetitive pattern emerging here, so I??™ll
gloss over some things as we go as that repetitiveness starts to come out; but for this class, since it??™s the
first xxxWorker class, we??™ll look at all of its code.
CHAPTER 7 n ENTER THE ENTERPRISE: A DWR-BASED REPORT PORTAL 393
Next up is removeReportFromFavorites():
public List
removeReportFromFavorites(final String inUsername,
final String inReportName) throws Exception {
try {
Map tokens = new HashMap();
tokens.put("username", inUsername);
tokens.
Pages:
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687