Skip to content

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

  1. Build Criteria(dpi, userID).
  2. BeforeRetrieve: when UserID.Trim.Length > 0, use RetrieveByUserIDSQL (SQL-021, adds WHERE MENU_FAVORITE.MENU_USER = :UserID) and AddParm("UserID", value, 30); otherwise use the unfiltered RetrieveSQL (SQL-020). (BR-MENU-001; table MENU_FAVORITE)
  3. AfterRetrieve loads one clsMenuFavorite per row.
  4. 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_DATE populated) 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.

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