Restaurant Part 4 – Initial Data – Spring Boot Web Application

This is the fourth part of the series. The links for the remaining posts are introduction, application execution, screens, basic testing, detailed testing.

Overview

Initial order data is uploaded to the database during application startup. The data is mentioned in a json format. The jar contains two json filesorder.json for the default profile and orders-test.json for the test profile. In the json file, one can define orders in various states, default dishes for orders and orders for search.

JSON to Java Mapping

The json file is mapped by the OrderData.JsonOrderData class. The table.count property in the application properties should be equal or greater than the largest table number in the json file. Below table describes the various options available.

Parameter NameDescriptionValue Type / Java Object
singleDefaultDishUsed for an order with a default single dish.InputDishData
multipleDefaultDishes Used for an order with default multiple dishes.InputDishData Array
[ordered\preparing\ready\served]StatusSingleDishTablesTable numbers of default single dish orders in ORDERED, PREPARING, READY, SERVED status.Integer Array
[ordered\preparing\ready\served]StatusMutipleDishTables Table numbers of default multiple dishes orders in ORDERED, PREPARING, READY, SERVED status. Integer Array
[billed\cancelled]StatusSingleDishCountCount of single dish orders in BILLED, CANCELLED status. Integer
[billed\cancelled]StatusMultipleDishesCountCount of multiple dishes orders in BILLED, CANCELLED status. Integer
individualTablesOrders with custom dishes in different status.InputOrderData Array
searchOrdersSearch orders with default single dish orders with varying past modification times.InputSearchOrderData Array

An external custom json data file can be created based on requirements. This can be done by creating a new profile with the table.count and data.path properties with the json file location. Else these properties can be given as command arguments to an existing profile. Both of these methods are described here.

Leave a Reply

Your email address will not be published. Required fields are marked *