Build result Change event
Hi,
I am writing a Build Result Changed Event Handler Follow-up action using CLM 4.0.1.
public void handleEvent(IChangeEvent event,
IProcessConfigurationElement handlerConfiguration)
throws TeamRepositoryException {
}
How do I get the IBuilddefinition or the IBuildResult from the event triggered.
|
Accepted answer
Hi Pancha, a change event may have an associated item. Use IChangeEvent.getItem() to get its handle.
In the case of build events this is a build result handle, but could conceivably be something else so you should check before fetching it.
e.g.
To get the definition, you'd fetch the IBuildDefinition whose handle is given by buildResult.getBuildDefinition().
It's possible that the result has been deleted between the time the event was generated and the time the event handler is called, so you need to handle that (i.e. the try/catch for ItemNotFoundException).
We also set some properties from the result and definition as string extensions on the change event, so it's possible to get this info even if the result has been deleted.
e.g.
You can find all string extensions on the event by casting the event down to com.ibm.team.repository.common.model.Item and calling getStringExtensions().
Pancha Gyaneswari Yelika selected this answer as the correct answer
Comments
Pancha Gyaneswari Yelika
commented Mar 21 '13, 1:48 a.m.
Thanks Nick, I have done accordingly and working fine. Could I know from where we can find what are all the properties present. And also could we get the the values for all the properties, related to the event using event.getStringExtension("propertyName"); The string extensions keys are: buildDefinitionId, status, state, label, requestorId, personalBuild, and tags. All prefixed by build.IBuildResult.
Constants for these are defined in our internal class com.ibm.team.build.internal.common.events.BuildResultEvent.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.