≡ Menu

Ninja Updates: Make Modifications Without Leaving a Trace

Share the knowledge

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.

Warning

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?

  • http://www.facebook.com/mahadevant Mahadevan Thiagarajan

    Yes, this mode has been there for a long long time. Typical use case, When the Product Upgrade happens, new attributes gets added and gets populated with default values, and you do not want the dates (upgrade date )& last modifying user to be “infodba”.

  • Ralf Lammert

    Nice, I haven’t known yet about this ninja mode. The ninja mode I used in the past was named SQL. 😉

    • http://plmdojo.com/ Scott Pigman

      I’ve used SQL for reporting and analysis, but I’ve not dared use it for updates. That’s definitely off in the realm of unsupported operations.

  • Jagatheeswaran

    how to do the same think using Java RAC

Optimization WordPress Plugins & Solutions by W3 EDGE