@Tracked(value=TRACE) public abstract class ObjectAdapterActivity extends DefaultActivityImpl implements com.centurylink.mdw.activity.types.AdapterActivity, com.centurylink.mdw.adapter.AdapterInvocationError
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
DO_LOGGING |
protected static java.lang.String |
REQUEST_VARIABLE |
protected static java.lang.String |
RESPONSE_VARIABLE |
| Constructor and Description |
|---|
ObjectAdapterActivity() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
closeConnection(java.lang.Object connection)
Close a connection opened.
|
com.centurylink.mdw.model.Response |
directInvoke(com.centurylink.mdw.model.workflow.ActivityRuntimeContext runtimeContext,
java.lang.Object request)
This method is used for directly invoke the adapter activity
from code, rather than as part of process execution flow.
|
protected boolean |
doLogging()
Determines if external requests/responses should
be logged into adapter instance table.
|
void |
execute()
Subclasses do not have to but may override this method.
|
protected void |
executePostScript(java.lang.Object response) |
protected java.lang.Object |
executePreScript(java.lang.Object request) |
protected java.lang.String |
externalRequestToString(java.lang.Object requestData)
This method is used to serialize external system requests for
logging purpose.
|
protected java.lang.Object |
externalResponseFromString(java.lang.String stringData)
This is used when the adapter is asynchronous but
the protocol is synchronous, where response data is
logged in adapter instance table.
|
protected java.lang.String |
externalResponseToString(java.lang.Object responseData)
This method is used to serialize external system responses for
logging purpose.
|
java.lang.String |
getAdapterInvocationErrorMessage()
This method allows the concrete adapters to define whatever they need for
a decent error message.
|
protected java.lang.String |
getPostScript() |
protected java.util.Map<java.lang.String,java.lang.Object> |
getPostScriptBindings(java.lang.Object response)
Extra bindings for post-script beyond process variable values.
|
protected java.lang.String |
getPreScript() |
protected java.util.Map<java.lang.String,java.lang.Object> |
getPreScriptBindings(java.lang.Object request)
Extra bindings for pre-script beyond process variable values.
|
protected java.lang.Object |
getRequestData()
Override this method if need to translate data from variable
or need to get data elsewhere.
|
protected com.centurylink.mdw.model.Response |
getResponse(java.lang.Object connection,
java.lang.Object responseObject)
Override to set protocol response status/message.
|
protected com.centurylink.mdw.model.Response |
getStubbedResponse(java.lang.Object requestObject)
Return stubbed response from external system.
|
protected com.centurylink.mdw.model.event.AdapterStubRequest |
getStubRequest(java.lang.String requestContent) |
protected java.lang.String |
getStubResponse(java.lang.String requestData)
Deprecated.
|
protected void |
handleAdapterFailure(int pErrorCode,
java.lang.Throwable pErrorCause)
The method is invoked when the requests failed to send
or the response is not received from external systems
(for protocols where responses are expected).
|
protected void |
handleAdapterInvocationError(java.lang.Throwable errorCause)
This method should not normally be overriden.
|
protected void |
handleAdapterSuccess(java.lang.Object pResponse)
The method is invoked when the external system interaction is a success.
|
protected abstract java.lang.Object |
invoke(java.lang.Object pConnection,
java.lang.Object request)
This method must be implemented to perform the
real invocation of external system service.
|
protected boolean |
isStubMode() |
abstract boolean |
isSynchronous()
Determine if the adapter itself is synchronous, i.e.
|
protected java.lang.Long |
logRequest(com.centurylink.mdw.model.request.Request request) |
protected java.lang.Long |
logRequest(java.lang.String message)
Deprecated.
|
protected java.lang.Long |
logResponse(com.centurylink.mdw.model.Response response) |
protected java.lang.Long |
logResponse(java.lang.String message)
Deprecated.
|
protected abstract java.lang.Object |
openConnection()
Open a connection to the external system.
|
executecloseDatabaseAccess, createDocument, createDocument, createDocument, createDocument, doCompatibilityCodeSubstitutions, evaluateExpression, executeScript, getActivityId, getActivityInstance, getActivityInstanceId, getActivityName, getAsset, getAttribute, getAttribute, getAttribute, getAttribute, getAttributes, getAttributeValue, getAttributeValueAsVariableName, getAttributeValueSmart, getDocument, getDocumentContent, getDocumentForUpdate, getEngine, getEntryCode, getExternalEventInstanceDetails, getMainProcessDefinition, getMasterRequestId, getOutputDocuments, getPackage, getParameterId, getParameters, getParameterStringValue, getParameterType, getParameterValue, getParameterValue, getParentProcessId, getPerformanceLevel, getProcessDefinition, getProcessId, getProcessInstance, getProcessInstanceId, getProcessInstanceOwner, getProcessInstanceOwnerId, getProperty, getRequiredAttribute, getRequiredVariableValue, getReturnCode, getReturnMessage, getRuntimeContext, getScriptEvaluator, getScriptExecClassName, getScriptExecutor, getValue, getValueSmart, getVariableInstance, getVariableValue, getVariableValueSmart, getWorkTransitionInstanceId, initialize, isDisabled, isLogDebugEnabled, isLogInfoEnabled, isOutputDocument, lockActivityInstance, lockProcessInstance, logdebug, logexception, loginfo, logsevere, logtag, logwarn, openDatabaseAccess, prepare, setOutputDocuments, setParameterValue, setParameterValue, setParameterValueAsDocument, setParameterValues, setProcessInstanceCompletionCode, setReturnCode, setReturnMessage, setValue, setVariableValue, setVariableValue, startTransaction, stopTransaction, translatePlaceHolder, updateDocumentContent, updateDocumentInfo, updateDocumentInfo, valueIsJavaExpression, valueIsVariableprotected static final java.lang.String DO_LOGGING
protected static final java.lang.String REQUEST_VARIABLE
protected static final java.lang.String RESPONSE_VARIABLE
public void execute()
throws com.centurylink.mdw.activity.ActivityException
execute in interface com.centurylink.mdw.activity.types.GeneralActivityexecute in class DefaultActivityImplcom.centurylink.mdw.activity.ActivityExceptionprotected com.centurylink.mdw.model.event.AdapterStubRequest getStubRequest(java.lang.String requestContent)
throws com.centurylink.mdw.connector.adapter.AdapterException
com.centurylink.mdw.connector.adapter.AdapterExceptionprotected boolean doLogging()
protected void handleAdapterSuccess(java.lang.Object pResponse)
throws com.centurylink.mdw.activity.ActivityException,
com.centurylink.mdw.connector.adapter.ConnectionException,
com.centurylink.mdw.connector.adapter.AdapterException
pResponse, - from the external systemcom.centurylink.mdw.activity.ActivityException - thrown when the handler itself has system problemscom.centurylink.mdw.connector.adapter.AdapterException - thrown when the external system responded but
the response needs to be handled as an error (for retry or fail the activity)com.centurylink.mdw.translator.TranslationException - if the response cannot be translated correctly. This
is a RuntimeExceptioncom.centurylink.mdw.connector.adapter.ConnectionExceptionprotected void handleAdapterFailure(int pErrorCode,
java.lang.Throwable pErrorCause)
throws com.centurylink.mdw.activity.ActivityException
pErrorCause - the exception capturedpErrorCode - if the exception contains non-zero error code,
it is passed in here. Otherwise it is set to
either AdapterActivityBase.APPLICATION_ERROR
or AdapterActivityBase.SYSTEM_ERRORcom.centurylink.mdw.activity.ActivityExceptionprotected java.lang.Object getRequestData()
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityException - when the attribute cannot be
fetched for any reasoncom.centurylink.mdw.translator.TranslationException - if the request cannot be translated correctly. This
is a RuntimeExceptionprotected void handleAdapterInvocationError(java.lang.Throwable errorCause)
throws com.centurylink.mdw.activity.ActivityException
errorCause - com.centurylink.mdw.activity.ActivityExceptionpublic java.lang.String getAdapterInvocationErrorMessage()
This method allows the concrete adapters to define whatever they need for a decent error message. For instance they can include endpoint urls etc
getAdapterInvocationErrorMessage in interface com.centurylink.mdw.adapter.AdapterInvocationErrorprotected java.lang.Long logRequest(com.centurylink.mdw.model.request.Request request)
@Deprecated protected java.lang.Long logRequest(java.lang.String message)
protected java.lang.Long logResponse(com.centurylink.mdw.model.Response response)
@Deprecated protected java.lang.Long logResponse(java.lang.String message)
protected java.lang.String externalRequestToString(java.lang.Object requestData)
requestData - data for going to external systemprotected java.lang.String externalResponseToString(java.lang.Object responseData)
responseData - data directly from the external systemprotected java.lang.Object externalResponseFromString(java.lang.String stringData)
stringData - @Deprecated protected java.lang.String getStubResponse(java.lang.String requestData)
getStubbedResponseprotected com.centurylink.mdw.model.Response getStubbedResponse(java.lang.Object requestObject)
public abstract boolean isSynchronous()
isSynchronous in interface com.centurylink.mdw.activity.types.AdapterActivityprotected abstract java.lang.Object invoke(java.lang.Object pConnection,
java.lang.Object request)
throws com.centurylink.mdw.connector.adapter.AdapterException,
com.centurylink.mdw.connector.adapter.ConnectionException
pConnection - request - com.centurylink.mdw.connector.adapter.AdapterException - Adapter exception may or
may not be retriable, which you can set in the
exception itself. Default is not retriable.com.centurylink.mdw.connector.adapter.ConnectionException - certain protocol may also
throw ConnectionException here. ConnectionException
can be retried.protected com.centurylink.mdw.model.Response getResponse(java.lang.Object connection,
java.lang.Object responseObject)
throws java.io.IOException
java.io.IOExceptionprotected abstract java.lang.Object openConnection()
throws com.centurylink.mdw.connector.adapter.ConnectionException,
com.centurylink.mdw.connector.adapter.AdapterException
com.centurylink.mdw.connector.adapter.ConnectionException - retriable connection failurecom.centurylink.mdw.connector.adapter.AdapterException - non-retriable connection failureprotected abstract void closeConnection(java.lang.Object connection)
connection - public com.centurylink.mdw.model.Response directInvoke(com.centurylink.mdw.model.workflow.ActivityRuntimeContext runtimeContext,
java.lang.Object request)
throws com.centurylink.mdw.connector.adapter.AdapterException,
com.centurylink.mdw.connector.adapter.ConnectionException
request - request messagecom.centurylink.mdw.connector.adapter.AdapterExceptioncom.centurylink.mdw.connector.adapter.ConnectionExceptionprotected boolean isStubMode()
protected java.lang.Object executePreScript(java.lang.Object request)
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionprotected void executePostScript(java.lang.Object response)
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionprotected java.util.Map<java.lang.String,java.lang.Object> getPreScriptBindings(java.lang.Object request)
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionprotected java.util.Map<java.lang.String,java.lang.Object> getPostScriptBindings(java.lang.Object response)
throws com.centurylink.mdw.activity.ActivityException
com.centurylink.mdw.activity.ActivityExceptionprotected java.lang.String getPreScript()
protected java.lang.String getPostScript()