# Business Logic — KKW02519SFLogic.getSessionData() [71 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02519SF.KKW02519SFLogic` |
| Layer | Controller / Business Logic (webview layer — presentation-adjacent business logic class) |
| Module | `KKW02519SF` (Package: `eo.web.webview.KKW02519SF`) |

## 1. Role

### KKW02519SFLogic.getSessionData()

This method is responsible for initializing the screen state of the **Telephone Option Service Contract Update** (電話オプションサービス契約更新) screen by copying inherited data from the previous screen's form bean into the current screen's form bean. The business domain is K-Opticom's telecom service contract management system, specifically handling **option service contracts** (such as call forwarding, international call restriction, usage amount notification) and **sub-option service contracts** tied to a primary service contract.

The method implements a **data propagation / screen initialization** pattern. It is not a shared utility but an internal, single-purpose method called exclusively during the `actionInit()` entry point — meaning its role is tightly coupled to this specific screen (KKW02519SF: Telephone Option Service Contract Update). It retrieves a customer contract inheritance list (`CUST_KEI_HKTGI_LIST`) from the screen's data bean, extracts the first entry, and then **deep copies** a flat set of key identifying fields (system ID, service contract number, sub-option numbers, transfer reason code, etc.) plus an **array of transfer reason details** (異動理由明細) with variable cardinality.

The method handles two distinct operational modes through its final conditional block: depending on the telephone number sequence (`TELNO_JUN`) flag, it activates either the **Telephone 1 tab** or **Telephone 2 tab** option interface control code, enabling conditional UI tab visibility on the front end.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getSessionData svcFormBean"])
    START --> RETRIEVE_SCREEN["Retrieves screen info via JCCWebCommon.getScreenInfo"]
    RETRIEVE_SCREEN --> GET_LIST["Get CUST_KEI_HKTGI_LIST array from svcFormBean"]
    GET_LIST --> GET_FIRST["Get first dataBean (index 0) from array"]
    GET_FIRST --> COPY_SYSID["Copy SYSID from previous screen bean"]
    COPY_SYSID --> COPY_SVC_NO["Copy SVC_KEI_NO from previous screen bean"]
    COPY_SVC_NO --> COPY_UCWK["Copy SVC_KEI_UCWK_NO from previous screen bean"]
    COPY_UCWK --> COPY_OP["Copy OP_SVC_KEI_NO from previous screen bean"]
    COPY_OP --> COPY_SBOP["Copy SBOP_SVC_KEI_NO from previous screen bean"]
    COPY_SBOP --> COPY_IDO_DIV["Copy IDO_DIV from previous screen bean"]
    COPY_IDO_DIV --> COPY_TRAN_DIV["Copy TRAN_DIV and set tranDiv field"]
    COPY_TRAN_DIV --> COPY_MSKM["Copy MSKM_NO from previous screen bean"]
    COPY_MSKM --> CLEAR_RSN["Get IDO_RSN_CD_LIST and clear it"]
    CLEAR_RSN --> GET_COUNT["Get count of transfer reasons from previous screen bean"]
    GET_COUNT --> CHECK_COUNT{"cnt > 0"}
    CHECK_COUNT -->|Yes| LOOP_START["For i=0 to cnt-1"]
    CHECK_COUNT -->|No| CHECK_TELNO["Get TELNO_JUN from previous screen bean"]
    LOOP_START --> ADD_BEAN["Add new dataBean to idoRsnList"]
    ADD_BEAN --> SET_RSN_CD["Copy IDO_RSN_CD_02 to new bean as IDO_RSN_CD_07"]
    SET_RSN_CD --> SET_RSN_MEMO["Copy IDO_RSN_MEMO_02 to new bean as IDO_RSN_MEMO_07"]
    SET_RSN_MEMO --> INCREMENT["Increment i"]
    INCREMENT --> CHECK_I["i < cnt"]
    CHECK_I -->|Yes| LOOP_START
    CHECK_I -->|No| CHECK_TELNO
    CHECK_TELNO --> TELNO_1{"TELNO_JUN == 1?"}
    TELNO_1 -->|Yes| SET_TAB1["Set TEL_1_TAB_OP_IF_CTL_CD = 1"]
    TELNO_1 -->|No| TELNO_2{"TELNO_JUN == 2?"}
    TELNO_2 -->|Yes| SET_TAB2["Set TEL_2_TAB_OP_IF_CTL_CD = 1"]
    TELNO_2 -->|No| RETURN_END
    SET_TAB1 --> RETURN_END
    SET_TAB2 --> RETURN_END
    RETURN_END(["Return true"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcFormBean` | `X31SDataBeanAccess` | The current screen's data bean access object that holds all form-level data for the Telephone Option Service Contract Update screen. It carries the **Customer Contract Inheritance List** (`CUST_KEI_HKTGI_LIST`) — a collection of data beans populated by the previous screen with customer and service contract identifiers. It also receives the copied fields and the transfer reason detail list after this method executes. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `tranDiv` | `String` | Processing division (処理区分) — a class-level field set by this method to store the processing mode/category retrieved from the inherited bean. Used by other methods in the class to determine which processing branch to take. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getScreenInfo` | - | - | Reads screen state/information into the logic instance (metadata setup, no data layer access) |
| R | `X31SDataBeanAccess.getDataBeanArray` | - | - | Reads a named list of data beans (customer contract inheritance list) from the form bean |
| R | `X31SDataBeanAccessArray.getDataBean` | - | - | Reads the first entry (index 0) from the customer contract inheritance list array |
| R | `X31SDataBeanAccess.sendMessageString` (with DATABEAN_GET_VALUE) | - | - | Reads a string field value from the previous screen's inherited bean — used for SYSID, contract numbers, transfer reason codes/memos, and TELNO_JUN |
| R | `X31SDataBeanAccess.sendMessage` (with DATABEAN_GET_COUNT) | - | - | Reads the count of transfer reason entries from the inherited bean |
| C | `X31SDataBeanAccessArray.addDataBean` | - | - | Creates a new data bean entry in the transfer reason detail list (異動理由明細) |
| W | `X31SDataBeanAccessArray.clearArray` | - | - | Clears all existing entries in the transfer reason detail list before repopulating |
| W | `X31SDataBeanAccess.sendMessageString` (with DATABEAN_SET_VALUE) | - | - | Writes string field values to the current screen's form bean — used for all field copies and tab control codes |

**CRUD Summary:**
- **No database/Entity writes or reads** — this method operates entirely in-memory within the web-tier data bean layer.
- All operations are **screen data transfer** (propagation of state from one screen's context to another).
- The method performs 8 individual field copies, one clear + N insert loop for transfer reason details, and 2 conditional tab control code writes.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `sendMessageString` [-] (×12), `getDataBeanArray` [-] (×2), `getDataBean` [-], `clearArray` [-], `sendMessage` [-].

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKW02519SFLogic.actionInit()` | `actionInit()` → `getSessionData(svcFormBean)` | `sendMessageString [W]` (×12), `getDataBeanArray [R]` (×2), `clearArray [W]`, `addDataBean [C]` |

**Caller context:**
- `KKW02519SFLogic.actionInit()` is the **screen initialization entry point** method. It is called when the user first navigates to the Telephone Option Service Contract Update screen (KKW02519SF).
- `actionInit()` acquires the common info bean and service form bean, then calls `getSessionData(svcFormBean)` to populate the screen's data state before rendering.
- There are **no external service component (SC) or database calls** originating from this method — all operations are data bean in-memory transfers.

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] `(Screen info retrieval and inheritance list extraction)` (L1176)

> Retrieves screen metadata and extracts the customer contract inheritance list from the form bean.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.getScreenInfo(this);` // Retrieves screen info into logic instance |
| 2 | CALL | `custKeiHktgiList = svcFormBean.getDataBeanArray(KKW02519SFConst.CUST_KEI_HKTGI_LIST);` // [-> CUST_KEI_HKTGI_LIST="顧客契約引継リスト"] Gets customer contract inheritance list |
| 3 | CALL | `custKeiHktgiInf = custKeiHktgiList.getDataBean(0);` // Gets first entry from inheritance list |

**Block 2** — [FIELD COPIES] `(Copy simple scalar fields from inherited bean to current screen bean)` (L1181–L1202)

> Copies 8 individual string fields from the previous screen's inherited bean (custKeiHktgiInf) to the current screen's form bean (svcFormBean). Each copy follows the pattern: read from index-02 field → write to corresponding current-scope field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcFormBean.sendMessageString(SYSID, DATABEAN_SET_VALUE, custKeiHktgiInf.sendMessageString(SYSID_02, DATABEAN_GET_VALUE));` // [SYSID="システムID"] Copy system ID |
| 2 | SET | `svcFormBean.sendMessageString(SVC_KEI_NO, DATABEAN_SET_VALUE, custKeiHktgiInf.sendMessageString(SVC_KEI_NO_02, DATABEAN_GET_VALUE));` // [SVC_KEI_NO="サービス契約番号"] Copy service contract number |
| 3 | SET | `svcFormBean.sendMessageString(SVC_KEI_UCWK_NO, DATABEAN_SET_VALUE, custKeiHktgiInf.sendMessageString(SVC_KEI_UCWK_NO_02, DATABEAN_GET_VALUE));` // [SVC_KEI_UCWK_NO="サービス契約内訳番号"] Copy service contract detail number |
| 4 | SET | `svcFormBean.sendMessageString(OP_SVC_KEI_NO, DATABEAN_SET_VALUE, custKeiHktgiInf.sendMessageString(OP_SVC_KEI_NO_02, DATABEAN_GET_VALUE, 0));` // [OP_SVC_KEI_NO="オプションサービス契約番号"] Copy option service contract number (with index 0) |
| 5 | SET | `svcFormBean.sendMessageString(SBOP_SVC_KEI_NO, DATABEAN_SET_VALUE, custKeiHktgiInf.sendMessageString(SBOP_SVC_KEI_NO_02, DATABEAN_GET_VALUE));` // [SBOP_SVC_KEI_NO="サブオプションサービス契約番号"] Copy sub-option service contract number |
| 6 | SET | `svcFormBean.sendMessageString(IDO_DIV, DATABEAN_SET_VALUE, custKeiHktgiInf.sendMessageString(IDO_DIV_02, DATABEAN_GET_VALUE));` // [IDO_DIV="異動区分"] Copy transfer/division type |
| 7 | SET | `tranDiv = custKeiHktgiInf.sendMessageString(TRAN_DIV_02, DATABEAN_GET_VALUE);` // [TRAN_DIV_02="処理区分"] Copy processing division → set class-level field tranDiv |
| 8 | SET | `svcFormBean.sendMessageString(MSKM_NO, DATABEAN_SET_VALUE, custKeiHktgiInf.sendMessageString(MSKM_NO_02, DATABEAN_GET_VALUE));` // [MSKM_NO="申請番号"] Copy application number |

**Block 3** — [ARRAY TRANSFER REASON DETAILS] `(Clear, count, and loop-copy transfer reason codes and memos)` (L1205–L1219)

> Prepares the transfer reason detail list by clearing any existing entries, reading the count of reason entries from the inherited bean, then iterating to copy each reason code and its associated memo text.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `idoRsnList = svcFormBean.getDataBeanArray(KKW02519SFConst.IDO_RSN_CD_LIST);` // [IDO_RSN_CD_LIST="異動理由明細"] Get transfer reason detail list |
| 2 | EXEC | `idoRsnList.clearArray();` // Clear all existing entries |
| 3 | SET | `cnt = (Integer) custKeiHktgiInf.sendMessage(IDO_RSN_CD_02, DATABEAN_GET_COUNT);` // [IDO_RSN_CD_02="異動理由コード"] Get count of transfer reason entries |

**Block 3.1** — [FOR LOOP] `(Iterate over each transfer reason entry)` (L1208)

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0;` // Loop counter initialization |
| 2 | SET | `i++` // Increment after each iteration |
| 3 | CONDITION | `i < cnt` // Loop continues while counter is less than count |

**Block 3.1.1** — [LOOP BODY] `(Copy each transfer reason code and memo)` (L1210–L1217)

> Inside each loop iteration: add a new data bean to the list, copy the transfer reason code and memo text from the inherited bean.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `bean = idoRsnList.addDataBean();` // Create new data bean in the list |
| 2 | SET | `ido_rsn_cd = custKeiHktgiInf.sendMessageString(IDO_RSN_CD_02, DATABEAN_GET_VALUE, i);` // [IDO_RSN_CD_02="異動理由コード"] Get transfer reason code at index i |
| 3 | SET | `bean.sendMessageString(IDO_RSN_CD_07, DATABEAN_SET_VALUE, ido_rsn_cd);` // [IDO_RSN_CD_07="異動理由コード"] Store in new bean |
| 4 | SET | `idoRsnMemo = custKeiHktgiInf.sendMessageString(IDO_RSN_MEMO_02, DATABEAN_GET_VALUE);` // [IDO_RSN_MEMO_02="異動理由メモ"] Get transfer reason memo text |
| 5 | SET | `bean.sendMessageString(IDO_RSN_MEMO_07, DATABEAN_SET_VALUE, idoRsnMemo);` // [IDO_RSN_MEMO_07="異動理由メモ"] Store memo in new bean |

> **Note:** The memo text is read at a fixed index (no per-iteration index), which means each iteration reads the same memo. This appears to be inherited data structure behavior where memo text is shared across all reason entries from the previous screen bean.

**Block 4** — [TELEPHONE NUMBER SEQUENCE CONDITION] `(Determine which tab's option interface control code to activate)` (L1224–L1232)

> Reads the telephone number sequence flag (`TELNO_JUN`) from the inherited bean. Based on its value, activates the corresponding tab's option interface control code on the current screen bean. This conditional logic was added under IT1-2013-0000328 to support input assistance workflows on the application screen.

| # | Type | Code |
|---|------|------|
| 1 | SET | `telno_jun = custKeiHktgiInf.sendMessageString(TELNO_JUN_02, DATABEAN_GET_VALUE);` // [TELNO_JUN_02="電話番号順"] Read telephone number sequence |

**Block 4.1** — [IF] `(TELNO_JUN equals "1")` (L1225) (ODD[1])

> If the telephone number sequence is "1" (first/odd-numbered phone line), activate the Telephone 1 tab option interface.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcFormBean.sendMessageString(TEL_1_TAB_OP_IF_CTL_CD, DATABEAN_SET_VALUE, "1");` // [TEL_1_TAB_OP_IF_CTL_CD="電話1タブオプション情報制御コード"] Activate Telephone 1 tab |

**Block 4.2** — [ELSE-IF] `(TELNO_JUN equals "2")` (L1227) (ODD[2])

> If the telephone number sequence is "2" (second/even-numbered phone line), activate the Telephone 2 tab option interface.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcFormBean.sendMessageString(TEL_2_TAB_OP_IF_CTL_CD, DATABEAN_SET_VALUE, "1");` // [TEL_2_TAB_OP_IF_CTL_CD="電話2タブオプション情報制御コード"] Activate Telephone 2 tab |

**Block 5** — [RETURN] `(Method completion)` (L1234)

> Always returns `true` indicating successful screen data initialization. The method never throws exceptions or returns false under normal code path.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Always success |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `CUST_KEI_HKTGI_LIST` | Field | Customer Contract Inheritance List (顧客契約引継リスト) — the data bean array that carries customer contract data between screens |
| `IDO_RSN_CD_LIST` | Field | Transfer Reason Details (異動理由明細) — list of reason codes explaining contract status changes (activation, deactivation, modification) |
| `SYSID` | Field | System ID (システムID) — internal system identifier for the K-Opticom platform |
| `SVC_KEI_NO` | Field | Service Contract Number (サービス契約番号) — primary contract identifier for a telecom service |
| `SVC_KEI_UCWK_NO` | Field | Service Contract Detail Number (サービス契約内訳番号) — sub-identifier within a service contract, used to distinguish line items |
| `OP_SVC_KEI_NO` | Field | Option Service Contract Number (オプションサービス契約番号) — contract number for optional add-on services (call forwarding, international restriction, usage notifications, etc.) |
| `SBOP_SVC_KEI_NO` | Field | Sub-Option Service Contract Number (サブオプションサービス契約番号) — contract number for secondary/dependent optional services |
| `IDO_DIV` | Field | Transfer/Change Division (異動区分) — classification of the type of contract change (new activation, modification, cancellation, restoration) |
| `TRAN_DIV` | Field | Processing Division (処理区分) — class-level flag indicating the current processing mode/context |
| `MSKM_NO` | Field | Application Number (申請番号) — the request/application ID for this service change transaction |
| `IDO_RSN_CD` | Field | Transfer Reason Code (異動理由コード) — code explaining why a contract status changed |
| `IDO_RSN_MEMO` | Field | Transfer Reason Memo (異動理由メモ) — free-text explanation accompanying a transfer reason code |
| `TELNO_JUN` | Field | Telephone Number Sequence (電話番号順) — flag indicating which phone line this record pertains to (1=first/odd, 2=second/even) |
| `TEL_1_TAB_OP_IF_CTL_CD` | Field | Telephone 1 Tab Option Interface Control Code (電話1タブオプション情報制御コード) — activates the Telephone 1 tab UI section on the screen |
| `TEL_2_TAB_OP_IF_CTL_CD` | Field | Telephone 2 Tab Option Interface Control Code (電話2タブオプション情報制御コード) — activates the Telephone 2 tab UI section on the screen |
| X31SDataBeanAccess | Type | X31 framework data bean access class — provides get/set operations for screen form fields |
| X31SDataBeanAccessArray | Type | X31 framework data bean array — manages collections of data beans for list-style screen fields |
| DATABEAN_GET_VALUE | Constant | X31 framework constant — specifies a read operation on a data bean field |
| DATABEAN_SET_VALUE | Constant | X31 framework constant — specifies a write operation on a data bean field |
| DATABEAN_GET_COUNT | Constant | X31 framework constant — specifies a count operation (returns number of entries in a list field) |
| KKW02519SF | Module | Telephone Option Service Contract Update screen module — handles update operations for optional telecom services |
| JCCWebCommon | Component | Common web utility class — provides shared screen information retrieval and display control |
| Option Service | Business term | Optional add-on services offered alongside a base telecom contract (e.g., call forwarding, international call restriction, usage amount threshold notification) |
| Sub-Option Service | Business term | Secondary optional services that depend on or are bundled with a primary option service |
| Transfer (異動) | Business term | Any change to a service contract's status or parameters, including activation, modification, cancellation, and restoration |
