i
Pre/Post
When starting the modeler for a rule that uses the “Rest” type adapter, the area displayed is Pre/Post WS, and for a “JDBC” type rule is Pre/Post SQL.
Two required initial methods must be coded:
•protected void beforeExecutionRule() throws java.lang.Exception{}
It allows adding logic before the ApiRest service call or the JDBC invocation.
Example: An object can be read using the Deyel SDK and the result used as an input parameter in the JDBC invocation.
•protected void afterExecutionRule() throws java.lang.Exception{}
It allows adding logic after the ApiRest service call or the JDBC invocation.
Example: The result of the JDBC invocation can be received, processed, and saved in a form.
Additionally, in the “Rest” type rule, the following methods can be invoked:
Before Execution (beforeExecutionRule) |
After Execution (afterExecutionRule) |
---|---|
setBody(String body): Allows to define the body parameter of the request. |
String getBodyResponse(): Allows to get the body of the response. |
addHeader(String key, String value): Allows to add a heading to the request. |
Integer getHTTPStatus():Allows to get the HTTP state of the response. |
addQueryParam(String key, String value): Allows to add a parameter query to the request. |
List getHeadersResponse (); It allows to obtain a list of the headers of the HTTP request executed. This list is made up of objects of org.apache.http. header type. |
addValueToURL(String key, String value): Replaces the text indicated in the first parameter with the value of the second parameter in the url of the service to call. |
|