# Business Logic — KKW02501SFLogic.actionInit() [124 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02501SF.KKW02501SFLogic` |
| Layer | Web / Screen Logic (Controller layer — extends `JCCWebBusinessLogic`) |
| Module | `KKW02501SF` (Package: `eo.web.webview.KKW02501SF`) |

## 1. Role

### KKW02501SFLogic.actionInit()

This method is the **initial display (entry) handler** for the **E-Mail Information Update** screen — a web page that allows K-Opticom customers and call-center agents to update, cancel, restore, or cancel reservation of E-Mail service details attached to an Option Service contract. It is the screen's entry-point `actionInit()` invoked after a user navigates from the **Option Service Contract List** screen.

The method follows a **preparation - service - post-processing** pattern common in the X31 web framework. First, it acquires screen context and the current service form DataBean. Then, it populates input maps via `setInitsrv()` and dispatches to the underlying business service (`doService` calling `KKSV0427` / `KKSV0427OP`). After the service returns, it stores the results back into the DataBean via `storeDataBeanInitsrv()`.

The **core business logic** of `actionInit()` lies in the message-display and update-blocking section at the end. It reads the **process division** (`trans_div`) and **Option Service contract status** (`op_svc_kei_stat`) from the DataBean and applies conditional rules: depending on whether the screen represents a **Change**, **Cancellation**, **Restoration**, or **Reservation Cancellation** operation, it checks if the Option Service's current status permits the requested operation. If the status does not match an allowed set, the method displays a localized error message (e.g., "E-Mail Information — Change") and disables the update flag (`CHG_KAHI_FLG = false`) to prevent the user from proceeding with an invalid operation.

This method is the **primary entry point** for screen KKW02501SF and is called by multiple screens that use its DataBean as a shared reference, notably `KKA17001SFLogic` (the parent screen that passes customer contract inheritance context into KKW02501SF).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionInit entry"])
    INIT_VARS["Initialize maps and variables"]
    GET_BEAN["Get service form bean"]
    GET_SCREEN["Get screen info"]
    SET_HKTGI["setHktjiBean"]
    SET_INITSRV["setInitsrv"]
    CALL_SERVICE["doService"]
    STORE_BEAN["storeDataBeanInitsrv"]
    GET_TRAN_DIV["Get trans_div from DataBean"]
    GET_STAT["Get op_svc_kei_stat from DataBean"]
    COND_TRAN{trans_div check}

    COND_TRAN --> |03 Change| BRANCH_CHGE
    COND_TRAN --> |04 Cancellation| BRANCH_DSL
    COND_TRAN --> |05 Restoration| BRANCH_KAIHK
    COND_TRAN --> |06 Reservation Cancel| BRANCH_RSV
    COND_TRAN --> |other| END_NODE

    BRANCH_CHGE --> CHGE_STAT{SVC_KEI_STAT check}
    CHGE_STAT --> |010 020 030 100| CHGE_OK
    CHGE_STAT --> |other| CHGE_BLOCK

    BRANCH_DSL --> DSL_STAT{SVC_KEI_STAT check}
    DSL_STAT --> |030 100 210| DSL_OK
    DSL_STAT --> |other| DSL_BLOCK

    BRANCH_KAIHK --> KAIHK_STAT{SVC_KEI_STAT check}
    KAIHK_STAT --> |910| KAIHK_OK
    KAIHK_STAT --> |other| KAIHK_BLOCK

    BRANCH_RSV --> RSV_STAT{SVC_KEI_STAT check}
    RSV_STAT --> |010 020 030 100| RSV_OK
    RSV_STAT --> |other| RSV_BLOCK

    CHGE_OK --> END_NODE
    CHGE_BLOCK --> END_NODE
    DSL_OK --> END_NODE
    DSL_BLOCK --> END_NODE
    KAIHK_OK --> END_NODE
    KAIHK_BLOCK --> END_NODE
    RSV_OK --> END_NODE
    RSV_BLOCK --> END_NODE

    node1["Initialize maps and variables"] --> node2
    node2["Get service form bean"] --> node3
    node3["Get screen info"] --> node4
    node4["setHktjiBean"] --> node5
    node5["setInitsrv"] --> node6
    node6["doService"] --> node7
    node7["storeDataBeanInitsrv"] --> node8
    node8["Get trans_div"] --> node9
    node9["Get op_svc_kei_stat"] --> COND_TRAN
```

**Flow breakdown:**

1. **Initialization phase (L204–222):** Declare local `HashMap` variables for service input/output, create a `msgInfo` String array, acquire the `X31SDataBeanAccess` form bean, and store it in a single-element array.

2. **Screen context acquisition (L224–225):** Call `JCCWebCommon.getScreenInfo(this)` to populate screen context information.

3. **Bean setup (L227–228):** Call `setHktgiBean(paramBean)` to set up the customer contract inheritance list DataBean.

4. **Input map preparation (L230–232):** Create the `inputMap` and call `setInitsrv(paramBean, inputMap)` to populate input data for the service.

5. **Service dispatch (L234–235):** Create `outputMap` and call `doService("KKSV0427", "KKSV0427OP", inputMap, outputMap)` to invoke the backend business logic.

6. **Output mapping (L238–239):** Call `storeDataBeanInitsrv(paramBean, outputMap)` to map the service output back into the DataBean.

7. **Process division determination (L242–321):** Read `trans_div` and `op_svc_kei_stat` from the DataBean and execute status validation logic based on the operation type (Change, Cancellation, Restoration, Reservation Cancellation).

8. **Logging and return (L324–325):** Dump the DataBean for debugging and return `true`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This is an instance method with no parameters; it operates entirely on instance state and the X31 DataBean framework. |

**Instance fields and external state read:**

| Source | Usage |
|--------|-------|
| `super.getServiceFormBean()` | Returns the `X31SDataBeanAccess` containing the current screen state and all form fields |
| `super` (JCCWebBusinessLogic) | Provides `getScreenInfo()` for screen context retrieval |
| `this` (KKW02501SFLogic instance) | Passed to service methods and message-setting calls for context |
| `INFO_MSGSTRING[]` | Static constant array with Japanese message strings for each operation type |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getScreenInfo` | JCCWebCommon | - | Reads screen context information (screen ID, navigation source) |
| - | `setHktgiBean` | KKW02501SFLogic (internal) | - | Sets up the customer contract inheritance list DataBean for multi-customer scenarios |
| - | `setInitsrv` | KKW02501SFLogic (internal) | - | Populates the input Map with service parameters (DataBean fields, system IDs) |
| - | `doService` | KKW02501SFLogic (internal) | - | Dispatches to CBS `KKSV0427` with operation `KKSV0427OP` — invokes backend business logic |
| - | `storeDataBeanInitsrv` | KKW02501SFLogic (internal) | - | Maps service output back into the DataBean for display on the screen |
| - | `JKKAddSupportCC.setMessageInfo` | JKKAddSupportCC | - | Sets localized message for screen display |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Reads values from the DataBean by key (TRAN_DIV, OP_SVC_KEI_STAT) |
| - | `X31SDataBeanAccess.sendMessageBoolean` | X31SDataBeanAccess | - | Sets the update availability flag (CHG_KAHI_FLG) in the DataBean |
| - | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Sets localized message info for screen display with message code and parameters |

**Notes on the service dispatch:**

- The `doService("KKSV0427", "KKSV0427OP", ...)` call invokes a business service component (CBS) identified by screen code `KKSV0427` and operation `KKSV0427OP`. This CBS performs the backend data retrieval and processing for the E-Mail information update screen. The actual SC/CBS and database table mappings are defined in the CBS layer and are not directly visible in this method.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKA17001SF | `KKA17001SFLogic.actionInit()` -> creates KKW02501SFLogic -> calls `actionInit()` | `doService [R] KKSV0427_CBS` |
| 2 | Screen:KKA16801SF | `KKA16801SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 3 | Screen:KKA16101SF | `KKA16101SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 4 | Screen:KKA15001SF | `KKA15001SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 5 | Screen:KKA06601SF | `KKA06601SFLogic.actionInit()` | Self-defined actionInit |
| 6 | Screen:KKA16401SF | `KKA16401SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 7 | Screen:KKA16601SF | `KKA16601SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 8 | Screen:KKA15201SF | `KKA15201SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 9 | Screen:KKA17101SF | `KKA17101SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 10 | Screen:KKA17001SF (copy) | `KKA17001SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 11 | Screen:KKA18001SF | `KKA18001SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 12 | Screen:KKA16201SF | `KKA16201SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 13 | Screen:KKA14701SF | `KKA14701SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 14 | Screen:KKA14201SF | `KKA14201SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |
| 15 | Screen:KKA16301SF | `KKA16301SFLogic.actionInit()` -> `this.actionInit()` (self) | Self-defined actionInit |

**Primary caller (most relevant):** `KKA17001SFLogic` is the key caller. It constructs the input context (SYSID, SVC_KEI_NO, TRAN_DIV, IDO_DIV, OP_SVC_KEI_NO, OP_SVC_KEI_STAT, MSKM_NO, etc.) into the DataBean before calling `KKW02501SFLogic.actionInit()`. This screen acts as a **wrapper** that pre-processes customer contract inheritance data and delegates to KKW02501SF for the E-Mail update logic.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Variable declarations (L204)

> Declares local HashMap variables and message array for service interaction.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = null` // Service input Map for creating service call data |
| 2 | SET | `outputMap = null` // Service output Map for obtaining data from service |
| 3 | SET | `msgInfo = new String[1]` // Message display buffer — 1-element String array |

**Block 2** — [SET] DataBean acquisition (L212–213)

> Acquires the service form DataBean and wraps it in a single-element array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean = super.getServiceFormBean()` // Gets X31SDataBeanAccess from parent |
| 2 | SET | `paramBean = {bean}` // Wraps bean in single-element array for pass-by-ref |

**Block 3** — [CALL] Screen info acquisition (L224–225)

> Obtains screen context (screen ID, navigation source, etc.) from the framework.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.getScreenInfo(this)` // Reads screen info into this context |

**Block 4** — [CALL] Customer contract inheritance setup (L227–228)

> Sets up the customer contract inheritance list DataBean for multi-customer scenarios.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setHktgiBean(paramBean)` // Sets up CUST_KEI_HKTGI_LIST DataBean array |

**Block 5** — [SET + CALL] Input map preparation (L230–232)

> Creates input Map and populates it with service parameters.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = new HashMap<String, Object>()` // New HashMap for service input |
| 2 | CALL | `setInitsrv(paramBean, inputMap)` // Populates inputMap with init data |

**Block 6** — [SET + CALL] Service dispatch (L234–235)

> Creates output Map and dispatches to the backend CBS.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outputMap = new HashMap<String, Object>()` // New HashMap for service output |
| 2 | CALL | `doService("KKSV0427", "KKSV0427OP", inputMap, outputMap)` // Calls backend CBS |

**Block 7** — [CALL] Output mapping (L238–239)

> Maps the CBS output back into the DataBean for screen display.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `storeDataBeanInitsrv(paramBean, outputMap)` // Stores output into DataBean |

**Block 8** — [SET + EXEC] Read process division and status (L242–241)

> Resets msgInfo and reads the process division and Option Service contract status from the DataBean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `msgInfo = new String[1]` // Reset message buffer |
| 2 | CALL | `trans_div = bean.sendMessageString(KKW02501SFConst.TRAN_DIV, X31CWebConst.DATABEAN_GET_VALUE)` // Reads process division (L237) |
| 3 | CALL | `op_svc_kei_stat = bean.sendMessageString(KKW02501SFConst.OP_SVC_KEI_STAT, X31CWebConst.DATABEAN_GET_VALUE)` // Reads contract status (L240) |

**Block 9** — [IF] Process division = Change (OP_TRAN_DIV_CHGE = "03") (L245)

> Validates if the Option Service contract status permits a **Change** operation. Allowed statuses: 010 (Received), 020 (Under Review), 030 (Contracted), 100 (Service In Progress).

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.OP_TRAN_DIV_CHGE.equals(trans_div)` // OP_TRAN_DIV_CHGE = "03" (Change) (L245) |

**Block 9.1** — [IF] Status check within Change branch (L248–253)

> If status is one of the allowed values, do nothing (allow change). Otherwise, show error and disable update.

| # | Type | Code |
|---|------|------|
| 1 | IF | `op_svc_kei_stat` is one of: SVC_KEI_STAT_010="010", SVC_KEI_STAT_020="020", SVC_KEI_STAT_030="030", SVC_KEI_STAT_100="100" (L248–251) |
| 2 | EXEC | (empty block — allowed, proceed) |
| 3 | ELSE | Status is not in allowed set (L253) |
| 4 | SET | `str = {"Change", "Option Service"}` // Japanese: {"変更", "オプションサービス"} (L257) |
| 5 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1510_KW, str)` // Error message display |
| 6 | CALL | `paramBean[0].sendMessageBoolean(CHG_KAHI_FLG, X31CWebConst.DATABEAN_SET_VALUE, false)` // Disable update flag |

**Block 10** — [ELSE IF] Process division = Cancellation (OP_TRAN_DIV_DSL = "04") (L265)

> Validates if the Option Service contract status permits a **Cancellation** operation. Allowed statuses: 030 (Contracted), 100 (Service In Progress), 210 (Suspended/Terminated).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `JKKCommonConst.OP_TRAN_DIV_DSL.equals(trans_div)` // OP_TRAN_DIV_DSL = "04" (Cancellation) (L265) |

**Block 10.1** — [IF] Status check within Cancellation branch (L266–277)

| # | Type | Code |
|---|------|------|
| 1 | IF | `op_svc_kei_stat` is one of: SVC_KEI_STAT_030="030", SVC_KEI_STAT_100="100", SVC_KEI_STAT_210="210" (L266–268) |
| 2 | EXEC | (empty block — allowed, proceed) |
| 3 | ELSE | Status is not in allowed set (L271) |
| 4 | SET | `str = {"Cancellation", "Option Service"}` // Japanese: {"解約", "オプションサービス"} (L275) |
| 5 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1510_KW, str)` // Error message display |
| 6 | CALL | `paramBean[0].sendMessageBoolean(CHG_KAHI_FLG, X31CWebConst.DATABEAN_SET_VALUE, false)` // Disable update flag |

**Block 11** — [ELSE IF] Process division = Restoration (OP_TRAN_DIV_KAIHK = "05") (L283)

> Validates if the Option Service contract status permits a **Restoration** operation. Only status 910 (Cancelled) is allowed.

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `JKKCommonConst.OP_TRAN_DIV_KAIHK.equals(trans_div)` // OP_TRAN_DIV_KAIHK = "05" (Restoration) (L283) |

**Block 11.1** — [IF] Status check within Restoration branch (L284–297)

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.SVC_KEI_STAT_910.equals(op_svc_kei_stat)` // SVC_KEI_STAT_910 = "910" (L284) |
| 2 | SET | `msgInfo[0] = INFO_MSGSTRING[2]` // "E-Mail Information Restoration" (L287) |
| 3 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0370__I, msgInfo)` // Information message display |
| 4 | ELSE | Status is not "910" (Cancelled) (L292) |
| 5 | SET | `str = {"Restoration", "Option Service"}` // Japanese: {"回復", "オプションサービス"} (L296) |
| 6 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1510_KW, str)` // Error message display |
| 7 | CALL | `paramBean[0].sendMessageBoolean(CHG_KAHI_FLG, X31CWebConst.DATABEAN_SET_VALUE, false)` // Disable update flag |

**Block 12** — [ELSE IF] Process division = Reservation Cancellation (OP_TRAN_DIV_RSV_CL = "06") (L303)

> Validates if the Option Service contract status permits a **Reservation Cancellation** operation. Allowed statuses: 010 (Received), 020 (Under Review), 030 (Contracted), 100 (Service In Progress).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `JKKCommonConst.OP_TRAN_DIV_RSV_CL.equals(trans_div)` // OP_TRAN_DIV_RSV_CL = "06" (Reservation Cancellation) (L303) |

**Block 12.1** — [IF] Status check within Reservation Cancellation branch (L304–317)

| # | Type | Code |
|---|------|------|
| 1 | IF | `op_svc_kei_stat` is one of: SVC_KEI_STAT_010="010", SVC_KEI_STAT_020="020", SVC_KEI_STAT_030="030", SVC_KEI_STAT_100="100" (L304–307) |
| 2 | SET | `msgInfo[0] = INFO_MSGSTRING[3]` // "E-Mail Information Reservation Cancellation" (L310) |
| 3 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0370__I, msgInfo)` // Information message display |
| 4 | ELSE | Status is not in allowed set (L314) |
| 5 | SET | `str = {"Reservation Cancellation", "Option Service"}` // Japanese: {"予約取消", "オプションサービス"} (L318) |
| 6 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1510_KW, str)` // Error message display |
| 7 | CALL | `paramBean[0].sendMessageBoolean(CHG_KAHI_FLG, X31CWebConst.DATABEAN_SET_VALUE, false)` // Disable update flag |

**Block 13** — [EXEC + RETURN] Logging and return (L324–325)

> Dumps the DataBean to the log for debugging purposes and returns true to indicate successful initialization.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JSYwebLog.println(JSYwebLog.DataBean_Dump, getClass(), dumpDatabean(), null, null, null)` // DataBean dump to log |
| 2 | RETURN | `return true` // Normal completion |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `TRAN_DIV` | Field | Process division — classifies the type of operation (Change, Cancellation, Restoration, Reservation Cancellation) being performed on the E-Mail service |
| `OP_SVC_KEI_STAT` | Field | Option Service contract status — the current lifecycle status of the Option Service contract that the E-Mail service is attached to |
| `CHG_KAHI_FLG` | Field | Update availability flag — boolean flag controlling whether the screen's update/confirm buttons are enabled; set to `false` when the operation is not permitted for the current status |
| `EKB1510_KW` | Constant | Message code — displayed when an operation is blocked due to incompatible Option Service status; shows the operation type (e.g., "Change") paired with "Option Service" |
| `EKB0370__I` | Constant | Message code — displayed for informational messages (e.g., restoration confirmation, reservation cancellation confirmation) |
| `SVC_KEI_STAT_010` | Constant | Service detail status "010" — Received/Processed (acceptance completed) |
| `SVC_KEI_STAT_020` | Constant | Service detail status "020" — Under Review (waiting for review/approval) |
| `SVC_KEI_STAT_030` | Constant | Service detail status "030" — Contracted (contract completed, service not yet started) |
| `SVC_KEI_STAT_100` | Constant | Service detail status "100" — Service In Progress (active service) |
| `SVC_KEI_STAT_210` | Constant | Service detail status "210" — Suspended/Terminated (service temporarily or permanently halted) |
| `SVC_KEI_STAT_910` | Constant | Service detail status "910" — Cancelled (full cancellation completed) |
| `OP_TRAN_DIV_CHGE` | Constant | Process division "03" — Change operation (updating E-Mail details) |
| `OP_TRAN_DIV_DSL` | Constant | Process division "04" — Cancellation operation (cancelling E-Mail service) |
| `OP_TRAN_DIV_KAIHK` | Constant | Process division "05" — Restoration operation (restoring a cancelled E-Mail service) |
| `OP_TRAN_DIV_RSV_CL` | Constant | Process division "06" — Reservation Cancellation (cancelling a pending/reserved operation) |
| `INFO_MSGSTRING[0]` | Constant | "E-Mail Information Change" — Japanese: "Eメール情報の変更" |
| `INFO_MSGSTRING[1]` | Constant | "E-Mail Information Cancellation" — Japanese: "Eメール情報の解約" |
| `INFO_MSGSTRING[2]` | Constant | "E-Mail Information Restoration" — Japanese: "Eメール情報の回復" |
| `INFO_MSGSTRING[3]` | Constant | "E-Mail Information Reservation Cancellation" — Japanese: "Eメール情報の予約取消" |
| KKW02501SF | Screen Code | E-Mail Information Update screen — allows updating/cancelling/restoring E-Mail service details |
| KKSV0427 | CBS Code | Backend business service component for the Option Service Contract List screen (data preparation) |
| KKSV0427OP | CBS Operation | Operation code within KKSV0427 for processing the Option Service contract operations |
| OneStopDataBeanAccess | DataBean Framework | X31 framework class for accessing DataBean fields via message-based key-value access pattern |
| X31SDataBeanAccess | DataBean Class | Framework class representing the service form DataBean carrying all screen fields and state |
| JCCWebBusinessLogic | Parent Class | Base class for all web screen logic classes in the X31 framework; provides `getServiceFormBean()` and `getScreenInfo()` |
| E-Mail Information | Business Domain | The set of E-Mail service configuration details (address, capacity, virus check, alias) attached to an Option Service contract |
| Option Service | Business Domain | A bundled service offering in K-Opticom's product portfolio that includes E-Mail, internet, and other services |
| Customer Contract Inheritance | Business Domain | The relationship between a main customer contract and associated Option Service sub-contracts; allows viewing/updating E-Mail settings across inherited contracts |
