IChangeEvent title language indipendent
Hi,
I'm looking for some object property in order to select change-event. For example, while I'm looking for build result I get several different event title, but I want to do something only when the title is "Successful" or "Failed". So I use a string comparison to do it. But this it's OK only with an english locale server. Is there a property (something like ChangeEvent.SUCCESSFUL_TITLE) which I can use to compare title for every locale? Thanks, Michele. |
6 answers
Hi Michele, what kind of events are you dealing with? There's no generic success/failure status field on events, but events can carry arbitrary other data via string extensions.
See com.ibm.team.repository.common.IChangeEvent.getStringExtension(String) For example, Build events carry the build state and status (at the time of the event) as string extensions. You may also be able to retrieve the item the event is about and get status from there: com.ibm.team.repository.common.IChangeEvent.getItem() |
If you do fetch the item, note that you probably want to fetch the state at the time the event was created, not necessarily the latest state (if the item is an Auditable). You can use:
com.ibm.team.repository.service.IRepositoryItemService.fetchState(IAuditableHandle, String[]) |
Hi Nick,
thanks for your answer. I'm dealing with build result events and getting the event title to find when a build is successful. Do I have to use something different? I see that getStatus returns an UUID but I don't know how to map it with a successful build. Michele. |
Thanks, it works properly using both .getStringExtension(PROPERTY_BUILD_STATUS) and .getStringExtension(PROPERTY_BUILD_STATE) and comparing them to BuildStatus and BuildState static variables.
Best Regards, Michele |
Good to hear. Thanks for confirming.
|
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.