Interface ExceptionHandlerService

All Superinterfaces:
com.appiancorp.services.ContextSensitiveService, Service

public interface ExceptionHandlerService extends com.appiancorp.services.ContextSensitiveService
Provides methods relating to process exception handling.

Process exception handling is used for raising exceptions on processes or tasks when something goes wrong so that particular users (identified by their role for the process or task) can be notified of the problem and given a recommended course of action.

All exception types must first be registered using registerExceptionTypesWithNotes(com.appiancorp.suiteapi.process.ProcessExceptionType[], java.lang.String[]). See ProcessExceptionType for more information on how to configure a ProcessExceptionType before registering it.

Once an exception type has been registered it can be raised using raiseException(String, Long) or raiseExceptionMessage(String, Long, String) to raise an exception with a non-default message. After an exception has been raised on a process or a task (either by the process engine or by manually calling raiseException), the exception will be resolved as soon as the state of the process or task becomes anything other than ProcessSummary.STATE_PAUSED_BY_EXCEPTION or TaskSummary.TASK_STATUS_PAUSED_BY_EXCEPTION respectively.

Methods of service classes can all throw the unchecked exception ServiceException if any system-level error (for example, server failure) occurs, and will in general throw a checked exception (InvalidXXXException) when an entity to be retrieved is inaccessible, instead of returning null. Exceptions to this paradigm (including the use of ResultList as described below) are noted. All checked exceptions extend AppianException.

It may be necessary to retrieve a subset of results as opposed to an entire collection, and also to sort the subset by some property of the returned object. "Paging" methods which return a ResultPage are provided in certain instances for this purpose. The ResultPage will contain the sorted subset of results (via Result.getResults()), and the total number of items in the available result set (via ResultPage.getAvailableItems()).

It may also be necessary to retrieve some results, even if all results cannot be retrieved (for instance, some of the entities corresponding to a list of entity IDs may no longer exist). Methods which return a ResultList are provided for this purpose. The Result.getResults() method in this case will return all results which can be retrieved. In addition, there will be a list of result codes (ResultList.getResultCodes()) that represent the successful retrieval of an entity, or, if the entity could not be retrieved, the reason for the failure. See the CODE_XXX constants in ResultList for details.

See Also: