Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hello!
I have a listener in Windchill and have figured out how to catch 2 of of 3 events when it comes to rename in Windchill 10 M030.
To catch a change of filename aka CADName I listen for:
EPMDocumentManagerEvent.PRE_CHANGE_CAD_NAME
To catch a change of NUMBER I listen for:
IdentityServiceEvent.PRE_CHANGE_IDENTITY
However to listen for a change of NAME I'm stuck.
Does anyone have an idea what to look for?
It looks as if I can obtain this using:
PersistenceManagerEvent.POST_STORE
But I believe this is a little late in the chain since I plan to stop the transaction if some criteria are met and that would probably result in a rollback.
Any help is appreciated!
Best regards,
Peter
Solved! Go to Solution.
Hello!
Since no one seems to know I will answer this myself.
I have found out that I can listen for PersistenceManagerEvent.INSERT events and obtain the information I need according to below:
if (event instanceof PersistenceManagerEvent) {
PersistenceManagerEvent pme = (PersistenceManagerEvent) event;
Object target = pme.getEventTarget();
if (target instanceof IdentityChangeHistory) {
IdentityChangeHistory ich = (IdentityChangeHistory) target;
String attributeName = ich.getAttributeName();
if (attributeName.equals("name")) {
ObjectReference or = ich.getObject();
Persistable p = or.getObject();
if (p instanceof EPMDocumentMaster) {
EPMDocumentMaster master = (EPMDocumentMaster) p;
String newValue = ich.getNewValue();
String oldValue = ich.getOldValue();
}
}
}
}
It seems it is possible to check for number and filename using this event as well.
Cheers!
/Peter
Hello!
Since no one seems to know I will answer this myself.
I have found out that I can listen for PersistenceManagerEvent.INSERT events and obtain the information I need according to below:
if (event instanceof PersistenceManagerEvent) {
PersistenceManagerEvent pme = (PersistenceManagerEvent) event;
Object target = pme.getEventTarget();
if (target instanceof IdentityChangeHistory) {
IdentityChangeHistory ich = (IdentityChangeHistory) target;
String attributeName = ich.getAttributeName();
if (attributeName.equals("name")) {
ObjectReference or = ich.getObject();
Persistable p = or.getObject();
if (p instanceof EPMDocumentMaster) {
EPMDocumentMaster master = (EPMDocumentMaster) p;
String newValue = ich.getNewValue();
String oldValue = ich.getOldValue();
}
}
}
}
It seems it is possible to check for number and filename using this event as well.
Cheers!
/Peter
Thanks Peter really useful information.
thank you for the information, can you share the full code plz?