---
# Business Logic — KKIFE423.run() [12 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `local.gyomu.api.KKIFE423` |
| Layer | API (JAX-RS REST Endpoint — `@Path("KKIFE423")`, extends `ApiServerLocalBase`) |
| Module | `api` (Package: `local.gyomu.api`) |

## 1. Role

### KKIFE423.run()

This method is the core business logic entry point for the **Billing Discount Information Inquiry (Operator Support)** service. It serves as the backend handler invoked by the `execute()` REST endpoint, which receives HTTP POST requests from the operator support front-end. The method delegates all actual processing to the private `logicExecute()` method, which in turn calls the centralized `callBpService()` framework method to forward the request to business process service `KKSV0937` — the billing discount information lookup service. The method implements a simple **delegation pattern**: it receives request data from the API layer, pushes it through to the BP (business process) service chain via `callBpService()`, and returns the structured response without any branching, validation, or transformation logic of its own. It is a **shared IF handler** called exclusively by its own `execute()` JAX-RS method and serves as a lightweight API adapter in the operator support billing tools domain.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["run(reqPartsBean)"])
    START --> CALL["call logicExecute(reqPartsBean)"]
    CALL --> EXTRACT["extract resultMap
from outMap.get(KKSV093701CC)"]
    EXTRACT --> WRAP["create ApiServerPartsBean
setBody(resultMap)"]
    WRAP --> RESP["return resPartsBean"]
    RESP --> END_RETURN(["Return / Next"])
```

**Explanation:**
- The `run()` method receives an `ApiServerPartsBean` request containing the operator's inquiry payload.
- It calls `logicExecute(reqPartsBean)` to perform the business delegation.
- Inside `logicExecute`, the `callBpService()` framework call forwards the request to service `KKSV0937` (Billing Discount Information Inquiry) with `JOB_ID="KKIFE423"` and `SYSTEM_ID="OPS1"`.
- The result map is extracted from the output using the key `"KKSV0937" + "01CC"` = `"KKSV093701CC"`.
- A new `ApiServerPartsBean` is created, the result map is set as its body, and it is returned.
- No conditional branches, loops, or error handling exist in this method — it is a straightforward pass-through delegation.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `reqPartsBean` | `ApiServerPartsBean` | Server business API interlink data (request) — carries the operator's billing discount inquiry payload, including the business data map that gets forwarded to service KKSV0937. Contains operator query parameters for looking up discount information associated with a customer's billing account. |

**Instance fields read:**
| Field | Type | Value | Business Description |
|-------|------|-------|---------------------|
| `SERVICE_ID` | `String` | `"KKSV0937"` | The business service ID identifying the Billing Discount Information Inquiry service that handles the actual lookup. |
| `JOB_ID` | `String` | `"KKIFE423"` | Job identifier passed to the BP service invocation framework for tracking and logging. |
| `SYSTEM_ID` | `String` | `"OPS1"` | The upstream system ID identifying the operator support system as the caller. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| CALL | `logicExecute` | KKIFE423 | - | Calls private `logicExecute()` method which delegates to the BP service framework |

### Detailed called service analysis:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callBpService` (via KKIFE423.logicExecute) | KKSV0937SC | Billing discount information tables | Delegates to BP service KKSV0937 to query billing discount information. The `_01CC` suffix (`"01CC"`) is a framework convention used to extract the service-specific result map from the output map. |

**Notes on SC Code inference:**
- The service ID `KKSV0937` maps to a business process service component (SC). The actual SC code is derived from the service name `KKSV0937` — likely `KKSV0937SC` in the EJB/BP layer.
- No direct DB table references exist in this method; all database operations are handled by the downstream `KKSV0937` service, which is beyond the scope of this file.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0937 | `KKIFE423.execute(@Context HttpServletRequest, @Context ServletContext)` -> `super.exec("KKIFE423", ...)` -> framework dispatch -> `KKIFE423.run(reqPartsBean)` | `logicExecute [CALL] KKSV0937SC -> callBpService [R] billing discount info tables` |

**Notes:**
- `KKIFE423` is a JAX-RS REST endpoint (`@POST`, `@Path("KKIFE423")`). It is called via HTTP POST to the `/KKIFE423` endpoint.
- The `execute()` method calls `super.exec(APIID, pRequest, pContext)` which is defined in `ApiServerLocalBase` and handles framework-level dispatching to `run()`.
- No other classes directly call `KKIFE423.run()` — it is exclusively an internal API handler invoked through the REST framework pipeline.
- The associated screen is `KKSV0937` (Billing Discount Information Inquiry screen for operator support).

## 6. Per-Branch Detail Blocks

**Block 1** — [CALL] `(delegation to logicExecute)` (L88-L90)

> Generate response data by calling the business logic handler.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `this.logicExecute(reqPartsBean)` // Invoke private business logic method. Resolves `serviceId = SERVICE_ID` ("KKSV0937"), calls `callBpService()` with JOB_ID="KKIFE423" and SYSTEM_ID="OPS1" |

**Block 1.1** — [SET] `resPartsBean` assignment (L89-L90)

| # | Type | Code |
|---|------|------|
| 1 | SET | `resPartsBean = logicExecute(reqPartsBean)` // Response data generation — the `logicExecute` method internally calls `callBpService("KKSV0937", reqPartsBean, "KKIFE423", "OPS1")` and returns an `ApiServerPartsBean` containing the result map extracted from `outMap.get("KKSV093701CC")` |

**Block 2** — [RETURN] `(return resPartsBean)` (L95)

> Base logic call. Returns the response bean to the caller (the API framework dispatch).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return resPartsBean;` // Return the response containing the body set with resultMap from service KKSV0937 |

### logicExecute() Detail (called from Block 1)

**Block 2.1** — [SET] `serviceId` assignment (L101)

| # | Type | Code |
|---|------|------|
| 1 | SET | `serviceId = SERVICE_ID` // [-> SERVICE_ID = "KKSV0937"] Service ID for Billing Discount Information Inquiry |

**Block 2.2** — [CALL] `callBpService` invocation (L102)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callBpService(serviceId, reqPartsBean, JOB_ID, SYSTEM_ID)` // Forward request to BP service KKSV0937. Parameters: serviceId="KKSV0937", jobId="KKIFE423", systemId="OPS1". Returns `Map<String, Object>` containing the service output keyed by `"KKSV093701CC"` |

**Block 2.3** — [SET] `resultMap` extraction (L104)

| # | Type | Code |
|---|------|------|
| 1 | SET | `resultMap = (Map<String, Object>)outMap.get(serviceId + _01CC)` // [-> `_01CC = "01CC"`] Extract the KKSV0937-specific result map from the full output map using key `"KKSV093701CC"` |

**Block 2.4** — [SET] `resPartsBean` construction (L107-L108)

| # | Type | Code |
|---|------|------|
| 1 | SET | `resPartsBean = new ApiServerPartsBean()` // Create new response bean |
| 2 | EXEC | `resPartsBean.setBody(resultMap)` // Set the result map as the response body |

**Block 2.5** — [RETURN] `resPartsBean` return (L110)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return resPartsBean;` // Return response bean containing the billing discount inquiry result |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KKIFE423` | API ID | Billing Discount Information Inquiry (Operator Support) — JAX-RS REST API for querying billing discount data |
| `KKSV0937` | Service ID | The underlying business process service (BP service) that performs the actual billing discount information lookup |
| `_01CC` | Constant | Framework convention suffix ("01CC") used to extract service-specific result maps from the BP service output map |
| `ApiServerPartsBean` | Class | Server business API interlink data — the DTO carrying request/response data between the API layer and business logic |
| `callBpService` | Method | BP service invocation framework method — standard gateway for calling EJB-based business process services from the API layer |
| `JOB_ID` | Constant | Job identifier ("KKIFE423") — used for audit trail and process tracking within the BP service framework |
| `SYSTEM_ID` | Constant | Upstream system identifier ("OPS1") — identifies the operator support system as the source of the request |
| `SERVICE_ID` | Constant | Business service identifier ("KKSV0937") — routes the request to the correct BP service |
| `exec` | Method | Base class API execution entry point — handles HTTP request lifecycle, invokes `run()`, and returns the HTTP response |
| `@Path("KKIFE423")` | JAX-RS Annotation | REST endpoint path annotation — makes this class accessible via HTTP POST at `/KKIFE423` |
| `@POST` | JAX-RS Annotation | HTTP method annotation — this endpoint accepts POST requests |
