---
# Business Logic — KKW00846SF01DBean.loadModelData() [90 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA18001SF.KKW00846SF01DBean` |
| Layer | Web Data Bean (View tier — DBean used by JSF faces for screen data binding) |
| Module | `KKA18001SF` (Package: `eo.web.webview.KKA18001SF`) |

## 1. Role

### KKW00846SF01DBean.loadModelData()

This method is a **unified data accessor** for a single-record DTO-style bean in the K-Opticom telecom order fulfillment web application. It provides a **generic, key-based data retrieval** interface that allows UI screens to fetch individual field values and their edit states from the bean without knowing the internal field names. The method implements a **routing/dispatch design pattern**: it inspects the `key` parameter to determine which business data category the caller is requesting, then branches to the appropriate getter. Six data types are supported: Customer Contract Inheritance ID (SYSID), Service Contract Number, Error Separation, Error Reason Code (a multi-element list), Error Reason Memo, and Process Separation. Each data type is further subdivided by `subkey` into either `value` (the actual data) or `state` (the field's edit/validity state). The Error Reason Code branch is the most sophisticated — it supports index-based list access (via `key/index` format) and list-size queries (via `key/*`), and delegates index-element retrieval to the inner bean's own `loadModelData`. The method serves as the **primary data bridge between the JSF view layer and the backend bean model**, enabling screens to bind to individual fields generically.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])
    NULL_CHECK["key == null or subkey == null"]
    NULL_RETURN(["Return null"])
    SEP["separaterPoint = key.indexOf('/')"]

    SYSID_BRANCH["key equals SYSID"]
    SYSID_VALUE["subkey equals value (case-insensitive)"]
    SYSID_STATE["subkey equals state (case-insensitive)"]
    SYSID_VAL_RETURN(["Return getSysid_value"])
    SYSID_STATE_RETURN(["Return getSysid_state"])

    SVC_BRANCH["key equals Service Contract Number"]
    SVC_VALUE["subkey equals value"]
    SVC_STATE["subkey equals state"]
    SVC_VAL_RETURN(["Return getSvc_kei_no_value"])
    SVC_STATE_RETURN(["Return getSvc_kei_no_state"])

    IDO_BRANCH["key equals Error Separation"]
    IDO_VALUE["subkey equals value"]
    IDO_STATE["subkey equals state"]
    IDO_VAL_RETURN(["Return getIdo_div_value"])
    IDO_STATE_RETURN(["Return getIdo_div_state"])

    RSN_BRANCH["key equals Error Reason Code"]
    RSN_SUBSTRING["key = key.substring(separaterPoint + 1)"]
    RSN_ASTERISK["key equals '*'"]
    RSN_SIZE_RETURN(["Return list.size"])
    RSN_PARSE_INDEX["tmpIndex = parseInt(key)"]
    RSN_PARSE_FAIL(["Return null (parse error)"])
    RSN_NULL_INDEX["tmpIndex == null"]
    RSN_INDEX_OUT["tmpIndex out of range"]
    RSN_DELEGATE(["Return element.loadModelData(subkey)"])

    MEMO_BRANCH["key equals Error Reason Memo"]
    MEMO_VALUE["subkey equals value"]
    MEMO_STATE["subkey equals state"]
    MEMO_VAL_RETURN(["Return getIdo_rsn_memo_value"])
    MEMO_STATE_RETURN(["Return getIdo_rsn_memo_state"])

    PROC_BRANCH["key equals Process Separation"]
    PROC_VALUE["subkey equals value"]
    PROC_STATE["subkey equals state"]
    PROC_VAL_RETURN(["Return getTran_div_value"])
    PROC_STATE_RETURN(["Return getTran_div_state"])

    DEFAULT_RETURN(["Return null (no match)"])

    START --> NULL_CHECK
    NULL_CHECK -->|Yes| NULL_RETURN
    NULL_CHECK -->|No| SEP

    SEP --> SYSID_BRANCH
    SYSID_BRANCH -->|Yes| SYSID_VALUE
    SYSID_BRANCH -->|No| SVC_BRANCH
    SYSID_VALUE -->|Yes| SYSID_VAL_RETURN
    SYSID_VALUE -->|No| SYSID_STATE
    SYSID_STATE -->|Yes| SYSID_STATE_RETURN
    SYSID_STATE -->|No| SVC_BRANCH

    SVC_BRANCH -->|Yes| SVC_VALUE
    SVC_BRANCH -->|No| IDO_BRANCH
    SVC_VALUE -->|Yes| SVC_VAL_RETURN
    SVC_VALUE -->|No| SVC_STATE
    SVC_STATE -->|Yes| SVC_STATE_RETURN
    SVC_STATE -->|No| IDO_BRANCH

    IDO_BRANCH -->|Yes| IDO_VALUE
    IDO_BRANCH -->|No| RSN_BRANCH
    IDO_VALUE -->|Yes| IDO_VAL_RETURN
    IDO_VALUE -->|No| IDO_STATE
    IDO_STATE -->|Yes| IDO_STATE_RETURN
    IDO_STATE -->|No| RSN_BRANCH

    RSN_BRANCH -->|Yes| RSN_SUBSTRING
    RSN_BRANCH -->|No| MEMO_BRANCH
    RSN_SUBSTRING --> RSN_ASTERISK
    RSN_ASTERISK -->|Yes| RSN_SIZE_RETURN
    RSN_ASTERISK -->|No| RSN_PARSE_INDEX
    RSN_PARSE_INDEX --> RSN_PARSE_FAIL
    RSN_PARSE_FAIL --> RSN_NULL_INDEX
    RSN_NULL_INDEX -->|Yes| NULL_RETURN
    RSN_NULL_INDEX -->|No| RSN_INDEX_OUT
    RSN_INDEX_OUT -->|Out of range| NULL_RETURN
    RSN_INDEX_OUT -->|Valid| RSN_DELEGATE

    MEMO_BRANCH -->|Yes| MEMO_VALUE
    MEMO_BRANCH -->|No| PROC_BRANCH
    MEMO_VALUE -->|Yes| MEMO_VAL_RETURN
    MEMO_VALUE -->|No| MEMO_STATE
    MEMO_STATE -->|Yes| MEMO_STATE_RETURN
    MEMO_STATE -->|No| PROC_BRANCH

    PROC_BRANCH -->|Yes| PROC_VALUE
    PROC_BRANCH -->|No| DEFAULT_RETURN
    PROC_VALUE -->|Yes| PROC_VAL_RETURN
    PROC_VALUE -->|No| PROC_STATE
    PROC_STATE -->|Yes| PROC_STATE_RETURN
    PROC_STATE -->|No| DEFAULT_RETURN
```

**CRITICAL — Constant Resolution:**

| Branch Condition | Constant | Resolved Value | Business Meaning |
|-----------------|----------|----------------|------------------|
| `key.equals("SYSID")` | `KKW00846SFConst.SYSID_01` | `"SYSID"` | Customer Contract Inheritance ID (primary key) |
| `key.equals("サービス契約番号")` | `KKW00846SFConst.SVC_KEI_NO_01` | `"サービス契約番号"` | Service Contract Number |
| `key.equals("異動区分")` | `KKW00846SFConst.IDO_DIV_01` | `"異動区分"` | Error Separation (mutation type) |
| `key.equals("異動理由コード")` | `KKW00846SFConst.IDO_RSN_CD_01` | `"異動理由コード"` | Error Reason Code (list key) |
| `key.equals("異動理由メモ")` | `KKW00846SFConst.IDO_RSN_MEMO_01` | `"異動理由メモ"` | Error Reason Memo |
| `key.equals("処理区分")` | `KKW00846SFConst.TRAN_DIV_01` | `"処理区分"` | Process Separation |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business data category identifier. Specifies which field or data type to retrieve. Can take one of six values: `"SYSID"` (Customer Contract Inheritance ID), `"サービス契約番号"` (Service Contract Number), `"異動区分"` (Error Separation), `"異動理由コード"` (Error Reason Code), `"異動理由メモ"` (Error Reason Memo), or `"処理区分"` (Process Separation). For the Error Reason Code type, `key` is expected in `key/index` format where the part after `/` is either a numeric index or `*` for list size. |
| 2 | `subkey` | `String` | The attribute accessor type within the selected data category. For simple data types (SYSID, Service Contract Number, Error Separation, Error Reason Memo, Process Separation), it must be `"value"` to retrieve the data or `"state"` to retrieve the field's edit/validity state. For the Error Reason Code list items, it delegates the subkey to the inner element's own `loadModelData`. Case-insensitive comparison is used. |

**Instance fields read:**

| Field | Type | Usage |
|-------|------|-------|
| `sysid_value` | `String` | Returned when `key="SYSID"` and `subkey="value"` |
| `sysid_state` | `String` | Returned when `key="SYSID"` and `subkey="state"` |
| `svc_kei_no_value` | `String` | Returned when `key="サービス契約番号"` and `subkey="value"` |
| `svc_kei_no_state` | `String` | Returned when `key="サービス契約番号"` and `subkey="state"` |
| `ido_div_value` | `String` | Returned when `key="異動区分"` and `subkey="value"` |
| `ido_div_state` | `String` | Returned when `key="異動区分"` and `subkey="state"` |
| `ido_rsn_cd_list` | `X33VDataTypeList` | Used in the Error Reason Code branch — accessed for list size and indexed element retrieval |
| `ido_rsn_memo_value` | `String` | Returned when `key="異動理由メモ"` and `subkey="value"` |
| `ido_rsn_memo_state` | `String` | Returned when `key="異動理由メモ"` and `subkey="state"` |
| `tran_div_value` | `String` | Returned when `key="処理区分"` and `subkey="value"` |
| `tran_div_state` | `String` | Returned when `key="処理区分"` and `subkey="state"` |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW00846SF01DBean.getSysid_value` | KKW00846SF01DBean | - | Returns the SYSID (Customer Contract Inheritance ID) value field |
| R | `KKW00846SF01DBean.getSysid_state` | KKW00846SF01DBean | - | Returns the SYSID field edit/state flag |
| R | `KKW00846SF01DBean.getSvc_kei_no_value` | KKW00846SF01DBean | - | Returns the Service Contract Number value |
| R | `KKW00846SF01DBean.getSvc_kei_no_state` | KKW00846SF01DBean | - | Returns the Service Contract Number field edit/state flag |
| R | `KKW00846SF01DBean.getIdo_div_value` | KKW00846SF01DBean | - | Returns the Error Separation (mutation type) value |
| R | `KKW00846SF01DBean.getIdo_div_state` | KKW00846SF01DBean | - | Returns the Error Separation field edit/state flag |
| R | `KKW00846SF01DBean.getIdo_rsn_memo_value` | KKW00846SF01DBean | - | Returns the Error Reason Memo value |
| R | `KKW00846SF01DBean.getIdo_rsn_memo_state` | KKW00846SF01DBean | - | Returns the Error Reason Memo field edit/state flag |
| R | `KKW00846SF01DBean.getTran_div_value` | KKW00846SF01DBean | - | Returns the Process Separation value |
| R | `KKW00846SF01DBean.getTran_div_state` | KKW00846SF01DBean | - | Returns the Process Separation field edit/state flag |
| R | `KKW00846SF01DBean.loadModelData` | KKW00846SF01DBean | - | Recursive delegation to inner element's loadModelData (Error Reason Code list item) |
| R | `X33VDataTypeList.size()` | X33VDataTypeList | - | Returns the size of the Error Reason Code list |
| R | `X33VDataTypeList.get(int)` | X33VDataTypeList | - | Retrieves the element at the given index from the Error Reason Code list |
| - | `String.indexOf` | String | - | Finds the position of '/' separator in the key |
| - | `String.substring` | String | - | Extracts the index portion from the key (after the '/') |
| - | `String.equalsIgnoreCase` | String | - | Case-insensitive comparison of subkey against "value" or "state" |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: `KKW00846SFBean` | `KKW00846SFBean.loadModelData(String, String)` → `KKW00846SF01DBean.loadModelData(String, String)` | `getSysid_value [R] sysid_value`, `getSvc_kei_no_value [R] svc_kei_no_value`, `getIdo_div_value [R] ido_div_value`, `element.loadModelData [R] inner X33VDataTypeStringBean`, `getTran_div_value [R] tran_div_value` |
| 2 | Class: `KKW00846SFBean` | `KKW00846SFBean.loadModelData(String, String, String)` → `KKW00846SFBean.loadModelData(String, String)` → `KKW00846SF01DBean.loadModelData(String, String)` | Same as above |

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null check) (L229)

> Null guard: returns null if either parameter is null, preventing downstream NullPointerExceptions.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` | Find separator position for Error Reason Code key format processing |

**Block 2** — IF (SYSID branch) `[SYSID_01="SYSID"]` (L232)

> Data type: Customer Contract Inheritance ID — a String-type field. This is the primary system identifier for customer contract inheritance records.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("SYSID")` [SYSID_01="SYSID"] — check if key matches SYSID data type |
| 2 | IF (nested) | `subkey.equalsIgnoreCase("value")` — check subkey for value access |
| 3 | RETURN | `return getSysid_value();` | Return SYSID data value |
| 4 | IF-ELSEIF (nested) | `subkey.equalsIgnoreCase("state")` — check subkey for state access (subkey that is "state" (case-insensitive)) |
| 5 | RETURN | `return getSysid_state();` | Return SYSID field state |
| 6 | ELSE-IF (sibling to Block 2) | `key.equals("サービス契約番号")` [SVC_KEI_NO_01="サービス契約番号"] — check for Service Contract Number |

**Block 3** — ELSE-IF (Service Contract Number branch) `[SVC_KEI_NO_01="サービス契約番号"]` (L243)

> Data type: Service Contract Number — a String-type field representing the service contract line item identifier.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` — check subkey for value access |
| 2 | RETURN | `return getSvc_kei_no_value();` | Return service contract number value |
| 3 | IF-ELSEIF | `subkey.equalsIgnoreCase("state")` — check subkey for state access |
| 4 | RETURN | `return getSvc_kei_no_state();` | Return service contract number field state |
| 5 | ELSE-IF (sibling) | `key.equals("異動区分")` [IDO_DIV_01="異動区分"] — check for Error Separation |

**Block 4** — ELSE-IF (Error Separation branch) `[IDO_DIV_01="異動区分"]` (L254)

> Data type: Error Separation — a String-type field indicating the type of mutation/change (e.g., addition, deletion, modification of a contract line item).

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` — check subkey for value access |
| 2 | RETURN | `return getIdo_div_value();` | Return error separation value |
| 3 | IF-ELSEIF | `subkey.equalsIgnoreCase("state")` — check subkey for state access |
| 4 | RETURN | `return getIdo_div_state();` | Return error separation field state |
| 5 | ELSE-IF (sibling) | `key.equals("異動理由コード")` [IDO_RSN_CD_01="異動理由コード"] — check for Error Reason Code |

**Block 5** — ELSE-IF (Error Reason Code branch) `[IDO_RSN_CD_01="異動理由コード"]` (L265)

> Data type: Error Reason Code — a list-based data type where each list element is an `X33VDataTypeStringBean`. This is the most complex branch. The `key` parameter follows the format `"異動理由コード/index"` where index is either a numeric index or `*` for list size. The subkey is then delegated to the individual element's `loadModelData`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key = key.substring(separaterPoint + 1)` | Extract the index portion from the key after the '/' separator |
| 2 | IF | `key.equals("*")` — check if requesting list element count |
| 3 | RETURN | `return Integer.valueOf(ido_rsn_cd_list.size());` | Return list size when key is `*` |
| 4 | SET | `tmpIndexInt = null` | Initialize index variable |
| 5 | TRY | `tmpIndexInt = Integer.valueOf(key)` — attempt to parse key as integer |
| 6 | CATCH | `catch(NumberFormatException e) { return null; }` — if not numeric, return null (index is not a numeric string) |
| 7 | IF | `tmpIndexInt == null` — null check after parse attempt |
| 8 | RETURN | `return null;` | Return null if index is null |
| 9 | SET | `tmpIndex = tmpIndexInt.intValue()` | Unbox Integer to int |
| 10 | IF | `tmpIndex < 0 || tmpIndex >= ido_rsn_cd_list.size()` — bounds check (index exceeds list count minus one) |
| 11 | RETURN | `return null;` | Return null if index is out of range |
| 12 | CALL | `((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).loadModelData(subkey)` — cast list element to String bean and delegate subkey retrieval to the element's own loadModelData |
| 13 | ELSE-IF (sibling) | `key.equals("異動理由メモ")` [IDO_RSN_MEMO_01="異動理由メモ"] — check for Error Reason Memo |

**Block 6** — ELSE-IF (Error Reason Memo branch) `[IDO_RSN_MEMO_01="異動理由メモ"]` (L296)

> Data type: Error Reason Memo — a String-type field containing a free-text memo explaining the error/mutation reason.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` — check subkey for value access |
| 2 | RETURN | `return getIdo_rsn_memo_value();` | Return error reason memo value |
| 3 | IF-ELSEIF | `subkey.equalsIgnoreCase("state")` — check subkey for state access |
| 4 | RETURN | `return getIdo_rsn_memo_state();` | Return error reason memo field state |
| 5 | ELSE-IF (sibling) | `key.equals("処理区分")` [TRAN_DIV_01="処理区分"] — check for Process Separation |

**Block 7** — ELSE-IF (Process Separation branch) `[TRAN_DIV_01="処理区分"]` (L307)

> Data type: Process Separation — a String-type field indicating the type of processing operation (e.g., creation, update, cancellation).

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` — check subkey for value access |
| 2 | RETURN | `return getTran_div_value();` | Return process separation value |
| 3 | IF-ELSEIF | `subkey.equalsIgnoreCase("state")` — check subkey for state access |
| 4 | RETURN | `return getTran_div_state();` | Return process separation field state |

**Block 8** — ELSE (default/no match) (L317)

> No matching key found among the six supported data types. Returns null as a safe default.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `SYSID` | Field | Customer Contract Inheritance ID — the primary system identifier linking customer contract inheritance records across the order fulfillment system |
| `sysid_value` | Field | SYSID data value — the actual string content of the Customer Contract Inheritance ID |
| `sysid_state` | Field | SYSID field state — edit/validity state flag for the SYSID field (e.g., locked, editable, read-only) |
| `svc_kei_no` | Field | Service Contract Number — the identifier for a service contract line item in the customer's service plan |
| `svc_kei_no_value` | Field | Service Contract Number data value — the actual string content of the service contract number |
| `svc_kei_no_state` | Field | Service Contract Number field state — edit/validity state flag for the service contract number field |
| `ido_div` | Field | Error Separation (mutation type) — classifies the type of contract line item change (addition, deletion, modification) |
| `ido_div_value` | Field | Error Separation data value — the actual string content of the mutation type code |
| `ido_div_state` | Field | Error Separation field state — edit/validity state flag for the error separation field |
| `ido_rsn_cd` | Field | Error Reason Code — a code identifying the reason for a contract line item mutation/change |
| `ido_rsn_cd_list` | Field | List of Error Reason Code beans (`X33VDataTypeList`) — a multi-element collection where each element is a `X33VDataTypeStringBean` holding a single reason code and its metadata |
| `ido_rsn_memo` | Field | Error Reason Memo — free-text explanation for why a contract line item was changed |
| `ido_rsn_memo_value` | Field | Error Reason Memo data value — the actual text content of the memo |
| `ido_rsn_memo_state` | Field | Error Reason Memo field state — edit/validity state flag for the memo field |
| `tran_div` | Field | Process Separation — classifies the type of processing operation (e.g., creation, update, cancellation of a contract) |
| `tran_div_value` | Field | Process Separation data value — the actual string content of the process type code |
| `tran_div_state` | Field | Process Separation field state — edit/validity state flag for the process separation field |
| `X33VDataTypeStringBean` | Class | A reusable data-type bean that encapsulates a single String field with value and state accessors, used as the element type in list collections |
| `X33VDataTypeList` | Class | A custom list container holding `X33VDataTypeBeanInterface` elements, used for ordered collections of data items |
| DBean | Pattern | Data Bean — a view-tier bean that provides generic key-based data access to JSF screens, decoupling UI from specific field names |
| JSF | Acronym | JavaServer Faces — the Java web application framework used for building the UI screens |
| KKW00846SFConst | Class | Constant definition class for module KKW00846SF01, holding field name constants used throughout the module |
