# Business Logic — FUIFE198.execute() [12 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `local.gyomu.api.FUIFE198` |
| Layer | Controller (REST API entry point, JAX-RS) |
| Module | `api` (Package: `local.gyomu.api`) |

## 1. Role

### FUIFE198.execute()

FUIFE198 is a REST API endpoint that performs **Introduction Code (and Coupon Code) Validity Check**. This method serves as the public entry point for validating customer referral / introduction codes used in the telecom service ordering flow. The business purpose is to verify whether a provided introduction code (or coupon code) is active, valid, and associated with an eligible customer before allowing the ordering process to proceed.

The method implements the **delegation pattern** — it does not contain any business logic itself. Instead, it delegates to the framework's base `exec()` method (`ApiServerLocalBase.exec`), which handles authentication, authorization, parameter binding, and then routes the request to the underlying business service `FUSV0357`. The base framework invokes the service, which in turn calls `JFUShokaishaCheckCC` (Introduction Company Check Component) to perform the actual code validity validation.

This API is called in two contexts: (1) when a user enters an introduction code on the general Web or retail sales Web ordering screens, and (2) when the backend coupon/introduction code validation process (`JFUShokaishaCheckCC`) invokes it programmatically. Its role in the larger system is to provide a clean, stateless REST endpoint that shields callers from the complexity of the service invocation chain while returning a standardized response with validation results or error information.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["FUIFE198.execute(request, context)"])
    EXEC_EXEC["super.exec(APIID=\"FUIFE198\", request, context)"]
    EXEC_RETURN["Return Response"]

    START --> EXEC_EXEC
    EXEC_EXEC --> EXEC_RETURN
```

The `execute()` method is a thin delegation wrapper. It constructs the API invocation by calling `super.exec()` with three arguments:

- **APIID = "FUIFE198"**: The API identifier used for routing and logging within the framework.
- **pRequest**: The incoming HTTP servlet request containing parameters (e.g., introduction code, coupon code).
- **pContext**: The servlet context providing application-level configuration.

The base class `ApiServerLocalBase.exec()` handles the full request lifecycle: authentication, parameter parsing, service dispatch to `FUSV0357`, and response construction. The `execute()` method simply returns whatever `Response` the base framework produces.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `pRequest` | `@Context final HttpServletRequest` | The incoming HTTP request from the client (Web screen or backend caller). Carries introduction code (`in_intr_cd`), coupon code (`in_coupon_cd`), and other contextual parameters required for the validity check. |
| 2 | `pContext` | `@Context final ServletContext` | The Servlet context providing application-level configuration (e.g., service endpoints, environment settings). Used by the base framework for service resolution. |

**Inherited state from `ApiServerLocalBase`:**
- `APIID = "FUIFE198"` — API identifier for framework routing
- `SERVICE_ID = "FUSV0357"` — The underlying business service ID that performs the actual code validation
- `SYSTEM_ID = "FRN1"` — Source system identifier (Frontend system)
- `JOB_ID = "FUIFE198"` — Job identifier for tracing within the execution framework

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `exec` (ApiServerLocalBase) | FUIFE198 | - | Base framework method that handles authentication, parameter parsing, and service dispatch |
| - | `callBpService` (ApiServerLocalBase) | FUSV0357 | - | Delegates to the business service FUSV0357 for introduction code validation |

The `execute()` method itself does not directly perform any CRUD operations. All data access is handled by the downstream service `FUSV0357` and its component `JFUShokaishaCheckCC`, which performs reads against customer and code-related tables to verify the validity of introduction/coupon codes.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC: JFUShokaishaCheckCC | `JFUShokaishaCheckCC.chkIntrCd` -> `FUIFE198.execute` | Service FUSV0357 [R] Introduction/Coupon code tables |

**Notes:**
- `JFUShokaishaCheckCC` (Introduction Company Check Component) calls FUIFE198 in two contexts: (a) when an end user enters an introduction code on general Web / retail sales Web ordering screens, and (b) when the code validation check is invoked programmatically from within the component itself.
- The caller class follows the `JFU*` naming convention indicating it is a Common Component (CC) in the business process layer.

## 6. Per-Branch Detail Blocks

**Block 1** — [METHOD BODY] `(execute method entry)` (L65)

> This block represents the entire method body. It is a single-statement delegation with no conditional branches.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.exec(APIID, pRequest, pContext)` // Calls base class exec() with APIID="FUIFE198" |

**Block 2** — [RETURN] `(method return)` (L75)

> Returns the Response object from the base class execution.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return response;` // Response from base class exec() |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `APIID` | Constant | "FUIFE198" — Unique API identifier used for framework routing and logging |
| `SERVICE_ID` | Constant | "FUSV0357" — Business service ID that handles introduction code validation |
| `SYSTEM_ID` | Constant | "FRN1" — Source system identifier representing the Frontend system |
| `JOB_ID` | Constant | "FUIFE198" — Job identifier for execution tracing |
| 紹介コード (Shoukai Code) | Domain term | Introduction Code — A referral code used to track customer acquisition channels in the telecom ordering flow |
| クーポンコード (Coupon Code) | Domain term | Coupon Code — A promotional code used for discounts or special offers |
| 有効性チェック (Kouryouseki Check) | Domain term | Validity Check — Verification that a code is active, unexpired, and associated with an eligible entity |
| 一般WEBサービス (Ippan WEB Service) | Domain term | General Web Service — The standard customer-facing web ordering portal |
| 量販販売WEB (Ryouryan Hanbai WEB) | Domain term | Retail Sales Web — The channel for retail partner ordering systems |
| FUSV0357 | Service ID | The business service responsible for introduction/coupon code validation logic |
| JFUShokaishaCheckCC | Component | Introduction Company Check Component — Common Component that orchestrates the code validation workflow |
| FRN1 | System ID | Frontend system identifier — the originating system for customer-facing API calls |
| ApiServerLocalBase | Base class | Abstract base class for REST API endpoints in the `local.gyomu.api` package; provides `exec()` delegation and `callBpService()` framework |
| @Path | JAX-RS annotation | JAX-RS path annotation that maps the REST endpoint URL to the FUIFE198 class |
| @POST | JAX-RS annotation | JAX-RS method-level annotation indicating this endpoint accepts HTTP POST requests |
| ApiServerPartsBean | Bean | Request/response data container used for API business process integration |
| ApiBpInterface.ERROR_INFO | Constant | "ERROR_INFO" — Key used to retrieve error information from the service response map |
