Import Verification

While we want to reduce the time to execute this tutorial, we certainly don't wish to hide what is in the implementation.  The sections below explain exactly what you imported, and also what Grails services you could have used to perform them.

It is important to confirm that your project looks like the screen shots below.  If it does not, that may indicate you pasted the artifacts at the wrong location.




Create New Domain Class: Customer

After creating a project, a typical next step is to create Domain Classes that represent your database tables.  As we noted above, you already imported these.  The sections below explain how you could have done it yourself.

To create a Domain Class
  1. Right click on the project
  2. Select New > Domain Class (as shown below)
  3. Specify the name Customer on the ensuing dialog:



This creates an empty class, into which you can enter attribute names.  This is your complete model: Grails/Gorm will use this to create the database objects for you, and provide persistence APIs to read and write data.  An empty Customer class would look like this:





Modify Bootstap to load test data

In the next step, we'll create our user interface, but it will be boring if there is no test data.  Grails enables you to process events such as system startup in the Bootstrap class, which we'll use to populate our database.  The imported class looks like this - instantiating and initializing a series of Domain Class instances.




Generate Controllers and Views

A typical next step is to create a set of default User Interfaces.  This has already been done, but you can create your own as follows:
  1. Right click on the project and 
  2. Select New > Generate Controllers and Views as shown below:



On the ensuing dialog, click the [Browse...] button (where the cursor is), and then select the abltutorial.Customer Domain class as shown below:



You would then repeat this process for the remaining Domain Classes (in our case, PurchaseOrder, LineItem, CustomerAudit and Product).

Comments