# Business Logic — KKW14901SFLogic.actionDchs() [46 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW14901SF.KKW14901SFLogic` |
| Layer | Controller (Web Logic) |
| Module | `KKW14901SF` (Package: `eo.web.webview.KKW14901SF`) |

## 1. Role

### KKW14901SFLogic.actionDchs()

This method performs **data extraction** for the Fan Number-less Advance Notification service (番ボなし番号事前通知, `bmpnonno_senguchi`). It is the primary entry point that initiates an asynchronous batch job to extract data related to Fan Number-less Advance Notification records from the system. The method retrieves the current form's data bean, constructs a structured input map via the `KKSV0696_KKSV0696OPDBMapper` with service codes for three sub-components (batch existence check for data extraction, batch existence check for Yamato transmission, and data extraction processing), and then invokes the `KKSV0696` business service on the AP server. After the service returns, it evaluates the result via `getKKSV0696Result()` to determine whether the operation succeeded, whether a data extraction batch is already running, or whether a transmission batch is already running. Based on the result, it sets the appropriate user-facing message (error or success) using `JCCWebCommon.setMessageInfo()`, dumps the DataBean for logging, and returns `true` to indicate the method completed without throwing an exception. The method follows a **delegation + dispatch** design pattern: it delegates data mapping to the mapper, delegates service invocation to the AP server, and dispatches the result to the appropriate message path. It serves as a **screen entry point** tied to the KKW14901 screen (番ボなし番号事前通知一覧照会 / Fan Number-less Advance Notification Inquiry List), allowing users to trigger the batch data extraction job from the web UI.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionDchs"])
    START --> LOG["debugLog -- actionDchs[START] --"]
    LOG --> GETBEAN["getServiceFormBean"]
    GETBEAN --> PARAM["paramBean = bean array"]
    PARAM --> MAPPER["mapper = new KKSV0696_KKSV0696OPDBMapper()"]
    MAPPER --> INPUTMAP["inputMap = new HashMap"]
    INPUTMAP --> SET1["setKKSV069601SC"]
    SET1 --> SET2["setKKSV069602SC"]
    SET2 --> SET3["setKKSV069603SC"]
    SET3 --> INVOKE["invokeService KKSV0696 KKSV0696OP"]
    INVOKE --> GETRESULT["getKKSV0696Result"]
    GETRESULT --> COND1{rslt equals RSLT_DATA_CHSHT_NG1 \"1\"?}
    COND1 -->|Yes: Batch extraction in progress| ERR1["setMessageInfo EKB0930-NW: Data extraction batch is in progress"]
    COND1 -->|No| COND2{rslt equals RSLT_DATA_CHSHT_NG2 \"2\"?}
    COND2 -->|Yes: Batch transmission in progress| ERR2["setMessageInfo EKB0930-NW: Transmission batch is in progress"]
    COND2 -->|No: Success (rslt == RSLT_DATA_CHSHT_OK \"0\")| OK["setMessageInfo EKB7950--I: Fan number-less advance notification data extraction completed"]
    ERR1 --> DUMP["dumpDatabean"]
    ERR2 --> DUMP
    OK --> DUMP
    DUMP --> ENDLOG["debugLog -- actionDchs[END] --"]
    ENDLOG --> RET["return true"]
    RET --> END_NODE(["END"])
```

**Constant Resolution:**
- `RSLT_DATA_CHSHT_NG1 = "1"` -- Data extraction batch is running / Data extraction error (set when `KKSV069602SC` response lacks `ECC0111B010CBSMsg1List`)
- `RSLT_DATA_CHSHT_NG2 = "2"` -- Transmission batch is running / Transmission error (set when `KKSV069603SC` response lacks `trn_req_no`)
- `RSLT_DATA_CHSHT_OK = "0"` -- Normal completion (both sub-services returned expected keys)
- `FUNC_CD_2 = "2"` (JPCModelConstant) -- Function code for data extraction batch existence check and Yamato transmission batch existence check
- `FUNC_CD_3 = "3"` (JPCModelConstant) -- Function code for data extraction processing
- `DLYD_TRN_REQ_SBT_DATA_CHSHT = "10305"` -- Delivery processing request type code for data extraction
- `DLYD_TRN_REQ_SBT_YAMATO_SEND = "10301"` -- Delivery processing request type code for Yamato transmission
- `REQ_JOB_ID_DATA_CHSHT = "EO22V0510J0"` -- Request job ID for data extraction
- `EKB0930-NW` -- Batch in progress error message code
- `EKB7950--I` -- Information message code for normal completion

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. All input data is obtained internally via `super.getServiceFormBean()`, which retrieves the current screen's `X31SDataBeanAccess` (the form state held in the session). |

**Instance fields / external state read by this method:**
| No | Source | Type | Business Description |
|----|--------|------|---------------------|
| 1 | `super.getServiceFormBean()` | `X31SDataBeanAccess` | The current screen's shared form DataBean containing the session state for the Fan Number-less Advance Notification inquiry screen (KKW14901). Holds search criteria, display flags, and result data. |
| 2 | `JPCModelConstant.FUNC_CD_2` | `String` = `"2"` | Function code used by the AP-side service components for batch existence check operations (data extraction and Yamato transmission checks). |
| 3 | `JPCModelConstant.FUNC_CD_3` | `String` = `"3"` | Function code used by the AP-side service component for the actual data extraction processing. |
| 4 | `KKW14901SFConst.DLYD_TRN_REQ_SBT_DATA_CHSHT` | `String` = `"10305"` | Delivery processing request subtype code identifying the data extraction batch job type. |
| 5 | `KKW14901SFConst.DLYD_TRN_REQ_SBT_YAMATO_SEND` | `String` = `"10301"` | Delivery processing request subtype code identifying the Yamato (courier) transmission batch job type. |
| 6 | `KKW14901SFConst.REQ_JOB_ID_DATA_CHSHT` | `String` = `"EO22V0510J0"` | Request job ID for the asynchronous data extraction batch job dispatched to the AP server. |
| 7 | `RSLT_DATA_CHSHT_OK` | `String` = `"0"` | Constant indicating successful result from the KKSV0696 service. |
| 8 | `RSLT_DATA_CHSHT_NG1` | `String` = `"1"` | Constant indicating data extraction batch is in progress or an extraction error occurred. |
| 9 | `RSLT_DATA_CHSHT_NG2` | `String` = `"2"` | Constant indicating transmission batch is in progress or a transmission error occurred. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `KKW14901SFLogic.debugLog` | - | - | Calls `debugLog` in `KKW14901SFLogic` (trace logging) |
| R | `KKW14901SFLogic.getKKSV0696Result` | KKSV0696 | - | Calls `getKKSV0696Result` to evaluate the service result |
| - | `KKW14901SFLogic.invokeService` | KKSV0696 | - | Calls `invokeService` to dispatch to the AP server |
| - | `KKSV0696_KKSV0696OPDBMapper.setKKSV069601SC` | - | - | Calls `setKKSV069601SC` to map input for data extraction batch existence check |
| - | `KKSV0696_KKSV0696OPDBMapper.setKKSV069602SC` | - | - | Calls `setKKSV069602SC` to map input for Yamato transmission batch existence check |
| - | `KKSV0696_KKSV0696OPDBMapper.setKKSV069603SC` | - | - | Calls `setKKSV069603SC` to map input for data extraction processing |
| C | `KKSV069601SC` | KKSV069601SC | (AP batch: batch existence check for data extraction) | Invokes data extraction batch existence check -- determines if data extraction batch job is currently running |
| C | `KKSV069602SC` | KKSV069602SC | (AP batch: batch existence check for Yamato transmission) | Invokes Yamato transmission batch existence check -- determines if the Yamato (courier) transmission batch job is currently running |
| C | `KKSV069603SC` | KKSV069603SC | (AP batch: data extraction) | Invokes data extraction processing -- initiates the asynchronous batch job to extract Fan Number-less Advance Notification data, with job ID `EO22V0510J0` |
| - | `JCCWebCommon.setMessageInfo` | - | - | Sets flash/error message for display to the user |
| - | `JSYwebLog.println` | - | - | Dumps DataBean to the web log |

**Detailed analysis:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `invokeService(KKSV0696, KKSV0696OP, inputMap)` | KKSV0696 | (AP-side batch dispatch) | Invokes the KKSV0696 service on the AP server. The input map contains three sub-component mappings: KKSV069601SC (data extraction batch existence check), KKSV069602SC (Yamato transmission batch existence check), and KKSV069603SC (data extraction processing). The AP server dispatches the appropriate asynchronous batch job (`EO22V0510J0`) based on the mapped parameters. No direct DB table access occurs in this method -- all data operations are delegated to the AP batch layer. |

## 5. Dependency Trace

This method is called from the KKW14901 screen's action dispatch chain. In this framework, the screen dispatcher routes user actions (button clicks, link activations) to the corresponding `action*()` method.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW14901 | `action*()` dispatcher -> `KKW14901SFLogic.actionDchs()` | `invokeService [C] KKSV069601SC (batch existence check)`, `invokeService [C] KKSV069602SC (batch existence check)`, `invokeService [C] KKSV069603SC (data extraction batch)` |

**Notes on callers:**
- `KKW14901SFLogic` is the business logic class for the KKW14901 screen (番ボなし番号事前通知一覧照会 / Fan Number-less Advance Notification Inquiry List). The `actionDchs()` method is invoked when the user clicks the "Data Extraction" button on this screen.
- The KKSV0696 service is a shared service also referenced by the `KKSV0696_KKSV0696OPDBMapper` and `KKSV0697_KKSV0697OPDBMapper` mapping classes.
- No other screens or batches directly call `actionDchs()` -- it is specific to the KKW14901 screen.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] L575

> Initialize: debug logging starts.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `debugLog("-- actionDchs[START] --")` // Trace logging: method entry [-> debugLog in JCCWebBusinessLogic] |

**Block 2** — [SET] L578-579

> Retrieve the current screen's DataBean and wrap it in an array for the mapper.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean = super.getServiceFormBean()` // Get service form DataBean [-> inherited from JCCWebBusinessLogic] |
| 2 | SET | `paramBean = new X31SDataBeanAccess[]{bean}` // Wrap in single-element array [-> passed to mapper methods] |

**Block 3** — [SET] L582-586

> Upper mapping: Set up the KKSV0696 OPDBMapper and prepare the input map with three sub-component configurations.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapper = new KKSV0696_KKSV0696OPDBMapper()` // Create mapper instance [-> eo.web.webview.mapping] |
| 2 | SET | `inputMap = new HashMap<String, Object>()` // Create input parameter map |
| 3 | CALL | `mapper.setKKSV069601SC(paramBean, inputMap, JPCModelConstant.FUNC_CD_2)` // Map data extraction batch existence check [FUNC_CD_2="2", dlyd_trn_req_sbt_cd_k="10305"] |
| 4 | CALL | `mapper.setKKSV069602SC(paramBean, inputMap, JPCModelConstant.FUNC_CD_2)` // Map Yamato transmission batch existence check [FUNC_CD_2="2", dlyd_trn_req_sbt_cd_k="10301"] |
| 5 | CALL | `mapper.setKKSV069603SC(paramBean, inputMap, JPCModelConstant.FUNC_CD_3)` // Map data extraction processing [FUNC_CD_3="3", req_job_id="EO22V0510J0", dlyd_trn_req_sbt_cd="10305"] |

**Block 4** — [SET] L589

> Service call (no-prefixed-number advance notification data extraction service). Invokes the KKSV0696 AP service.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outputMap = invokeService("KKSV0696", "KKSV0696OP", inputMap)` // AP-side service call -> extracts data asynchronously [-> KKSV0696 service component] |

**Block 5** — [SET] L592

> Evaluate the service result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rslt = getKKSV0696Result(outputMap)` // Check if batches are running or if extraction succeeded [-> KKSV0696 result evaluation] |

**Block 6** — [IF/ELSE-IF/ELSE] `(RSLT_DATA_CHSHT_NG1.equals(rslt))` L594-611

> Conditional branches on the service result. Three branches: data extraction batch in progress, transmission batch in progress, or success.

**Block 6.1** — [IF branch: batch extraction error] L594-598

> The data extraction batch is already running or encountered an error. `getKKSV0696Result` returned `"1"` because `KKSV069602SC` response lacked the `ECC0111B010CBSMsg1List` key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `RSLT_DATA_CHSHT_NG1 = "1"` [-> constant] |
| 2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0930_NW, new String[]{"Data extraction batch is in progress", "In progress"})` // Display error: batch already running [EKB0930-NW = batch in progress error] |

**Block 6.2** — [ELSE-IF branch: batch transmission error] `[RSLT_DATA_CHSHT_NG2 = "2"]` L600-604

> The transmission batch is already running or encountered an error. `getKKSV0696Result` returned `"2"` because `KKSV069603SC` response lacked the `trn_req_no` key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `RSLT_DATA_CHSHT_NG2 = "2"` [-> constant] |
| 2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0930_NW, new String[]{"Transmission batch is in progress", "In progress"})` // Display error: batch already running [EKB0930-NW = batch in progress error] |

**Block 6.3** — [ELSE branch: success] L606-610

> The service completed normally (result is `"0"` = `RSLT_DATA_CHSHT_OK`, meaning both `KKSV069602SC` returned `ECC0111B010CBSMsg1List` and `KKSV069603SC` returned `trn_req_no`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `RSLT_DATA_CHSHT_OK = "0"` [-> constant] |
| 2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB7950__I, new String[]{"Fan number-less advance notification data extraction"})` // Display success message [EKB7950--I = info completion] |

**Block 7** — [EXEC] L613

> Debug output: dump the current DataBean state to the log.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JSYwebLog.println(JSYwebLog.DataBean_Dump, getClass(), dumpDatabean(), null, null, null)` // Dump DataBean to web log [-> JSYwebLog] |

**Block 8** — [SET] L616-618

> End of method: debug log and return.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `debugLog("-- actionDchs[END] --")` // Trace logging: method exit |
| 2 | RETURN | `return true` // Always returns true; exceptions are thrown, not returned |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `bmpnonno_senguchi` | Field / Domain | Fan Number-less Advance Notification — a telecom service where customers are notified in advance of service changes without requiring a Fan (phone number) port-in procedure |
| `dlyd_trn_req_sbt_cd` | Field | Delivery processing request subtype code — classifies the type of delivery/batch processing request (e.g., data extraction, Yamato courier transmission) |
| `dlyd_trn_req_sbt_cd_k` | Field | Delivery processing request subtype code (key variant) — used in the AP-side batch existence check to identify which batch job to query |
| `req_job_id` | Field | Request job ID — the identifier for the asynchronous batch job dispatched to the AP server (e.g., `EO22V0510J0` for data extraction) |
| `func_code` | Field | Function code — distinguishes the type of operation (e.g., `"2"` for batch existence check, `"3"` for data extraction processing) |
| `ECC0111B010CBSMsg1List` | Field | CBS response list key — indicates the data extraction batch existence check service returned a valid response; its absence signals a batch error |
| `trn_req_no` | Field | Transmission request number — the ID of the transmission request returned by the data extraction sub-service; its absence signals a transmission batch error |
| KKSV0696 | Service | Fan Number-less Advance Notification Data Extraction Service — AP-side service that coordinates data extraction batch existence checks and the actual data extraction batch job |
| KKSV069601SC | SC Code | Data extraction batch existence check sub-component |
| KKSV069602SC | SC Code | Yamato transmission batch existence check sub-component |
| KKSV069603SC | SC Code | Data extraction processing sub-component |
| KKW14901 | Screen | Fan Number-less Advance Notification Inquiry List screen — the web screen where users can view and manage Fan Number-less Advance Notification records |
| KK_W | Module prefix | Web module prefix (K-Opticom Web) — indicates the component belongs to the web tier |
| KK_S | Module prefix | Screen logic module prefix — indicates the component is a screen-specific business logic class |
| SF | Suffix | Screen Form — naming convention for screen logic classes |
| BC | Suffix | Business Component (base logic class) |
| JCCWebBusinessLogic | Class | Base class for all web business logic — provides common methods like `debugLog`, `getServiceFormBean`, `invokeService`, `dumpDatabean` |
| KKW14901SFLogic | Class | Business logic for the KKW14901 screen — handles data extraction, Yamato transmission, and inquiry list display |
| KKSV0696_KKSV0696OPDBMapper | Class | Data mapping class for the KKSV0696 service — maps screen DataBeans to AP-side service parameters and vice versa |
| JPCOnlineMessageConstant.EKB0930-NW | Constant | Batch in progress error message — displayed when the requested batch job is already running |
| JPCOnlineMessageConstant.EKB7950--I | Constant | Information message for normal completion — displayed when the data extraction job is dispatched successfully |
| JSYwebLog | Utility | Web logging utility — outputs DataBean dumps and other diagnostic information to the web log |
| X31SDataBeanAccess | Class | Shared form DataBean access class — provides the session-scoped DataBean holding the current screen's state |
| 番ボなし番号事前通知 (bombo senguchi) | Japanese term | Fan Number-less Advance Notification — telecom service term; "Fan" refers to a phone number; the service notifies customers of upcoming changes without requiring number port-in processing |
| YAMATO | Domain term | Yamato Transport — Japanese courier service; in this context, the Yamato transmission batch sends physical documents (advance notification letters) via courier |
| FUNC_CD_2 | Constant | Function code `"2"` — indicates batch existence check operation |
| FUNC_CD_3 | Constant | Function code `"3"` — indicates data extraction processing operation |
| DLYD_TRN_REQ_SBT_DATA_CHSHT | Constant | `"10305"` — delivery processing request subtype code for data extraction batch job |
| DLYD_TRN_REQ_SBT_YAMATO_SEND | Constant | `"10301"` — delivery processing request subtype code for Yamato courier transmission batch job |
| REQ_JOB_ID_DATA_CHSHT | Constant | `"EO22V0510J0"` — request job ID for the data extraction batch job on the AP server |
| RSLT_DATA_CHSHT_OK | Constant | `"0"` — result code indicating normal completion of the data extraction service |
| RSLT_DATA_CHSHT_NG1 | Constant | `"1"` — result code indicating data extraction batch error (batch in progress or extraction failure) |
| RSLT_DATA_CHSHT_NG2 | Constant | `"2"` — result code indicating transmission batch error (batch in progress or transmission failure) |
