petshop-40-queries.spp
petshop/catalogue/petshop-40-queries.spp
Download original file · Petstore source contents
1domain petshop;23Scenario serial readShopInventory(Goods, Goods[], StockLine[]) {4prepareProductSelection;5listProducts;6prepareInventorySelection;7findStockLine;8identify(StockLine[]);9}1011Scenario serial readShopMerchant(Merchant) {12configureMerchantLookup;13findMerchant;14identify(Merchant);15}1617atomic calculate prepareProductSelection(Goods) {18Goods.active = true;19}2021atomic calculate filterProducts(Goods, Goods[]) {22Goods[] filtered = new Goods[] {23};24for (Goods product : Goods[]) {25if (Goods.category == null || Goods.category == "" || product.category == Goods.category) {26filtered = append(filtered, product);27}28}29Goods[] = filtered;30}3132Scenario serial browseShopProducts(Goods, Goods[]) {33prepareProductSelection;34listProducts;35localizeCatalog;36filterProducts;37}