Class StoreRest
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable,BasicUniversalConfig,DefaultConfig,DefaultHtmlConfig
The page is store.ftlh, with a builder twin at ?builder. The feeds are read-only JSON over the
live store, and the revenue tile counts days by the store's clock in UTC.
Example:
<@page tab="store" toolkit="views"> <@card id="welcome" title="Welcome to the petstore"><div class="jc-prose">...</div></@card> <@card type="chart" id="by-status" title="Pets by status" src="/console/store/stats/status"> { kind: 'bar', x: { field: 'status' }, series: [ { field: 'count', label: 'Pets' } ] } </@card> </@page>
GET /console/store the page GET /console/store/recent-orders the ten newest orders GET /console/store/stats/daily {day, placed, delivered} for each recent day GET /console/store/kpi/revenue {label, value, unit} for the revenue tile GET /console/store/stats/species {species, count} for each species GET /console/store/stats/status {status, count} for each status GET /console/store/stats/pets {id, name, species, status} for each pet GET /console/store/fragments/hours the opening hours, as markup only
<@badge id="pending" src="/console/pets/changes/pending" href="/console/pets/changes" refreshMs=60000/>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.juneau.rest.server.servlet.RestServlet
RestServlet.Builder<R extends RestServlet,SELF extends RestServlet.Builder<R, SELF>>, RestServlet.DefaultBuilder<R extends RestServlet> -
Field Summary
Fields inherited from class org.apache.juneau.petstore.console.PetstoreConsolePage
PAGE_HEADER, TEMPLATESFields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.juneau.petstore.console.PetstoreConsolePage
builder, freemarker, store, twinMethods inherited from class org.apache.juneau.rest.server.servlet.RestServlet
builder, createAuthenticator, destroy, doLog, getContext, getPath, getPaths, getRequest, getResponse, getRestBuilder, init, log, log, service, setContextMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
StoreRest
public StoreRest()
-
-
Method Details
-
page
Renders the Store page, with the quick-stat tile values computed from the store.- Parameters:
req- The request;?builderrenders the builder twin.- Returns:
- The page view.
-
recentOrders
- Returns:
- The 10 most recent orders, by ship date then id, newest first.
-
daily
- Returns:
- 30 rows
{day, placed, delivered}ending today, oldest first; an order counts on its ship date.
-
revenue
The revenue tile: the summed pet prices of the orders delivered today, by the store clock in UTC.- Returns:
{label, value, unit}, with the value rounded to cents.
-
species
- Returns:
- One row
{species, count}per species, in enum order, zero counts included; pets with no species are not counted.
-
status
- Returns:
- One row
{status, count}per pet status, in enum order.
-
pets
- Returns:
- One row
{id, name, species, status}per pet, by id; the treemap groups them and opens the edit dialog from a tile.
-
hours
- Returns:
- The store hours as a chrome-free fragment.
-