Q:

How to capture revision event of WTObject?

I am using Windchill 10.0 M030. I have created a windchill service that captures some actions. I am done with capturing the delete, checkin, and state change events, but I don't know how to capture the revision event of an object. Can someone help me out?
Some example code snippets would be helpful. The events that are working fine are the following:
public void notifyEvent(KeyedEvent event) throws RemoteException,
            WTException {

        if (event instanceof PersistenceManagerEvent) {
            notifyEvent((PersistenceManagerEvent) event);
        }
        if (event instanceof WorkInProgressServiceEvent) {
            notifyEvent((WorkInProgressServiceEvent) event);
        }
        if (event instanceof EPMWorkspaceManagerEvent) {
            notifyEvent((EPMWorkspaceManagerEvent) event);
        }

        if (event instanceof LifeCycleServiceEvent) {
            notifyEvent((LifeCycleServiceEvent) event);
        }
    }

Is there any separate event like Revise event to be captured in this way? How can I do that?
Thank you.

A:

Here is the code for your ListenerAdapter :
public class VersionEventListenerAdapter extends ServiceEventListenerAdapter {

public VersionEventListenerAdapter(String serviceId) {
    super(serviceId);
}

public void notifyVetoableEvent(Object event) throws WTException, WTPropertyVetoException {
    if (!(event instanceof KeyedEvent)) {
        return;
    }

    Object target = ((KeyedEvent) event).getEventTarget();
    Object eventType = ((KeyedEvent) event).getEventType();

    if (eventType.equals(VersionControlServiceEvent.NEW_VERSION)
    {
       /** Call your business code here 
           example : yourMethod(target);
        **/
    }
}

And then the service to register the listener
public class MyStandardListenerService extends StandardManager implements MyListenerServiceInterface {

private static final long serialVersionUID = 1L;

protected synchronized void performStartupProcess() throws ManagerException {

    VersionEventListenerAdapter versionEventListenerAdapter = new VersionEventListenerAdapter(getName());
    getManagerService().addEventListener(versionEventListenerAdapter, VersionControlServiceEvent.generateEventKey(VersionControlServiceEvent.NEW_VERSION));

}

public static MyStandardListenerService newMyStandardListenerService() throws WTException {
    MyStandardListenerService instance = new MyStandardListenerService();
    instance.initialize();
    return instance;
}

This new service need to be registered in the wt.properties. See the customizer's guide for more details about how to register it (with xconfmanager command line utility)

