# Business Logic — KKW01023SF02DBean.loadModelData() [65 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01023SF.KKW01023SF02DBean` |
| Layer | Data Bean / Web View Layer (implements `X33VDataTypeBeanInterface`, `X33VListedBeanInterface`) |
| Module | `KKW01023SF` (Package: `eo.web.webview.KKW01023SF`) |

## 1. Role

### KKW01023SF02DBean.loadModelData()

This method serves as the primary **data routing and dispatch** entry point for the Discount Service Contract Inquiry screen (画面ID: `KKW01023`, business name: 割引サービス契約照会). It provides a unified, key-based accessor that allows screen-level view beans to retrieve field-level data (value, enable status, validation state) from this data bean without knowing the specific internal fields.

The method supports **four business data items** that appear on the discount service contract inquiry screen: (1) Record Count (番号／件数), (2) Target Contract Identification Code Name (対象契約識別コード名称), (3) Target Contract Number (対象契約番号), and (4) Target Service Name (対象サービス名称). Each item can be accessed via **three subkey types**: `value` for the actual data, `enable` for the field's enabled/disabled state, and `state` for the validation status indicator.

This method implements a **routing/dispatch design pattern** — it acts as a facade that delegates to typed getter methods based on the combination of the `key` (item name) and `subkey` (accessor type). It is a **shared utility** called by the parent bean's `getItemData()` method whenever a data-type-bean (データタイプビーン) item of class `KKW01023SF02DBean` is encountered during screen data binding. No external SC, CBS, or DB calls are made; all data originates from the bean's own instance fields.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])
    NULL_CHECK{key or subkey<br>is null?}
    SEP_CHECK{"key equals<br>番号  slash  件数"}
    NO_CNT_VALUE{subkey equals<br>value ignoring case}
    NO_CNT_ENABLE{subkey equals<br>enable ignoring case}
    NO_CNT_STATE{subkey equals<br>state ignoring case}
    NO_CNT_RET_V["return getNo_cnt_value"]
    NO_CNT_RET_E["return getNo_cnt_enabled"]
    NO_CNT_RET_S["return getNo_cnt_state"]
    SEP_CHECK2{"key equals<br>対象契約識別コード名称"}
    TG_SKBT_VALUE{subkey equals<br>value ignoring case}
    TG_SKBT_ENABLE{subkey equals<br>enable ignoring case}
    TG_SKBT_STATE{subkey equals<br>state ignoring case}
    TG_SKBT_RET_V["return getTg_kei_skbt_cd_nm_value"]
    TG_SKBT_RET_E["return getTg_kei_skbt_cd_nm_enabled"]
    TG_SKBT_RET_S["return getTg_kei_skbt_cd_nm_state"]
    SEP_CHECK3{"key equals<br>対象契約番号"}
    TGT_KENO_VALUE{subkey equals<br>value ignoring case}
    TGT_KENO_ENABLE{subkey equals<br>enable ignoring case}
    TGT_KENO_STATE{subkey equals<br>state ignoring case}
    TGT_KENO_RET_V["return getTgt_kei_no_value"]
    TGT_KENO_RET_E["return getTgt_kei_no_enabled"]
    TGT_KENO_RET_S["return getTgt_kei_no_state"]
    SEP_CHECK4{"key equals<br>対象サービス名称"}
    TGT_SVC_VALUE{subkey equals<br>value ignoring case}
    TGT_SVC_ENABLE{subkey equals<br>enable ignoring case}
    TGT_SVC_STATE{subkey equals<br>state ignoring case}
    TGT_SVC_RET_V["return getTgt_svc_nm_value"]
    TGT_SVC_RET_E["return getTgt_svc_nm_enabled"]
    TGT_SVC_RET_S["return getTgt_svc_nm_state"]
    DEFAULT_RET["return null"]
    END_NODE(["Return / Next"])

    START --> NULL_CHECK
    NULL_CHECK -->|Yes| DEFAULT_RET
    NULL_CHECK -->|No| SEP_CHECK
    SEP_CHECK -->|Yes| NO_CNT_VALUE
    SEP_CHECK -->|No| SEP_CHECK2
    NO_CNT_VALUE -->|Yes| NO_CNT_RET_V
    NO_CNT_VALUE -->|No| NO_CNT_ENABLE
    NO_CNT_ENABLE -->|Yes| NO_CNT_RET_E
    NO_CNT_ENABLE -->|No| NO_CNT_STATE
    NO_CNT_STATE -->|Yes| NO_CNT_RET_S
    NO_CNT_STATE -->|No| DEFAULT_RET
    SEP_CHECK2 -->|Yes| TG_SKBT_VALUE
    SEP_CHECK2 -->|No| SEP_CHECK3
    TG_SKBT_VALUE -->|Yes| TG_SKBT_RET_V
    TG_SKBT_VALUE -->|No| TG_SKBT_ENABLE
    TG_SKBT_ENABLE -->|Yes| TG_SKBT_RET_E
    TG_SKBT_ENABLE -->|No| TG_SKBT_STATE
    TG_SKBT_STATE -->|Yes| TG_SKBT_RET_S
    TG_SKBT_STATE -->|No| DEFAULT_RET
    SEP_CHECK3 -->|Yes| TGT_KENO_VALUE
    SEP_CHECK3 -->|No| SEP_CHECK4
    TGT_KENO_VALUE -->|Yes| TGT_KENO_RET_V
    TGT_KENO_VALUE -->|No| TGT_KENO_ENABLE
    TGT_KENO_ENABLE -->|Yes| TGT_KENO_RET_E
    TGT_KENO_ENABLE -->|No| TGT_KENO_STATE
    TGT_KENO_STATE -->|Yes| TGT_KENO_RET_S
    TGT_KENO_STATE -->|No| DEFAULT_RET
    SEP_CHECK4 -->|Yes| TGT_SVC_VALUE
    SEP_CHECK4 -->|No| DEFAULT_RET
    TGT_SVC_VALUE -->|Yes| TGT_SVC_RET_V
    TGT_SVC_VALUE -->|No| TGT_SVC_ENABLE
    TGT_SVC_ENABLE -->|Yes| TGT_SVC_RET_E
    TGT_SVC_ENABLE -->|No| TGT_SVC_STATE
    TGT_SVC_STATE -->|Yes| TGT_SVC_RET_S
    TGT_SVC_STATE -->|No| DEFAULT_RET
    DEFAULT_RET --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (項目名) used to identify which business field to access. Valid values correspond to four screen data items: `番号／件数` (Record Count), `対象契約識別コード名称` (Target Contract Identification Code Name), `対象契約番号` (Target Contract Number), `対象サービス名称` (Target Service Name). This determines which group of getter methods is invoked. |
| 2 | `subkey` | `String` | The accessor type that specifies what aspect of the data item to return. Valid values (case-insensitive): `value` (returns the actual field value), `enable` (returns the enabled/disabled state of the field for UI rendering), `state` (returns the validation status indicator). This is typically used by the X33 view framework to bind field properties dynamically. |

**Instance fields read by this method:**

| Field Name | Type | Business Description |
|-----------|------|---------------------|
| `no_cnt_value` | `String` | Record count value — the number of matching service contract records |
| `no_cnt_enabled` | `Boolean` | Record count field enabled/disabled flag |
| `no_cnt_state` | `String` | Record count validation state |
| `tg_kei_skbt_cd_nm_value` | `String` | Target contract identification code name — the identifier for the contracted service type |
| `tg_kei_skbt_cd_nm_enabled` | `Boolean` | Contract code name field enabled/disabled flag |
| `tg_kei_skbt_cd_nm_state` | `String` | Contract code name validation state |
| `tgt_kei_no_value` | `String` | Target contract number — the contract identifier for the service |
| `tgt_kei_no_enabled` | `Boolean` | Contract number field enabled/disabled flag |
| `tgt_kei_no_state` | `String` | Contract number validation state |
| `tgt_svc_nm_value` | `String` | Target service name — the human-readable name of the contracted service |
| `tgt_svc_nm_enabled` | `Boolean` | Service name field enabled/disabled flag |
| `tgt_svc_nm_state` | `String` | Service name validation state |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW01023SF02DBean.getNo_cnt_value` | KKW01023SF02DBean | - | Returns the record count value field (`no_cnt_value`) |
| R | `KKW01023SF02DBean.getNo_cnt_enabled` | KKW01023SF02DBean | - | Returns the record count enabled state (`no_cnt_enabled`) |
| R | `KKW01023SF02DBean.getNo_cnt_state` | KKW01023SF02DBean | - | Returns the record count validation state (`no_cnt_state`) |
| R | `KKW01023SF02DBean.getTg_kei_skbt_cd_nm_value` | KKW01023SF02DBean | - | Returns the target contract identification code name value |
| R | `KKW01023SF02DBean.getTg_kei_skbt_cd_nm_enabled` | KKW01023SF02DBean | - | Returns the contract code name enabled state |
| R | `KKW01023SF02DBean.getTg_kei_skbt_cd_nm_state` | KKW01023SF02DBean | - | Returns the contract code name validation state |
| R | `KKW01023SF02DBean.getTgt_kei_no_value` | KKW01023SF02DBean | - | Returns the target contract number value |
| R | `KKW01023SF02DBean.getTgt_kei_no_enabled` | KKW01023SF02DBean | - | Returns the contract number enabled state |
| R | `KKW01023SF02DBean.getTgt_kei_no_state` | KKW01023SF02DBean | - | Returns the contract number validation state |
| R | `KKW01023SF02DBean.getTgt_svc_nm_value` | KKW01023SF02DBean | - | Returns the target service name value |
| R | `KKW01023SF02DBean.getTgt_svc_nm_enabled` | KKW01023SF02DBean | - | Returns the service name enabled state |
| R | `KKW01023SF02DBean.getTgt_svc_nm_state` | KKW01023SF02DBean | - | Returns the service name validation state |

All 12 operations are **Read (R)** operations on the bean's own instance fields. No external service calls, database queries, or entity operations are performed. This method acts purely as a delegation layer — the actual data is populated into the bean's fields by earlier processing stages (typically by a CBS that queries the database and sets these fields before the screen is rendered).

## 5. Dependency Trace

### Incoming Calls (Who calls this method)

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getNo_cnt_value [R] no_cnt_value field` |
| 2 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getNo_cnt_enabled [R] no_cnt_enabled field` |
| 3 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getNo_cnt_state [R] no_cnt_state field` |
| 4 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTg_kei_skbt_cd_nm_value [R] tg_kei_skbt_cd_nm_value field` |
| 5 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTg_kei_skbt_cd_nm_enabled [R] tg_kei_skbt_cd_nm_enabled field` |
| 6 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTg_kei_skbt_cd_nm_state [R] tg_kei_skbt_cd_nm_state field` |
| 7 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTgt_kei_no_value [R] tgt_kei_no_value field` |
| 8 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTgt_kei_no_enabled [R] tgt_kei_no_enabled field` |
| 9 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTgt_kei_no_state [R] tgt_kei_no_state field` |
| 10 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTgt_svc_nm_value [R] tgt_svc_nm_value field` |
| 11 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTgt_svc_nm_enabled [R] tgt_svc_nm_enabled field` |
| 12 | Screen:KKW01023 (KKW01023SFBean) | `KKW01023SFBean.getItemData(key)` → `KKW01023SF02DBean.loadModelData(key, subkey)` | `getTgt_svc_nm_state [R] tgt_svc_nm_state field` |

**Call chain detail:** The parent bean `KKW01023SFBean` registers this data bean as a data-type-bean for the "キャンペーン対象適用条件" (Campaign Application Target Conditions) item. When the screen framework calls `getItemData()` with the item key, the bean instantiates a new `KKW01023SF02DBean` and routes the call to its `loadModelData()` method. The framework then iterates through the list items, calling `loadModelData(subkey)` on each bean instance to extract `value`, `enable`, and `state` properties for UI binding.

**Note:** No other caller classes were found — this method is exclusively used within the KKW01023SF module by its parent bean `KKW01023SFBean`.

## 6. Per-Branch Detail Blocks

### Block 1 — IF (null check) (L219)

> If either `key` or `subkey` is null, return null immediately. This is a guard clause to prevent NullPointerException during key comparison.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key == null || subkey == null)` // key or subkey is null — early return to prevent NPE |
| 2 | RETURN | `return null;` // Returns null if either parameter is null |

### Block 2 — IF (key check: 番号／件数 = Record Count) (L225)

> Checks if the key matches the record count item. The Javadoc comment says: 項目ごとに処理を入れる (Insert processing for each item). This is the first of four data type branches.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // Finds position of "/" separator in key (unused in current logic, reserved for potential parsing) |
| 2 | IF | `if(key.equals("番号／件数"))` // [KEY: Record Count item] 項目ごとに処理を入れる // Data type that is a String item "Record Count" (Item ID: no_cnt) |

#### Block 2.1 — IF (subkey = value) (L227)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` // subkey is "value" — get actual data value |
| 2 | CALL | `return getNo_cnt_value();` // Returns the record count value field |

#### Block 2.2 — ELSE IF (subkey = enable) (L229)

> subkeyが"enable"の場合、no_cnt_enableのgetterの戻り値を返す (If subkey is "enable", return the getter value of no_cnt_enabled).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(subkey.equalsIgnoreCase("enable"))` // subkey is "enable" — get field enabled/disabled state |
| 2 | CALL | `return getNo_cnt_enabled();` // Returns the record count enabled state Boolean |

#### Block 2.3 — ELSE IF (subkey = state) (L231)

> subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(subkey.equalsIgnoreCase("state"))` // subkey is "state" — get validation status |
| 2 | CALL | `return getNo_cnt_state();` // Returns the record count validation state string |

#### Block 2.4 — ELSE (default for record count)

| # | Type | Code |
|---|------|------|
| 1 | ELSE | Falls through to no-match default — returns null at end of method |

### Block 3 — ELSE IF (key check: 対象契約識別コード名称 = Target Contract Identification Code Name) (L238)

> データタイプがStringの項目"対象契約識別コード名称"(項目ID:tg_kei_skbt_cd_nm) (Data type is String item "Target Contract Identification Code Name" (Item ID: tg_kei_skbt_cd_nm))

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(key.equals("対象契約識別コード名称"))` |

#### Block 3.1 — IF (subkey = value) (L240)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` |
| 2 | CALL | `return getTg_kei_skbt_cd_nm_value();` // Returns the contract code name value |

#### Block 3.2 — ELSE IF (subkey = enable) (L242)

> subkeyが"enable"の場合、tg_kei_skbt_cd_nm_enableのgetterの戻り値を返す (If subkey is "enable", return the getter value of tg_kei_skbt_cd_nm_enabled).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(subkey.equalsIgnoreCase("enable"))` |
| 2 | CALL | `return getTg_kei_skbt_cd_nm_enabled();` // Returns the contract code name enabled state |

#### Block 3.3 — ELSE IF (subkey = state) (L244)

> subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(subkey.equalsIgnoreCase("state"))` |
| 2 | CALL | `return getTg_kei_skbt_cd_nm_state();` // Returns the contract code name validation state |

### Block 4 — ELSE IF (key check: 対象契約番号 = Target Contract Number) (L251)

> データタイプがStringの項目"対象契約番号"(項目ID:tgt_kei_no) (Data type is String item "Target Contract Number" (Item ID: tgt_kei_no))

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(key.equals("対象契約番号"))` |

#### Block 4.1 — IF (subkey = value) (L253)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` |
| 2 | CALL | `return getTgt_kei_no_value();` // Returns the contract number value |

#### Block 4.2 — ELSE IF (subkey = enable) (L255)

> subkeyが"enable"の場合、tgt_kei_no_enableのgetterの戻り値を返す (If subkey is "enable", return the getter value of tgt_kei_no_enabled).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(subkey.equalsIgnoreCase("enable"))` |
| 2 | CALL | `return getTgt_kei_no_enabled();` // Returns the contract number enabled state |

#### Block 4.3 — ELSE IF (subkey = state) (L257)

> subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(subkey.equalsIgnoreCase("state"))` |
| 2 | CALL | `return getTgt_kei_no_state();` // Returns the contract number validation state |

### Block 5 — ELSE IF (key check: 対象サービス名称 = Target Service Name) (L264)

> データタイプがStringの項目"対象サービス名称"(項目ID:tgt_svc_nm) (Data type is String item "Target Service Name" (Item ID: tgt_svc_nm))

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(key.equals("対象サービス名称"))` |

#### Block 5.1 — IF (subkey = value) (L266)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` |
| 2 | CALL | `return getTgt_svc_nm_value();` // Returns the service name value |

#### Block 5.2 — ELSE IF (subkey = enable) (L268)

> subkeyが"enable"の場合、tgt_svc_nm_enableのgetterの戻り値を返す (If subkey is "enable", return the getter value of tgt_svc_nm_enabled).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(subkey.equalsIgnoreCase("enable"))` |
| 2 | CALL | `return getTgt_svc_nm_enabled();` // Returns the service name enabled state |

#### Block 5.3 — ELSE IF (subkey = state) (L270)

> subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status).

| # | Type | Code |
|---|------|------|
| 1 | ELSE IF | `else if(subkey.equalsIgnoreCase("state"))` |
| 2 | CALL | `return getTgt_svc_nm_state();` // Returns the service name validation state |

### Block 6 — ELSE (default: no matching property) (L277)

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

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching key/subkey combination found — returns null |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `no_cnt` | Field | Record count — the number of matching service contract inquiry results displayed on the screen |
| `tg_kei_skbt_cd_nm` | Field | Target contract identification code name — the identifier (e.g., FTTH, Mail, ENUM) that classifies the type of contracted service |
| `tgt_kei_no` | Field | Target contract number — the unique contract identifier for the service agreement |
| `tgt_svc_nm` | Field | Target service name — the human-readable name of the contracted discount service |
| `key` | Parameter | Item name (項目名) — identifies which business field the caller wants to access |
| `subkey` | Parameter | Sub-key (サブキー) — specifies the data aspect: `value` (actual data), `enable` (enabled/disabled flag), or `state` (validation status) |
| KKW01023 | Screen ID | Discount Service Contract Inquiry screen (割引サービス契約照会) — the screen where contract details are displayed with campaign application conditions |
| データタイプビーン | Term | Data type bean — a bean that implements `X33VDataTypeBeanInterface`, used to provide field-level data (value, enable, state) to the view framework |
| キャンペーン対象適用条件 | Term | Campaign Application Target Conditions — the screen section where campaign eligibility rules are defined, using this bean as its data-type-bean |
| X33VDataTypeBeanInterface | Interface | X33 View framework interface that defines the `getItemData()` contract for screen data binding |
| X33VListedBeanInterface | Interface | X33 View framework interface that defines list-type data binding for repeating data sections |
| value | Subkey | The actual business data value of the field |
| enable | Subkey | A Boolean flag indicating whether the UI field is enabled (true) or disabled (false) |
| state | Subkey | A String indicating the validation status of the field (e.g., valid, invalid, required) |
| 割引サービス契約照会 | Business term | Discount Service Contract Inquiry — the business function of querying and displaying discounted service contract details |
| 番号／件数 | UI Field | Record count / number of items — displays the count of inquiry results |
| 対象契約識別コード名称 | UI Field | Target contract identification code name — displays the type of contracted service |
| 対象契約番号 | UI Field | Target contract number — displays the contract's unique identifier |
| 対象サービス名称 | UI Field | Target service name — displays the name of the contracted service |
