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.

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

20.10 %OnRollBack<br />

This instance method is called by the %Save method if an object cannot be saved. This<br />

method holds code that performs rollback-related actions on objects other than the one being<br />

rolled back. At the time when this method is invoked, the state of the object may be inconsistent<br />

with other objects; you can use %OnRollBack to correct this condition.<br />

Its syntax is:<br />

ReturnValue %OnRollBack()<br />

where:<br />

ReturnValue<br />

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

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

20.11 %OnValidateObject<br />

This instance method is called by the %ValidateObject method just after all validation has<br />

occurred. This allows you to perform content-dependent validation, such as where valid values<br />

for one property vary according to the value of another property.<br />

Its syntax is:<br />

ReturnValue %OnValidateObject()<br />

where:<br />

ReturnValue<br />

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

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

176 <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!