oslc-mappings.xml

oslc-mappings.xml 配置文件控制 Rational® ClearQuest® 如何预填充新的 OSLC 2.0 链接记录。

描述

oslc-mappings.xml 文件包含两段。两段都是支持 ClearQuest 预填充新记录所必需的:
  • oslcRecordConfig 段将 ClearQuest 记录字段映射到 OSLC 属性。
  • oslcProjectPrefillConfig 段控制创建新记录期间使用的 OSLC 属性。

oslcRecordConfig 段

oslcRecordConfig 段将特定 ClearQuest 记录字段映射到特定 OSLC 属性。对于用来预填充新记录的每种 ClearQuest 记录类型,都包含一个 oslcRecordConfig 段。

例如,要通过 8.0.0/SAMPL 数据库中的缺陷记录类型和客户记录类型进行预填充,oslc-mappings.xml 文件必须包含两个 oslcRecordConfig 段:

<oslcRecordConfig type="cq.record:Defect@8.0.0/SAMPL">
	<oslcFieldMapping name="dcterms:title" field="Headline"/>
	<oslcFieldMapping name="dcterms:description" field="Description"/>
</oslcRecordConfig>

<oslcRecordConfig type="cq.record:Customer@8.0.0/SAMPL">
	<oslcFieldMapping name="dcterms:title" field="Name"/>
	<oslcFieldMapping name="dcterms:description" field="Description"/>
</oslcRecordConfig>

每个 oslcRecordConfig 段可以具有一个或多个 oslcFieldMapping 属性。 每个 oslcFieldMapping 属性将一个 ClearQuest 字段映射到一个对应的 OSLC 属性。这些映射可以用于 ClearQuest 字段到 OSLC 属性的通用映射。 不限制可以映射的 OSLC 属性数量。 但是,只有当前用于预填充 ClearQuest 记录创建对话框的 OSLC 属性为 dcterms:titledcterms:description 属性。在以下示例中,dcterms:title OSLC 属性映射到 ClearQuest 标题字段,dcterms:description OSLC 属性映射到 ClearQuest 描述字段。

<oslcRecordConfig type="cq.record:Defect@8.0.0/SAMPL">

	<oslcFieldMapping name="dcterms:title" field="Headline"/>
	<oslcFieldMapping name="dcterms:description" field="Description"/>

</oslcRecordConfig>

要映射不同模式存储库或不同用户数据库中的相同记录类型,每个模式存储库或数据库都必须具有 oslcRecordConfig 段。以下示例显示不同模式存储库和用户数据库的配置:

<oslcRecordConfig type="cq.record:Defect@8.0.0/SAMPL">
	<oslcFieldMapping name="dcterms:title" field="Headline"/>
	<oslcFieldMapping name="dcterms:description" field="Description"/>
</oslcRecordConfig>

<oslcRecordConfig type="cq.record:Defect@7.0.0/TEST">
	<oslcFieldMapping name="dcterms:title" field="id"/>
	<oslcFieldMapping name="dcterms:description" field="Headline"/>
</oslcRecordConfig>

<oslcRecordConfig type="cq.record:Defect@7.0.0/PROD">
	<oslcFieldMapping name="dcterms:title" field="id"/>
	<oslcFieldMapping name="dcterms:description" field="Headline"/>
</oslcRecordConfig>

oslcProjectPrefillConfig 段

oslcProjectPrefillConfig 段控制创建新记录期间使用的 OSLC 属性。您要为其提供预填充信息的每个相关项目都有一个 oslcProjectPrefillConfig 段。在每个 oslcProjectPrefillConfig 段中,您要为其提供预填充信息的每个 ClearQuest 记录类型都有一个或多个段。

以下示例显示名为“RTC 4.0 Change Management”的项目的预填充信息。一个 oslcProjectPrefillConfig 段包含两个 oslcRecordPrefill 段,一个用于来自 8.0.0/SAMPL 数据库中缺陷记录类型的预填充信息,一个用于来自客户记录类型的预填充信息。

<oslcProjectPrefillConfig
projectName="RTC 4.0 (Change Management)" supportsPrefillMarkup="true">

	<oslcRecordPrefill type="cq.record:Defect@8.0.0/SAMPL">
		<oslcPrefillProperty name="dcterms:title" prefix="ClearQuest Headline: "/>
		<oslcPrefillProperty name="dcterms:description" prefix="Problem Description:<br/&gt;"/>
	</oslcRecordPrefill>

	<oslcRecordPrefill type="cq.record:Customer@8.0.0/SAMPL">
		<oslcPrefillProperty name="dcterms:title" prefix="ClearQuest Customer Name: "/>
		<oslcPrefillProperty name="dcterms:description" prefix="Customer Description:<br/&gt;"/>
	</oslcRecordPrefill>

</oslcProjectPrefillConfig>

每个 oslcRecordPrefill 段最多包含两个 oslcPrefillProperty 行。 目前,预填充仅支持 dcterms:titledcterms:description 属性。

supportsPrefillMarkup 属性决定通过 ClearQuest 将信息预填充到相关项目时要使用哪种换行符。如果 supportsPrefillMarkup 属性设置为 TRUE,但项目不支持富文本格式,您可能会在预填充数据中看到字符 &ltbr/>,而不是换行符。如果 supportsPrefillMarkup 属性设置为 FALSE,并且项目支持富文本格式,您可能会注意到所有预填充的多行数据都显示在一行上。

如果项目支持富文本格式,您或许可以使用带有前缀的 HTML 标记。在以下示例中,具有用于粗体和斜体的开始和结束标记,以及两个换行符:

<oslcProjectPrefillConfig
projectName="RTC 4.0 (Change Management)" supportsPrefillMarkup="true">

	<oslcRecordPrefill type="cq.record:Defect@8.0.0/SAMPL">
		<oslcPrefillProperty name="dcterms:title" prefix="ClearQuest Headline: "/>
		<oslcPrefillProperty name="dcterms:description" prefix="<b&gt;<i&gt;ClearQuest Description:</b&gt;</i&gt;<br/&gt;<br/&gt;"/>
	
	</oslcRecordPrefill>

</oslcProjectPrefillConfig>

cqrest.properties 中的 OSLC 映射如何影响预填充属性

如果在 cqrest.properties 文件中设置了 OSLC 映射,那么将只使用 cqrest.properties 文件中的映射,而不使用 oslcProjectPrefillConfig 段中的任何预填充属性。

如果您的 GET/POST/PUT 调用需要通用 OSLC 属性映射,并且您需要预填充记录表单,请从 cqrest.properties 文件中除去值,并在 oslc-mappings.xml 文件的 oslcRecordConfig 段中输入这些值。不限制可在该段中映射的 OSLC 属性数量。


反馈