This chapter aims
We've learned how to create a new data model, and now we're going to insert some data into our new data model to test
There are 2 ways to insert data into the data model, one to insert data into the HMC, and one to use Hybris's Import-export data Framework, which is generally called Impex.
Enter Data via the HMC
Manually inserting some data through the HMC first
- Activate Hybris to Http://localhost:9001/hmc/hybris address
- Browse Stadium, click New and enter the data in the image below, click Cliclk to save a new stadium
- Add a second stadium, Name:allianz capacity:66000
Add some matches to the stadium created above
- First make sure that Cuppy, Cuppytrail and CUPPYTRAILHMC have been initialized.
- Assign some matches to the new stadium
Here we add some matchs examples to stadium to illustrate how the HMC handles these relationships types defined in Items.xml.
Impex by convention
I typically import data into the data model, most of which I would choose the Impex method-the "Impex by convention" definition is much more convenient than importing the bulk of the stadium data in the HMC.
- Generic files are named Essentialdata*.impex and Projectdata*.impex, and files are saved under the <extension>resources/impex folder
- If you use the Impex by configuration method, you must provide the Impex filename path in config/local.properties in advance. For details, refer to Impex Import for Essential and Project Data.
Create an Impex File
New file Cuppytrail/resources/impex/projectdatastadium.impex:
Insert_update stadium;code[unique=true];capacity; emirates;60361; villapark;42788 UPDATE Match;id[unique=true];group (Competition (code), code) [Unique=true];stadium (code); 1;wc2010:a ; emirates;2;wc2010:a; Emirates;3;wc2010:b; Emirates;4;wc2010:b; Villapark $START _userrightstype; UID; memberofgroups; Password; target;read;change;create;remove;change_permusergroup;cuppyadmins;;;;;;;;;;;; stadium;+;+;+;+;-$END _userrights
- This Impex contains a header row with a SQL table Command and columns, stating that we want to update the Table Stadium, I n Particular the columns code (whose values must be unique), capacity and matches whose IDs would be specified below. This was followed by several rows containing the data to import.
- We are specifying, stadiums and several matches to import
- The code attribute needs to be unique: unique=true.
- The Userrights section sets access rights for Cuppyadmins-usergroup on Stadium type.
You can view the import file in Excel, but is aware that should not save the file in Excel as any special characters m Ay be corrupted
Invoke the Impex from within Hybris
- Open Platform/update Location
- Select only cuppytrail items
- This time the browser will display Creating project data for Cuppytrail ... Inform you that Impex has been executed
- If you have already completed trail ~ Integration in the HMC part of this study
- Open the HMC to see if the import was successful
- Supplemental points
- Select System-types in the HMC to search for "Stadium"
- In the results of the search, double-click Stadium
- Click the Edit button to perform a generic search, and in the results list, double-click the first
- A new browser window pops up and sees a new stadium
Or you can also import Impex in the HMC
- Landing HMC
- Open node System, Tools, Import
- Select the file location to import
- Click the Start button to perform the import
Populating the data model (inserting values into data model)