Tuesday 22 May 2012

Reserved operation names

This is something which is well documented by Compuware, but which I always forget, and it always drives me a little insane trying to figure out what's going on!  


Uniface has some reserved (or "predefined") operation names...

  • init - executed when a component instance is created (newinstance or activate).
  • cleanup - executed when a component instance is removed (deleteinstance or exit or completion of <accept> or <quit>).
  • attach - executed when a contained DSP is attached to a parent DSP.
  • detach - executed when a child DSP is detached from its parent.
  • exec - executed when a component is activated (activate or run).
  • accept - executed when an "accept" request is invoked on the current component (<accept>).
  • quit - executed when a "quit" request is invoked on the current component (<quit>).


EDIT:  The following operation names have been reserved for future use...
  • abort
  • complete

This means that you cannot have an operation defined with this name in the operations (<oper>) trigger, unless you are using it for this purpose specifically.  If you do then this operation will be fired when you call it, and in the above situation as well.  

I had an AJAX operation on a SVC called "init" which I simply could not figure out why it was firing twice.  In this case, it was firing once as the form was being activated (by calling the operation) and then again because I had called the operation.  This baffled me for some time!

Summary: Do not accidently use reserved operation names for your operations, or you may get some unexpected behaviour!

No comments:

Post a Comment