# Business Logic — KKW01021SF01DBean.loadModelData() [100 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01021SF.KKW01021SF01DBean` |
| Layer | **Data Bean** (Webview layer — X33 framework data holder) |
| Module | `KKW01021SF` (Package: `eo.web.webview.KKW01021SF`) |

## 1. Role

### KKW01021SF01DBean.loadModelData()

This method serves as the **centralized data access dispatcher** for the `KKW01021SF01DBean` data bean, which holds all form-field state for a **diversion/move-in service order screen** (異動画面). In the K-Opticom telecom self-service domain, this screen allows customers to register or modify a service transfer (異動) — moving their contract from one location, customer identity, or service line to another. The method implements a **routing/dispatch pattern**: it inspects the incoming `key` (item name) and `subkey` (value or state), then delegates to the appropriate getter on the bean to return the requested field data.

The method handles **7 distinct data types**, each corresponding to a business concept on the diversion registration screen: (1) Customer SYSID (the internal customer identifier), (2) Service Contract Number (サービス契約番号), (3) Diversion Type (異動区分), (4) Diversion Reason Code (異動理由コード) — which uses a special list-based indexed access, (5) Diversion Reason Memo (異動理由メモ), (6) Application Number (申込番号), and (7) Application Detail Number (申込詳細番号). For simple types, each supports two subkeys: `"value"` returns the current data value, while `"state"` returns the field's editing/validation state.

As a **shared utility data bean** within the X33 framework, this method is called by the screen's parent bean (`KKW01021SFBean`) via `storeModelData` during screen initialization and data population. It acts as the **bridge between the X33 view layer and the bean's internal fields**, enabling dynamic data binding without hard-coded field access across the UI layer.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])
    NULL_CHECK{key or subkey is null}
    SEPARATOR["int separaterPoint = key.indexOf('/')"]
    COND_SYSID{key equals SYSID}
    SUBKEY_VAL_SYSID{subkey equals value}
    SUBKEY_STA_SYSID{subkey equals state}
    RET_SYSID_VAL["return getSysid_value"]
    RET_SYSID_STA["return getSysid_state"]
    COND_SVC{key equals サービス契約番号}
    SUBKEY_VAL_SVC{subkey equals value}
    SUBKEY_STA_SVC{subkey equals state}
    RET_SVC_VAL["return getSvc_kei_no_value"]
    RET_SVC_STA["return getSvc_kei_no_state"]
    COND_IDO_DIV{key equals 異動区分}
    SUBKEY_VAL_IDODIV{subkey equals value}
    SUBKEY_STA_IDODIV{subkey equals state}
    RET_IDODIV_VAL["return getIdo_div_value"]
    RET_IDODIV_STA["return getIdo_div_state"]
    COND_RSN_CD{key equals 異動理由コード}
    KEY_SUBSTR["key = key.substring(separaterPoint + 1)"]
    INDEX_STAR{key equals *}
    RET_RSN_CD_COUNT["return list.size"]
    PARSE_INDEX{NumberFormatException}
    INDEX_NULL{tmpIndexInt is null}
    INDEX_BOUNDS{tmpIndex out of bounds}
    RET_RSN_CD_INDEX["return list element loadModelData subkey"]
    COND_RSN_MEMO{key equals 異動理由メモ}
    SUBKEY_VAL_RSNMEMO{subkey equals value}
    SUBKEY_STA_RSNMEMO{subkey equals state}
    RET_RSN_MEMO_VAL["return getIdo_rsn_memo_value"]
    RET_RSN_MEMO_STA["return getIdo_rsn_memo_state"]
    COND_MSKM_NO{key equals 申込番号}
    SUBKEY_VAL_MSKM{subkey equals value}
    SUBKEY_STA_MSKM{subkey equals state}
    RET_MSKM_VAL["return getMskm_no_value"]
    RET_MSKM_STA["return getMskm_no_state"]
    COND_MSKM_DTL{key equals 申込詳細番号}
    SUBKEY_VAL_DTL{subkey equals value}
    SUBKEY_STA_DTL{subkey equals state}
    RET_DTL_VAL["return getMskm_dtl_no_value"]
    RET_DTL_STA["return getMskm_dtl_no_state"]
    RET_NULL["return null"]
    END(["End"])

    START --> NULL_CHECK
    NULL_CHECK -->|Yes| RET_NULL
    NULL_CHECK -->|No| SEPARATOR
    SEPARATOR --> COND_SYSID
    COND_SYSID -->|Yes| SUBKEY_VAL_SYSID
    SUBKEY_VAL_SYSID -->|Yes| RET_SYSID_VAL
    SUBKEY_VAL_SYSID -->|No| SUBKEY_STA_SYSID
    SUBKEY_STA_SYSID -->|Yes| RET_SYSID_STA
    SUBKEY_STA_SYSID -->|No| COND_SVC
    COND_SYSID -->|No| COND_SVC
    COND_SVC -->|Yes| SUBKEY_VAL_SVC
    SUBKEY_VAL_SVC -->|Yes| RET_SVC_VAL
    SUBKEY_VAL_SVC -->|No| SUBKEY_STA_SVC
    SUBKEY_STA_SVC -->|Yes| RET_SVC_STA
    SUBKEY_STA_SVC -->|No| COND_IDO_DIV
    COND_SVC -->|No| COND_IDO_DIV
    COND_IDO_DIV -->|Yes| SUBKEY_VAL_IDODIV
    SUBKEY_VAL_IDODIV -->|Yes| RET_IDODIV_VAL
    SUBKEY_VAL_IDODIV -->|No| SUBKEY_STA_IDODIV
    SUBKEY_STA_IDODIV -->|Yes| RET_IDODIV_STA
    SUBKEY_STA_IDODIV -->|No| COND_RSN_CD
    COND_IDO_DIV -->|No| COND_RSN_CD
    COND_RSN_CD -->|Yes| KEY_SUBSTR
    COND_RSN_CD -->|No| COND_RSN_MEMO
    KEY_SUBSTR --> INDEX_STAR
    INDEX_STAR -->|Yes| RET_RSN_CD_COUNT
    INDEX_STAR -->|No| PARSE_INDEX
    PARSE_INDEX -->|Yes| RET_NULL
    PARSE_INDEX -->|No| INDEX_NULL
    INDEX_NULL -->|Yes| RET_NULL
    INDEX_NULL -->|No| INDEX_BOUNDS
    INDEX_BOUNDS -->|Yes| RET_NULL
    INDEX_BOUNDS -->|No| RET_RSN_CD_INDEX
    RET_RSN_CD_COUNT --> COND_RSN_MEMO
    RET_NULL --> COND_RSN_MEMO
    RET_RSN_CD_INDEX --> COND_RSN_MEMO
    COND_RSN_MEMO -->|Yes| SUBKEY_VAL_RSNMEMO
    SUBKEY_VAL_RSNMEMO -->|Yes| RET_RSN_MEMO_VAL
    SUBKEY_VAL_RSNMEMO -->|No| SUBKEY_STA_RSNMEMO
    SUBKEY_STA_RSNMEMO -->|Yes| RET_RSN_MEMO_STA
    SUBKEY_STA_RSNMEMO -->|No| COND_MSKM_NO
    COND_RSN_MEMO -->|No| COND_MSKM_NO
    COND_MSKM_NO -->|Yes| SUBKEY_VAL_MSKM
    SUBKEY_VAL_MSKM -->|Yes| RET_MSKM_VAL
    SUBKEY_VAL_MSKM -->|No| SUBKEY_STA_MSKM
    SUBKEY_STA_MSKM -->|Yes| RET_MSKM_STA
    SUBKEY_STA_MSKM -->|No| COND_MSKM_DTL
    COND_MSKM_NO -->|No| COND_MSKM_DTL
    COND_MSKM_DTL -->|Yes| SUBKEY_VAL_DTL
    SUBKEY_VAL_DTL -->|Yes| RET_DTL_VAL
    SUBKEY_VAL_DTL -->|No| SUBKEY_STA_DTL
    SUBKEY_STA_DTL -->|Yes| RET_DTL_STA
    SUBKEY_STA_DTL -->|No| RET_NULL
    COND_MSKM_DTL -->|No| RET_NULL
    RET_SYSID_VAL --> END
    RET_SYSID_STA --> END
    RET_SVC_VAL --> END
    RET_SVC_STA --> END
    RET_IDODIV_VAL --> END
    RET_IDODIV_STA --> END
    RET_RSN_MEMO_VAL --> END
    RET_RSN_MEMO_STA --> END
    RET_MSKM_VAL --> END
    RET_MSKM_STA --> END
    RET_DTL_VAL --> END
    RET_DTL_STA --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **item name** (項目名) identifying which field's data to retrieve. Acts as a discriminator for data types: `"SYSID"` (Customer ID), `"サービス契約番号"` (Service Contract Number), `"異動区分"` (Diversion Type), `"異動理由コード"` (Diversion Reason Code), `"異動理由メモ"` (Diversion Reason Memo), `"申込番号"` (Application Number), `"申込詳細番号"` (Application Detail Number). |
| 2 | `subkey` | `String` | The **sub-key** (サブキー) specifying what aspect of the field to retrieve. Typically `"value"` for the actual data content, or `"state"` for the field's validation/editing state (e.g., whether the field is read-only, required, or disabled). |

**Instance fields read by this method:**

| No | Field Name | Type | Business Description |
|----|-----------|------|---------------------|
| 1 | `sysid_value` | `String` | Customer SYSID value — internal identifier for the customer (顧客) |
| 2 | `sysid_state` | `String` | Customer SYSID field state |
| 3 | `svc_kei_no_value` | `String` | Service contract number value (サービス契約番号) |
| 4 | `svc_kei_no_state` | `String` | Service contract number field state |
| 5 | `ido_div_value` | `String` | Diversion/move-in type value (異動区分) |
| 6 | `ido_div_state` | `String` | Diversion type field state |
| 7 | `ido_rsn_cd_list` | `X33VDataTypeList` | List of diversion reason codes (異動理由コード) — each element is an `X33VDataTypeStringBean` that supports its own `loadModelData` dispatch |
| 8 | `ido_rsn_memo_value` | `String` | Diversion reason memo text (異動理由メモ) |
| 9 | `ido_rsn_memo_state` | `String` | Diversion reason memo field state |
| 10 | `mskm_no_value` | `String` | Application/order number value (申込番号) |
| 11 | `mskm_no_state` | `String` | Application number field state |
| 12 | `mskm_dtl_no_value` | `String` | Application detail number value (申込詳細番号) |
| 13 | `mskm_dtl_no_state` | `String` | Application detail number field state |

## 4. CRUD Operations / Called Services

This method performs **pure read (R) operations** — it is a data getter with no writes, creates, deletes, or service component calls to external SC/CBS layers. All called methods are internal getter delegations on the same bean.

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW01021SF01DBean.getSysid_value` | KKW01021SF01DBean | - | Reads the customer SYSID (internal customer identifier) value field |
| R | `KKW01021SF01DBean.getSysid_state` | KKW01021SF01DBean | - | Reads the customer SYSID field state (editability/validation status) |
| R | `KKW01021SF01DBean.getSvc_kei_no_value` | KKW01021SF01DBean | - | Reads the service contract number (サービス契約番号) value |
| R | `KKW01021SF01DBean.getSvc_kei_no_state` | KKW01021SF01DBean | - | Reads the service contract number field state |
| R | `KKW01021SF01DBean.getIdo_div_value` | KKW01021SF01DBean | - | Reads the diversion type (異動区分) value — classification of the move-in/move-out operation |
| R | `KKW01021SF01DBean.getIdo_div_state` | KKW01021SF01DBean | - | Reads the diversion type field state |
| R | `KKW01021SF01DBean.getIdo_rsn_memo_value` | KKW01021SF01DBean | - | Reads the diversion reason memo (異動理由メモ) text value |
| R | `KKW01021SF01DBean.getIdo_rsn_memo_state` | KKW01021SF01DBean | - | Reads the diversion reason memo field state |
| R | `KKW01021SF01DBean.getMskm_no_value` | KKW01021SF01DBean | - | Reads the application number (申込番号) value — order registration sequence number |
| R | `KKW01021SF01DBean.getMskm_no_state` | KKW01021SF01DBean | - | Reads the application number field state |
| R | `KKW01021SF01DBean.getMskm_dtl_no_value` | KKW01021SF01DBean | - | Reads the application detail number (申込詳細番号) value — sub-item within an application |
| R | `KKW01021SF01DBean.getMskm_dtl_no_state` | KKW01021SF01DBean | - | Reads the application detail number field state |
| R | `KKW01021SF01DBean.loadModelData` | KKW01021SF01DBean | - | Delegated call on a list element (異動理由コード entry) to get its value or state by subkey |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | KKW01021SFBean | `KKW01021SFBean.loadModelData(gamenId, key, subkey)` -> delegates to `KKW01021SF01DBean.loadModelData(key, subkey)` | Read-only bean getter dispatch — no SC/CBS or DB terminal |

**Note:** The pre-computed caller is the overloaded `KKW01021SFBean.loadModelData(String, String)` which simply forwards to `KKW01021SF01DBean.loadModelData(String, String)`. This bean is instantiated within `KKW01021SFBean` and used to populate form data for the diversion/move-in service registration screen. The method performs no external service calls, DB access, or CRUD operations — it is a pure in-memory data dispatcher within the X33 view framework.

## 6. Per-Branch Detail Blocks

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

Early null guard — returns null immediately if either parameter is null.

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

**Block 2** — [EXEC] `key.indexOf("/")` (L266)

Computes the separator position for keys containing a "/" character (used by the 異動理由コード block to extract a sub-element).

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/")` // Find position of "/" separator |

**Block 3** — [ELSE-IF] `key.equals("SYSID")` (L269)

Matches the customer SYSID data type (項目ID: sysid). SYSID is the internal customer identifier (お客户 SYSID).

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` // Check if requesting the value |
| 2 | RETURN | `return getSysid_value()` // Return the SYSID data value |
| 3 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey is "state" -> return field state (subkeyが"state"の場合、ステータスを返す) |
| 4 | RETURN | `return getSysid_state()` // Return the SYSID field state |

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

Matches the service contract number data type (項目ID: svc_kei_no). This is the K-Opticom service contract line item number.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` // Check if requesting the value |
| 2 | RETURN | `return getSvc_kei_no_value()` // Return the service contract number value |
| 3 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey is "state" -> return field state (subkeyが"state"の場合、ステータスを返す) |
| 4 | RETURN | `return getSvc_kei_no_state()` // Return the service contract number field state |

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

Matches the diversion/move-in type data type (項目ID: ido_div). Classifies what kind of service transfer this is (e.g., move-in, move-out, transfer).

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` // Check if requesting the value |
| 2 | RETURN | `return getIdo_div_value()` // Return the diversion type value |
| 3 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey is "state" -> return field state (subkeyが"state"の場合、ステータスを返す) |
| 4 | RETURN | `return getIdo_div_state()` // Return the diversion type field state |

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

Special block for the diversion reason code data type (項目ID: ido_rsn_cd). Unlike other blocks, this type holds a **list of codes** (異動理由コード list) and supports indexed access via a `"*" key for count or a numeric index for a specific entry.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // Extract sub-element after "/" (keyの次の要素を取得) |
| 2 | IF | `key.equals("*")` // Check if requesting list count (インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す) |
| 3 | RETURN | `return Integer.valueOf(ido_rsn_cd_list.size())` // Return the number of entries in the reason code list |
| 4 | TRY-CATCH | `tmpIndexInt = Integer.valueOf(key)` // Parse the key as a numeric index |
| 5 | CATCH | `NumberFormatException e` -> `return null` // If key is not a valid numeric string, return null (インデックス値が数値文字列でない場合は、ここでnullを返す) |
| 6 | IF | `tmpIndexInt == null` // Defensive null check after parsing (index value is null) |
| 7 | RETURN | `return null` // Return null if index is null |
| 8 | SET | `int tmpIndex = tmpIndexInt.intValue()` // Extract primitive int from Integer |
| 9 | IF | `tmpIndex < 0 || tmpIndex >= ido_rsn_cd_list.size()` // Check if index is out of bounds (インデックス値がリスト個数-1を超える場合、ここでnullを返す) |
| 10 | RETURN | `return null` // Out-of-bounds -> return null |
| 11 | RETURN | `return ((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).loadModelData(subkey)` // Delegate to list element's loadModelData to get its value or state |

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

Matches the diversion reason memo data type (項目ID: ido_rsn_memo). Free-text field describing why the service diversion is being requested.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` // Check if requesting the value |
| 2 | RETURN | `return getIdo_rsn_memo_value()` // Return the reason memo text value |
| 3 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey is "state" -> return field state (subkeyが"state"の場合、ステータスを返す) |
| 4 | RETURN | `return getIdo_rsn_memo_state()` // Return the reason memo field state |

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

Matches the application number data type (項目ID: mskm_no). The main order/application registration sequence number.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` // Check if requesting the value |
| 2 | RETURN | `return getMskm_no_value()` // Return the application number value |
| 3 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey is "state" -> return field state (subkeyが"state"の場合、ステータスを返す) |
| 4 | RETURN | `return getMskm_no_state()` // Return the application number field state |

**Block 9** — [ELSE-IF] `key.equals("申込詳細番号")` (L351)

Matches the application detail number data type (項目ID: mskm_dtl_no). Sub-item number within an application for multi-line service items.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` // Check if requesting the value |
| 2 | RETURN | `return getMskm_dtl_no_value()` // Return the application detail number value |
| 3 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey is "state" -> return field state (subkeyが"state"の場合、ステータスを返す) |
| 4 | RETURN | `return getMskm_dtl_no_state()` // Return the application detail number field state |

**Block 10** — [ELSE/DEFAULT] (L361)

No matching key found. Returns null for unrecognized data types.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // No matching property exists -> return null (条件に一致するプロパティが存在しない場合は、nullを返す) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sysid` | Field | SYSID — internal system identifier for the customer (お客户). Unique identifier assigned to each registered customer in the K-Opticom system. |
| `svc_kei_no` | Field | Service Contract Number (サービス契約番号) — the service line contract identifier for a K-Opticom telecom service. Each service line (FTTH, Mail, etc.) has its own contract number. |
| `ido_div` | Field | Diversion Type (異動区分) — classifies the type of service transfer/move-in operation. Distinguishes between different categories of contract transfer (e.g., new move-in, transfer between lines). |
| `ido_rsn_cd` | Field | Diversion Reason Code (異動理由コード) — codes explaining why the service diversion/move-in is being performed. Stored as a list of `X33VDataTypeStringBean` entries. |
| `ido_rsn_memo` | Field | Diversion Reason Memo (異動理由メモ) — free-text memo describing the reason for the service diversion. |
| `mskm_no` | Field | Application Number (申込番号) — the sequence number assigned to a service order registration application (申込). Identifies the main order application. |
| `mskm_dtl_no` | Field | Application Detail Number (申込詳細番号) — sub-item number within an application for multi-line service registrations. |
| `key` | Parameter | Item name (項目名) — the discriminator that identifies which field's data to retrieve. Contains the business data type. |
| `subkey` | Parameter | Sub-key (サブキー) — specifies what aspect of the field to retrieve: `"value"` for data content, `"state"` for field editability/validation state. |
| `X33VDataTypeList` | Class | X33 Framework list data type — a generic list container holding typed data beans (e.g., `X33VDataTypeStringBean`). Used for list-type fields like reason codes. |
| `X33VDataTypeStringBean` | Class | X33 Framework string data bean — a wrapper for string data that supports its own `loadModelData` dispatch for value/state sub-key access. |
| `X33VListedBeanInterface` | Interface | X33 Framework interface for beans that contain list-type data fields. |
| `X33VDataTypeBeanInterface` | Interface | X33 Framework interface for beans that support value/state-based data access via `loadModelData`. |
| 異動 (Idou) | Business term | Diversion/Transfer — the telecom business process of moving a service contract from one location, customer, or line to another. Central concept of the KKW01021SF screen. |
| X33 Framework | Technical | Fujitsu's web client framework used for building self-service portal screens. Provides data binding, bean lifecycle management, and view-model patterns via interfaces like `X33VDataTypeBeanInterface`. |
| DBean | Technical abbreviation | Data Bean — a bean class (convention: `*DBean`) that holds form field data and state for a screen, implementing data binding interfaces for the X33 framework. |
| KKW01021SF | Module | Service diversion/move-in registration screen module (異動登録画面). Part of the K-Opticom self-service web portal. |
