Starting from my previous answer (here), you just need to test the status of the target object :
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))
{
//Check if the object is checkedOut
if (target instanceof Workable && WorkInProgressHelper.isCheckedOut((Workable)target) {
return;
}
/** Call your business code here
example : yourMethod(target);
**/
}
}