It's all about the answers!

Ask a question

What is the eventCategory for “Build result changed” event?


Jia Jia Li (8057152192) | asked Jan 13 '16, 12:51 a.m.
I want to extend a follow up action in the “Event handling” configuration for “Build result changed” event. From the other forum topic, I know I should use the com.ibm.team.process.service.eventHandlers extension point, but when extend it, what is the eventCategory value?

And is there any Event Handler extension workshop? Is the same as operation follow up action extension?

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Jan 13 '16, 3:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I found it always hard to find anything about event handlers. I don't have an example and I don't have a list of event categories. I am not aware of any examples. However, the basic extension mechanism works similar to a follow up action and the interfaces you must implement can be found in the extension.

For build I found BuildResultChangeEvent if following it up the extension hierarchy I find com.ibm.team.build.internal.common.events.BuildChangeEvent and there:

    public static final String BUILD_RESULT_CHANGED_EVENT_CATEGORY = "com.ibm.team.build.category.BuildResultChanged"; //$NON-NLS-1$

com.ibm.team.build.category.BuildResultChanged would be what I would try.
Ralph Schoon selected this answer as the correct answer

One other answer



permanent link
Jia Jia Li (8057152192) | answered Jan 14 '16, 1:30 a.m.
edited Jan 14 '16, 1:49 a.m.
Yes, Ralph, you are right, thanks for your way to find the event category id.
I use the following extension to create a Build Result Change event followup actions:
       <extension point="com.ibm.team.process.service.eventHandlers">
        <eventHandler
            class="com.ibm.team.build.internal.service.process.event.tests.BuildProcessEventHandler"
            id="com.ibm.team.build.test.BuildProcessEventHandler"
            eventCategory="com.ibm.team.build.category.BuildResultChanged"
            name="Build Event Handler">
        <extensionService
            componentId="com.ibm.team.build"
            implementationClass="com.ibm.team.build.internal.service.process.event.tests.BuildProcessEventHandler">
          <prerequisites>
              <requiredService interface="com.ibm.team.repository.service.IRepositoryItemService"/>
              <requiredService interface="com.ibm.team.build.internal.common.ITeamBuildService"/>
          </prerequisites>
        </extensionService>
      </eventHandler>
   </extension>
Here is a example code from BuildProcessEventHandler class.

public class BuildProcessEventHandler extends AbstractService implements IChangeEventHandler {

    /*
     * (non-Javadoc) Intentionally not documented. See parent.
     */
    public void handleEvent(IChangeEvent event, IProcessConfigurationElement handlerConfiguration)
            throws TeamRepositoryException {

        if (BuildResultChangeEvent.BUILD_RESULT_CHANGED_EVENT_CATEGORY.equals(event.getCategory())) {
            IRepositoryItemService repoService = getService(IRepositoryItemService.class);
            IBuildResult buildResult = (IBuildResult) repoService.fetchItem(event.getItem(),
                    IBuildResult.PROPERTIES_COMPLETE);
            buildResult = (IBuildResult) buildResult.getWorkingCopy();
            buildResult.setTags(getClass().getSimpleName());
            ITeamBuildService teamBuildService = getService(ITeamBuildService.class);
            teamBuildService.save(buildResult);
        } else {
            throw new IllegalArgumentException("Why am I being invoked for a non-build event?"); //$NON-NLS-1$
        }
    }
}

Comments
Ralph Schoon commented Jan 14 '16, 3:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Thanks for sharing.

Your answer


Register or to post 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.