Interface RowDetailMixin

All Known Implementing Classes:
OrdersRest, PetsRest, UsersRest

public interface RowDetailMixin
Mixin that serves the bean-backed row details of a resource.

An implementing resource lists its bean-backed details in rowDetails(). Each detail is served under its key at three endpoints: the detail (row-detail/{key}/{id}), one tab (row-detail/{key}/{id}/tab/{tabId}) and the tab counts (row-detail/{key}/{id}/counts).

Only readable, non-ignored bean properties that the owning table shows (or the detail names explicitly) are ever served. Every failure — an unknown key, tab or row, a null lookup result or a malformed id — answers the same empty 404 with Cache-Control: no-store, so nothing about what exists can be learned from the response.

Since:
10.0.0
  • Field Details

    • ROW_ID

      static final Pattern ROW_ID
      Grammar of a servable row id.
    • SEGMENT

      static final Pattern SEGMENT
      Grammar of a servable detail key or tab id.
  • Method Details

    • rowDetails

      The bean-backed details this resource serves.
      Returns:
      The details. Each must have a distinct key.
    • validRowId

      default boolean validRowId(String id)
      Whether id is a servable row id.
      Parameters:
      id - The candidate id.
      Returns:
      true if the id matches the row-id grammar and is not . or ...
    • rowDetailIndex

      Returns the details indexed by key.
      Returns:
      The index.
      Throws:
      IllegalStateException - If two details share a key.
    • rowDetail

      default JsonMap rowDetail(@Path("key") String key, @Path("id") String id, RestResponse res)
      Serves one row's detail.
      Parameters:
      key - The detail key.
      id - The row id.
      res - The response.
      Returns:
      The detail, or an empty map with a 404.
    • rowDetailTab

      default JsonMap rowDetailTab(@Path("key") String key, @Path("id") String id, @Path("tabId") String tabId, RestResponse res)
      Serves one tab of a row's detail.
      Parameters:
      key - The detail key.
      id - The row id.
      tabId - The tab id.
      res - The response.
      Returns:
      The tab's fields, or an empty map with a 404.
    • rowDetailCounts

      default JsonMap rowDetailCounts(@Path("key") String key, @Path("id") String id, RestResponse res)
      Serves the tab counts of a row.
      Parameters:
      key - The detail key.
      id - The row id.
      res - The response.
      Returns:
      The counts keyed by tab id, or an empty map with a 404.