Skip to content

Manage a user's menu favorites

Creates, updates, removes, and retrieves favorite menu rows.

Field Value
Operation ID OP-MENU-002
Trigger Caller maintains or loads favorites.
Inputs IDataPortalInfo, user and favorite keys
Outputs Persisted favorite rows and collections
Primary components clsMenuFavorite, clsMenuFavoriteCollection
Entry point SAIF.Business.Menu\clsMenuFavorite.vb

Steps

  1. Create a new favorite key with SQL-MENU-036 against MENU_FAVORITE.
  2. Insert a new favorite with SQL-MENU-038 or retrieve an existing favorite with SQL-MENU-039.
  3. Update order or inactive date with SQL-MENU-040, or delete the row with SQL-MENU-037.
  4. After every insert, update, or delete, validate that exactly one row changed so the object honors BR-MENU-001.
  5. Load all favorites with SQL-MENU-041 or one user's favorites with SQL-MENU-042.
  6. When menu composition later executes SQL-MENU-043, active favorites re-enter the authorized set (BR-MENU-004).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Caller manages favorite]) --> CreateOrLoad{New, update,<br/>or delete?}

    CreateOrLoad -->|New favorite| NextVal["SQL-MENU-036: get next<br/>MENU_FAVORITE sequence value"]
    NextVal --> Insert["SQL-MENU-038: insert<br/>new favorite row"]
    Insert --> Verify{"Rows affected = 1?<br/>(BR-MENU-001)"}

    CreateOrLoad -->|Update order/<br/>inactive date| Update["SQL-MENU-040: update<br/>favorite order or<br/>ITEM_INACTIVE_DATE"]
    Update --> Verify

    CreateOrLoad -->|Delete| Delete["SQL-MENU-037: delete<br/>favorite row"]
    Delete --> Verify

    CreateOrLoad -->|Retrieve existing| Retrieve["SQL-MENU-039: retrieve<br/>one existing favorite"]
    Retrieve --> Ready(["Favorite persisted"])

    Verify -->|No| Error(["Report optimistic-contention<br/>error — do not commit"])
    Verify -->|Yes| Ready

    Ready --> LoadAll["Load all favorites<br/>(SQL-MENU-041) or one user's<br/>favorites (SQL-MENU-042)"]
    LoadAll --> Compose["Menu composition<br/>(SQL-MENU-043) re-includes<br/>active favorites<br/>(BR-MENU-004)"]

Failure and edge-case behavior

  • A soft-deleted favorite remains stored but drops out of active menu composition because SQL-MENU-043 requires ITEM_INACTIVE_DATE IS NULL.
  • Row-count mismatches surface through BR-MENU-001 instead of silently succeeding.

Sources

  • SAIF.Business.Menu\clsMenuFavorite.vb