Module Specific Data

You can use LoadModuleData.xml defined in the module's data folder (if this file doesn't exist, create it) to load module-specific data. You can define ModelFile (XML), InboundInterfaceFile (CSV), and groovy based Scripts in any order and any number of times (similar to dataset LoadData.xml except LoadModuleData doesn't load ValueChain, StandardProcessType, and UiMetaModel) to load data in that particular sequence. Data files must be defined in the same folder and sub-folders. For e.g

<LoadModuleData xmlns="http://www.onenetwork.com/Platform">
 
    <ModelFile>Enterprises.xml</ModelFile>
    <InboundInterfaceFile inboundInterface="ZBKS.EnterpriseLoad">EnterpriseFile.csv</InboundInterfaceFile>
    <Script>
		com.onenetwork.platform.env.servicelocator.Services.get(com.onenetwork.platform.data.sql.SqlService.class).executeQuery("update enterprise set description = 'Test Update Through Script' where ent_name = 'PTAModuleSampleEnterprise' and vc_id = " + context.getValueChainId());
    </Script>
</LoadModuleData>

You can use context (PlatformUserContext) as a binding parameter inside the groovy script to access the ValueChain admin user information.

As modules are shared across different instances, you should not hardcode ValueChainId to the XML and CSV files. Instead, you can use VC_ID macro.

XML example

<ModelList xmlns="http://www.onenetwork.com/Platform">
	<ValueChainId>VC_ID</ValueChainId>
	<CustomModelName>Standard Enterprise</CustomModelName>
	<ActionName>PLT.InsertOrUpdate</ActionName>
	<Enterprise>
		<Name>SampleEnterprise</Name>
		<ValueChainId>VC_ID</ValueChainId>
		<DisplayName>Sample Enterprise</DisplayName>
		<Description>Sample Enterprise</Description>
		<TypeName>Standard Enterprise</TypeName>
	</Enterprise>
</ModelList>  

CSV example

#* Name,Description,ValueChainId
CSVTest2Enterprise - VC_ID,This is another test of an inbound interface,VC_ID 

LoadModuleData.xml will only be called if dataset LoadData.xml has reference to load module-specific data. For that, add the following entry after UiMetaModel element

  1. <LoadModuleData/> - If you want to load data from all the modules. (This is the most common use case.)

  2. <LoadModuleData modulePrefix="ZBKS"/> - If you want to load only ZBKS module data.

  3. <LoadModuleData modulePrefix="ZBKS,ZPTS"/> - If you want to load data from multiple modules but not all.