# Business Logic — KKW22301SF01DBean.loadModelData() [52 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW22301SF.KKW22301SF01DBean` |
| Layer | Data Bean / View Model |
| Module | `KKW22301SF` (Package: `eo.web.webview.KKW22301SF`) |

## 1. Role

### KKW22301SF01DBean.loadModelData()

This method serves as a **unified data access gateway** for the KKW22301SF screen's view model. It enables screens to retrieve typed field data by a compound key composed of a Japanese field name (the "item name") and a sub-key indicating the requested property aspect (value, enabled state, or field state). The method implements a **routing/dispatch pattern**: it routes incoming (key, subkey) pairs to one of nine specialized getter methods — three per data type — depending on which business entity the key references. It supports three service-level data categories: **Service Contract Number** (`サービス契約番号`), **System ID** (`SYSID`), and **Billing Contract Number** (`請求契約番号`). Its role in the larger system is as a shared model-binding utility that bridges the screen's data presentation layer (JSF/SelectItems) with the bean's internal state, enabling uniform data retrieval across list-type UI components that store `X33VDataTypeBeanInterface` instances.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])
    CHECK_NULL["key == null || subkey == null"]
    NULL_RETURN(["return null"])
    FIND_SLASH["int separaterPoint = key.indexOf('/')"]
    CHECK_SVC_KEY["key equals ServiceContractNo"]
    CHECK_SVC_SUBKEY["subkey equals value"]
    SVC_VALUE_RETURN(["return getSvc_kei_no_value"])
    CHECK_SVC_ENABLE["subkey equals enable"]
    SVC_ENABLE_RETURN(["return getSvc_kei_no_enabled"])
    CHECK_SVC_STATE["subkey equals state"]
    SVC_STATE_RETURN(["return getSvc_kei_no_state"])
    CHECK_SYSID_KEY["key equals SYSID"]
    CHECK_SYSID_SUBKEY["subkey equals value"]
    SYSID_VALUE_RETURN(["return getSysid_value"])
    CHECK_SYSID_ENABLE["subkey equals enable"]
    SYSID_ENABLE_RETURN(["return getSysid_enabled"])
    CHECK_SYSID_STATE["subkey equals state"]
    SYSID_STATE_RETURN(["return getSysid_state"])
    CHECK_SEIKY_KEY["key equals BillingContractNo"]
    CHECK_SEIKY_SUBKEY["subkey equals value"]
    SEIKY_VALUE_RETURN(["return getSeiky_kei_no_value"])
    CHECK_SEIKY_ENABLE["subkey equals enable"]
    SEIKY_ENABLE_RETURN(["return getSeiky_kei_no_enabled"])
    CHECK_SEIKY_STATE["subkey equals state"]
    SEIKY_STATE_RETURN(["return getSeiky_kei_no_state"])
    NO_MATCH_RETURN(["return null"])

    START --> CHECK_NULL
    CHECK_NULL --> |true| NULL_RETURN
    CHECK_NULL --> |false| FIND_SLASH
    FIND_SLASH --> CHECK_SVC_KEY
    CHECK_SVC_KEY --> |true| CHECK_SVC_SUBKEY
    CHECK_SVC_KEY --> |false| CHECK_SYSID_KEY
    CHECK_SVC_SUBKEY --> |true| SVC_VALUE_RETURN
    CHECK_SVC_SUBKEY --> |false| CHECK_SVC_ENABLE
    CHECK_SVC_ENABLE --> |true| SVC_ENABLE_RETURN
    CHECK_SVC_ENABLE --> |false| CHECK_SVC_STATE
    CHECK_SVC_STATE --> |true| SVC_STATE_RETURN
    CHECK_SVC_STATE --> |false| CHECK_SYSID_KEY
    CHECK_SYSID_KEY --> |true| CHECK_SYSID_SUBKEY
    CHECK_SYSID_KEY --> |false| CHECK_SEIKY_KEY
    CHECK_SYSID_SUBKEY --> |true| SYSID_VALUE_RETURN
    CHECK_SYSID_SUBKEY --> |false| CHECK_SYSID_ENABLE
    CHECK_SYSID_ENABLE --> |true| SYSID_ENABLE_RETURN
    CHECK_SYSID_ENABLE --> |false| CHECK_SYSID_STATE
    CHECK_SYSID_STATE --> |true| SYSID_STATE_RETURN
    CHECK_SYSID_STATE --> |false| CHECK_SEIKY_KEY
    CHECK_SEIKY_KEY --> |true| CHECK_SEIKY_SUBKEY
    CHECK_SEIKY_KEY --> |false| NO_MATCH_RETURN
    CHECK_SEIKY_SUBKEY --> |true| SEIKY_VALUE_RETURN
    CHECK_SEIKY_SUBKEY --> |false| CHECK_SEIKY_ENABLE
    CHECK_SEIKY_ENABLE --> |true| SEIKY_ENABLE_RETURN
    CHECK_SEIKY_ENABLE --> |false| CHECK_SEIKY_STATE
    CHECK_SEIKY_STATE --> |true| SEIKY_STATE_RETURN
    CHECK_SEIKY_STATE --> |false| NO_MATCH_RETURN
```

**Requirements:**
- Every if/else chain is represented as diamond nodes with labeled branches.
- Three data-type categories are each dispatched to three property getters (value/enable/state).
- Null-guard and no-match returns are shown explicitly.
- The `separaterPoint` variable is computed but not used in this method's current logic.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The Japanese field name that identifies which business data entity to retrieve. Acceptable values: `"サービス契約番号"` (Service Contract Number — item ID: `svc_kei_no`), `"SYSID"` (System ID — item ID: `sysid`), or `"請求契約番号"` (Billing Contract Number — item ID: `seiky_kei_no`). Case-sensitive exact match. Determines which of the three data-type branches is taken. |
| 2 | `subkey` | `String` | The property aspect to retrieve from the selected data entity. Acceptable values (case-insensitive): `"value"` (returns the actual data value), `"enable"` (returns whether the field is enabled/active), or `"state"` (returns the field state/status). Determines which specialized getter within the matched branch is invoked. |

**External state / instance fields read:**
- `svc_kei_no_value`, `svc_kei_no_enabled`, `svc_kei_no_state` — internal fields for service contract number data
- `sysid_value`, `sysid_enabled`, `sysid_state` — internal fields for system ID data
- `seiky_kei_no_value`, `seiky_kei_no_enabled`, `seiky_kei_no_state` — internal fields for billing contract number data

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW22301SF01DBean.getSeiky_kei_no_enabled` | KKW22301SF01DBean | - | Returns `getSeiky_kei_no_enabled` in `KKW22301SF01DBean` |
| R | `KKW22301SF01DBean.getSeiky_kei_no_state` | KKW22301SF01DBean | - | Returns `getSeiky_kei_no_state` in `KKW22301SF01DBean` |
| R | `KKW22301SF01DBean.getSeiky_kei_no_value` | KKW22301SF01DBean | - | Returns `getSeiky_kei_no_value` in `KKW22301SF01DBean` |
| R | `KKW22301SF01DBean.getSvc_kei_no_enabled` | KKW22301SF01DBean | - | Returns `getSvc_kei_no_enabled` in `KKW22301SF01DBean` |
| R | `KKW22301SF01DBean.getSvc_kei_no_state` | KKW22301SF01DBean | - | Returns `getSvc_kei_no_state` in `KKW22301SF01DBean` |
| R | `KKW22301SF01DBean.getSvc_kei_no_value` | KKW22301SF01DBean | - | Returns `getSvc_kei_no_value` in `KKW22301SF01DBean` |
| R | `KKW22301SF01DBean.getSysid_enabled` | KKW22301SF01DBean | - | Returns `getSysid_enabled` in `KKW22301SF01DBean` |
| R | `KKW22301SF01DBean.getSysid_state` | KKW22301SF01DBean | - | Returns `getSysid_state` in `KKW22301SF01DBean` |
| R | `KKW22301SF01DBean.getSysid_value` | KKW22301SF01DBean | - | Returns `getSysid_value` in `KKW22301SF01DBean` |

**CRUD Classification:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getSvc_kei_no_value()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the service contract number value from internal bean state |
| R | `getSvc_kei_no_enabled()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the service contract number enabled flag from internal bean state |
| R | `getSvc_kei_no_state()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the service contract number state/status from internal bean state |
| R | `getSysid_value()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the system ID value from internal bean state |
| R | `getSysid_enabled()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the system ID enabled flag from internal bean state |
| R | `getSysid_state()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the system ID state/status from internal bean state |
| R | `getSeiky_kei_no_value()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the billing contract number value from internal bean state |
| R | `getSeiky_kei_no_enabled()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the billing contract number enabled flag from internal bean state |
| R | `getSeiky_kei_no_state()` | KKW22301SF01DBean | — (in-memory bean field) | Reads the billing contract number state/status from internal bean state |

**Note:** This method performs **purely in-memory reads** — it does not invoke any external SC/CBS, database, or persistence layer. All nine called getters are internal accessor methods on the same `KKW22301SF01DBean` instance, reading fields that were populated by prior screen processing (e.g., data loaded from the database during screen initialization).

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW22301SF | `KKW22301SFBean` (delegate) -> `KKW22301SF01DBean.loadModelData` | `getSvc_kei_no_value() [R] in-memory field` |
| 2 | Screen:KKW22301SF | `KKW22301SFBean` (delegate) -> `KKW22301SF03DBean.loadModelData` | `getSeiky_kei_no_value() [R] in-memory field` |

**Caller details:**
- `KKW22301SFBean` — The parent screen bean for the KKW22301SF screen. It implements `X33VDataTypeBeanInterface` and delegates `loadModelData(String gamenId, String key, String subkey)` to the `01DBean` subclass (line 1105). It also iterates over typed data-type list beans (e.g., `cust_kei_hktgi_list_list`, `campaign_icrn_list`) and calls `loadModelData` on each element to extract `value` properties for JSF `SelectItem` population.
- `KKW22301SF03DBean` — A DBean subclass used for list-type data items. Its `loadModelData` delegates further to `X33VDataTypeStringBean` instances for individual list row data access.

## 6. Per-Branch Detail Blocks

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

> Guard clause: if either parameter is null, immediately return null. This prevents NullPointerException in subsequent string comparisons and `indexOf` operations.

| # | Type | Code |
|---|------|------|
| 1 | COND | `if (key == null || subkey == null)` |
| 2 | RETURN | `return null;` // Returns null if either parameter is null (nullの場合、nullを返す) |

---

**Block 2** — EXEC (unused computation) `(key.indexOf('/'))` (L187)

> Computes the index of the first '/' character in `key`. This value is stored in `separaterPoint` but is **not used** anywhere in this method. It appears to be a vestigial variable, possibly intended for future use when keys contain hierarchical "/" separators.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf('/');` // Compute slash index in key (区切り点の位置を取得) |

---

**Block 3** — IF-ELSE-IF (data type: Service Contract Number) `(key.equals("サービス契約番号"))` (L190)

> Branch for the **Service Contract Number** data type (item ID: `svc_kei_no`). Routes to one of three getters based on the subkey property. This is the first of three data-type categories.

**Block 3.1** — IF-ELSE-IF (subkey: value) `(subkey.equalsIgnoreCase("value"))` (L191)

| # | Type | Code |
|---|------|------|
| 1 | COND | `if (subkey.equalsIgnoreCase("value"))` // Case-insensitive check for "value" subkey |
| 2 | CALL | `return getSvc_kei_no_value();` // Returns the service contract number value (サービス契約番号の値を取得) |

**Block 3.2** — IF-ELSE-IF (subkey: enable) `(subkey.equalsIgnoreCase("enable"))` (L194)

| # | Type | Code |
|---|------|------|
| 1 | COND | `else if (subkey.equalsIgnoreCase("enable"))` // Case-insensitive check for "enable" subkey |
| 2 | CALL | `return getSvc_kei_no_enabled();` // Returns the svc_kei_no_enable getter value (enableの場合、svc_kei_no_enableのgetterの戻り値を返す) |

**Block 3.3** — IF-ELSE-IF (subkey: state) `(subkey.equalsIgnoreCase("state"))` (L197)

| # | Type | Code |
|---|------|------|
| 1 | COND | `else if (subkey.equalsIgnoreCase("state"))` // Case-insensitive check for "state" subkey |
| 2 | CALL | `return getSvc_kei_no_state();` // Returns the state status (stateの場合、ステータスを返す) |

---

**Block 4** — ELSE-IF (data type: System ID) `(key.equals("SYSID"))` (L201)

> Branch for the **System ID** data type (item ID: `sysid`). Identical structure to Block 3 but targets system ID fields. This is the second data-type category.

**Block 4.1** — IF-ELSE-IF (subkey: value) `(subkey.equalsIgnoreCase("value"))` (L202)

| # | Type | Code |
|---|------|------|
| 1 | COND | `if (subkey.equalsIgnoreCase("value"))` |
| 2 | CALL | `return getSysid_value();` // Returns the SYSID value (SYSIDの値を取得) |

**Block 4.2** — IF-ELSE-IF (subkey: enable) `(subkey.equalsIgnoreCase("enable"))` (L205)

| # | Type | Code |
|---|------|------|
| 1 | COND | `else if (subkey.equalsIgnoreCase("enable"))` |
| 2 | CALL | `return getSysid_enabled();` // Returns the sysid_enable getter value (enableの場合、sysid_enableのgetterの戻り値を返す) |

**Block 4.3** — IF-ELSE-IF (subkey: state) `(subkey.equalsIgnoreCase("state"))` (L208)

| # | Type | Code |
|---|------|------|
| 1 | COND | `else if (subkey.equalsIgnoreCase("state"))` |
| 2 | CALL | `return getSysid_state();` // Returns the state status (stateの場合、ステータスを返す) |

---

**Block 5** — ELSE-IF (data type: Billing Contract Number) `(key.equals("請求契約番号"))` (L212)

> Branch for the **Billing Contract Number** data type (item ID: `seiky_kei_no`). Identical structure to Blocks 3 and 4 but targets billing contract number fields. This is the third data-type category.

**Block 5.1** — IF-ELSE-IF (subkey: value) `(subkey.equalsIgnoreCase("value"))` (L213)

| # | Type | Code |
|---|------|------|
| 1 | COND | `if (subkey.equalsIgnoreCase("value"))` |
| 2 | CALL | `return getSeiky_kei_no_value();` // Returns the billing contract number value (請求契約番号の値を取得) |

**Block 5.2** — IF-ELSE-IF (subkey: enable) `(subkey.equalsIgnoreCase("enable"))` (L216)

| # | Type | Code |
|---|------|------|
| 1 | COND | `else if (subkey.equalsIgnoreCase("enable"))` |
| 2 | CALL | `return getSeiky_kei_no_enabled();` // Returns the seiky_kei_no_enable getter value (enableの場合、seiky_kei_no_enableのgetterの戻り値を返す) |

**Block 5.3** — IF-ELSE-IF (subkey: state) `(subkey.equalsIgnoreCase("state"))` (L219)

| # | Type | Code |
|---|------|------|
| 1 | COND | `else if (subkey.equalsIgnoreCase("state"))` |
| 2 | CALL | `return getSeiky_kei_no_state();` // Returns the state status (stateの場合、ステータスを返す) |

---

**Block 6** — ELSE / FALL-THROUGH (no matching key found) (L224)

> Default exit: no matching key was found in any of the three data-type branches. Returns null.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service Contract Number — the identifier for a service contract line item. The primary key for service-level billing and provisioning records. |
| `svc_kei_no_value` | Field | The actual value of the service contract number |
| `svc_kei_no_enabled` | Field | Enabled/disabled flag for the service contract number field on the screen |
| `svc_kei_no_state` | Field | State/status metadata for the service contract number |
| `sysid` | Field | System ID — an internal system identifier used across the K-Opticom platform for tracking and referencing entities. Stored as a string. |
| `sysid_value` | Field | The actual value of the system ID |
| `sysid_enabled` | Field | Enabled/disabled flag for the system ID field |
| `sysid_state` | Field | State/status metadata for the system ID |
| `seiky_kei_no` | Field | Billing Contract Number (`請求契約番号`) — the identifier for a billing contract line item. Used for invoicing and billing processing. |
| `seiky_kei_no_value` | Field | The actual value of the billing contract number |
| `seiky_kei_no_enabled` | Field | Enabled/disabled flag for the billing contract number field |
| `seiky_kei_no_state` | Field | State/status metadata for the billing contract number |
| `key` | Parameter | Japanese field name used as a lookup key. Case-sensitive. Maps to one of three data-type categories. |
| `subkey` | Parameter | Property accessor — specifies which attribute of the matched data type to retrieve: `value`, `enable`, or `state`. Case-insensitive. |
| `separaterPoint` | Variable | Intermediate variable storing the index of "/" in `key`. Computed but unused in the current implementation. |
| X33VDataTypeBeanInterface | Interface | Framework interface for data-type beans that support key-based data loading via `loadModelData()`. Used by JSF list components. |
| X33VDataTypeStringBean | Class | A framework class for string-typed data-type beans. Also provides `loadModelData()` for sub-key based data access. |
| `サービス契約番号` | Field (Japanese) | "Service Contract Number" — the Japanese label used as the `key` parameter for the service contract data branch |
| `SYSID` | Field (Japanese) | "System ID" — the Japanese/system label used as the `key` parameter for the system ID data branch |
| `請求契約番号` | Field (Japanese) | "Billing Contract Number" — the Japanese label used as the `key` parameter for the billing contract data branch |
| KKW22301SF | Module | A K-Opticom screen module (SF = Screen Form). The screen ID convention where KKW = internal module prefix, 22301 = sequence number, SF = screen. |
| DBean | Class type | Data Bean — a bean class that holds and manages screen data. Suffix `01DBean` indicates the primary data bean for the screen. |
| SelectItem | Class | JSF UI component wrapper. `loadModelData` is called on list items to extract display values for generating `SelectItem` options. |
