25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Using</strong> Callback Methods<br />

20.6 %OnDelete<br />

This class method is called by the %Delete method just before an object is deleted. This<br />

method can be used to ensure that deleting an object does corrupt data integrity, such as by<br />

ensuring that an object designed to contain other objects is only deleted when it is empty.<br />

Its syntax is:<br />

ReturnValue %OnDelete(OID AS %ObjectIdentity)<br />

where:<br />

ReturnValue<br />

OID<br />

A %Status code, where an error code stops the deletion.<br />

An object identifier for the object being deleted.<br />

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

20.7 %OnDetermineClass<br />

This class method is called by the %Delete, %Oid, and %Open methods when one of these<br />

receives a partially-formed OID as an argument. The purpose of %OnDetermineClass is to<br />

supply a class name to its calling method.<br />

Its syntax is:<br />

ReturnValue %OnDetermineClass(OID As %ObjectIdentity, ByRef Class As<br />

%String)<br />

where:<br />

ReturnValue<br />

OID<br />

Class<br />

A %Status code, where behavior depends on the calling routine. If<br />

invoked by %Open, the attempt to open the object fails, no OREF is<br />

returned, and the error status is passed back to the caller. If invoked<br />

by %Delete, the attempt to delete the object fails.<br />

The instance with the partially-formed name<br />

A string in which the name of the instance's class is placed.<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!