25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

%OnAfterSave<br />

ReturnValue<br />

SaveDepth<br />

Insert<br />

CallCount<br />

A %Status code, where an error code causes the save to fail and the<br />

transaction to be rolled back.<br />

An integer value passed in from %AddToSaveSet that represents<br />

the internal state of SaveSet construction. If you use<br />

%OnAddToSaveSet to add any other records to the SaveSet, pass<br />

this value to %AddToSaveSet without change.<br />

A flag indicating if the object being saved is being inserted into the<br />

extent (1) or that it is already part of the extent (0).<br />

The number of times that %OnAddToSaveSet has been called for<br />

this object. Due to the networked nature of object references it is<br />

possible that %AddToSaveSet can be invoked on the same object<br />

multiple times.<br />

You can update objects, create new objects, delete objects and ask objects to include themselves<br />

in the current SaveSet by calling %AddToSaveSet. If you modify the current instance<br />

or any of its descendants, you must let the system know that you have done this by calling<br />

%AddToSaveSet for the modified instance(s) and passing a value of 1 for the method's<br />

Refresh argument.<br />

None of the modification restrictions imposed on %OnAfterSave, %OnBeforeSave, or<br />

%OnValidateObject are in place for %OnAddToSaveSet.<br />

If you delete an object using %OnAddToSaveSet, you need to call %RemoveFromSaveSet<br />

to clean up any dangling references to it.<br />

This method is available to the %Library.RegisteredObject class and its subclasses.<br />

20.2 %OnAfterSave<br />

This instance method is called by the %Save method just after an object is saved. This method<br />

allows you to perform actions outside the scope of the object being saved, such as queueing<br />

a later notification action; an example of this is a bank using the deposit in excess of a certain<br />

amount to cause it to send the customer an explanation of its deposit policies.<br />

Its syntax is:<br />

ReturnValue %OnAfterSave(Insert as Boolean)<br />

where:<br />

<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 171

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!