# Business Logic — KKW03201SFLogic.getSessionData() [94 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW03201SF.KKW03201SFLogic` |
| Layer | Service Logic / Web Controller Layer |
| Module | `KKW03201SF` (Package: `eo.web.webview.KKW03201SF`) |

## 1. Role

### KKW03201SFLogic.getSessionData()

This method retrieves carry-over information (引継情報) from the previous screen's session state and maps it onto the current service form data bean for the 050-number issuance registration screen (050番号発番登録画面). The 050-number refers to a special telephone number porting/issuance service provided by K-Opticom.

The method performs data-level flattening: it reads the second-layer customer contract carry-over list (顧客契約引継リスト), extracts the first item, and copies individual fields — SYSID, service contract number, transfer division (異動区分), and transfer reason codes/memos — down to the top-level service form bean. This is a classic inter-screen data propagation pattern used in multi-step web workflows where the user navigates across screens while maintaining shared context.

The method also sets the operational date (運用年月日) from the system date and applies telephone-number-tab-operation-control logic: based on the `telno_jun` (電話番号順, telephone number sequence) value received from the previous screen, it enables the tab operation interface control code for either Telephone #1 or Telephone #2. This supports conditional UI tab behavior in the registration screen.

If no screen carry-over data exists (the previous screen data map is null), the method returns false, signaling that the screen should not proceed — likely redirecting the user to an earlier step in the workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getSessionData begins"])
    
    START --> S1["Retrieve screen info from previous screen"]
    
    S1 --> S1COND{Screen info null}
    
    S1COND --> FAIL["Return false"]
    S1COND --> S2["Get customer contract carry-over list from second layer"]
    
    S2 --> S3["Copy SYSID to service form bean"]
    S3 --> S4["Copy service contract number to service form bean"]
    S4 --> S5["Copy transfer division to service form bean"]
    S5 --> S6["Get transfer reason code count"]
    S6 --> S7["For each transfer reason: get code and memo, add detail row, set code and memo"]
    
    S7 --> S8["Set service contract internal details number"]
    S8 --> S9["Set operational date from system date"]
    S9 --> S10["Get telephone number sequence value"]
    
    S10 --> S10A{"telephoneNumberSequence is 1"}
    
    S10A --> T1["Set Telephone 1 tab control code to 1"]
    S10A --> S10B{"telephoneNumberSequence is 2"}
    
    T1 --> DONE["Return true"]
    S10B --> T2["Set Telephone 2 tab control code to 1"]
    S10B --> DONE
```

**CRITICAL — Constant Resolution:**

| Code Reference | Resolved Value | Business Meaning |
|----------------|---------------|------------------|
| `KKW03201SFConst.SYSID` / `KKW03201SFConst.SYSID_04` | `"SYSID"` | System ID — unique identifier for the customer/account |
| `KKW03201SFConst.SVC_KEI_NO` / `KKW03201SFConst.SVC_KEI_NO_04` | `"サービス契約番号"` | Service contract number |
| `KKW03201SFConst.IDO_DIV` / `KKW03201SFConst.IDO_DIV_04` | `"異動区分"` | Transfer division — classification of contract change type |
| `KKW03201SFConst.IDO_RSN_CD_04` / `KKW03201SFConst.IDO_RSN_CD` | `"異動理由コード"` | Transfer reason code |
| `KKW03201SFConst.IDO_RSN_MEMO_04` / `KKW03201SFConst.IDO_RSN_MEMO_06` | `"異動理由メモ"` | Transfer reason memo — free-text explanation |
| `KKW03201SFConst.IDO_RSN_LIST` | `"異動理由詳細"` | Transfer reason detail list (array of detail items) |
| `KKW03201SFConst.SVC_KEI_UCWK_NO` / `KKW03201SFConst.SVC_KEI_UCWK_NO_04` | `"サービス契約内訳番号"` | Service contract internal details number |
| `KKW03201SFConst.UNYO_YMD` | `"運用年月日"` | Operational year-month-day (system date) |
| `KKW03201SFConst.TELNO_JUN_04` | `"電話番号順"` | Telephone number sequence — order indicator for telephone numbers |
| `KKW03201SFConst.TEL_1_TAB_OP_IF_CTL_CD` | `"電話1タブオペレーション情報制御コード"` | Telephone 1 tab operation info control code |
| `KKW03201SFConst.TEL_2_TAB_OP_IF_CTL_CD` | `"電話2タブオペレーション情報制御コード"` | Telephone 2 tab operation info control code |
| `JKKCommonConst.HKTGI_CUST_KEI_HKTGI_LIST` | `"顧客契約引継リスト"` | Customer contract carry-over list (second-layer nested data bean array) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcFormBean` | `X31SDataBeanAccess` | The service form data bean acting as the target data holder for the 050-number issuance registration screen. It carries carry-over fields (SYSID, contract number, transfer reasons, etc.) populated from the previous screen's session state. The method writes all resolved values into this bean so downstream screen rendering can display them. |

**Instance/external state read by this method:**

| Source | Access Pattern | Business Meaning |
|--------|---------------|------------------|
| `this` (KKW03201SFLogic instance) | Passed to `JCCWebCommon.getScreenInfo(this)` and `JCCWebCommon.getOpeDate(this, null)` | The logic instance itself carries context (likely a reference to the enclosing action/servlet) used by common utilities to locate session attributes and system date. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getScreenInfo` | - | Session/Request | Reads screen carry-over data map from previous screen context (session/request attributes). Returns `HashMap<String, Object>` containing data passed from the prior step in the multi-screen workflow. |
| R | `X31SDataBeanAccess.getDataBeanArray` | - | In-memory data bean | Retrieves the nested second-layer customer contract carry-over list (顧客契約引継リスト) from the service form bean. Returns an array data bean for iteration. |
| R | `X31SDataBeanAccessArray.getDataBean` | - | In-memory data bean | Fetches the first item (index 0) from the customer contract carry-over list — the primary customer contract record being carried over. |
| R | `X31SDataBeanAccess.sendMessageString` (GET) | - | In-memory data bean | Reads string values (SYSID, contract number, transfer reason codes/memos, telephone number sequence) from the sub-bean. |
| R | `X31SDataBeanAccess.sendMessage` (GET_COUNT) | - | In-memory data bean | Retrieves the count of transfer reason code entries to determine loop iteration count. |
| R | `OneStopDataBeanAccessArray.getDataBean` | - | In-memory data bean | Accesses the transfer reason detail list for adding new rows. |
| C | `OneStopDataBeanAccessArray.addDataBean` | - | In-memory data bean | Creates a new row in the transfer reason detail list (異動理由詳細) for each transfer reason code found. |
| R | `OneStopDataBeanAccess.sendMessageString` (SET) | - | In-memory data bean | Writes string values (SYSID, contract number, transfer reason codes/memos, internal details number) into the service form bean. |
| R | `OneStopDataBeanAccess.sendMessageString` (ADD) | - | In-memory data bean | Adds a transfer reason code entry to the detail list without overwriting existing entries. |
| R | `JCCWebCommon.getOpeDate` | - | System clock | Retrieves the current operational date (運用年月日) from the system — used to stamp the record with the processing date. |

**Classification Summary:**
- No database CRUD operations (C/R/U/D on persistent entities). This method operates entirely in-memory, working with web session data beans and request attributes.
- **Read (R)**: Screen info, data bean fields, system date — all read from session/request in-memory structures.
- **Create (C)**: New transfer reason detail list rows via `addDataBean()` — in-memory array expansion.
- **No direct Entity/DB table access**: This method is a pure data-propagation layer; actual persistence is handled by downstream methods called elsewhere in the workflow.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `getScreenInfo` [R], `getDataBeanArray` [R], `getDataBean` [R], `sendMessageString` [R], `sendMessage` [R], `addDataBean` [C], `getOpeDate` [R], `sendMessageString` [R], `sendMessageString` [R], `sendMessageString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic:KKW03201SFLogic.actionInitKKW03201 | `actionInit` -> `actionInitKKW03201` -> `getSessionData` | `getScreenInfo` [R], `getDataBeanArray` [R], `getDataBean` [R], `sendMessageString` [R], `addDataBean` [C], `getOpeDate` [R] |

**Call Chain Details:**
1. **KKW03201SFLogic.actionInitKKW03201()** — The direct caller within the same logic class. This method is the screen-specific initialization handler for screen KKW03201 (050-number issuance registration). It calls `getSessionData()` to populate the service form bean with carry-over data from the previous screen before proceeding with further initialization (parameter maps, pulldown population, etc.).

**Upstream Entry Points:**
- The `actionInit()` method acts as a dispatcher, routing to `actionInitKKW03201()` when the screen ID matches `KKW03201` (resolved from `JKKScreenConst.SCREEN_ID_KKW03201`). This dispatcher is typically invoked by a screen controller (e.g., `KKSV0099`, `KKSV0100`, or `KKSV0101`) as the entry point for the registration workflow.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] (null check for screen info) (L868)

> Retrieves screen carry-over data from the previous screen. If no data exists, the method returns early with failure.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `dataMap = JCCWebCommon.getScreenInfo(this)` // Retrieves HashMap of screen data from session/request |
| 2 | IF | `dataMap == null` [SYSID="SYSID"] (L870) |

**Block 1.1** — [ELSE] (dataMap is null) (L870)

> Screen carry-over data is missing — the previous screen did not pass data. Return failure to halt the workflow.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` // Aborts processing — no carry-over data available |

**Block 1.2** — [IF body] (dataMap is not null) (L872)

> Data exists. Proceed to extract and map carry-over fields.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `custList = svcFormBean.getDataBeanArray(JKKCommonConst.HKTGI_CUST_KEI_HKTGI_LIST)` // ["顧客契約引継リスト"] Get customer contract carry-over list (second-layer) |
| 2 | CALL | `subbean = custList.getDataBean(0)` // Get first item from the carry-over list |

---

**Block 2** — [EXEC] (Copy SYSID) (L875-L877)

> Copies the SYSID from the sub-bean (layer 04) to the top-level service form bean.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.SYSID, X31CWebConst.DATABEAN_SET_VALUE, subbean.sendMessageString(KKW03201SFConst.SYSID_04, X31CWebConst.DATABEAN_GET_VALUE))` // ["SYSID"] SYSID = subbean.SYSID_04 |

---

**Block 3** — [EXEC] (Copy service contract number) (L879-L881)

> Copies the service contract number from the sub-bean to the service form bean.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.SVC_KEI_NO, X31CWebConst.DATABEAN_SET_VALUE, subbean.sendMessageString(KKW03201SFConst.SVC_KEI_NO_04, X31CWebConst.DATABEAN_GET_VALUE))` // ["サービス契約番号"] Contract number = subbean.SVC_KEI_NO_04 |

---

**Block 4** — [EXEC] (Copy transfer division) (L883-L885)

> Copies the transfer division classification from the sub-bean to the service form bean.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.IDO_DIV, X31CWebConst.DATABEAN_SET_VALUE, subbean.sendMessageString(KKW03201SFConst.IDO_DIV_04, X31CWebConst.DATABEAN_GET_VALUE))` // ["異動区分"] Transfer division = subbean.IDO_DIV_04 |

---

**Block 5** — [FOR LOOP] (Transfer reason code iteration) (L887-L923)

> Iterates over all transfer reason codes (異動理由コード) from the sub-bean. For each code, it reads the associated memo and creates a new detail row in the transfer reason detail list (異動理由詳細) with both the code and memo.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `count = subbean.sendMessage(KKW03201SFConst.IDO_RSN_CD_04, X31CWebConst.DATABEAN_GET_COUNT)` // ["異動理由コード"] Get count of transfer reason entries |
| 2 | SET | `i = 0` // Loop variable |
| 3 | IF | `i < count` [LOOP_CONDITION] |

**Block 5.1** — [FOR BODY] (per-iteration processing) (L890-L923)

| # | Type | Code |
|---|------|------|
| 1 | SET | `idoRsnCd` // Declare transfer reason code variable |
| 2 | SET | `idoRsnMemo` // Declare transfer reason memo variable |
| 3 | CALL | `arraybean = svcFormBean.getDataBeanArray(KKW03201SFConst.IDO_RSN_LIST)` // ["異動理由詳細"] Get transfer reason detail list |
| 4 | SET | `bean` // Declare row variable for detail list |
| 5 | CALL | `idoRsnCd = subbean.sendMessageString(KKW03201SFConst.IDO_RSN_CD_04, X31CWebConst.DATABEAN_GET_VALUE, i)` // ["異動理由コード"] Read transfer reason code at index i from sub-bean |
| 6 | CALL | `idoRsnMemo = subbean.sendMessageString(KKW03201SFConst.IDO_RSN_MEMO_04, X31CWebConst.DATABEAN_GET_VALUE)` // ["異動理由メモ"] Read transfer reason memo from sub-bean |
| 7 | CALL | `svcFormBean.sendMessageString(KKW03201SFConst.IDO_RSN_CD, X31CWebConst.DATABEAN_ADD_VALUE, idoRsnCd)` // ["異動理由コード"] Add transfer reason code to top-level bean |
| 8 | CALL | `bean = arraybean.addDataBean()` // ["異動理由詳細"] Create new row in transfer reason detail list |
| 9 | EXEC | `bean.sendMessageString(KKW03201SFConst.IDO_RSN_CD_06, X31CWebConst.DATABEAN_SET_VALUE, idoRsnCd)` // ["異動理由コード"] Set code in new detail row |
| 10 | EXEC | `bean.sendMessageString(KKW03201SFConst.IDO_RSN_MEMO_06, X31CWebConst.DATABEAN_SET_VALUE, idoRsnMemo)` // ["異動理由メモ"] Set memo in new detail row |

**Block 5.1.1** — [COMMENT] (UI legacy note) (L894, L920)

> Commented note referencing a 2012/05/14 change by ariyoshi regarding the transfer reason show/hide logic. UI legacy marker (UI残65).

---

**Block 6** — [EXEC] (Set service contract internal details number) (L926-L930)

> Sets the service contract internal details number (サービス契約内訳番号) from the sub-bean into the service form bean.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.SVC_KEI_UCWK_NO, X31CWebConst.DATABEAN_SET_VALUE, subbean.sendMessageString(KKW03201SFConst.SVC_KEI_UCWK_NO_04, X31CWebConst.DATABEAN_GET_VALUE))` // ["サービス契約内訳番号"] Internal details number = subbean.SVC_KEI_UCWK_NO_04 |

---

**Block 7** — [EXEC] (Set operational date) (L933-L935)

> Sets the operational date (運用年月日) to the current system date obtained from `JCCWebCommon.getOpeDate()`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.UNYO_YMD, X31CWebConst.DATABEAN_SET_VALUE, JCCWebCommon.getOpeDate(this, null))` // ["運用年月日"] Current system date |

---

**Block 8** — [IF / ELSE-IF] (Telephone number tab operation control) (L938-L945)

> Based on the telephone number sequence (電話番号順) value from the sub-bean, determines which telephone tab's operation control code to enable. This controls UI tab behavior: if the sequence is "1", enable Telephone #1 tab; if "2", enable Telephone #2 tab. This is associated with KAD-2012-00000087.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `telno_jun = subbean.sendMessageString(KKW03201SFConst.TELNO_JUN_04, X31CWebConst.DATABEAN_GET_VALUE)` // ["電話番号順"] Get telephone number sequence |
| 2 | IF | `"1".equals(telno_jun)` [TELNO_JUN_04="1"] (L939) |

**Block 8.1** — [IF body] (telephoneNumberSequence == "1") (L939-L940)

> Telephone #1 is the primary sequence — enable Telephone #1 tab operation.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.TEL_1_TAB_OP_IF_CTL_CD, X31CWebConst.DATABEAN_SET_VALUE, "1")` // ["電話1タブオペレーション情報制御コード"] Set to 1 |

**Block 8.2** — [ELSE-IF] (telephoneNumberSequence == "2") (L941)

| # | Type | Code |
|---|------|------|
| 1 | IF | `"2".equals(telno_jun)` [TELNO_JUN_04="2"] (L941) |

**Block 8.2.1** — [ELSE-IF body] (telephoneNumberSequence == "2") (L941-L942)

> Telephone #2 is the primary sequence — enable Telephone #2 tab operation.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.TEL_2_TAB_OP_IF_CTL_CD, X31CWebConst.DATABEAN_SET_VALUE, "1")` // ["電話2タブオペレーション情報制御コード"] Set to 1 |

**Block 8.3** — [ELSE] (implicit, no else branch in source)

> If telno_jun is neither "1" nor "2" (e.g., empty string, null, or other value), no tab control code is set. The method proceeds to return true without enabling either telephone tab. This means the telephone tab UI elements remain in their default state.

---

**Block 9** — [RETURN] (L947)

> Success — all carry-over data has been mapped onto the service form bean.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // All fields populated successfully |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the primary identifier for a customer's service contract line |
| `svc_kei_ucwk_no` | Field | Service contract internal details number — internal tracking ID for service contract sub-items |
| `sysid` | Field | System ID — unique identifier for the customer or account in the K-Opticom system |
| `hktgi_cust_kei_hktgi_list` | Field | Customer contract carry-over list — second-layer nested data bean containing contract data passed between screens |
| `ido_div` | Field | Transfer division (異動区分) — classification code indicating the type of contract change (e.g., port-in, port-out, modification) |
| `ido_rsn_cd` | Field | Transfer reason code (異動理由コード) — code explaining why a contract transfer occurred |
| `ido_rsn_memo` | Field | Transfer reason memo (異動理由メモ) — free-text explanation accompanying the transfer reason code |
| `ido_rsn_list` | Field | Transfer reason detail list (異動理由詳細) — array of detail rows, each containing a reason code and memo |
| `unyo_ymd` | Field | Operational year-month-day (運用年月日) — the system date used as the processing date for the record |
| `telno_jun` | Field | Telephone number sequence (電話番号順) — order indicator (1 or 2) for telephone numbers in the contract, used to determine which tab UI to activate |
| `tel_1_tab_op_if_ctl_cd` | Field | Telephone 1 tab operation info control code — enables/disables the Telephone #1 tab in the registration UI |
| `tel_2_tab_op_if_ctl_cd` | Field | Telephone 2 tab operation info control code — enables/disables the Telephone #2 tab in the registration UI |
| `op_svc_cd` | Field | Option service code (オプションサービスコード) — code identifying the option service type |
| `op_svc_cd_050` | Constant | "B029" — the option service code for 050-number issuance (050番号発番) |
| 050番号 (050-gou) | Business term | 050-number — a special virtual telephone number service in Japan, often used for business calling, porting, or toll-free lines |
| 発番 (hatsuban) | Business term | Number issuance — the process of assigning a new telephone number |
| 契約引継 (keiyaku hikitsugi) | Business term | Contract carry-over — passing contract data from a previous screen or step in the workflow to the current screen |
| 異動 (idou) | Business term | Transfer / change — any modification to an existing service contract (porting, suspension, modification, cancellation) |
| 内訳 (uchiwake) | Business term | Internal details / breakdown — sub-item level information within a contract |
| タブオペレーション (tab opereshon) | Technical term | Tab operation — UI tab control mechanism for showing/hiding or enabling/disabling interface panels |
| X31SDataBeanAccess | Technical term | Fujitsu Futurity X31 framework data bean access class — provides typed get/set/add methods for screen data fields |
| X31SDataBeanAccessArray | Technical term | X31 framework nested data bean array class — represents a list/array of data bean items for repeated structures |
| JCCWebCommon | Technical term | Common web utilities class — provides cross-cutting services like screen info retrieval and operational date |
| JCCWebBusinessLogic | Technical term | Base business logic class — parent class for all web-view logic classes, provides commonInfoBean and serviceFormBean accessors |
| DATABEAN_SET_VALUE | Constant | X31 framework constant — indicates a set (overwrite) operation on a data bean field |
| DATABEAN_GET_VALUE | Constant | X31 framework constant — indicates a get (read) operation on a data bean field |
| DATABEAN_ADD_VALUE | Constant | X31 framework constant — indicates an add (append) operation on a data bean field (for arrays/lists) |
| DATABEAN_GET_COUNT | Constant | X31 framework constant — indicates a count operation on a data bean array field |
| KKW03201SF | Module | 050-number issuance registration screen module — handles the multi-step workflow for registering a new 050-number service |
| KAD-2012-00000087 | Ticket | Change request ticket — added telephone number tab operation control logic to the carry-over flow |
