public interface ExceptionHandlerService
extends com.appiancorp.services.ContextSensitiveService
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.
Modifier and Type | Field and Description |
---|---|
static boolean |
getAllExceptionTypes$UPDATES |
static boolean |
getExceptionType$UPDATES |
static boolean |
getExceptionTypes$UPDATES |
static boolean |
raiseException$UPDATES |
static boolean |
raiseExceptionMessage$UPDATES |
static boolean |
registerExceptionTypesWithNotes$UPDATES |
Modifier and Type | Method and Description |
---|---|
ResultPage |
getAllExceptionTypes(int startIndex_,
int batchSize_,
java.lang.Integer sortProperty_,
java.lang.Integer sortOrder_)
Get all the
ProcessExceptionType objects, paging. |
ProcessExceptionType |
getExceptionType(java.lang.String exceptionTypeLocalId_)
Get the
ProcessExceptionType from its unique id. |
ProcessExceptionType[] |
getExceptionTypes(java.lang.String[] exceptionTypeLocalIds_)
Get the
ProcessExceptionType objects from their unique ids. |
void |
raiseException(java.lang.String exceptionTypeLocalId_,
java.lang.Long id_)
Raise an exception on a task or process.
|
void |
raiseExceptionMessage(java.lang.String exceptionTypeLocalId_,
java.lang.Long id_,
java.lang.String message_)
Raise an exception on a task or process.
|
void |
registerExceptionTypesWithNotes(ProcessExceptionType[] exceptionTypes_,
java.lang.String[] content_)
Register exception types, and the note content for those exception types.
|
static final boolean getExceptionType$UPDATES
static final boolean getExceptionTypes$UPDATES
static final boolean getAllExceptionTypes$UPDATES
static final boolean raiseException$UPDATES
static final boolean raiseExceptionMessage$UPDATES
static final boolean registerExceptionTypesWithNotes$UPDATES
ProcessExceptionType getExceptionType(java.lang.String exceptionTypeLocalId_) throws InvalidExceptionTypeException
ProcessExceptionType
from its unique id.exceptionTypeLocalId_
- The localId of the
ProcessExceptionType
to get.ProcessExceptionType
associated with
the passed id.InvalidExceptionTypeException
- if no
ProcessExceptionType
with the passed id exists.ServiceException
- if any system-level error occursProcessExceptionType[] getExceptionTypes(java.lang.String[] exceptionTypeLocalIds_) throws InvalidExceptionTypeException
ProcessExceptionType
objects from their unique ids.exceptionTypeLocalIds_
- The localIds of the
ProcessExceptionType
objects to get.ProcessExceptionType
objects associated
with the passed ids.InvalidExceptionTypeException
- Thrown if no exception type
with the passed id exists.ServiceException
- if any system-level error occursResultPage getAllExceptionTypes(int startIndex_, int batchSize_, java.lang.Integer sortProperty_, java.lang.Integer sortOrder_)
ProcessExceptionType
objects, paging.startIndex_
- The index into the collection of total results at which to start.
Negative numbers are treated as zeros.batchSize_
- The number of results to return.
use Constants.COUNT_ALL
to return the entire collection, but this is STRONGLY discouraged.sortProperty_
- The property by which the results will be sorted.
This will be one of the SORT_BY_XXX
constants in
ProcessExceptionType
sortOrder_
- The order in which to sort the results.
This is one of
Constants.SORT_ORDER_ASCENDING
or
Constants.SORT_ORDER_DESCENDING
ServiceException
- if any system-level error occursvoid raiseException(java.lang.String exceptionTypeLocalId_, java.lang.Long id_) throws InvalidExceptionTypeException, java.lang.IllegalArgumentException, InvalidProcessException, InvalidActivityException, PrivilegeException
exceptionTypeLocalId_
- The localId of the exception type to raise.id_
- The id of the process or task for which the
exception should be raised.InvalidExceptionTypeException
- if no exception type
with the passed local id exists.java.lang.IllegalArgumentException
- if the task or process specified by
id_
does not existInvalidProcessException
- if no process with the
passed id exists.InvalidActivityException
- if no task with the passed
id exists.PrivilegeException
- if the user does not have sufficient permissions
to execute this method.ServiceException
- if any system-level error occursvoid raiseExceptionMessage(java.lang.String exceptionTypeLocalId_, java.lang.Long id_, java.lang.String message_) throws InvalidExceptionTypeException, java.lang.IllegalArgumentException, InvalidProcessException, InvalidActivityException, PrivilegeException
exceptionTypeLocalId_
- The localId of the exception type to raise.id_
- The id of the process or task for which the
exception should be raised.message_
- A custom message to show the userInvalidExceptionTypeException
- if no exception type
with the passed local id exists.java.lang.IllegalArgumentException
- if the task or process specified by
id_
does not existInvalidProcessException
- if no process with the
passed id exists.InvalidActivityException
- if no task with the passed
id exists.PrivilegeException
- if the user does not have sufficient permissions
to execute this method.ServiceException
- if any system-level error occursvoid registerExceptionTypesWithNotes(ProcessExceptionType[] exceptionTypes_, java.lang.String[] content_) throws PrivilegeException, AppianException
localId
. The noteId
field will be ignored.
Note that there is NO need to separately write the note content to disk
using NotesContentService.createNoteContent(java.lang.String, java.lang.String)
- this will be handled
automatically.exceptionTypes_
- the exception types to be registeredcontent_
- the content of the notes associated with the respective
exception types. The length of this array must be the same as the length
of exceptionTypes_
PrivilegeException
- if the user does not have sufficient permissions to
execute this method. A user can call this method successfully if
com.appiancorp.suiteapi.process.security.ProcessPermissions#registerExceptionType
returns true
for the user.ServiceException
- if any system-level error occursAppianException
Copyright © 2003-2024 Appian Corporation. All Rights Reserved.