I'm not going to start you off with some waste-of-time "Hello World!" app. We are going to go straight into making useful code. Creating a listener gives you the ability to automate actions. Let's say you wanted to kickoff another piece of code whenever a user created a new revision. You could either write something that queries for new revisions every so often (boring) or make a listener to runs that code on the fly. Let's create our first listener! Reference link: Java Docs: Note: This goes for all code on this site. I am just giving you the quickest path from point A to B. It is up to you to fully build out the rest of the code i.e. error handling, unit testing, logging, etc. Don't let that scare you away. You aren't building some major app here. I am just trying to make you aware that what I give you might work in some instances but not others. You must problem solve to figure out how to tweak it to make it reliable and safe. Code the Listener in Java
WTDocumentListenerAdapter.java
WTDocumentListenerService.java
StandardWTDocumentListenerService.java
Register the Listener with WindchillWe need to register the new service with Windchill so that it will be useable.
myservice.xconf
myservice-wt.properties.xconf
Testing the Listener
Next StepsYou now have an automated way of triggering custom code. Try figuring out the other event types like check out, check in, lifecycle state change, rename, etc. Try setting up listeners for CAD and WTParts. This is where you find out if this is for you.
Once you have your super listener created, you are ready for Part 3.
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorErick Johnson Archives
May 2024
Categories
All
|