程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Rational >> 使用 XPathValueFetcher 業務規則跟蹤 Rational Focal Point 中的項目

使用 XPathValueFetcher 業務規則跟蹤 Rational Focal Point 中的項目

編輯:Rational

Rational Focal Point 中的鏈接管理

IBM Rational Focal Point 與協作式生命周期管理 (CLM) 應用程序的 Rational 解決方案的集成基於 Linked Data 技術。換句話說,在 Rational Focal Point 和 CLM 應用程序(比如 Rational Requirements Composer 和 Rational Team Concert )之間創建的鏈接 是該集成的一個重要部分。圖 1 使用鏈接描繪了各種 Focal Point 和 CLM 應用程序資源,以及它們之間的 關系。請注意,鏈接是多對多的關系。

您需要掌握的知識

閱讀本文需要掌握 REST 架構、XML 和 XPath 方面的知識。

圖 1. 資源和關系

Rational Focal Point 與 CLM 應用程序的集成為您提供了以下能力:

根據 Focal Point 中的一個 Business Need 創建單一 CLM 資源,比如一個工作項或一個需求工件。

根據 Focal Point UI 創建一個 CLM 資源集合(比如工作項或需求工件)並批量處理它們。

將現有的 CLM 資源鏈接到 Focal Point UI 中的 Business Need。

在 Focal Point UI 中預覽鏈接的 CLM 資源。

使用 XPathValueFetcher 業務規則從鏈接的 CLM 資源將關鍵數據獲取到 Focal Point 中,供利益相關者 可使用這些數據來監視項目。

配置 XPathValueFetcher 業務規則

Rational Focal Point 的一個重要優勢是,您能夠以治理儀表 板 (governance dashboard) 的形式使用它。產品經理、業務利益相關者和高層管理人員可以使用 CLM 應用 程序(比如 Rational Team Concert 和 Rational Requirements Composer),在項目執行或規劃期間跟蹤和 傳達他們的計劃的進度和狀態。

還可以使用 XPathValueFetcher 業務規則,根據拉入到 Focal Point 中的 CLM 數據來過濾 Focal Point 元素。例如,您可以列出在 Rational Requirements Composer 中為其批 准了相應的需求狀態的所有業務規則。

Focal Point 使用 IntegrationLinkAttribute 將多個鏈接連 接到 CLM 資源。通過使用這些鏈接,XPathValueFetcher 規則可以將信息從一個 CLM 應用程序獲取到一個包 含文本和數字值的 Focal Point 屬性中,比如鏈接到 Rational Team Concert 中的某個工作項的 Status 和 Progress 數據。

執行 XPathValueFetcher 業務規則的前提條件

XPathValueFetcher 業務規則 在後台運行。它需要輸入用戶身份驗證信息,然後才能在沒有用戶干預的情況下向 CLM 服務器發出請求。

Rational Jazz 技術提供了一種分配某個功能性的 user-to-consumer 密鑰的方法,無需來自 Focal Point 的用戶的干預即可發出後台請求。

圖 2. 創建一個使用者密鑰並將一個功能用戶附加到一個使 用者密鑰

圖 3. 以 Friend 的形式添加一個 CLM 使用者密鑰,該密鑰用於 XPathValueFetcher 身份驗證

遵循 XPathValueFetcher 業務規則格式

=XPathValueFetcher('Integration link attribute',"URL parameters","XPath expression","Label","true")

1. 輸入 Integration Link 屬性的名稱

Focal Point 允許使用 Integration Link 屬性,將特定項目區域的鏈接存儲到 CLM 應用程序中。可 使用此屬性創建或鏈接到配置的項目區域中的 CLM 資源。

作為 XPathValueFetcher 業務規則的第一 個參數,輸入用於鏈接到 CLM 應用程序的 Integration Link 屬性的名稱,例如工作項(參見 圖 4)。

2. 配置 URL 參數

URL 參數用於從 CLM 服務器查詢需要的資源和屬性。Rational Team Concert 和 Rational Requirements Composer 中的 URL 參數的配置方式不同:

在查詢 Rational Team Concert 中的資源時,XPathValueFetcher 業務規則使用 OSLC REST 服務獲取工 作項的 XML 表示。

在查詢 Rational Requirements Composer 中的資源時,該規則使用 Rational Requirements Composer Reportable REST API 獲取需求的 XML 表示。

配置一個 Rational Team Concert 工作項 的 URL 參數

Rational Team Concert 在 HTTP GET 請 求上提供了 oslc_cm.properites 參數,以便從工作項 URL 獲取有限數量的資源屬性。如果在請求中省略了 此參數,那麼 XML 響應中會提供所有資源屬性。

圖 4. 鏈接到某個工作項的一個 Integration Link 屬性和該工作項的詳細懸停顯示視圖

顯示 Rational Team Concert 工作項的鏈接(如圖 4 所示),從 IntegrationLinkAttribute 復制 Rational Team Concert 工作項的鏈接,以便使用任何 REST 客戶端發出 HTTP GET 請求。圖 5 顯示了用於 向工作項 URL 發出 GET 請求的 Mozila Firefox REST 客戶端。

圖 5. Rational Team Concert 工作 項 URL 的 HTTP GET 請求,使用 Firefox RESTClient 加載項

創建 URL 參數來獲取 Rational Team Concert 工作項的 State 和 Progress 信息

State 和 Progresstracking 都是 XML 格式的引用資源,Rational Team Concert 提供了一個以內聯資源形式獲取它們 的選項。例如:

rtc_cm:progressTracking{*}, rtc_cm:state{*}
? oslc_cm.properties=rtc_cm%3Astate%7B*%7D,rtc_cm%3AprogressTracking%7B*%7D

注意:
oslc_cm.properties 是一個請求 URL 的一部分。這需要對參數進行編碼。例如:

{*} 編碼為 % 7B*%7D,rtc_cm:state 編碼為 rtc_cm%3Astate。

這是 Rational Team Concert 工作項的 URL 的一 個示例(在第 3 步中,會使用這個 URL 來構建 XPath Expression):

https://ibm-mnadigar- w5:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/13?oslc_cm.properties=rtc_cm% 3Astate%7B*%7D,rtc_cm%3AprogressTracking%7B*%7D

配置 Rational Requirements Composer 的 URL 參數

該 XPathValueFetcher 業務規則使用 Rational Requirements Composer Reportable REST API 從 Rational Requirements Composer 中獲取數據。在 Focal Point 中,Rational Requirements Composer Requirement 鏈接存儲為 OSLC 資源 URL,在發出 GET 請求前,這些 URL 自動轉換為 XPathValueFetcher 業務規則中的一個 Reportable REST URL。

這是 Focal Point 中存儲的一個示例 Rational Requirements Composer 需求 URL 格式:

https://fpdev.integration:9443/rm/resources/__JnJ8rYzEeGXfpEm4RWRkQ

等效的 Rational Requirements Composer Reportable REST API URL 格式為:

https://fpdev.integration:9443/rm/publish/resources? resourceURI=__JnJ8rYzEeGXfpEm4RWRkQ&fields=/ds:dataSource/ds:artifact/

對於 Rational Requirements Composer,URL 參數應為:

/ds:dataSource/ds:artifact/

可輸入任何有效的 XPath 表達式。例如:

=XPathValueFetcher('Requirements', "/ds:dataSource/ds:artifact""/ds:dataSource/ds:artifact/rrm:collaboration/rrm:att ributes/attribute:objectType/attribute:customAttribute [@attribute:name='Status']/@attribute:literalName","Status","update_ interval=1h")

這是一個 Rational Requirements Composer Reportable REST 需求 URL 的示例 (在下一步中,會使用這個 URL 來構建 XPath 表達式):

https://fpdev.integration:9443/rm/publish/resources? resourceURI__JnJ8rYzEeGXfpEm4RWRkQ&fields=/ds:dataSource/ds:artifact/

圖 6. Rational Requirements Composer 需求 Reportable REST URL 上的一個 HTTP GET 請求

3. 構造 XPath 表達式

構造了 URL 參數後,使用 URL 參數步驟 中構造的示例 URL 發出 HTTP GET 請求。

使用包含 URL 參數步驟 2 中使用的標頭的 REST 客戶端,獲取工作項或需求的 XML 表示作為響應。

使用此 XML 構造將在 Focal Point 中檢索的 XML 格式屬性的 XPath 表達式。

使用免費的 XPath 編輯器構造此表達式。

以下是用於 Rational Requirements Composer 和 Rational Team Concert 的 XPath 表達式的示例:

Rational Requirements Composer XPath 表達式示例:

/ds:dataSource/ds:artifact/rrm:title

/ds:dataSource/ds:artifact/ds:collaboration/ds:attributes/attribute:objectType/attribute:cust omAttribute[@attribute:name='Status']/@attribute:literalName/child::text()

/ds:dataSource/ds:artifact/ds:collaboration/ds:attributes/attribute:objectType/attribute:cust omAttribute[@attribute:name='Difficulty']/@attribute:literalName

Rational Team Concert XPath 表達式示例:

//rtc_cm:state/dc:title[text()]

//oslc_cm:priority[enumeration()]

//oslc_pl:workCompleted[text()]

//oslc_pl:effortRemaining[text()]

從 Rational Requirements Composer 需求中獲取 Status、Difficulty 和 Stability 的 XPathValueFetcher 業務規則示例:

=XPathValueFetcher('Detailed Requirements', "/ds:dataSource/ds:artifact"

"/ds:dataSource/ds:artifact/rrm:collaboration/rrm:attributes/attribute:objectType/attrib ute:customAttribute[@attribute:name='Status']/@attribute:literalName

/ds:dataSource/ds:artifact/rrm:collaboration/rrm:attributes/attribute:objectType/attribute:cu stomAttribute[@attribute:name='Difficulty']/@attribute:literalName

/ds:dataSource/ds:artifact/rrm:collaboration/rrm:attributes/attribute:objectType/attribute:cu stomAttribute[@attribute:name='Stability']/@attribute:literalName"

"Status, Difficulty, Stability"

"update_interval=1h")

圖 7. 構造 Rational Requirements Composer 需求標題的 XPath 表達式的示例 XPath 編輯器視圖

4. 添加標簽

標簽是向從 CLM 應用程序中獲取的每個值(XPath 表達式)顯示的一些有意義的信息 。例如:

=XPathValueFetcher('work items',"/?oslc_cm.properties=rtc_cm%3Astate% 7B*%7D","//rtc_cm:state/dc:title[text()]","work item State", true, "run_at=1")

圖 8. 圖 8. 配置 XPathValueFetcher 業務規則中的標簽

5. 指 定最後運行時的時間戳

Rational Focal Point 允許對 XPathValueFetcher 業務規則進行安排,以後 台作業的形式定期運行它們,比如 updater_interval=xxxh|m|s 或 run_at=xxx。使用此參數。您可在 UI 中 顯示最後運行此業務規則的時間(參見圖 9 中的示例):

=XPathValueFetcher('Work Items',"/?oslc_cm.properties=rtc_cm%3Astate%7B*%7D","//rtc_cm:state/dc:title [text()]","Work Item State", true, "update_interval=1h ")

圖 9. 圖 9. Work Item Details 顯示了最後運行規則時的時間戳

6. 將規則配置為作為後台作業運行

Focal Point 允許將 XPathValueFetcher 業務規則配置為作為 後台作業運行。您可指定它應運行的頻率。以下是兩個示例。

update_interval=xxx h|m|s

使 用此參數,您可以指定兩次運行之間的間隔。對於 update_interval=1h expression,兩個業務規則的執行間 隔時間設置為 1 小時。您可將此參數用於所有業務規則。

run_at

使用此參數,您可以確定一 個具體的時間來更新業務規則。您可以同時使用 update_interval= 和 run_at=。對於表達式 run_at=8,7,3 ,業務規則每周在早上 8:00 運行一次,它將運行 3 天。參數中的數量表示:

start_at

days_between_runs

days_before_first_run

您可以根據您的需要自定義此參數。例如,可以使用 run_at=8 在每天早上 8:00 運行業務規則,或者使 用 run_at=8,7 在早上 8:00 每周運行一次。您可將此參數用於所有業務規則:

=XPathValueFetcher ('Work Items', "/?oslc_cm.properties=rtc_cm%3Astate%7B*% 7D","//rtc_cm:state/dc:title[text()]","Work Item State", true, "update_interval=1h")

7. 手動觸發 XPathValueFetcher 業務規則

對於與 Jazz Team Server 同步數據的 OSLC 視圖命令,可將它配置為從 Rational Focal Point 用戶界面觸發 XPathValueFetcher 業務規則。這個 view 命令通過 XPathValueFetcher 業務規則應用於該視圖中的所有元 素和屬性。

配置 Synchronize OSLC 視圖命令涉及以下步驟:

選擇您希望顯示視圖命令的 Focal Point 視圖(圖 10 中的示例中的Approved Projects)。

對於鏈接的元素,可以選擇 Business Needs。

選擇配置為鏈接到 Rational Team Concert 和 Rational Requirement Composer 的 IntegrationLinkAttribute。

對於命令選項,選擇 Synchronize data with Jazz Team Server。

圖 10. 通過配置 OSLC 視圖命令與 Jazz Team Server 同步數據

可從 Focal Point 視圖執行配置的 OSLC 視圖命令,如圖 11 所示。

圖 11. 通過執行 OSLC 視圖 命令與 Jazz Team Server 同步數據

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved