# Business Logic — KKW01034SF01DBean.loadModelData() [111 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01034SF.KKW01034SF01DBean` |
| Layer | View Bean (Data Binding / UI Model Layer — `eo.web.webview`) |
| Module | `KKW01034SF` (Package: `eo.web.webview.KKW01034SF`) |

## 1. Role

### KKW01034SF01DBean.loadModelData()

This method is a **key-based data access router** (also known as a map-lookup dispatcher) for the movement/relocation (異動) screen in the K-Opticom telecom order management system. It enables the Futurity X33 UI framework to retrieve field values and UI states from the data bean using human-readable Japanese string keys rather than direct Java field references. The method supports **7 distinct data types** — SYSID, service contract number (サービス契約番号), movement type (異動区分), movement reason code (異動理由コード), movement reason memo (異動理由メモ), application number (申込番号), and application detail number (申請明細番号) — each returning either its current **value** (via the `value` subkey) or its **UI state** (via the `state` subkey), except for the list-based movement reason code field which supports indexed access (integer index or `"*"` for count).

The method implements the **strategy/dispatch pattern**: it receives a string `key` that acts as a business field name and a `subkey` that selects the data facet (value or state), then routes to the appropriate getter. This decouples the UI layer from the bean's internal field structure, allowing the view to request data through stable string keys rather than reflection or direct access. It also acts as the **read endpoint** in the X33 data binding lifecycle, complementing `storeModelData` which handles writes. Its role in the larger system is to serve as the single data retrieval entry point for all fields managed by the `KKW01034SF01DBean` view bean, enabling the framework's `X33VLoadModel` to populate form components dynamically.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])

    N1["Check key and subkey null"]

    C1{key equals SYSID}
    C2{key equals Service Contract No}
    C3{key equals Movement Type}
    C4{key equals Movement Reason Code}
    C5{key equals Movement Reason Memo}
    C6{key equals Application No}
    C7{key equals Application Detail No}

    SUB_SYSID{subkey equals value}
    SUB_VAL2{subkey equals value}
    SUB_ST2{subkey equals state}
    SUB_VAL3{subkey equals value}
    SUB_ST3{subkey equals state}
    SUB_VAL5{subkey equals value}
    SUB_ST5{subkey equals state}
    SUB_VAL6{subkey equals value}
    SUB_ST6{subkey equals state}

    SUB_KEY_SPLIT{key contains slash}
    IDX_CHECK{key equals asterisk}
    IDX_PARSE{Parse key as Integer}
    BOUNDS{tmpIndex valid range}

    END_RETURN["Return null"]

    SYSID_VAL["Return getSysid_value()"]
    SYSID_ST["Return getSysid_state()"]
    SVC_VAL["Return getSvc_kei_no_value()"]
    SVC_ST["Return getSvc_kei_no_state()"]
    DIV_VAL["Return getIdo_div_value()"]
    DIV_ST["Return getIdo_div_state()"]
    COUNT_RET["Return ido_rsn_cd_list.size()"]
    PARSE_FAIL["Return null"]
    MEMO_VAL["Return getIdo_rsn_memo_value()"]
    MEMO_ST["Return getIdo_rsn_memo_state()"]
    MSKM_VAL["Return getMskm_no_value()"]
    MSKM_ST["Return getMskm_no_state()"]
    BDY_FAIL["Return null"]
    DELEGATE["Call loadModelData on list item"]

    START --> N1
    N1 --> C1
    C1 -->|yes| SUB_SYSID
    C1 -->|no| C2
    SUB_SYSID -->|yes| SYSID_VAL
    SUB_SYSID -->|no| SYSID_ST
    SYSID_VAL --> END_RETURN
    SYSID_ST --> END_RETURN
    C2 -->|yes| SUB_VAL2
    C2 -->|no| C3
    SUB_VAL2 -->|yes| SVC_VAL
    SUB_ST2 -->|yes| SVC_ST
    SVC_VAL --> END_RETURN
    SVC_ST --> END_RETURN
    C3 -->|yes| SUB_VAL3
    C3 -->|no| C4
    SUB_VAL3 -->|yes| DIV_VAL
    SUB_ST3 -->|yes| DIV_ST
    DIV_VAL --> END_RETURN
    DIV_ST --> END_RETURN
    C4 -->|yes| SUB_KEY_SPLIT
    C4 -->|no| C5
    SUB_KEY_SPLIT -->|yes| IDX_CHECK
    IDX_CHECK -->|yes| COUNT_RET
    IDX_CHECK -->|no| IDX_PARSE
    COUNT_RET --> END_RETURN
    IDX_PARSE -->|success| BOUNDS
    IDX_PARSE -->|failure| PARSE_FAIL
    PARSE_FAIL --> END_RETURN
    BOUNDS -->|invalid| BDY_FAIL
    BOUNDS -->|valid| DELEGATE
    DELEGATE --> END_RETURN
    BDY_FAIL --> END_RETURN
    C5 -->|yes| SUB_VAL5
    C5 -->|no| C6
    SUB_VAL5 -->|yes| MEMO_VAL
    SUB_ST5 -->|yes| MEMO_ST
    MEMO_VAL --> END_RETURN
    MEMO_ST --> END_RETURN
    C6 -->|yes| SUB_VAL6
    C6 -->|no| C7
    SUB_VAL6 -->|yes| MSKM_VAL
    SUB_ST6 -->|yes| MSKM_ST
    MSKM_VAL --> END_RETURN
    MSKM_ST --> END_RETURN
    C7 -->|yes| SUB_ST6
```

**Processing Flow Summary:**

1. **Null Guard (L296)**: If either `key` or `subkey` is null, return null immediately (null-safe early exit).
2. **Separator Detection (L300)**: Compute `key.indexOf("/")` — this `separaterPoint` is only used in the Movement Reason Code branch (Block 4).
3. **SYSID Branch (L303-L311)**: For the system ID field, return the value or state via `getSysid_value()` / `getSysid_state()`.
4. **Service Contract No. Branch (L314-L322)**: For the service contract number (サービス契約番号), return the value or state via `getSvc_kei_no_value()` / `getSvc_kei_no_state()`.
5. **Movement Type Branch (L325-L333)**: For the movement type (異動区分), return the value or state via `getIdo_div_value()` / `getIdo_div_state()`.
6. **Movement Reason Code Branch (L344-L381)**: A list-based field (ANK-2755 change, 2016/08/10). Performs substring extraction from the key to get the index portion, then supports three modes — `"*"` returns list count, an integer parses the index and returns the bean at that position (delegating to its own `loadModelData`), or an invalid index returns null.
7. **Movement Reason Memo Branch (L384-L392)**: For the movement reason memo (異動理由メモ), return the value or state via `getIdo_rsn_memo_value()` / `getIdo_rsn_memo_state()`.
8. **Application No. Branch (L395-L403)**: For the application number (申込番号), return the value or state via `getMskm_no_value()` / `getMskm_no_state()`.
9. **Application Detail No. Branch (L406-L414)**: For the application detail number (申請明細番号), return the value or state via `getMskm_dtl_no_value()` / `getMskm_dtl_no_state()`.
10. **Default (L418)**: If no key matches, return null.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business field name to look up. This is a human-readable Japanese string that identifies which data field the UI is requesting. Valid values: `"SYSID"` (system ID), `"サービス契約番号"` (Service Contract No.), `"異動区分"` (Movement Type), `"異動理由コード"` (Movement Reason Code), `"異動理由メモ"` (Movement Reason Memo), `"申込番号"` (Application No.), `"申請明細番号"` (Application Detail No.). For the Movement Reason Code field, the key is further processed via `substring()` to extract an index (e.g., `"異動理由コード/2"` becomes `"2"`). The special value `"*"` is used to request the list count instead of a specific element. |
| 2 | `subkey` | `String` | The data facet requested within the matched field. Valid values: `"value"` (returns the current data value of the field) or `"state"` (returns the UI state, e.g., enabled/disabled/readonly flags). For the Movement Reason Code list field, `subkey` is forwarded to the individual `X33VDataTypeStringBean.loadModelData()` call. |

**Instance Fields / External State Read:**

| # | Field | Type | Access Pattern |
|---|-------|------|----------------|
| 1 | `ido_rsn_cd_list` | `X33VDataTypeList` | Accessed in Block 4 to get list size and retrieve elements at specific indices; holds a list of `X33VDataTypeStringBean` objects representing individual movement reason code entries |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW01034SF01DBean.getSysid_value` | KKW01034SF01DBean | - | Returns the SYSID value field |
| R | `KKW01034SF01DBean.getSysid_state` | KKW01034SF01DBean | - | Returns the SYSID UI state field |
| R | `KKW01034SF01DBean.getSvc_kei_no_value` | KKW01034SF01DBean | - | Returns the service contract number value |
| R | `KKW01034SF01DBean.getSvc_kei_no_state` | KKW01034SF01DBean | - | Returns the service contract number UI state |
| R | `KKW01034SF01DBean.getIdo_div_value` | KKW01034SF01DBean | - | Returns the movement type value |
| R | `KKW01034SF01DBean.getIdo_div_state` | KKW01034SF01DBean | - | Returns the movement type UI state |
| R | `KKW01034SF01DBean.loadModelData` | KKW01034SF01DBean | - | Recursively delegates to list item's loadModelData |
| R | `KKW01034SF01DBean.getIdo_rsn_memo_value` | KKW01034SF01DBean | - | Returns the movement reason memo value |
| R | `KKW01034SF01DBean.getIdo_rsn_memo_state` | KKW01034SF01DBean | - | Returns the movement reason memo UI state |
| R | `KKW01034SF01DBean.getMskm_no_value` | KKW01034SF01DBean | - | Returns the application number value |
| R | `KKW01034SF01DBean.getMskm_no_state` | KKW01034SF01DBean | - | Returns the application number UI state |
| R | `KKW01034SF01DBean.getMskm_dtl_no_value` | KKW01034SF01DBean | - | Returns the application detail number value |
| R | `KKW01034SF01DBean.getMskm_dtl_no_state` | KKW01034SF01DBean | - | Returns the application detail number UI state |

This method is a **pure read (R) operation**. It does not create, update, or delete any data. It reads from the bean's own instance fields and delegates to other getter methods within the same class. All data is sourced from in-memory state previously populated by the X33 framework's load lifecycle.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Internal (KKW01034SF01DBean) | `KKW01034SF01DBean.loadModelData` (self-invocation / framework dispatch) | `getSysid_value [R] sysid_value`, `getSysid_state [R] sysid_state`, `getSvc_kei_no_value [R] svc_kei_no_value`, `getSvc_kei_no_state [R] svc_kei_no_state`, `getIdo_div_value [R] ido_div_value`, `getIdo_div_state [R] ido_div_state`, `loadModelData (X33VDataTypeStringBean) [R] ido_rsn_cd_list`, `getIdo_rsn_memo_value [R] ido_rsn_memo_value`, `getIdo_rsn_memo_state [R] ido_rsn_memo_state`, `getMskm_no_value [R] mskm_no_value`, `getMskm_no_state [R] mskm_no_state`, `getMskm_dtl_no_value [R] mskm_dtl_no_value`, `getMskm_dtl_no_state [R] mskm_dtl_no_state` |

**Notes on Callers:**
- The only direct caller identified is `KKW01034SF01DBean.loadModelData()` itself — this method is invoked by the **Futurity X33 framework** (`X33VLoadModel`) during screen data initialization, not by other application code. The framework calls this method through the `X33VDataTypeBeanInterface` interface contract to populate form fields from the data bean.
- The method also has a **self-delegation** in Block 4: when the Movement Reason Code list item is accessed, it calls `loadModelData(subkey)` on an `X33VDataTypeStringBean` child object.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(key == null || subkey == null)` (L296)

> Null guard: If either parameter is null, return null immediately to prevent NPE downstream.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // key,subkeyがnullの場合、nullを返す (If key/subkey is null, return null) |

**Block 2** — [IF] `(key.equals("SYSID"))` (L303)

> Branch: The data type is a String item "SYSID" (item ID: sysid). Check the subkey to return value or state.

**Block 2.1** — [IF-ELSE-IF] `(subkey.equalsIgnoreCase("value"))` (L304)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getSysid_value()` // Return SYSID value field |
| 2 | RETURN | `return getSysid_value();` |

**Block 2.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L307)

> If subkey is "state" (サブキーが"state"の場合、ステータスを返す — Return the status when subkey is "state").

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getSysid_state()` // Return SYSID state field |
| 2 | RETURN | `return getSysid_state();` |

**Block 3** — [ELSE-IF] `(key.equals("サービス契約番号"))` (L314)

> Branch: The data type is a String item "Service Contract No." (データタイプがStringの項目"サービス契約番号" (item ID: svc_kei_no)). Check the subkey to return value or state.

**Block 3.1** — [IF-ELSE-IF] `(subkey.equalsIgnoreCase("value"))` (L315)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getSvc_kei_no_value()` // Return service contract number value |
| 2 | RETURN | `return getSvc_kei_no_value();` |

**Block 3.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L318)

> If subkey is "state" (サブキーが"state"の場合、ステータスを返す — Return the status when subkey is "state").

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getSvc_kei_no_state()` // Return service contract number state |
| 2 | RETURN | `return getSvc_kei_no_state();` |

**Block 4** — [ELSE-IF] `(key.equals("異動区分"))` (L325)

> Branch: The data type is a String item "Movement Type" (データタイプがStringの項目"異動区分" (item ID: ido_div)). Check the subkey to return value or state.

**Block 4.1** — [IF-ELSE-IF] `(subkey.equalsIgnoreCase("value"))` (L326)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getIdo_div_value()` // Return movement type value |
| 2 | RETURN | `return getIdo_div_value();` |

**Block 4.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L329)

> If subkey is "state" (サブキーが"state"の場合、ステータスを返す — Return the status when subkey is "state").

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getIdo_div_state()` // Return movement type state |
| 2 | RETURN | `return getIdo_div_state();` |

**Block 5** — [ELSE-IF] `(key.equals("異動理由コード"))` (L344)

> Branch: The data type is a String item "Movement Reason Code" (データタイプがStringの項目"異動理由コード" (item ID: ido_rsn_cd)). This field was changed from a simple string to a list-based field in ANK-2755 (2016/08/10). It supports indexed access into `ido_rsn_cd_list`, allowing the UI to retrieve individual list entries or the total count.

**Block 5.1** — [SET] Extract index portion from key via substring (L346)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // keyの次の要素を取得 (Get the next element after the separator — extracts the index after "/") |
| 2 | SET | `separaterPoint = key.indexOf("/")` // (L300 — computed earlier) |

**Block 5.2** — [IF] `(key.equals("*"))` (L348)

> If the index value is `"*"`, return the number of list elements instead of a specific entry (インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す — If "*" is specified instead of the index value, return the number of list elements).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ido_rsn_cd_list.size()` |
| 2 | SET | `Integer` wrapper around list size |
| 3 | RETURN | `return Integer.valueOf(ido_rsn_cd_list.size());` |

**Block 5.3** — [TRY-CATCH] Parse key as Integer (L352-L361)

> Attempt to convert the key string to an integer index value.

**Block 5.3.1** — [TRY] Successful integer parse (L353-L355)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = Integer.valueOf(key);` |

**Block 5.3.2** — [CATCH] `(NumberFormatException e)` (L358-L360)

> If the index value is not a numeric string, return null (インデックス値が数値文字列でない場合は、ここでnullを返す — If the index value is not a numeric string, return null here).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` |

**Block 5.4** — [IF] `(tmpIndexInt == null)` (L362-L364)

> Guard against null index even after parse attempt.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` |

**Block 5.5** — [IF] `(tmpIndex < 0 || tmpIndex >= ido_rsn_cd_list.size())` (L368-L370)

> Check index bounds: if the index exceeds list size minus 1, return null (インデックス値がリスト個数-1を超える場合は、ここでnullを返す — If the index value exceeds the list count minus 1, return null here).

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndex = tmpIndexInt.intValue();` |
| 2 | RETURN | `return null;` |

**Block 5.6** — [CALL] Delegate to list item's loadModelData (L372-L373)

> Cast the list element to X33VDataTypeStringBean and call its loadModelData with the subkey to retrieve the actual field data (subkey value or state from the individual list item).

| # | Type | Code |
|---|------|------|
| 1 | SET | `X33VDataTypeStringBean` cast of `ido_rsn_cd_list.get(tmpIndex)` |
| 2 | CALL | `.loadModelData(subkey)` |
| 3 | RETURN | `return ((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).loadModelData(subkey);` |

**Block 6** — [ELSE-IF] `(key.equals("異動理由メモ"))` (L384)

> Branch: The data type is a String item "Movement Reason Memo" (データタイプがStringの項目"異動理由メモ" (item ID: ido_rsn_memo)). Check the subkey to return value or state.

**Block 6.1** — [IF-ELSE-IF] `(subkey.equalsIgnoreCase("value"))` (L385)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getIdo_rsn_memo_value()` // Return movement reason memo value |
| 2 | RETURN | `return getIdo_rsn_memo_value();` |

**Block 6.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L388)

> If subkey is "state" (サブキーが"state"の場合、ステータスを返す — Return the status when subkey is "state").

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getIdo_rsn_memo_state()` // Return movement reason memo state |
| 2 | RETURN | `return getIdo_rsn_memo_state();` |

**Block 7** — [ELSE-IF] `(key.equals("申込番号"))` (L395)

> Branch: The data type is a String item "Application No." (データタイプがStringの項目"申込番号" (item ID: mskm_no)). Check the subkey to return value or state.

**Block 7.1** — [IF-ELSE-IF] `(subkey.equalsIgnoreCase("value"))` (L396)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getMskm_no_value()` // Return application number value |
| 2 | RETURN | `return getMskm_no_value();` |

**Block 7.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L399)

> If subkey is "state" (サブキーが"state"の場合、ステータスを返す — Return the status when subkey is "state").

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getMskm_no_state()` // Return application number state |
| 2 | RETURN | `return getMskm_no_state();` |

**Block 8** — [ELSE-IF] `(key.equals("申請明細番号"))` (L406)

> Branch: The data type is a String item "Application Detail No." (データタイプがStringの項目"申請明細番号" (item ID: mskm_dtl_no)). Check the subkey to return value or state.

**Block 8.1** — [IF-ELSE-IF] `(subkey.equalsIgnoreCase("value"))` (L407)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getMskm_dtl_no_value()` // Return application detail number value |
| 2 | RETURN | `return getMskm_dtl_no_value();` |

**Block 8.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L410)

> If subkey is "state" (サブキーが"state"の場合、ステータスを返す — Return the status when subkey is "state").

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getMskm_dtl_no_state()` // Return application detail number state |
| 2 | RETURN | `return getMskm_dtl_no_state();` |

**Block 9** — [DEFAULT] (L418)

> If no matching property exists, return null (条件に合致するプロパティが存在しない場合は、nullを返す — If no property matches the condition, return null).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sysid` | Field | System ID — the internal unique identifier for the record, used as a primary key reference in the UI |
| `svc_kei_no` | Field | Service Contract Number — the service contract line item number identifying a specific service agreement |
| `ido_div` | Field | Movement Type (異動区分) — classifies the type of change/transfer operation being performed on the service contract |
| `ido_rsn_cd` | Field | Movement Reason Code (異動理由コード) — the reason code for the movement/transfer; stored as a list to support multiple reason entries |
| `ido_rsn_cd_list` | Field | List of Movement Reason Code beans — an `X33VDataTypeList` containing `X33VDataTypeStringBean` entries, each representing one movement reason code entry |
| `ido_rsn_memo` | Field | Movement Reason Memo (異動理由メモ) — free-text memo field providing additional context for the movement reason |
| `mskm_no` | Field | Application Number (申込番号) — the application/registration number identifying a service application record |
| `mskm_dtl_no` | Field | Application Detail Number (申請明細番号) — the detail line item number within an application, identifying a specific line of the application |
| `value` | Subkey | Request facet: retrieve the current data value of the field |
| `state` | Subkey | Request facet: retrieve the UI state (enabled/disabled/readonly) of the field for rendering controls |
| X33VDataTypeBeanInterface | Interface | Futurity X33 framework interface for data beans that support key-based load/store of field values |
| X33VListedBeanInterface | Interface | Futurity X33 framework interface for data beans that hold list-based data (e.g., the `ido_rsn_cd_list`) |
| X33VDataTypeStringBean | Class | A Futurity X33 list element bean representing a string data type entry, used to hold individual movement reason code items |
| ANK-2755 | Change Request | A change request (dated 2016/08/10) that converted `ido_rsn_cd` from a simple string field to a list-based field, enabling multiple movement reason codes per record |
| K-Opticom | Business term | Japanese telecommunications service provider (K-Opticom KK) — the system owner and operator |
| 異動 (Ido) | Japanese term | Movement/Transfer — refers to changes in service contract status such as transfers, cancellations, or modifications |
| X33VDataTypeList | Class | A Futurity X33 framework class providing a typed list container for list-based data type beans |
