Sometimes you need to make changes to Teamcenter data without leaving any trace that you were there. A simple ITK program could do the update, but it will also change the Last Modified Date and Last Modifying User properties in the process. That is, unless you do the update in ninja mode and leave no trace behind.
When You Need to Be A Ninja
Sometimes there are valid reasons to make an update without updating the last modified date and user. For example, I recently wrote a short program to populate some new attributes with data from another system. Since the core data hasn’t actually changed — it’s only been synchronized with the external system — I didn’t want to change the last modifying user and date fields. Knowing who actually worked on something last, and when, is often useful information to have. It wouldn’t be very useful if all the data were suddenly updated to say that I had been the last person to work on it.
Not the Ninja Way
Now I know that those last-modified attributes are just fields that I can get and set with POM or AOM functions, so my original plan was to do something like:
# Pseudo-code -- not real function names! # store current values original_user = get_last_modifying_user() original_date = get_last_modified_date() # Updates last modifying user and date: fill_in_new_attributes() # Restore original values: set_last_modifying_user(original_user) set_last_modifying_date(original_date)
But then as I was perusing the documentation for the POM_ library I found a better way…
The Way of the Ninja
Here’s how to turn on Ninja mode:
POM_set_env_info(POM_bypass_attr_update, FALSE, 0, 0, 0, "")
POM_set_env_info can do a lot of things — so read the docs! — but the thing I was interested in was it’s ability to temporarily disable
updating last modifying user and last modify dates when instances are saved. And by golly, it worked.
I don’t think I need to spend any time describing how ninja mode could be horribly misused out of either ignorance or malice. And it can be particularly misused by someone with a DBA account who can turn on bypass mode. So be careful who gets those DBA accounts, ‘kay?