S++Business systems language
DEMO SOURCE · SPP / APP / PHYRead the book

petshop-10-services.spp

petshop/catalogue/petshop-10-services.spp

Download original file · Petstore source contents

1domain petshop;23atomic query importCatalogue(Goods, Goods[]);45atomic query listProducts(Goods, Goods[]);67atomic check checkGoodsCredential(Goods) {8    require(Goods.sku != null && Goods.sku != "", "ITEM_REQUIRED");9}1011atomic check checkGoodsSale(Goods) {12    require(Goods.active, "PRODUCT_UNAVAILABLE");13}1415atomic calculate prepareInventorySelection(Goods[], StockLine[]) {16    StockLine[] = new StockLine[] {17    };18    for (Goods product : Goods[]) {19        StockLine stock = new StockLine();20        stock.goods = product;21        StockLine[] = append(StockLine[], stock);22    }23}2425atomic calculate initializeInventory(Goods[], StockLine[], StockSupply[]);