Administering : Managing business rules and expressions : Business rules definitions : XPathValueFetcher business rule
  
XPathValueFetcher business rule
The XPathValueFetcher business rule fetches the value from a URL or a Integration link attribute.
You can use this business rule to fetch more information of a work item or requirements from CLM system such as Rational Team Concert and Rational Requirements Composer.
Prerequisites
A module that contains Integration link attribute
A business rule attribute container that can be a Text, Float, or Integer
An authorized consumer key in the CLM application server.
A functional user registered for the authorized key.
The CLM application server must be registered as a friend.
Format
In the business rule container attribute, type the business rule in this format:
=XPathValueFetcher('Integration link attribute name',
"URL parameters","XPath expression","Label","true")
To know the OSLC CM specifications for the work item attributes, refer the document on the Jazz.net web site. You need to register on the Jazz.net web site to view the document.
Parameters
 
Parameter
Description
Integration link attribute
The Integration link attribute that defines the link to a specific project area in a Jazz Team Server
URL parameters
The URL parameter to query the required work item information.
XPath expression
Specify the expression to navigate to the required element and the computation that needs to be done from the value that is retrieved.
Label
Specify a string label such as Status or Planned For. The value is retrieved from the expression.
true
Displays the last run time of the business rule.
run_at
Sets a specific time to update the business rule.
You cannot use both "update_interval=" and "run_at=" at the same time.
For the expression "run_at=8,7,3", the business rule runs once a week at 8:00 am, and will start running in three days. The numbers in the parameter represent start_at, days_between_runs, and days_before_first_run.
You can use this parameter for all of the business rules.
update_interval
Sets the interval between the two runs.
For the expression "update_interval=1h", the interval time between the execution of two business rules is set to one hour.
You can use this parameter for all of the business rules.
Notes
For retrieving Rational Requirements Composer resources, you must include /ds:dataSource/ds:artifact/ at the start of the URL parameters and XPath expression value.
For retrieving Rational Team Concert resources, ensure that you are using the OSLC v1.0 syntax.
Examples to fetch values from Rational Team Concert
In this example the XPathValueFetcher business rule is used to fetch the state of a work item.
=XPathValueFetcher('Work Items',
"/?oslc_cm.properties=rtc_cm:state{}",
"//rtc_cm:state/dc:title[text()]", "State", "run_at=1")
In this example the XPathValueFetcher business rule is used to fetch the actual effort for a work item in hours by retrieving the actual effort values of all the children work items in Rational Team Concert 3.x.
=(XPathValueFetcher('Work Items',
"/?oslc_cm.properties=rtc_cm:progressTracking{}",
"//oslc_pl:workCompleted[text()]","run_at=1")) / ( 1000*60*60 )
In this example the XPathValueFetcher business rule is used to fetch the planned effort for a work item in hours by retrieving the planned effort values of all the children work items in Rational Team Concert 3.x.
=(XPathValueFetcher('Work Items',
"/?oslc_cm.properties=rtc_cm:progressTracking{}",
"//oslc_pl:effortRemaining[text()]","run_at=1")) / ( 1000*60*60 ) + 'Actual Effort'
In this example the XPathValueFetcher business rule is used to fetch the total time spent in hours for a work item in Rational Team Concert 2.x. by retrieving the time spent values of all the children work items.
=(XPathValueFetcher('Work Items',
"/rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.children/?oslc_cm.properties=rtc_cm:timeSpent",
"sum(//rtc_cm:timeSpent[text()])","run_at=1")) / ( 1000*60*60 )
In this example the XPathValueFetcher business rule is used to fetch the total estimate in hours for a work item in Rational Team Concert 2.x by retrieving the estimate values of all the children work items.
=(XPathValueFetcher('Work Items',
"/rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.children/?oslc_cm.properties=rtc_cm:estimate",
"sum(//rtc_cm:estimate[text()])","run_at=1")) / ( 1000*60*60 )
Examples to fetch values from Rational Requirements Composer
In this example, the XPathValueFetcher business rule is used to fetch the configured requirement attributes Status and Difficulty in Rational Requirements Composer.
=XPathValueFetcher('Requirements',
"/ds:dataSource/ds:artifact/ds:collaboration/ds:attributes/attribute:objectType/attribute:customAttribute[@attribute:name='Status']/@attribute:literalName",
"/ds:dataSource/ds:artifact/ds:collaboration/ds:attributes/attribute:objectType/attribute:customAttribute[@attribute:name='Status']/@attribute:literalName, /ds:dataSource/ds:artifact/ds:collaboration/ds:attributes/attribute:objectType/attribute:customAttribute[@attribute:name='Difficulty']/@attribute:literalName",
"Status, Difficulty","update_interval=3")
In this example, the Focal Point attribute Derived Requirements locates an artifact in Rational Requirements Composer, and extract the value for Estimated Cost, labeling it as Cost, and updating the value every 12 hours.
=XPathValueFetcher('Derived Requirements',
"/ds:dataSource/ds:artifact/rrm:collaboration/rrm:attributes/attribute:objectType/attribute:customAttribute[@attribute:name='Estimated%20Cost']/@attribute:value",
"/ds:dataSource/ds:artifact/rrm:collaboration/rrm:attributes/attribute:objectType/attribute:customAttribute[@attribute:name='Estimated Cost']/@attribute:value",
"Cost","update_interval=12")
Go up to
Business rules definitions