---

# Business Logic — KKW14901SFLogic.actionSend() [53 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW14901SF.KKW14901SFLogic` |
| Layer | Controller (WebLogic — extends JCCWebBusinessLogic, invoked from web screen) |
| Module | `KKW14901SF` (Package: `eo.web.webview.KKW14901SF`) |

## 1. Role

### KKW14901SFLogic.actionSend()

This method performs the **Yamato Send** operation — it triggers the delivery of a "number-free pre-notification" (番ポなし番号事前通知) notice to customers via the Yamato postal delivery service (ヤマト便). In the context of K-Opticom's telecom services, when a customer's service details change (e.g., address change, plan migration, or service suspension), a pre-notification letter must be mailed through Yamato Transport (ヤマト運輸) to inform the customer of the upcoming change.

The method follows a **dispatch-and-delegate** pattern: it gathers the current form state from the web layer into a `X31SDataBeanAccess` bean, prepares the service invocation parameters by configuring four Service Component (SC) sub-processes (KKSV069701SC through KKSV069704SC) via a `KKSV0697_KKSV0697OPDBMapper`, and then delegates the core business logic to the BPM service `KKSV0697Flow` (operation: `KKSV0697OP`). After the service returns a result code, the method classifies the outcome into one of three error conditions or a success condition, sets an appropriate user-facing message via `JCCWebCommon.setMessageInfo`, dumps the DataBean for logging, and returns `true` to indicate the action completed (regardless of business success/failure — errors are communicated through the message).

**Branch summary:**
- **NG1 (result = "1")**: No unsent data exists — the system could not find any records requiring a Yamato send (e.g., no pending notices). This is a data-absence error.
- **NG2 (result = "2")**: An extraction batch is currently running — the system is busy preparing data for dispatch and cannot initiate a Yamato send at this time.
- **NG3 (result = "3")**: A send batch is currently running — a Yamato send batch process is already in progress, so a new send request is blocked.
- **OK (result = "0")**: The service completed normally, and the Yamato send was initiated successfully.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionSend START"])
    INIT_LOG["debugLog: -- actionSend START --"]
    GET_BEAN["Get X31SDataBeanAccess from super.getServiceFormBean"]
    CREATE_BEAN_ARRAY["Create paramBean array from bean"]
    CREATE_MAPPER["Create KKSV0697_KKSV0697OPDBMapper"]
    CREATE_INPUT_MAP["Create inputMap HashMap"]
    SET_SC_01["mapper.setKKSV069701SC"]
    SET_SC_02["mapper.setKKSV069702SC"]
    SET_SC_03["mapper.setKKSV069703SC"]
    SET_SC_04["mapper.setKKSV069704SC"]
    INVOKE_SVC["invokeService KKSV0697 KKSV0697OP"]
    GET_RESULT["getKKSV0697Result"]
    COND_RESULT{"Result check"}
    BRANCH_NG1["RSLT_YAMATO_SEND_NG1 equals 1"]
    MSG_NG1["setMessageInfo: No unsent data exists"]
    BRANCH_NG2["RSLT_YAMATO_SEND_NG2 equals 2"]
    MSG_NG2["setMessageInfo: Extraction batch in progress"]
    BRANCH_NG3["RSLT_YAMATO_SEND_NG3 equals 3"]
    MSG_NG3["setMessageInfo: Send batch in progress"]
    BRANCH_OK["Normal completion"]
    MSG_OK["setMessageInfo: Number-free pre-notification Yamato send"]
    DUMP_BEAN["JSYwebLog.println dump DataBean"]
    END_LOG["debugLog: -- actionSend END --"]
    RETURN["return true"]
    END(["actionSend END"])

    START --> INIT_LOG
    INIT_LOG --> GET_BEAN
    GET_BEAN --> CREATE_BEAN_ARRAY
    CREATE_BEAN_ARRAY --> CREATE_MAPPER
    CREATE_MAPPER --> CREATE_INPUT_MAP
    CREATE_INPUT_MAP --> SET_SC_01
    SET_SC_01 --> SET_SC_02
    SET_SC_02 --> SET_SC_03
    SET_SC_03 --> SET_SC_04
    SET_SC_04 --> INVOKE_SVC
    INVOKE_SVC --> GET_RESULT
    GET_RESULT --> COND_RESULT
    COND_RESULT -- "NG1" --> BRANCH_NG1
    BRANCH_NG1 --> MSG_NG1
    COND_RESULT -- "NG2" --> BRANCH_NG2
    BRANCH_NG2 --> MSG_NG2
    COND_RESULT -- "NG3" --> BRANCH_NG3
    BRANCH_NG3 --> MSG_NG3
    COND_RESULT -- "OK" --> BRANCH_OK
    BRANCH_OK --> MSG_OK
    MSG_NG1 --> DUMP_BEAN
    MSG_NG2 --> DUMP_BEAN
    MSG_NG3 --> DUMP_BEAN
    MSG_OK --> DUMP_BEAN
    DUMP_BEAN --> END_LOG
    END_LOG --> RETURN
    RETURN --> END
```

**Processing overview:**

1. **Initialization & Logging** — Logs the start of `actionSend`.
2. **Bean Extraction** — Retrieves the current web form DataBean (`X31SDataBeanAccess`) from the super-class and wraps it into a single-element array (`paramBean`) for the mapper.
3. **Input Map Configuration** — Creates a `KKSV0697_KKSV0697OPDBMapper` and an empty `inputMap` HashMap. Calls four mapper setup methods (`setKKSV069701SC` through `setKKSV069704SC`) to populate the input map with service-specific parameters. These use `JPCModelConstant.FUNC_CD_1`, `FUNC_CD_2`, and `FUNC_CD_3` to specify function codes.
4. **Service Invocation** — Invokes the BPM service `KKSV0697Flow` with operation ID `KKSV0697OP`, passing the configured input map. The service performs the core Yamato send logic (batch extraction, send execution, and result determination).
5. **Result Classification** — Extracts the result code string from the service output via `getKKSV0697Result`, then branches on the result:
   - `"1"` (NG1): No unsent data exists
   - `"2"` (NG2): Extraction batch in progress
   - `"3"` (NG3): Send batch in progress
   - `"0"` or other (OK): Normal completion
6. **Message Setup** — Sets a user-facing message via `JCCWebCommon.setMessageInfo` with error code `EKB0930_NW` for errors or `EKB7950__I` for success.
7. **Logging & Return** — Dumps the DataBean for diagnostic logging, logs the end, and returns `true` (action completed from the framework perspective).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no external parameters. All input data is derived from the current web form session state. |

**Instance fields / external state accessed:**

| Source | Description |
|--------|-------------|
| `super.getServiceFormBean()` | Retrieves the current `X31SDataBeanAccess` form bean from the parent web framework. Contains the screen's input data (customer info, service details, etc.). |
| `JPCModelConstant.FUNC_CD_1`, `FUNC_CD_2`, `FUNC_CD_3` | Function code constants used to identify which sub-process of the KKSV0697OP service is being configured. |
| `KKW14901SFLogic.RSLT_YAMATO_SEND_NG1` (="1") | Constant for "no unsent data" error condition. |
| `KKW14901SFLogic.RSLT_YAMATO_SEND_NG2` (="2") | Constant for "extraction batch running" error condition. |
| `KKW14901SFLogic.RSLT_YAMATO_SEND_NG3` (="3") | Constant for "send batch running" error condition. |
| `JPCOnlineMessageConstant.EKB0930_NW` | Error message template key for notification failure scenarios. |
| `JPCOnlineMessageConstant.EKB7950__I` | Informational message template key for successful Yamato send notification. |
| `JCCWebCommon.setMessageInfo()` | Sets a message for display on the web screen (via the framework's message management). |
| `JSYwebLog.println()` | Diagnostic logging utility that dumps DataBean content for troubleshooting. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `KKSV0697_KKSV0697OPDBMapper.setKKSV069701SC` | KKSV069701SC | - | Configures input parameters for SC01 (delivery processing dependency type setup) via the mapper. |
| - | `KKSV0697_KKSV0697OPDBMapper.setKKSV069702SC` | KKSV069702SC | - | Configures input parameters for SC02 (likely delivery address change processing). |
| - | `KKSV0697_KKSV0697OPDBMapper.setKKSV069703SC` | KKSV069703SC | - | Configures input parameters for SC03 (likely delivery batch extraction processing). |
| - | `KKSV0697_KKSV0697OPDBMapper.setKKSV069704SC` | KKSV069704SC | - | Configures input parameters for SC04 (likely Yamato send batch processing). |
| R | `invokeService("KKSV0697", "KKSV0697OP", inputMap)` | KKSV0697OP | BPM Service: `KKSV0697Flow` | Invokes the Yamato send BPM service. The KKSV0697Flow EJB processes the request, which internally triggers the four SC sub-processes. Reads service data, determines send eligibility, executes the send batch, and returns a result code. |
| R | `getKKSV0697Result(outputMap)` | KKW14901SFLogic | - | Extracts and returns the result code string from the service invocation output map. |
| - | `JCCWebCommon.setMessageInfo(this, ...)` | JCCWebCommon | - | Sets a user-facing message on the web screen (error or success). |
| - | `KKW14901SFLogic.debugLog(...)` | KKW14901SFLogic | - | Internal debug logging utility. |
| - | `JSYwebLog.println(JSYwebLog.DataBean_Dump, ...)` | JSYwebLog | - | Dumps DataBean content to the system log for diagnostic purposes. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | WebController (KKW14901SF screen) | `KKW14901SFController` -> `KKW14901SFLogic.actionSend()` | `invokeService KKSV0697OP [R] BPM Service KKSV0697Flow` |

**Notes:**
- The `actionSend()` method is defined within `KKW14901SFLogic` and is invoked by the web screen controller for the KKW14901SF screen (number-free pre-notification Yamato send screen).
- The method delegates to the `KKSV0697Flow` BPM service, which internally manages SC01-SC04 sub-processes. These sub-processes are responsible for extracting delivery data, validating batch availability, and executing the Yamato postal send. The specific DB tables accessed within SC01-SC04 are not directly visible in this method's source (they are encapsulated within the BPM service layer).

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialization (L630-L632)

> Retrieves the web form DataBean and prepares it for the mapper.

| # | Type | Code |
|---|------|------|
| 1 | LOG | `debugLog("-- actionSend[START] --")` |
| 2 | CALL | `bean = super.getServiceFormBean()` | [-> Returns `X31SDataBeanAccess` with current screen data] |
| 3 | SET | `paramBean = new X31SDataBeanAccess[]{bean}` | [Wraps bean in single-element array for mapper API compatibility] |

**Block 2** — [SET] Input Map Configuration (L637-L643)

> Creates the mapper and populates the input map with service configuration. The four `setKKSV*` methods prepare sub-process parameters.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapper = new KKSV0697_KKSV0697OPDBMapper()` | [Creates new mapper instance] |
| 2 | SET | `inputMap = new HashMap<String, Object>()` | [Empty map for service parameters] |
| 3 | CALL | `mapper.setKKSV069701SC(paramBean, inputMap, JPCModelConstant.FUNC_CD_1)` | [SC01: Delivery processing dependency type setup with func code 1] |
| 4 | CALL | `mapper.setKKSV069702SC(paramBean, inputMap, JPCModelConstant.FUNC_CD_2)` | [SC02: Delivery address change processing with func code 2] |
| 5 | CALL | `mapper.setKKSV069703SC(paramBean, inputMap, JPCModelConstant.FUNC_CD_2)` | [SC03: Delivery batch extraction with func code 2] |
| 6 | CALL | `mapper.setKKSV069704SC(paramBean, inputMap, JPCModelConstant.FUNC_CD_3)` | [SC04: Yamato send batch with func code 3] |

**Block 3** — [CALL] Service Invocation (L646)

> Invokes the BPM service. The KKSV0697Flow EJB processes the Yamato send request end-to-end.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `outputMap = invokeService("KKSV0697", "KKSV0697OP", inputMap)` | [Calls KKSV0697 BPM service (operation KKSV0697OP). Returns output map with result code] |

**Block 4** — [SET] Result Extraction (L649)

> Extracts the result code string from the output map.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `rslt = getKKSV0697Result(outputMap)` | [Extracts and returns the result code String from the service output. Result "0" = OK, "1" = NG1, "2" = NG2, "3" = NG3] |

**Block 5** — [IF/ELSE-IF/ELSE] Result Classification (L651-L676)

> Branches on the result code to determine the action outcome and set the appropriate message.

**Block 5.1** — [IF] `RSLT_YAMATO_SEND_NG1 = "1"` (L651)

> No unsent data exists — the Yamato send could not be initiated because there is no data to send.
> Error message template: `EKB0930_NW`, args: `["未送信データが存在しない", "送信の実行"]` -> "No unsent data exists" / "Send execution"

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0930_NW, new String[]{"未送信データが存在しない", "送信の実行"})` | [Sets error: No unsent data exists] |

**Block 5.2** — [ELSE-IF] `RSLT_YAMATO_SEND_NG2 = "2"` (L656)

> Extraction batch is running — the system is busy preparing data and cannot accept a new send request.
> Error message template: `EKB0930_NW`, args: `["抽出バッチが実行中の", "実行"]` -> "Extraction batch in progress" / "Execution"

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0930_NW, new String[]{"抽出バッチが実行中の", "実行"})` | [Sets error: Extraction batch in progress] |

**Block 5.3** — [ELSE-IF] `RSLT_YAMATO_SEND_NG3 = "3"` (L662)

> Send batch is running — a Yamato send batch process is already active.
> Error message template: `EKB0930_NW`, args: `["送信バッチが実行中の", "実行"]` -> "Send batch in progress" / "Execution"

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0930_NW, new String[]{"送信バッチが実行中の", "実行"})` | [Sets error: Send batch in progress] |

**Block 5.4** — [ELSE] Normal completion (L668)

> The service completed normally (result = "0" or any other non-error code).
> Info message template: `EKB7950__I`, args: `["番ポなし番号事前通知ヤマト送信"]` -> "Number-free number pre-notification Yamato send"

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB7950__I, new String[]{"番ポなし番号事前通知ヤマト送信"})` | [Sets success message] |

**Block 6** — [SET] Final Logging & Return (L680-L681)

> Dumps the DataBean for log analysis, logs completion, and returns `true`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JSYwebLog.println(JSYwebLog.DataBean_Dump, getClass(), dumpDatabean(), null, null, null)` | [Dumps DataBean content to log] |
| 2 | LOG | `debugLog("-- actionSend[END] --")` | [Logs completion] |
| 3 | RETURN | `return true` | [Always returns true — framework considers the action complete regardless of business result] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `actionSend` | Method | Yamato Send action — triggers postal delivery of a number-free pre-notification letter via Yamato Transport |
| Yamato Send (ヤマト送信) | Business term | Sending a physical notice letter through Yamato Transport (ヤマト運輸), a major Japanese postal service, to notify customers of service changes |
| Number-free pre-notification (番ポなし番号事前通知) | Business term | A pre-notification letter mailed to inform customers of upcoming changes to their phone number or service without requiring them to visit a shop |
| `RSLT_YAMATO_SEND_NG1` | Constant | Result code "1" — No unsent data error. The system found no records requiring a Yamato send. |
| `RSLT_YAMATO_SEND_NG2` | Constant | Result code "2" — Extraction batch running error. A data extraction batch is in progress, blocking the send request. |
| `RSLT_YAMATO_SEND_NG3` | Constant | Result code "3" — Send batch running error. A Yamato send batch is already in progress. |
| `RSLT_YAMATO_SEND_OK` | Constant | Result code "0" — Normal completion. The Yamato send was initiated successfully. |
| `X31SDataBeanAccess` | Class | Web form DataBean that carries the current screen's input data (customer ID, service details, etc.) between the view and logic layers |
| `KKSV0697Flow` | BPM Service | Enterprise Java Bean that orchestrates the Yamato send business process. Contains operations for delivery data extraction, batch management, and postal send execution. |
| `KKSV0697OP` | Service Operation | Operation ID for the Yamato send sub-process within `KKSV0697Flow` |
| `KKSV0697_KKSV0697OPDBMapper` | Mapper | Data mapping class that prepares input parameters (SC codes, function codes, bean references) for the KKSV0697OP service invocation |
| SC01-SC04 | Sub-process | Service Component sub-processes: SC01 (delivery processing dependency type), SC02 (delivery address change), SC03 (batch extraction), SC04 (Yamato send batch) |
| `dlyd_trn_req_sbt_cd_k` | Field | Delivery processing dependency type code — identifies the type of delivery-related processing requested |
| `EKB0930_NW` | Message Code | Error message template key for notification failure scenarios (used for all three error branches) |
| `EKB7950__I` | Message Code | Informational message template key for successful Yamato send notification |
| `JPCModelConstant.FUNC_CD_1` | Constant | Function code 1 — used in setKKSV069701SC for initial setup |
| `JPCModelConstant.FUNC_CD_2` | Constant | Function code 2 — used in setKKSV069702SC and setKKSV069703SC |
| `JPCModelConstant.FUNC_CD_3` | Constant | Function code 3 — used in setKKSV069704SC for final send batch |
| `JCCWebCommon.setMessageInfo` | Utility | Framework utility to set a message for display on the web screen to the end user |
| `getKKSV0697Result` | Method | Extracts the result code string from the service invocation output map |
| BPM | Acronym | Business Process Management — the middleware framework (Fujitsu Futurity BP) used for orchestrating business processes via EJB |

---

---
