Populating Data Model

来源:互联网 发布:a 算法解决八数码 编辑:程序博客网 时间:2024/05/16 12:35

方法1、Enter data via the hMC

First we will create data manually in the hMC:

  1. Start hybris and navigate to the hmc http://localhost:9001/hmc/hybris
  2. Browse to Stadium, click New and enter the data below. Click Create to save the new Stadium
  3. Add a second stadium Allianz with Capacity 66000

Add some matches to the Stadium created above. 

  1. Make sure you have entered the Cuppy, CuppyTrail and CuppyTrailhmc extensions in your localextensions.xml file. You can check that they've been included in the build by looking at the platform - extensions page in the hAC.
  2. Assign some matches to the newly created stadiums
  • Right-click on the matches field to get a context menu - select + Add Match
  • In the new search window, click on the search button
  • In the results area, select some matches by clicking anywhere in the match row except the little blue button
  • Then click the use button
  • This will return the selected matches to the stadium

In this use case we have added Matches to the Stadium which illustrates how the hMC handles relationships defined in the items.xml file.


方法2、ImpEx by Convention

During the initialization and update processes, the platform looks for ImpEx files in the <extension_name> /resources/impex folder. In particular:

  • For essential data: The platform scans the <extension_name> /resources/impex  folders for files with names that match the pattern essentialdata*.impex and imports the files during the essential data creation.

  • For project data: The platform scans the <extension_name> /resources/impex folders for files with names that match the pattern projectdata*.impex and imports the files during the project data creation.

The ImpEx directory does not exist by default. You must create it and copy files to it.

For example, if you have the following folder structure:

  • resources/impex/essentialdataOne.impex

  • resources/impex/essDataOne.impex

  • resources/impex/DataOne.csv

  • resources/impex/projectdataOne.impex

The files essentialdataOne.impex and projectdataOne.impex are located and imported during the essential and project data imports respectively.

If you have special folder structures or want to use another folder in the resources, you must override the configuration in your local.properties file:

  • For essential data, add the property <extension_name>.essentialdata-impex-pattern .

  • For project data, use <extension_name>.projectdata-impex-pattern .

For example, assume that you have the following folder structure:

  • resources/test1.csv

  • resources/subfolder/test2.csv

  • resources/impex/subfolder/subfolder/test3.csv

In this structure, only the test1.csv  file has the pattern <extension_name>.essentialdata-impex-pattern=*.csv. In contrast to the example above, the pattern:extension_name .essentialdata-impex-pattern=*/.csv includes test1.csvtest2.csv and test3.csv.

If you want your configuration to work as the default does, you must set the pattern to <extension_name> .essentialdata-impex-pattern=impex/essentialdata*.impex.
0 0
原创粉丝点击