# Business Logic — KKW02510SFLogic.actionInit() [122 LOC]

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

## 1. Role

### KKW02510SFLogic.actionInit()

This method performs the **initial display processing** (初期表示処理) for the Multi-Session Information Update screen (KKW02510SF). It serves as the entry point when a customer navigates to the optional service contract update screen, where they can view and manage their option service subscriptions (e.g., FTTH, mail services, IP additions).

The method executes in three logical phases as described in its Javadoc: **First**, it maps and prepares DataBean fields with inherited customer contract information from the previous screen by calling `setHktgiBean`, `setInitsrv`, and `getScreenInfo`. **Second**, it delegates to the backend service layer via `doService` with screen ID `"KKSV0071"` and operation `"KKSV0071OP"` to fetch live option service contract data. **Third**, it maps the service response back to the DataBean through `storeDataBeanInitsrv` and applies business-rule-based access controls.

A critical business responsibility of this method is **transaction division-based message output and update restriction**. After retrieving the transaction division (`trans_div`) and the option service contract status (`op_svc_kei_stat`) from the DataBean, the method evaluates a multi-branch conditional chain. Depending on whether the division is "change" (03), "cancellation" (04), "restoration" (05), or "reservation cancellation" (06), it either permits the screen to render normally, displays a contextual informational message (e.g., for restoration completed or reservation cancelled states), or locks the update capability by setting `CHG_KAHI_FLG` to `false` and showing an error that the selected operation is unavailable for the current service status.

The method follows the **dispatch/delegation pattern**: it collects screen state, prepares service inputs, calls a remote service component, and then maps outputs — a standard MVC entry-point flow in the K-Opticom web framework.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionInit entry"])
    INIT_VARS["Initialize variables: inputMap, outputMap, msgInfo"]
    GET_BEAN["Get X31SDataBeanAccess from super.getServiceFormBean"]
    GET_SCREEN["JCCWebCommon.getScreenInfo - Read screen info"]
    SET_HKTGI["setHktgiBean - Set customer contract inheritance"]
    CREATE_INPUT["Create new HashMap for inputMap"]
    SET_INITSRV["setInitsrv - Prepare init service data"]
    CREATE_OUTPUT["Create new HashMap for outputMap"]
    CALL_SVC["doService KKSV0071 - Execute init service"]
    STORE_DATA["storeDataBeanInitsrv - Map service response to DataBean"]
    GET_TRAN_DIV["Get TRAN_DIV from DataBean"]
    GET_OP_STAT["Get OP_SVC_KEI_STAT from DataBean"]
    CHECK_TRAN["Check trans_div value"]
    MSG_DUMP["JSYwebLog.println - Log DataBean dump"]
    RETURN["Return true"]

    START --> INIT_VARS --> GET_BEAN --> GET_SCREEN --> SET_HKTGI --> CREATE_INPUT --> SET_INITSRV --> CREATE_OUTPUT --> CALL_SVC --> STORE_DATA --> GET_TRAN_DIV --> GET_OP_STAT --> CHECK_TRAN --> MSG_DUMP --> RETURN
```

**Branch Details — Transaction Division Processing:**

| # | Condition | Branch Meaning |
|---|-----------|---------------|
| 1 | `OP_TRAN_DIV_CHGE = "03"` | Processing division = Change (変更) |
| 2 | `OP_TRAN_DIV_DSL = "04"` | Processing division = Cancellation (解約) |
| 3 | `OP_TRAN_DIV_KAIHK = "05"` | Processing division = Restoration (回復) |
| 4 | `OP_TRAN_DIV_RSV_CL = "06"` | Processing division = Reservation Cancellation (予約取消) |

Within each division branch, the `op_svc_kei_stat` values are checked:

| Status Code | Business Meaning |
|-------------|------------------|
| `"010"` | Accepted (受取済) |
| `"020"` | Verified (照查済) |
| `"030"` | Closed (締済) |
| `"100"` | Service Active (サービス提供中) |
| `"210"` | Suspended/Interrupted (休止・中断中) |
| `"910"` | Cancelled (解除済) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It reads state from inherited session/scopes via `super.getServiceFormBean()` and `super.getScreenInfo()`. |

**Instance Fields / External State Read:**

| Source | Access Method | Business Description |
|--------|---------------|---------------------|
| `super.serviceFormBean` | `getServiceFormBean()` | Shared form DataBean carrying session-scoped customer and contract data |
| `this` (logic instance) | `getScreenInfo(this)` | Receives screen context (parameters, previous screen state) via the framework |
| `KKW02510SFConst` | Static constants | Field keys used to read/write DataBean values (TRAN_DIV, OP_SVC_KEI_STAT, CHG_KAHI_FLG) |
| `X31CWebConst` | Static constants | DataBean operation codes (DATABEAN_GET_VALUE, DATABEAN_SET_VALUE) |
| `JKKCommonConst` | Static constants | Transaction division codes and service status codes |
| `JPCOnlineMessageConstant` | Static constants | Message ID keys for display/error messages |

## 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 | - | Calls `getScreenInfo` in `JCCWebCommon` to retrieve screen context and passed parameters |
| - | `KKW02510SFLogic.setHktgiBean` | KKW02510SFLogic | - | Internal helper to populate DataBean with customer contract inheritance data |
| - | `KKW02510SFLogic.setInitsrv` | KKW02510SFLogic | - | Internal helper to prepare init service input map with DataBean values |
| - | `KKW02510SFLogic.storeDataBeanInitsrv` | KKW02510SFLogic | - | Internal helper to map service response output into DataBean fields |
| - | `KKW02510SFLogic.doService` | KKW02510SFLogic | - | Delegates to remote service component `KKSV0071` / `KKSV0071OP` |
| R | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Reads string values from DataBean (TRAN_DIV, OP_SVC_KEI_STAT) |
| W | `OneStopDataBeanAccess.sendMessageBoolean` | OneStopDataBeanAccess | - | Writes boolean flag (CHG_KAHI_FLG) to DataBean |
| - | `JKKAddSupportCC.setMessageInfo` | JKKAddSupportCC | - | Sets display message for change division error |
| - | `JKKCreateNhkDntIktCC.setMessageInfo` | JKKCreateNhkDntIktCC | - | Sets informational display messages |
| - | `JKKFumeiKktkSvcKeiUpdCC.setMessageInfo` | JKKFumeiKktkSvcKeiUpdCC | - | Sets informational messages |
| - | `JKKGetKikiUpdCodeNameCC.setMessageInfo` | JKKGetKikiUpdCodeNameCC | - | Sets informational messages |
| - | `JKKGetKojiAkTaknkikiCC.setMessageInfo` | JKKGetKojiAkTaknkikiCC | - | Sets informational messages |

**How to classify:**
- **C** (Create): Methods with names like insert\*, create\*, add\*, save\*, persist\*, register\*, execute\*Add\*
- **R** (Read): Methods with names like find\*, get\*, select\*, search\*, load\*, fetch\*, call\*SC\* (service calls that query data)
- **U** (Update): Methods with names like update\*, set\*, modify\*, merge\*, change\*
- **D** (Delete): Methods with names like delete\*, remove\*, drop\*, cancel\*

**How to find SC Code:**
- Look at the method name itself — if it contains a pattern like `callEKK0361A010SC`, the SC Code is `EKK0361A010SC`
- Use `search_files` to find the method definition and check its containing class name for SC/CBS patterns
- SC Codes typically match: `[A-Z]{3}\d{4}[A-Z]\d{3}(SC|CBS)`

**How to find Entity/DB tables:**
- Use `read_file` to read the source of called methods (e.g., `executeOdrHakkoJokenAdd`)
- Search for table name constants: `KK_T_*`, `ZM_M_*`, or similar patterns
- Search for SQL operations or entity references in the called method
- Use `search_files` with pattern `*CBS*` or `*SC*` to find service component implementations

## 5. Dependency Trace

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0071 | `KKSV0071Controller.actionInit` -> `KKW02510SFLogic.actionInit` | `doService [R] KKSV0071/KKSV0071OP` |
| 2 | Self (internal) | `KKW02510SFLogic.actionInit` -> `setHktgiBean` -> `setInitsrv` -> `doService` | `KKW02510SFLogic [internal] DataBean read/write` |

**Notes on callers:**
- The `KKSV0071` screen is the primary entry point that invokes this `actionInit` method during its initial load phase.
- No other classes directly reference `KKW02510SFLogic.actionInit` in the search results, indicating this is a screen-specific entry point used only by the KKSV0071 initial display flow.

## 6. Per-Branch Detail Blocks

### Block 1 — Variable Initialization (L94)

> Initializes local variables for input/output maps, message display, and data bean access.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap<String, Object> inputMap = null;` // Input map for service [-> inputMap] |
| 2 | SET | `HashMap<String, Object> outputMap = null;` // Output map from service [-> outputMap] |
| 3 | SET | `String[] msgInfo = new String[1];` // Message display buffer |
| 4 | EXEC | `X31SDataBeanAccess bean = super.getServiceFormBean();` // Get shared form bean [-> getServiceFormBean] |
| 5 | SET | `X31SDataBeanAccess[] paramBean = {bean};` // Wrap bean in array for method calls |

### Block 2 — Screen Info Retrieval and Bean Setup (L104–L107)

> Retrieves screen context from the previous screen and sets customer contract inheritance data into the DataBean.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.getScreenInfo(this);` // Get screen info from previous screen [R] JCCWebCommon |
| 2 | CALL | `setHktgiBean(paramBean);` // Set customer contract inheritance list [internal] KKW02510SFLogic |

### Block 3 — Service Input Preparation (L110–L112)

> Creates input map and prepares init service data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = new HashMap<String, Object>();` // Initialize input map |
| 2 | CALL | `setInitsrv(paramBean, inputMap);` // Prepare init service data [internal] KKW02510SFLogic |

### Block 4 — Service Execution (L115–L116)

> Calls the backend service component to retrieve option service contract data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outputMap = new HashMap<String, Object>();` // Initialize output map |
| 2 | CALL | `doService("KKSV0071", "KKSV0071OP", inputMap, outputMap);` // Execute init service [R] KKSV0071/KKSV0071OP |

### Block 5 — DataBean Mapping (L119–L120)

> Maps service response data into the DataBean for screen rendering.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `storeDataBeanInitsrv(paramBean, outputMap);` // Map response to DataBean [internal] KKW02510SFLogic |
| 2 | SET | `msgInfo = new String[1];` // Reset message buffer |

### Block 6 — Transaction Division and Status Retrieval (L123–L126)

> Reads the transaction division and option service contract status from the DataBean for business rule evaluation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `trans_div = bean.sendMessageString(KKW02510SFConst.TRAN_DIV, X31CWebConst.DATABEAN_GET_VALUE);` // Get processing division [R] DataBean |
| 2 | SET | `op_svc_kei_stat = bean.sendMessageString(KKW02510SFConst.OP_SVC_KEI_STAT, X31CWebConst.DATABEAN_GET_VALUE);` // Get option service contract status [R] DataBean |

### Block 7 — IF: Transaction Division = Change (変更) (L129–L145)

> When the processing division is "change" (OP_TRAN_DIV_CHGE = "03"), validate that the service status allows modification.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.OP_TRAN_DIV_CHGE.equals(trans_div)` [OP_TRAN_DIV_CHGE = "03" (変更 = Change)] (L129) |
| 2 | IF-INNER | `SVC_KEI_STAT_020 \|\| SVC_KEI_STAT_030 \|\| SVC_KEI_STAT_100.equals(op_svc_kei_stat)` [020=照查済, 030=締済, 100=サービス提供中] (L131–134) |
| 2.1 | SET | `;` // no-op — service status is valid, allow screen render |
| 2.2 | ELSE | (L135) |
| 2.2.1 | SET | `String[] str = {"変更","オプションサービス"};` // Error message args: "Change", "Option Service" |
| 2.2.2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1510_KW, str);` // Set error message [W] JCCWebCommon |
| 2.2.3 | EXEC | `paramBean[0].sendMessageBoolean(KKW02510SFConst.CHG_KAHI_FLG, X31CWebConst.DATABEAN_SET_VALUE, false);` // Disable update flag [W] DataBean |

### Block 8 — ELSE IF: Transaction Division = Cancellation (解約) (L146–L162)

> When the processing division is "cancellation" (OP_TRAN_DIV_DSL = "04"), validate that the service status allows cancellation.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `JKKCommonConst.OP_TRAN_DIV_DSL.equals(trans_div)` [OP_TRAN_DIV_DSL = "04" (解約 = Cancellation)] (L146) |
| 2 | IF-INNER | `SVC_KEI_STAT_030 \|\| SVC_KEI_STAT_100 \|\| SVC_KEI_STAT_210.equals(op_svc_kei_stat)` [030=締済, 100=サービス提供中, 210=休止・中断中] (L147–149) |
| 2.1 | SET | `;` // no-op — service status is valid for cancellation |
| 2.2 | ELSE | (L150) |
| 2.2.1 | SET | `String[] str = {"解約","オプションサービス"};` // Error message args: "Cancellation", "Option Service" |
| 2.2.2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1510_KW, str);` // Set error message [W] JCCWebCommon |
| 2.2.3 | EXEC | `paramBean[0].sendMessageBoolean(KKW02510SFConst.CHG_KAHI_FLG, X31CWebConst.DATABEAN_SET_VALUE, false);` // Disable update flag [W] DataBean |

### Block 9 — ELSE IF: Transaction Division = Restoration (回復) (L163–L177)

> When the processing division is "restoration" (OP_TRAN_DIV_KAIHK = "05"), display informational message if service is cancelled (910), otherwise show error and disable update.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `JKKCommonConst.OP_TRAN_DIV_KAIHK.equals(trans_div)` [OP_TRAN_DIV_KAIHK = "05" (回復 = Restoration)] (L163) |
| 2 | IF-INNER | `SVC_KEI_STAT_910.equals(op_svc_kei_stat)` [910=解除済 = Cancelled] (L165) |
| 2.1 | SET | `msgInfo[0] = INFO_MSGSTRING[2];` // Restore informational message [-> INFO_MSGSTRING index 2] |
| 2.2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0370__I, msgInfo);` // Display info message [W] JCCWebCommon |
| 2.3 | ELSE | (L167) |
| 2.3.1 | SET | `String[] str = {"回復","オプションサービス"};` // Error message args: "Restoration", "Option Service" |
| 2.3.2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1510_KW, str);` // Set error message [W] JCCWebCommon |
| 2.3.3 | EXEC | `paramBean[0].sendMessageBoolean(KKW02510SFConst.CHG_KAHI_FLG, X31CWebConst.DATABEAN_SET_VALUE, false);` // Disable update flag [W] DataBean |

### Block 10 — ELSE IF: Transaction Division = Reservation Cancellation (予約取消) (L178–L196)

> When the processing division is "reservation cancellation" (OP_TRAN_DIV_RSV_CL = "06"), display informational message if service status is one of the valid pre-service states, otherwise show error and disable update.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `JKKCommonConst.OP_TRAN_DIV_RSV_CL.equals(trans_div)` [OP_TRAN_DIV_RSV_CL = "06" (予約取消 = Reservation Cancellation)] (L178) |
| 2 | IF-INNER | `SVC_KEI_STAT_010 \|\| SVC_KEI_STAT_020 \|\| SVC_KEI_STAT_030 \|\| SVC_KEI_STAT_100.equals(op_svc_kei_stat)` [010=受取済, 020=照查済, 030=締済, 100=サービス提供中] (L179–182) |
| 2.1 | SET | `msgInfo[0] = INFO_MSGSTRING[3];` // Reservation cancellation informational message [-> INFO_MSGSTRING index 3] |
| 2.2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0370__I, msgInfo);` // Display info message [W] JCCWebCommon |
| 2.3 | ELSE | (L184) |
| 2.3.1 | SET | `String[] str = {"予約取消","オプションサービス"};` // Error message args: "Reservation Cancellation", "Option Service" |
| 2.3.2 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1510_KW, str);` // Set error message [W] JCCWebCommon |
| 2.3.3 | EXEC | `paramBean[0].sendMessageBoolean(KKW02510SFConst.CHG_KAHI_FLG, X31CWebConst.DATABEAN_SET_VALUE, false);` // Disable update flag [W] DataBean |

### Block 11 — DataBean Log Output (L199)

> Dumps the DataBean state to the log for debugging purposes.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JSYwebLog.println(JSYwebLog.DataBean_Dump, getClass(), dumpDatabean(), null, null, null);` // Debug DataBean dump |

### Block 12 — Return (L202)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Normal end |

## 7. Glossary

Define ALL domain-specific terms, Japanese field names, and technical abbreviations used in this method. This section makes the document accessible to Business Analysts (BA) who may not be familiar with the codebase's naming conventions.

| Term | Type | Business Meaning |
|------|------|------------------|
| `actionInit` | Method | Initial display processing — entry point for screen initialization in the K-Opticom web framework |
| `TRAN_DIV` | Field | Processing division code — identifies the type of operation the user intends to perform on the option service contract |
| `OP_SVC_KEI_STAT` | Field | Option service contract status — current lifecycle state of the customer's option service subscription |
| `CHG_KAHI_FLG` | Field | Update enable flag — when `false`, the screen disables all update fields (grayed out) |
| `setHktgiBean` | Method | Sets customer contract inheritance list into the DataBean for screen rendering |
| `setInitsrv` | Method | Prepares init service input data — extracts relevant fields from the DataBean into the input map |
| `storeDataBeanInitsrv` | Method | Maps service response output back into the DataBean for the view layer |
| `doService` | Method | Delegates to the remote service component for business logic execution |
| KKSV0071 | Screen ID | Screen for optional service contract information update initial display |
| KKSV0071OP | Operation ID | Operation component for KKSV0071 |
| OP_TRAN_DIV_CHGE | Constant | Transaction division code "03" = Change (変更) — modifying existing option service settings |
| OP_TRAN_DIV_DSL | Constant | Transaction division code "04" = Cancellation (解約) — terminating the option service contract |
| OP_TRAN_DIV_KAIHK | Constant | Transaction division code "05" = Restoration (回復) — restoring a previously cancelled option service |
| OP_TRAN_DIV_RSV_CL | Constant | Transaction division code "06" = Reservation Cancellation (予約取消) — cancelling a pending reservation |
| SVC_KEI_STAT_010 | Constant | Service status "010" = Accepted (受取済) — order has been received but not yet processed |
| SVC_KEI_STAT_020 | Constant | Service status "020" = Verified (照查済) — order has passed verification checks |
| SVC_KEI_STAT_030 | Constant | Service status "030" = Closed (締済) — order has been finalized/closed |
| SVC_KEI_STAT_100 | Constant | Service status "100" = Service Active (サービス提供中) — service is currently being provided to the customer |
| SVC_KEI_STAT_210 | Constant | Service status "210" = Suspended/Interrupted (休止・中断中) — service is temporarily suspended |
| SVC_KEI_STAT_910 | Constant | Service status "910" = Cancelled (解除済) — service contract has been fully cancelled |
| EKB1510_KW | Message ID | Error message key — displayed when service status does not allow the requested operation |
| EKB0370__I | Message ID | Informational message key — displayed for context-specific informational notices |
| X31SDataBeanAccess | Class | Fujitsu X31 framework DataBean access object — carries session-scoped screen data |
| JCCWebCommon | Class | Common web utility class — provides screen info retrieval and message setting |
| JSYwebLog | Class | Web logging utility — logs DataBean state for debugging |
| FTTH | Business term | Fiber To The Home — fiber-optic internet service offered as an option service |
| Option Service | Business term | Optional add-on services (e.g., FTTH, mail services, IP addresses) that customers can subscribe to alongside their base telecom contract |
| Customer Contract Inheritance | Business term | Inheriting customer contract context from a previous screen to maintain session continuity |
