[[TOC(heading=Training Section Contents, Training*)]] = Section 3: Dealing with Data = The basis of all applications involves retrieving information from a data source and putting information back into a data source. A helpful acronym CRUD represents the various phases of single data record management. '''C''' - (create) create a data record or entity '''R''' - (read) retrieval of a specific data record or entity '''U''' - (update) modification and persistence of a data record or entity '''D''' - (delete) removal of a specific data record or entity In our applications, we work with all phases of CRUD. List is another phase of data management commonly used in applications. List deals with retrieval of multiple data records, but isn't included in CRUD because it ruins the cleverness. Each phase has an associated pattern in Model-Glue. By learning these patterns, you will be able to quickly develop applications that work with data. Also, by understanding these patterns, you will be able to quickly understand Model-Glue applications written by other developers. It is important to note, Model-Glue enforces the Model/View/Controller (MVC) pattern. As such, much of Model-Glue specific development revolves around the Controller and to a lesser extent the View. The Model is generally left unaware of Model-Glue as a best practice. == And Look at This One I Made Before == In this module, we will deal with a number of pre-made files. These files contain content that is not relevant to Model-Glue. In some cases, HTML markup has been built for you, in other cases model objects have been made for you. Since this class is compressed, we'll explain how all these relate together and do exercises on the Model-Glue specific items. == Exercise: Dealing with Data == 1. Open up your /PlantOMatic/config/ModelGlue.xml 2. Paste the following Controller definition inside the section {{{ }}} 3. Paste the following Event Handler definitions inside the section {{{ }}} 4. Open /PlantOMatic/config/ColdSpring.xml and add the following bean definition {{{ }}} 5. Create a new file in /PlantOMatic/controller named !ShipmentController.cfc 6. Use the following code as the body of !ShipmentController.cfc {{{ }}} 7. Open /PlantOMatic/views/Display.Shipment.cfm and prepend the following: {{{ }}} 8. Open /PlantOMatic/views/Form.Shipment.cfm and prepend the following: {{{ }}} 9. Open /PlantOMatic/views/List.Shipment.cfm and prepend the following: {{{ }}} == Putting It All Together == Once you successfully complete the above tasks, run your application and click the home navigation element. You should see a screen load with the title of Saved Shipments (see figure below). You may interact with this screen, pressing Edit, Print, Display and the other links in the User Interface. All of them will work, except for New Item. We'll cover New Item in a future section. [[Image(training03-1.png, nolink)]][[BR]] '' Shipment List View '' ---- Back: [wiki:Training/Section02 Training Section 2: Show Me Some Skinning] Next: [wiki:Training/Section04 Training Section 4: Request Formats Are Your Friend]