public abstract class AppianSmartService
extends java.lang.Object
Input parameters are defined by using Java bean setters, with an optional getter.
Output parameters are defined by using a Java bean getter, without an explicit setter.
The name of the input/output parameter is defined as either the name of the bean, or the value
of the @Name
annotation. Additional options, such as required-ness, can be
overridden using the @Input
annotation.
When the smart service is executed, the implementation in the run
method will be executed.
Sub-classes must only provide one constructor; that constructor can take any combination of Appian services,
as well as SmartServiceContext
.
Name
,
Input
,
PaletteInfo
,
SmartServiceContext
Constructor and Description |
---|
AppianSmartService() |
Modifier and Type | Method and Description |
---|---|
java.util.List<NamedTypedValue> |
getDynamicOutputs()
Deprecated.
It is not possible to create a node output dynamically at design time.
|
java.lang.Long |
getProcessIdStartedFrom() |
void |
onSave(MessageContainer messages)
Invoked when an attended form is saved.
|
abstract void |
run()
Override this method to provide the main logic for the custom smart service.
|
void |
setDynamicInputs(java.util.List<? extends NamedTypedValue> inputs)
Dynamic inputs, those added by the designer using the New Node Input functionality in the UI, can be used by the
smart service by overriding the
setDynamicInputs method. |
void |
setProcessIdStartedFrom(java.lang.Long processIdStartedFrom) |
void |
validate(MessageContainer messages)
Override with custom validation logic to validate the inputs and any other pre-requisites to ensure a successful
completion of the smart service.
|
public void setDynamicInputs(java.util.List<? extends NamedTypedValue> inputs)
setDynamicInputs
method. The body of the method could, for instance, be
used to store the inputs into a member variable that can then be used in the body of the run implementation.inputs
- the inputs on the data tab of the node that were added by the model designer. This parameter is
populated by the process execution layer for classes that extend AppianSmartService.@Deprecated public java.util.List<NamedTypedValue> getDynamicOutputs()
run
method and added to the
runtime results by calling getDynamicOutputs().add()
. Any output added in this way must match the name of
a node output created dynamically at design time in order for the value to be available for output mapping.public void validate(MessageContainer messages)
run()
. If the logic of the
method adds any errors to the MessageContainer
, the node will fail to complete and the errors will be
displayed to the user (in the case of an attended node) or displayed in the alert (in the case of an unattended
node).messages
- the MessageContainer
that will hold the error messages displayed as the result of failed
validation. The parameter is provided by the process execution layer.onSave(com.appiancorp.suiteapi.process.framework.MessageContainer)
,
run()
public void onSave(MessageContainer messages)
validate
method, this method allows for logic to validate
inputs or other pre-requisites. Unlike validate
, this is only invoked on attended activities when the user
chooses to save the form instead of submitting it. Only override this method if there are strict reasons why a
form cannot be saved with invalid values in the inputs. From a usability perspective, it is preferable to allow
a user to save a form in an invalid state instead of preventing the save with validation messages.messages
- the MessageContainer
that will hold the error messages displayed as the result of failed
validation. The parameter is provided by the process execution layer.validate(com.appiancorp.suiteapi.process.framework.MessageContainer)
public abstract void run() throws SmartServiceException
run
method is invoked
when the node is executed, after calling all setters and the validate
method. Throw a
SmartServiceException in the body of your method to indicate that the smart service should fail to complete. Note:
no automatic cleanup will be conducted, so if your smart service changed the state of persisted data before
throwing the exception, that change will remain.SmartServiceException
SmartServiceException
public void setProcessIdStartedFrom(java.lang.Long processIdStartedFrom)
processIdStartedFrom
- public java.lang.Long getProcessIdStartedFrom()
Copyright © 2003-2024 Appian Corporation. All Rights Reserved.