如何捕获WTObject的修订事件? [英] How to capture revision event of WTObject?
问题描述
我正在使用Windchill 10.0 M030.我创建了一个Windchill服务,该服务捕获了一些操作.我已经完成了捕获删除,签入和状态更改事件的工作,但是我不知道如何捕获对象的修订事件.有人可以帮我吗?
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);
}
}
是否有其他单独的事件(例如Revise事件)以这种方式捕获?我该怎么办?
Is there any separate event like Revise event to be captured in this way? How can I do that?
谢谢.
推荐答案
以下是您的ListenerAdapter的代码:
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;
}
此新服务需要在wt.properties中注册.有关如何注册的更多详细信息,请参见定制程序指南(使用xconfmanager命令行实用程序)
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)
这篇关于如何捕获WTObject的修订事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!