Quantcast
Channel: PTC Community: Message List - Windchill
Viewing all articles
Browse latest Browse all 8876

Re: Which event to listen for to catch a name change

$
0
0

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


Viewing all articles
Browse latest Browse all 8876

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>