配置映射定义
您需要通过确定哪些 IXB DTD 标记将有助于条件和值映射,来配置映射。所有这些配置都需要在 <WindchillE>\codebase\registry\ixb\mapping\IXMappingConfiguration.xml 中进行。
<Mapping preferenceDefinition="R_objectContainerPath"
mappingProcessor="wt.ixb.publicforapps.extendedmapping.processor.
SingleTagMappingProcessor">
<!-This configuration relates to preference definition
‘R_objectContainerPath’ and uses a mapping processor for single tag -!>
<Tag value="objectContainerPath" regex="true" replaceFull="true" />
<!-objectContainerPath is the tag in IX DTD that would be used to apply
the mappings defined by the preference definition. And, regular expressions
would be utilized for this mapping with full replacement of the
value by the value in the preference instance -!>
</Mapping>
这是用于处理生命周期属性映射的配置示例。
<Mapping preferenceDefinition="R_lifecycle" separator=";"
mappingProcessor="wt.ixb.publicforapps.extendedmapping.
processor.MultiTagMappingProcessor">
<!-R_lifecycle is the preference definition that provides
the mapping value and the mapping processor suggests the use
of multiple tags for the mapping values-!>

<Tag value="externalTypeId" condition="true" regex="true"/>
<!-externalTypeId is the tag that sets the condition, unless the
condition is fulfilled the mapping would not be applicable.
RegEx match is applicable here -!>

<!-You can have multiple elements mapped simultaneously-!>
<Tag value="lifecycleInfo/lifecycleTemplateName"/>
<!-this is the element that is mapped -!>
<Tag value="lifecycleInfo/lifecycleState"/>
<!-This is another element that is mapped -!>
</Mapping>
* 
示例文件位于系统中的以下位置:。\IX_LOAD\prog_examples\Mappings\src\IXMappingConfiguration.xml
您需要将此文件中的所有映射元素填充到 IXMappingConfiguration.xml 中,才能使用映射转换器实用程序。
如映射结构中所示,可以定义多个映射。每个映射元素与一个 preferenceDefinition 和一个 mappingProcessor 相关联。可以提供一个可选的 applicableXApplications 属性,以将映射配置限制为仅适用于那些 IX 应用程序。
applicableXApplications 是以逗号分隔的适用应用程序列表。如果未指定,则映射适用于所有应用程序。
每个映射元素都可以在其下定义一个或多个标记。标记可以是条件类型 (由 condition=”true” 属性定义) 或可映射类型 (非条件)。这些可映射标记将隐式具有 "condition=false"。条件类型的标记可以指定属性 "multi=true",以定义值属性所参考的特定元素可以具有多个实例,并且将提取每个实例来评估条件。
仅考虑可映射标记以返回映射值。一个可映射类型的标记只能与一个适用的 mappingProcessor 和一个 preferenceDefinition 相关联。如果同一标记有多个映射定义,则将为可映射标记选择此配置文件中的第一个适用的映射定义。映射的多个类型条件标记将为 AND 条件。
多个标记意味着映射数据将在源映射数据和目标数据中具有可解析的 (通过属性分隔符) 映射。映射数据中的源值应遵循与该映射元素所定义的序列相同的序列,并由分隔符分隔。同样,目标值应遵循为映射定义的可映射标记的相同序列。也可以通过属性 regex="true” 将标记定义为支持 regex。默认值为非 regex 标记 ("false")。Regex 支持根据正则表达式进行替换。如果 regex 对于可映射标记为 true,则可以另外指定属性 replaceFull="true" (默认为 false),以指示匹配时映射值应替换完整值。所有这样定义的表达式将以自然顺序排序,并且将尝试通过所有定义的此类映射进行第一个匹配。请小心避免不必要地使用它,以免导致性能下降。被称为条件的标记可能在映射数据中指定了值,也可能没有,但它仍应通过带有空白条件值的适当分隔符来保持序列。
预设仅提供两个映射处理器实现。
wt.ixb.publicforapps.extendedmapping.processor.SingleTagMappingProcessor 将处理单个标记映射,包括对 regex 的支持。
wt.ixb.publicforapps.extendedmapping.processor.MultiTagMappingProcessor 将处理带有多个标记 (包括条件标记) 的映射。此处理器还将在条件标记和可映射标记中支持 regex。
以上两个预设映射处理器适用于简单字符串操作的概念。如果需要将任何业务逻辑附加到正在考虑的映射数据中的这些字符串值中,则需要根据指导指南 (如自定义映射行为中所述) 编写其自定义的映射处理器/映射器,以扩展这两个处理器。
这对您有帮助吗?