Use case Description

This use case outlines the procedure for retrieving data from relational tables in a database by executing a DB query within an Adeptia process flow. The retrieved information is then presented on a web form reflecting data from the past 30 days. This process includes establishing a REST provider endpoint that triggers the execution of the process flow incorporating the DB query.

Actors:

Preconditions:

Postconditions:

Steps:

1. Design Process flow

Overview

When the file queue page is accessed, the backend server performs specific steps to ensure that all relevant file queue data is accurately retrieved and displayed on the front end. There are three primary flows, each with a distinct purpose. Once designed, these flows need to be published for the REST provider.

Process Overview

When the file queue page is accessed, the backend server performs the following steps to ensure that all relevant file queue data is accurately retrieved and displayed on the front end. Here are three flows working and each flow has a purpose.

Once the flow has been designed, it must be published for the REST provider.

image-20240621-060942.png

a. Default Flow: Retrieve All File Information For the Last 30 days

image-20240722-085205.png

This process will extract all file information from the last 30 days.

image-20240620-113900.png
Process Steps

Step 1: Receive Request

Step 2: Query the Database

Step 3: Send Data to Frontend

image-20240620-113900.png

Process flow activity:

  1. Source Activity - The source comprises a database. It is necessary to create DbInfo and DbLayout to be invoked in the source activity

image-20240625-052511.png

You must utilize the EDIT Query option to efficiently retrieve attributes from multiple tables and display relevant information on the user interface. Additionally, you implement conditions to filter the data as needed.

image-20240621-073355.png

Table Name: DB/file_queueFQ/

SELECT FQ.ID,FQ.PARTNER_NAME,FQ.TRANSACTION_TYPE,FQ.FILE_REF_ID,FQ.PHASE,FQ.OVERALL_STATUS,FQ.ERROR_CODE,FQ.INCOMING_FILE_DATE,FQ.TOTAL_RECORDS,FQ.DUPLICATE_RECORDS,FQ.UNIQUE_RECORDS,FQ.GROUP_ID,FQ.V3_GROUP_ID,FQ.V3_PHASE,FQ.V3_STATUS,FQ.V3_TOTAL_RECORDS,FQ.V3_GOOD_RECORDS,FQ.V3_ERROR_RECORDS,FQ.V3_PASS_PERCENTAGE,FQ.V3_ERROR_MESSAGE,FQ.CORE_PHASE,FQ.CORE_STATUS,FQ.CORE_TOTAL_RECORDS,FQ.CORE_GOOD_RECORDS,FQ.CORE_ERROR_RECORDS,FQ.CORE_PASS_PERCENTAGE,FQ.CORE_ERROR_MESSAGE,FQ.CREATED_BY,FQ.LAST_MODIFIED_BY,FQ.LAST_MODIFIED_DATE,FND.FILE_NAME,FND.CREATED_DATE,ER.ERROR_MESSAGE,FQ.TRANSACTION_NAME FROM file_queue FQ LEFT JOIN file_name_details FND on FND.FILE_QUEUE_ID=FQ.ID LEFT JOIN error_code ER on FQ.ERROR_CODE=ER.ERROR_CODE

WHERE FND.FILE_TYPE='INPUT_FILE' and DATE_SUB(NOW(), INTERVAL 30 DAY) < FND.CREATED_DATE ORDER BY FQ.ID DESC

  1. Target Layout - The JSON schema for the target data (database) will be designed to be utilized in the RESTful API for the user interface. JSON is selected for its compatibility with RESTful APIs.

image-20240621-072506.png

  1. Mapping - You must load the database schema and the target schema (JSON) to finalize the mapping process.

image-20240621-072358.png
  1. Context Target Using ContextTarget to store data in the flow which will be carried by the REST provider.

image-20240621-072858.png

In the contextTarget, the variable name should strictly be "restResponse" to ensure the provider generates the desired output.

b.Search Flow: Search by Filename & Transaction Id

This flow process is for searching specific file information within the system. It enables how the user initiates the search, the interactions between the front end and back end, and the final display of the filtered results to the user.

image-20240722-085337.png

Process Overview

The search process for file information involves several key steps, starting from user initiation to the final display of search results. The following sections detail each step in the process.

Process Steps

Step 1: User Initiates Search

image-20240620-120055.png

Step 2: Frontend Sends Request

Step 3: Backend Searches File Queue Data

Step 4: Backend Returns Filtered Results

Step 5: Frontend Displays Results

Process flow activity:

  1. Gateway Activity: This condition retrieves a value based on user-provided search criteria through the UI's advanced search option. The code facilitates the retrieval of data according to the specified start_date

image-20240722-085645.png

Code Description :

Gateway Code

Description

String Query = context.get("start_date") == null ? "" : context.get("start_date");

if(Query!=null&&Query.length()>0)
{
return true;

}
else{
return false;
}

This code snippet performs the following actions:

  1. It initializes a string variable named Query.

    • If context.get("start_date") is null, Query is assigned an empty string ("").

    • If context.get("start_date") is not null, Query is assigned the value of context.get("start_date").

  2. It then checks if the Query variable is not null and has a length greater than 0.

    • If both conditions are true, the code returns true.

    • Otherwise, it returns false.

In summary, this code checks whether the start_date value from the context is non-null and non-empty. If it is, it returns true; otherwise, it returns false.

  1. Source Activity: The source comprises a database. It is necessary to create DbInfo and DbLayout to be invoked in the source activity

image-20240625-052511.png

You must utilize the EDIT Query option to efficiently retrieve attributes from multiple tables and display relevant information on the user interface. Additionally, you implement conditions to filter the data as needed.

image-20240625-053240.png

Table Name: DB/file_queueFQ/

SELECT FQ.ID,FQ.PARTNER_NAME,FQ.TRANSACTION_TYPE,FQ.FILE_REF_ID,FQ.PHASE,FQ.OVERALL_STATUS,FQ.ERROR_CODE,FQ.INCOMING_FILE_DATE,FQ.TOTAL_RECORDS,FQ.DUPLICATE_RECORDS,FQ.UNIQUE_RECORDS,FQ.GROUP_ID,FQ.V3_GROUP_ID,FQ.V3_PHASE,FQ.V3_STATUS,FQ.V3_TOTAL_RECORDS,FQ.V3_GOOD_RECORDS,FQ.V3_ERROR_RECORDS,FQ.V3_PASS_PERCENTAGE,FQ.V3_ERROR_MESSAGE,FQ.CORE_PHASE,FQ.CORE_STATUS,FQ.CORE_TOTAL_RECORDS,FQ.CORE_GOOD_RECORDS,FQ.CORE_ERROR_RECORDS,FQ.CORE_PASS_PERCENTAGE,FQ.CORE_ERROR_MESSAGE,FQ.CREATED_BY,FQ.LAST_MODIFIED_BY,FQ.LAST_MODIFIED_DATE,FND.FILE_NAME,FND.CREATED_DATE,ER.ERROR_MESSAGE,FQ.TRANSACTION_NAME FROM file_queue FQ LEFT JOIN file_name_details FND on FND.FILE_QUEUE_ID=FQ.ID LEFT JOIN error_code ER on FQ.ERROR_CODE=ER.ERROR_CODE

WHERE FND.CREATED_DATE BETWEEN '$$start_date$$' AND DATE_ADD('$$end_date$$', INTERVAL 1 DAY) AND FND.FILE_TYPE='INPUT_FILE' ORDER BY FQ.ID ASC

  1. Target Layout - The JSON schema for the target data (database) will be designed to be utilized in the RESTful API for the user interface. JSON is selected for its compatibility with RESTful APIs.

image-20240625-054235.png
  1. Mapping - You must load the database schema and the target schema (JSON) to finalize the mapping process.

image-20240625-054541.png
  1. Context Target -The target will be ContextTarget to store data in the flow for the REST provider.

image-20240625-055043.png

c. Advanced Process Flow - Filtering Records by (Start Date & End Date)

image-20240722-091719.png

Overview

This Process flow is used for advanced search in which a user can filter records based on their start date and end date using the Advanced Search functionality. This includes the interactions between the frontend and backend systems to accomplish this task.

Process Steps

1. Date Range Selection

2. Request Submission

image-20240621-060333.png

3. Date Filter

4. Response Handling

5. Display Results

image-20240621-060201.png

Process flow activity:

  1. Gateway Activity: This condition retrieves a value based on the search criteria provided by the user interface, using the advanced search option. The code facilitates the flow to retrieve data according to the specified search query.

image-20240722-091852.png

Code Description:

Gateway Code

Description

String Query = context.get("searchQuery") == null ? "" : context.get("searchQuery");

if(Query!=null&&Query.length()>0)
{
return true;

}
else{
return false;
}

The code is designed to determine whether the searchQuery retrieved from the context is valid, meaning it is not null and not an empty string. If searchQuery is valid, it returns true; otherwise, it returns false. This could be used to validate that a search query has been provided before proceeding with further operations.

  1. Source Activity - The source comprises a database. It is necessary to create DbInfo and DbLayout to be invoked in the source activity

image-20240625-091835.png

You must utilize the EDIT Query option to efficiently retrieve attributes from multiple tables and display relevant information on the user interface. Additionally, you implement conditions to filter the data as needed.

image-20240625-062204.png

Table Name: DB/file_queueFQ/

SELECT FQ.ID,FQ.PARTNER_NAME,FQ.TRANSACTION_TYPE,FQ.FILE_REF_ID,FQ.PHASE,FQ.OVERALL_STATUS,FQ.ERROR_CODE,FQ.INCOMING_FILE_DATE,FQ.TOTAL_RECORDS,FQ.DUPLICATE_RECORDS,FQ.UNIQUE_RECORDS,FQ.GROUP_ID,FQ.V3_GROUP_ID,FQ.V3_PHASE,FQ.V3_STATUS,FQ.V3_TOTAL_RECORDS,FQ.V3_GOOD_RECORDS,FQ.V3_ERROR_RECORDS,FQ.V3_PASS_PERCENTAGE,FQ.V3_ERROR_MESSAGE,FQ.CORE_PHASE,FQ.CORE_STATUS,FQ.CORE_TOTAL_RECORDS,FQ.CORE_GOOD_RECORDS,FQ.CORE_ERROR_RECORDS,FQ.CORE_PASS_PERCENTAGE,FQ.CORE_ERROR_MESSAGE,FQ.CREATED_BY,FQ.LAST_MODIFIED_BY,FQ.LAST_MODIFIED_DATE,FND.FILE_NAME,FND.CREATED_DATE,ER.ERROR_MESSAGE,FQ.TRANSACTION_NAME FROM file_queue FQ LEFT JOIN file_name_details FND on FND.FILE_QUEUE_ID=FQ.ID LEFT JOIN error_code ER on FQ.ERROR_CODE=ER.ERROR_CODE

WHERE ( DATE_SUB(NOW(), INTERVAL 30 DAY) < FND.CREATED_DATE ) AND ( FND.FILE_TYPE='INPUT_FILE' ) AND ( FQ.PARTNER_NAME like '%$$searchQuery$$%' OR FQ.TRANSACTION_TYPE like '%$$searchQuery$$%' OR FQ.PHASE like '%$$searchQuery$$%' OR FND.FILE_NAME like '%$$searchQuery$$%' OR FQ.OVERALL_STATUS like '%$$searchQuery$$%' OR FQ.V3_PHASE like '%$$searchQuery$$%' OR FQ.V3_STATUS like '%$$searchQuery$$%' OR FQ.V3_ERROR_MESSAGE like '%$$searchQuery$$%' OR FQ.CORE_PHASE like '%$$searchQuery$$%' OR FQ.CORE_STATUS like '%$$searchQuery$$%' OR FQ.CORE_ERROR_MESSAGE like '%$$searchQuery$$%' OR FQ.CREATED_BY like '%$$searchQuery$$%' OR FQ.TRANSACTION_NAME like '%$$searchQuery$$%' ) ORDER BY FQ.ID DESC

  1. Target Layout - The JSON schema for the source data (database) will be designed to be utilized in the RESTful API for the user interface. JSON is selected for its compatibility with RESTful APIs.

image-20240625-062937.png
  1. Mapping - You must load the database schema and the target schema (JSON) to finalize the mapping process.

image-20240625-063310.png
  1. Context Target -The target will be ContextTarget to store data in the flow for the REST provider.

image-20240625-063605.png

2. Create REST Provider End-point

Overview

A REST (Representational State Transfer) Provider is a service that offers resources and functionalities over HTTP(S) using standard REST principles. It enables clients to interact with the service through predefined APIs, facilitating the integration and communication between different systems.

In this particular use case, the process flow is shared by developing a REST provider that will eventually be integrated with the user interface.image-20240621-061858.png

Follow the steps below to create a REST Provider:

  1. Click Configure > WEB SERVICES > REST Provider.

  2. Click Create REST Provider

  3. In Create REST Provider window, type the name and description of the new Web Service Provider service in the Name and Description fields respectively.

image-20240621-062337.png
  1. Type API Version, for example, your API version can be 1

  2. Type the resource end path URL in the Resource End Path field. The URL can be static or dynamic. Static URL example:  /get/FileQueueDetails 

  3. Select the process flow name to trigger with the web service from the Process Flow Name field.

    1. Set parameterName attribute of the context source should be restRequest

      1. searchQuery - To enable the Advanced Search option

      2. start_date - Advanced search criteria

      3. end_date - Advanced search criteria

      4. start - Pagination control in the user interface

The above variables need to be bound in the user interface to process requests from the user.

Select the process flow name to trigger with the web service from the Process Flow Name field.

image-20240621-064010.png
  1. Click Add Method and select GET as the method type.

image-20240621-063007.png
  1. Select the Response Schema (For example, we are opting for the schema that has been utilized in the process flow as the target schema)

image-20240621-064545.png
  1. Save it.

3. Publish the Provider (REST URL) at UI

Once the above steps have been completed, it is necessary to link the REST provider URL with the user interface (UI) to present the data on the UI