If your plugin is passed a TransactionResult object, it may have been passed by one of the following events:
For these events, you attach an Error object to the transaction result, in order to describe the error using addError(). Other objects that it would be appropriate to attach are the GenericError class and its subclasses.
For more information, see the com.oracle.determinations.interview.engine.data.error package in the Determinations Interview Engine API documentation.
Other events and plugins aren't passed a TransactionResult, so in those cases, an Exception object must be thrown instead. In this case, the PluginException class and its subclasses are appropriate exceptions to be raised.
See the com.oracle.determinations.interview.engine.exceptions package in the Determinations Interview Engine API documentation.
Messages need to be localized when they are intended for users that speak different languages. Error messages from events and plugins can be localized in a manner similar to that in which rulebases are localized.
The best way to localize an error message is to supply a message code, which is then looked up within messages.XX.properties to supply the localized message. The XX here refers to the user's locale.
Web Determinations will determine whether the error object implements CodedMessage. Both GenericError and PluginException implement this interface. If this is the case, it will retrieve a message code from the getMessageCode() method. If this message code can be found in its messages.XX.properties file, then it is done.
Otherwise, it will look at the class name of the error, and look that up in messages.XX.properties. If it cannot find the class name, it will recursively search for superclass names until a matching name can be found. If no name can be resolved, it will use the message provided in the GenericErrorMessage template.
Parameters are passed in the Error or Exception object by way of getter methods; for example, UnknownAttributeError provides the getAttributeId() and getEntityInstanceIdentifier() methods. Because the message text is interpreted by Web Determinations's templating engine, these can be interpreted within the message text.
As an example, for UnknownAttributeError, the line in the English localization property file reads:
Can not find attribute '${message.getAttributeId()}' in entity '${message.getEntityInstanceIdentifier().getEntityId()}'.
The getAttributeId() call accesses the Error or Exception object to provide the actual Attribute ID that failed to load. If you want to pass additional parameters, the best way is to subclass the appropriate error object, and include getter methods for the parameters you want to pass. These can be called from the template supplied in messages.XX.properties.
An exception must be thrown.
getCommentaryURL() and getCommentaryContent() can throw PluginException or subclasses.
Other methods should only return boolean values; that is, hasCommentary(), isCommentaryEnabled(), isCommentaryRedirect().
See the examples\interview-engine\derby-commentary example in Interview Engine customizations.
An exception must be thrown.
listCases(), load(), and save() can throw PluginException or subclasses.
One other method should only return a boolean; that is, dataAdaptorProvidesCaseID().
See the examples\interview-engine\data-adaptor example in Interview Engine customizations.
An exception must be thrown.
getListOptions() can throw PluginException or subclasses.
See the examples\interview-engine\list-provider examples in Interview Engine customizations.
An exception must be thrown
generateDocument() can throw PluginException or subclasses.
See the examples\interview-engine\document-generator example in Interview Engine customizations.
Provides a TransactionResult.
handleEvent() can attach GenericError and subclasses to the provided TransactionResult.
See the examples\interview-engine\custom-control-validator example in Interview Engine customizations.
Provides a TransactionResult.
handleEvent() can attach GenericError and subclasses to the provided TransactionResult.
See the examples\interview-engine\custom-screen-validator example in Interview Engine customizations.
An exception must be thrown
mapValues(), extractValue(), getDisplayValue(), getValue(), getListDisplayForValue() can throw PluginException or subclasses.
See the examples\web-determinations\custom-control and examples\web-determinations\calendar-date-control examples in Web Determinations customizations.
An exception must be thrown
processAndRespond() and submit() can throw PluginException or subclasses.
See the examples\web-determinations\custom-screen example in Web Determinations customizations.
An exception must be thrown
parse() and getFormattedValue() can throw PluginException or subclasses.
See the examples\web-determinations\custom-formatter example in Web Determinations customizations.
An exception must be thrown
handleEvent() can throw PluginException or subclasses.
See the examples\web-determinations\auto-save example in Web Determinations customizations.
An exception must be thrown.
handleEvent() can throw PluginException or subclasses.
See the examples\web-determinations\auto-save example in Web Determinations customizations.