# Business Logic — KKW00816SF01DBean.loadModelData() [80 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00816SF.KKW00816SF01DBean` |
| Layer | View Data Bean (Framework adapter) |
| Module | `KKW00816SF` (Package: `eo.web.webview.KKW00816SF`) |

## 1. Role

### KKW00816SF01DBean.loadModelData()

This method serves as the central data-access dispatcher for the `KKW00816SF01DBean` data bean, implementing the `X33VDataTypeBeanInterface` contract from the Fujitsu Futurity X33 web framework. Its business purpose is to provide uniform, key-driven access to the bean's internal fields — enabling the UI layer (typically JSP view pages via the X33V framework) to retrieve field values, state codes, and indexed list elements without direct field access or type casting. The method supports five distinct data types: the system ID (`SYSID`), the service contract number (`サービス契約番号`), the change classification (`異動区分`), the change reason code list (`異動理由コード`), and the change reason memo (`異動理由メモ`). It implements a key-subkey routing pattern where each data type branches into either a "value" read or a "state" read, except for the change reason code which additionally supports indexed list access using numeric keys or `*` to return the list size. This dispatcher pattern is a core part of the X33V data binding architecture, where the framework calls `loadModelData` dynamically during form rendering to populate fields on screen, making it a shared utility called by the framework and the parent bean (`KKW00816SFBean`) during data initialization and display operations.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> COND_NULL["key == null
|| subkey == null"]
    COND_NULL -->|true| RET_NULL["Return null"]
    COND_NULL -->|false| FIND_SLASH["int separaterPoint =
key.indexOf('/')"]

    FIND_SLASH --> COND_SYSID["key.equals('SYSID')"]
    COND_SYSID -->|true| COND_SYSID_SUB["subkey.equalsIgnoreCase('value')"]
    COND_SYSID_SUB -->|true| RET_SYSID_VAL["Return getSysid_value()"]
    COND_SYSID_SUB -->|false| COND_SYSID_ST["subkey.equalsIgnoreCase('state')"]
    COND_SYSID_ST -->|true| RET_SYSID_ST["Return getSysid_state()"]
    COND_SYSID_ST -->|false| END_FALLTHROUGH["Fall through to final return"]

    COND_SYSID -->|false| COND_SVC["key.equals('サービス契約番号')"]
    COND_SVC -->|true| COND_SVC_SUB["subkey.equalsIgnoreCase('value')"]
    COND_SVC_SUB -->|true| RET_SVC_VAL["Return getSvc_kei_no_value()"]
    COND_SVC_SUB -->|false| COND_SVC_ST["subkey.equalsIgnoreCase('state')"]
    COND_SVC_ST -->|true| RET_SVC_ST["Return getSvc_kei_no_state()"]
    COND_SVC_ST -->|false| END_FALLTHROUGH

    COND_SVC -->|false| COND_IDODIV["key.equals('異動区分')"]
    COND_IDODIV -->|true| COND_IDODIV_SUB["subkey.equalsIgnoreCase('value')"]
    COND_IDODIV_SUB -->|true| RET_IDODIV_VAL["Return getIdo_div_value()"]
    COND_IDODIV_SUB -->|false| COND_IDODIV_ST["subkey.equalsIgnoreCase('state')"]
    COND_IDODIV_ST -->|true| RET_IDODIV_ST["Return getIdo_div_state()"]
    COND_IDODIV_ST -->|false| END_FALLTHROUGH

    COND_IDODIV -->|false| COND_RSNCD["key.equals('異動理由コード')"]
    COND_RSNCD -->|true| RSN_KEY_EXTRACT["key = key.substring(separaterPoint + 1)"]
    RSN_KEY_EXTRACT --> COND_STAR["key.equals('*')"]
    COND_STAR -->|true| RET_IDO_LIST_SIZE["Return Integer.valueOf(ido_rsn_cd_list.size())"]
    COND_STAR -->|false| TRY_PARSE["try { tmpIndexInt = Integer.valueOf(key) }"]
    TRY_PARSE -->|success| COND_NULL_INDEX["tmpIndexInt == null"]
    TRY_PARSE -->|catch NumberFormatException| RET_PARSE_NULL["Return null"]
    COND_NULL_INDEX -->|true| RET_NULL2["Return null"]
    COND_NULL_INDEX -->|false| COND_IDX_RANGE["tmpIndex < 0
|| tmpIndex >= ido_rsn_cd_list.size()"]
    COND_IDX_RANGE -->|true| RET_NULL3["Return null"]
    COND_IDX_RANGE -->|false| RET_IDX_CALL["((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).loadModelData(subkey)"]
    RET_IDX_CALL --> END_RETURN

    COND_RSNCD -->|false| COND_RSNMEMO["key.equals('異動理由メモ')"]
    COND_RSNMEMO -->|true| COND_RSNMEMO_SUB["subkey.equalsIgnoreCase('value')"]
    COND_RSNMEMO_SUB -->|true| RET_RSNMEMO_VAL["Return getIdo_rsn_memo_value()"]
    COND_RSNMEMO_SUB -->|false| COND_RSNMEMO_ST["subkey.equalsIgnoreCase('state')"]
    COND_RSNMEMO_ST -->|true| RET_RSNMEMO_ST["Return getIdo_rsn_memo_state()"]
    COND_RSNMEMO_ST -->|false| END_FALLTHROUGH

    COND_RSNMEMO -->|false| END_FALLTHROUGH

    END_FALLTHROUGH --> RET_FALLBACK["Return null"]
    RET_SYSID_VAL --> END_RETURN
    RET_SYSID_ST --> END_RETURN
    RET_SVC_VAL --> END_RETURN
    RET_SVC_ST --> END_RETURN
    RET_IDODIV_VAL --> END_RETURN
    RET_IDODIV_ST --> END_RETURN
    RET_IDO_LIST_SIZE --> END_RETURN
    RET_PARSE_NULL --> END_RETURN
    RET_NULL2 --> END_RETURN
    RET_NULL3 --> END_RETURN
    RET_RSNMEMO_VAL --> END_RETURN
    RET_RSNMEMO_ST --> END_RETURN

    END_RETURN(["Return / Next"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business field name used to identify which data item to retrieve. Valid values are `"SYSID"` (system ID), `"サービス契約番号"` (Service Contract Number), `"異動区分"` (Change Classification), `"異動理由コード"` (Change Reason Code — with a `/` separator prefix for index-based access), and `"異動理由メモ"` (Change Reason Memo). The key determines which conditional branch the method follows and which underlying field is accessed. |
| 2 | `subkey` | `String` | The sub-key that refines the data access mode within a given key branch. Typically takes values `"value"` to retrieve the actual field data, or `"state"` to retrieve the field's lifecycle state code (e.g., whether the field has been modified). For the `"異動理由コード"` key, `subkey` is passed through to the nested bean's `loadModelData` for further resolution. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `sysid_value` | `String` | System ID value — the internal system identifier |
| `sysid_state` | `String` | System ID lifecycle state code |
| `svc_kei_no_value` | `String` | Service contract number value — the identifier for the service contract |
| `svc_kei_no_state` | `String` | Service contract number lifecycle state code |
| `ido_div_value` | `String` | Change classification value — the type/category of a customer contract change |
| `ido_div_state` | `String` | Change classification lifecycle state code |
| `ido_rsn_cd_list` | `X33VDataTypeList` | List of change reason codes — a list of indexed `X33VDataTypeStringBean` items representing individual change reason entries for a contract change event |
| `ido_rsn_memo_value` | `String` | Change reason memo value — free-text explanation for why a contract change occurred |
| `ido_rsn_memo_state` | `String` | Change reason memo lifecycle state code |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKAdEditCC.substring` | JKKAdEditCC | - | Calls `substring` in `JKKAdEditCC` |
| - | `JKKAdEdit.substring` | JKKAdEdit | - | Calls `substring` in `JKKAdEdit` |
| - | `JKKTelnoInfoAddMapperCC.substring` | JKKTelnoInfoAddMapperCC | - | Calls `substring` in `JKKTelnoInfoAddMapperCC` |
| - | `JDKejbStringEdit.substring` | JDKejbStringEdit | - | Calls `substring` in `JDKejbStringEdit` |
| R | `KKW00816SF01DBean.getIdo_div_state` | KKW00816SF01DBean | - | Calls `getIdo_div_state` in `KKW00816SF01DBean` |
| R | `KKW00816SF01DBean.getIdo_div_value` | KKW00816SF01DBean | - | Calls `getIdo_div_value` in `KKW00816SF01DBean` |
| R | `KKW00816SF01DBean.getIdo_rsn_memo_state` | KKW00816SF01DBean | - | Calls `getIdo_rsn_memo_state` in `KKW00816SF01DBean` |
| R | `KKW00816SF01DBean.getIdo_rsn_memo_value` | KKW00816SF01DBean | - | Calls `getIdo_rsn_memo_value` in `KKW00816SF01DBean` |
| R | `KKW00816SF01DBean.getSvc_kei_no_state` | KKW00816SF01DBean | - | Calls `getSvc_kei_no_state` in `KKW00816SF01DBean` |
| R | `KKW00816SF01DBean.getSvc_kei_no_value` | KKW00816SF01DBean | - | Calls `getSvc_kei_no_value` in `KKW00816SF01DBean` |
| R | `KKW00816SF01DBean.getSysid_state` | KKW00816SF01DBean | - | Calls `getSysid_state` in `KKW00816SF01DBean` |
| R | `KKW00816SF01DBean.getSysid_value` | KKW00816SF01DBean | - | Calls `getSysid_value` in `KKW00816SF01DBean` |
| R | `KKW00816SF01DBean.loadModelData` | KKW00816SF01DBean | - | Calls `loadModelData` in `KKW00816SF01DBean` (delegated to nested bean in `ido_rsn_cd_list`) |

This method performs only read operations — it is a pure data accessor. It does not directly interact with any database tables or Service Components (SCs). All CRUD operations are handled at higher layers (the parent `KKW00816SFBean` or CBS layer) which populate the bean's fields before this method is called.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: KKW00816SF01DBean | `KKW00816SF01DBean.loadModelData(key, subkey)` — self-call (overloaded / same-signature re-invocation) | — (no terminal SC/DB — pure accessor) |

This method is called by the X33V framework during view rendering to dynamically resolve field values, and is also called by the parent bean `KKW00816SFBean` (and nested `X33VDataTypeStringBean` instances within `ido_rsn_cd_list`) when the framework traverses the data model. It is not directly invoked by a screen class — it is called indirectly through the framework's data binding mechanism.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null guard) `(key == null || subkey == null)` (L203)

> Guard clause: if either parameter is null, the method returns null immediately. This prevents NullPointerException during key comparison and represents the framework's contract that all fields are always set before data retrieval.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // key or subkey is null — return immediately [-> key==null \|\| subkey==null] |

---

**Block 2** — EXEC (separator position) (L207)

> Before any key comparison, compute the position of the `/` separator character in the key. This value is used later in the "Change Reason Code" branch to extract the index portion after the `/`.

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

---

**Block 3** — IF-ELSEIF chain (Data Type: SYSID) `[SYSID="SYSID"]` (L210)

> The first data type branch handles the system ID field. It checks if the key is "SYSID" and then dispatches to either the value getter or the state getter based on the subkey.

**Block 3.1** — IF (key is SYSID) `key.equals("SYSID")` (L210)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` // subkey is "value" — check case-insensitively |

**Block 3.1.1** — RETURN (SYSID value) (L211)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getSysid_value();` // Return the system ID value from sysid_value field |

**Block 3.2** — ELSE IF (key is SYSID, subkey is state) `subkey.equalsIgnoreCase("state")` (L213)

> If the subkey is "state", return the state code for the system ID field. (state: "state")

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getSysid_state();` // Return the system ID state code from sysid_state field |

**Block 3.3** — ELSE (fallthrough from SYSID branch)

> If the subkey is neither "value" nor "state" for SYSID, fall through to the next branch.

---

**Block 4** — ELSE IF (Data Type: Service Contract Number) `[サービス契約番号="サービス契約番号"]` (L220)

> The second data type branch handles the service contract number. It checks if the key matches the Japanese string "サービス契約番号" (Service Contract Number) and dispatches to value or state getters.

**Block 4.1** — IF (subkey is value) `subkey.equalsIgnoreCase("value")` (L221)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getSvc_kei_no_value();` // Return the service contract number value from svc_kei_no_value field |

**Block 4.2** — ELSE IF (subkey is state) `subkey.equalsIgnoreCase("state")` (L223)

> If the subkey is "state", return the lifecycle state code for the service contract number field. (state: "state")

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getSvc_kei_no_state();` // Return the service contract number state code from svc_kei_no_state field |

---

**Block 5** — ELSE IF (Data Type: Change Classification) `[異動区分="異動区分"]` (L230)

> The third data type branch handles the change classification (e.g., new connection, termination, modification). It checks if the key matches the Japanese string "異動区分" (Change Classification) and dispatches to value or state getters.

**Block 5.1** — IF (subkey is value) `subkey.equalsIgnoreCase("value")` (L231)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIdo_div_value();` // Return the change classification value from ido_div_value field |

**Block 5.2** — ELSE IF (subkey is state) `subkey.equalsIgnoreCase("state")` (L233)

> If the subkey is "state", return the lifecycle state code for the change classification field. (state: "state")

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIdo_div_state();` // Return the change classification state code from ido_div_state field |

---

**Block 6** — ELSE IF (Data Type: Change Reason Code — indexed list) `[異動理由コード="異動理由コード"]` (L240)

> The fourth data type branch is unique: it handles an indexed list of change reason codes. The key contains a `/` separator followed by either `*` (to return the list size) or a numeric index. This is a multi-level nested block with key extraction, index parsing, range validation, and delegation to nested beans.

**Block 6.1** — SET (key extraction) (L242)

> Extract the portion of the key after the `/` separator — this becomes the index string (e.g., "0", "1", "*", etc.).

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // Extract the index portion after '/' |

**Block 6.2** — IF (list size request) `key.equals("*")` (L244)

> If the extracted key is "*", return the number of items in the change reason code list. This allows the UI to know the total count of reason entries for iteration.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return Integer.valueOf(ido_rsn_cd_list.size());` // Return the size of the change reason code list |

**Block 6.3** — ELSE (index-based access) (L247)

> When the key is a numeric string (not "*"), parse it as an index and access the specific list element.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null;` // Temporary variable for parsed index |

**Block 6.4** — TRY-CATCH (index parsing) (L249)

> Attempt to parse the key string as an integer. If parsing fails (e.g., the key is not a valid number), catch the exception and return null.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = Integer.valueOf(key);` // Parse key as integer index |
| 2 | CATCH | `catch(NumberFormatException e) { return null; }` // If key is not a valid number, return null |

**Block 6.5** — IF (null check on parsed index) `tmpIndexInt == null` (L257)

> Verify the parsed index is not null after the try block (defensive check).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // tmpIndexInt is null — return null |

**Block 6.6** — SET (index conversion) (L259)

| # | Type | Code |
|---|------|------|
| 1 | SET | `int tmpIndex = tmpIndexInt.intValue();` // Convert Integer to primitive int |

**Block 6.7** — IF (index range validation) `tmpIndex < 0 \|\| tmpIndex >= ido_rsn_cd_list.size()` (L261)

> Validate the index is within the bounds of the list. If out of range, return null. (index value exceeds list size - 1)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // Index out of bounds — return null |

**Block 6.8** — CALL (delegate to nested bean) (L263)

> Retrieve the nested `X33VDataTypeStringBean` at the computed index and delegate to its `loadModelData(subkey)` to resolve the final value. This enables the framework to access individual properties of each list item.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return ((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).loadModelData(subkey);` // Get the nested bean at the index and delegate loadModelData |

---

**Block 7** — ELSE IF (Data Type: Change Reason Memo) `[異動理由メモ="異動理由メモ"]` (L266)

> The fifth and final data type branch handles the change reason memo — a free-text field explaining why a contract change occurred. It follows the same value/state pattern as the simple string fields.

**Block 7.1** — IF (subkey is value) `subkey.equalsIgnoreCase("value")` (L267)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIdo_rsn_memo_value();` // Return the change reason memo value from ido_rsn_memo_value field |

**Block 7.2** — ELSE IF (subkey is state) `subkey.equalsIgnoreCase("state")` (L269)

> If the subkey is "state", return the lifecycle state code for the change reason memo field. (state: "state")

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIdo_rsn_memo_state();` // Return the change reason memo state code from ido_rsn_memo_state field |

---

**Block 8** — ELSE (no matching key) (L276)

> If none of the known data types matched, return null. This is the default case for unrecognized keys. (no matching property found)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching property found — return null |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sysid` | Field | System ID — the internal system identifier for a record, used for database row identification and auditing |
| `svc_kei_no` | Field | Service Contract Number — the unique identifier for a service contract line item (e.g., an FTTH internet service contract) |
| `ido_div` | Field | Change Classification (ido = 異動) — the type/category of a customer contract change event (e.g., new connection, termination, modification, suspension) |
| `ido_rsn_cd` | Field | Change Reason Code — a coded reason why a contract change occurred, stored as an indexed list to support multiple reason entries per change event |
| `ido_rsn_memo` | Field | Change Reason Memo — free-text explanation for why a contract change occurred, complementing the coded reason |
| `value` | Sub-key | Requests the actual field data value |
| `state` | Sub-key | Requests the lifecycle/state code of a field (e.g., whether the field has been modified, is newly created, or was deleted) |
| `*` | Sub-key (list) | Requests the total count/size of an indexed list item |
| X33V | Framework | Fujitsu Futurity X33V — a Java web application framework for building JSP-based enterprise applications with data-binding capabilities |
| X33VDataTypeBeanInterface | Interface | Framework interface that beans implement to support dynamic property access via `loadModelData(String key, String subkey)` |
| X33VDataTypeList | Class | Framework class representing a typed list of data bean instances, used for repeating/inline table items on a screen |
| X33VDataTypeStringBean | Class | Framework class representing a string data type bean used as items within an X33VDataTypeList |
| SYSID | Constant | Literal string key for accessing the system ID field |
| サービス契約番号 | Constant | Japanese string key meaning "Service Contract Number" — used to access the service contract number field |
| 異動区分 | Constant | Japanese string key meaning "Change Classification" — used to access the change classification field |
| 異動理由コード | Constant | Japanese string key meaning "Change Reason Code" — used to access the change reason code list |
| 異動理由メモ | Constant | Japanese string key meaning "Change Reason Memo" — used to access the change reason memo field |
| FTTH | Business term | Fiber To The Home — a fiber-optic internet service offered by K-Opticom |
| K-Opticom | Company | Japan-based telecommunications provider (the domain of this system) |
