Personnalisation avancée > Business Logic Customization > Data Exchange using Standards in Windchill > STEP Data Exchange using EXPRESS > STEP Foundation > Configuring Metadata Mapping > Populate Preference Definition
  
Populate Preference Definition
There are two possible approaches here.
1. You need to populate a distinct Preference Definition for every mapping that is configured in the <Windchill>\codebase\registry\ixb\mapping IXMappingConfiguration.xml file. All such Preference Definitions could be combined and loaded using the Preferences Import utility. Each loadable Preference Definition would be populated in the importable file as below
<PreferenceDefinition>
<name>R_objectContainerPath</name>
<!-identifier of the preference definition,
unique in the system-->
<visibility>HIDDEN</visibility>
<!-should be HIDDEN to avoid it showing up in the UI -->
<categoryName>FederationMapping</categoryName>
<!- it would be always FederationMapping -->
<displayName>R_objectContainerPath</displayName>
<description>Mapping for the containerPath </description>
<fullDescription> Mapping for the containerPath
</fullDescription>
<defaultValue></defaultValue>
<!-can have no value, but schema needs this element
to be specified -->
<handler>com.ptc.windchill.enterprise.preference.handler.
MultiValueMapPreferenceHandler:</handler>
<!-always MultiValuePreferenceHandler -->
<defaultComments>Mapping Test for
objectContainerPath</defaultComments>
<clientOverride>true</clientOverride>
<!-if true, implies one can override the value -->
</PreferenceDefinition>
And would confirm to the schema
<!ELEMENT PreferenceDefinition ( name, ObjectID?, BACInfo?, visibility,
categoryName, displayName, description, fullDescription, defaultValue,
handler, defaultComments?, clientOverride?, clientDelegate?, clientData?)>
* 
A sample file resides in the system at the following location: ..\IX_LOAD\prog_examples\Mappings\src\mappings-pref.xml
It is then required that the Preference Definition be linked to a specific Preference Client. This is achieved by adding the following entry to the same loader file. Refer to ‘renault-preference-definition.xml’ included above.
<LinkPreferenceClientDefinition>
<name>R_objectContainerPath</name>
<!-identifier of the preference definition to be linked -->

<clientName>
536416322-1456322554305-2141932519-203-136-220-10
</clientName>

<!-name of the preference client to link to. This preference
client is implicitly created by the same utility that creates
the CollaborationSourceInfo and usually has the same name as
‘guid’ parameter provided to that utility.
This client name identifies the source system for which mappings
have been defined. One can relate the definition to multiple
client names and hence multiple source systems -->

</LinkPreferenceClientDefinition>
2. You can populate all the mappings in the CSV format as in the sample. And, then a Mapping converter utility as follows to generate a Preference Definition file that can be imported.
* 
A sample file resides in the system at the following location: ..\IX_LOAD\prog_examples\Mappings\src\mappings.csv
windchill wt.ixb.publicforapps.extendedmapping.tools.Metadat aMappingConverter -csvtoxml "e:\ptc\mapping-test\mappings.csv" null mappings-pref true
mappings-pref is the output XML file name to be latter imported.
And, here is the command to import the preference definitions into the system.
windchill wt.preference.ImportPreferences -importfile=e:\ptc\mapping-test\mappings-pref.xml -overwriteValueConflicts -user=wcadmin -password=wcadmin
* 
Find more on this utility using the ‘-usage’ option.
windchill wt.preference.ImportPreferences -usage