Load a user's favorites¶
Loads the favorite menu items recorded for one user, or all favorites across all users when no user is supplied.
| Field | Value |
|---|---|
| Operation ID | OP-MENU-08 |
| Trigger | Caller requests GetMenuFavoritesForUser |
| Inputs | IDataPortalInfo, user ID |
| Outputs | Populated clsMenuFavoriteCollection |
| Primary components | clsMenuFavoriteCollection.GetMenuFavoritesForUser |
| Entry point | SAIF.Business.Menu/clsMenuFavoriteCollection.vb |
Steps¶
- Build
Criteria(dpi, userID). BeforeRetrieve: whenUserID.Trim.Length > 0, useRetrieveByUserIDSQL(SQL-021, addsWHERE MENU_FAVORITE.MENU_USER = :UserID) andAddParm("UserID", value, 30); otherwise use the unfilteredRetrieveSQL(SQL-020). (BR-MENU-001; table MENU_FAVORITE)AfterRetrieveloads oneclsMenuFavoriteper row.- Note: this retrieval does not filter on
ITEM_INACTIVE_DATE, unlike the favorites branch of the authorized-item query (BR-MENU-006), so inactive favorites are included here.*
Process flow¶
flowchart TD
Start([GetMenuFavoritesForUser]) --> Choice{UserID supplied?}
Choice -->|Yes| ByUser["RetrieveByUserIDSQL: WHERE MENU_USER = :UserID"]
Choice -->|No| All[RetrieveSQL: unfiltered]
ByUser --> Load[AfterRetrieve: Load each clsMenuFavorite]
All --> Load
Load --> Done([Return populated collection])
Failure and edge-case behavior¶
- Inactive favorites (
ITEM_INACTIVE_DATEpopulated) are still returned by this retrieval, unlike the favorites branch of the authorized-item query.* - No favorites recorded for the user: an empty collection is returned, not an error.
Related documentation¶
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
- SAIF.Business.Menu/clsMenuFavoriteCollection.vb