# Business Logic — KKW00810SF03DBean.loadModelData() [73 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00810SF.KKW00810SF03DBean` |
| Layer | Data Bean / Web Layer (Controller-adjacent data holder) |
| Module | `KKW00810SF` (Package: `eo.web.webview.KKW00810SF`) |

## 1. Role

### KKW00810SF03DBean.loadModelData()

This method serves as a **data access dispatcher** within a data-type bean that models a "Service Contract Agreement Detail" row (サービス契約一致照会明細) displayed on the KKW00810SF screen. Its business role is to allow the generic view/data framework (X31C/X33V framework) to retrieve strongly-typed fields from this bean via a loose key/subkey contract, rather than requiring direct Java method invocations.

The method implements a **routing/dispatch pattern**: given a `key` identifying one of seven service-related fields and a `subkey` ("value" or "state") specifying whether to retrieve the field's actual data or its UI validation/error state, the method routes the call to the appropriate pair of getter methods. The seven data categories covered are: Service Contract Status, Service Code, Price Group Code, Price Course Code, Price Plan Code, and Service Start Date. This enables screen components to access both the current data value and the validation state of each field through a unified, reflection-free interface.

`loadModelData` is the companion to `storeModelData` (its setter counterpart). Together they implement a **model binding pattern** where the web framework populates or reads bean fields by string key rather than typed accessors. This design decouples the screen rendering layer from the exact field names, allowing the framework to iterate over data-type lists dynamically (e.g., iterating over repeated rows of service contract details) without compile-time knowledge of each field.

In the larger system, this method is called as part of the data binding cycle for the `ekk0081a010cbsmsg1list` data-type list, which represents the "Service Contract Agreement Detail" section of the Fixed IP Address Payment Result Display screen. Multiple downstream screens (KKSV0202, KKSV0452, KKSV0408, KKSV0332, KKSV0059) ultimately depend on this data flow to display and process service contract information.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])
    START --> CHECK_NULL["Check if key or subkey is null"]

    CHECK_NULL --> |key == null OR subkey == null| RETURN_NULL["Return null"]

    CHECK_NULL --> |key != null AND subkey != null| SEPARATOR["Find / separator in key"]

    SEPARATOR --> BRANCH1{key equals Services Contract Status}
    BRANCH1 --> |True| SVC_STAT["subkey check"]
    BRANCH1 --> |False| BRANCH2{key equals Service Code}

    BRANCH2 --> |True| SVC_CD["subkey check"]
    BRANCH2 --> |False| BRANCH3{key equals Price Group Code}

    BRANCH3 --> |True| PRC_GRP["subkey check"]
    BRANCH3 --> |False| BRANCH4{key equals Price Course Code}

    BRANCH4 --> |True| PCRS_CD["subkey check"]
    BRANCH4 --> |False| BRANCH5{key equals Price Plan Code}

    BRANCH5 --> |True| PPLAN_CD["subkey check"]
    BRANCH5 --> |False| BRANCH6{key equals Service Start Date}

    BRANCH6 --> |True| SVC_STAYMD["subkey check"]
    BRANCH6 --> |False| RETURN_NULL2["Return null"]

    SVC_STAT --> SVC_STAT_VAL{subkey equals value}
    SVC_STAT_VAL --> |True| GET_SVC_STAT_VAL["Return getSvc_kei_stat_value"]
    SVC_STAT_VAL --> |False| SVC_STAT_STATE{subkey equals state}
    SVC_STAT_STATE --> |True| GET_SVC_STAT_STATE["Return getSvc_kei_stat_state"]
    SVC_STAT_STATE --> |False| RETURN_NULL3["Return null"]

    SVC_CD --> SVC_CD_VAL{subkey equals value}
    SVC_CD_VAL --> |True| GET_SVC_CD_VAL["Return getSvc_cd_value"]
    SVC_CD_VAL --> |False| SVC_CD_STATE{subkey equals state}
    SVC_CD_STATE --> |True| GET_SVC_CD_STATE["Return getSvc_cd_state"]
    SVC_CD_STATE --> |False| RETURN_NULL4["Return null"]

    PRC_GRP --> PRC_GRP_VAL{subkey equals value}
    PRC_GRP_VAL --> |True| GET_PRC_GRP_VAL["Return getPrc_grp_cd_value"]
    PRC_GRP_VAL --> |False| PRC_GRP_STATE{subkey equals state}
    PRC_GRP_STATE --> |True| GET_PRC_GRP_STATE["Return getPrc_grp_cd_state"]
    PRC_GRP_STATE --> |False| RETURN_NULL5["Return null"]

    PCRS_CD --> PCRS_VAL{subkey equals value}
    PCRS_VAL --> |True| GET_PCRS_VAL["Return getPcrs_cd_value"]
    PCRS_VAL --> |False| PCRS_STATE{subkey equals state}
    PCRS_STATE --> |True| GET_PCRS_STATE["Return getPcrs_cd_state"]
    PCRS_STATE --> |False| RETURN_NULL6["Return null"]

    PPLAN_CD --> PPLAN_VAL{subkey equals value}
    PPLAN_VAL --> |True| GET_PPLAN_VAL["Return getPplan_cd_value"]
    PPLAN_VAL --> |False| PPLAN_STATE{subkey equals state}
    PPLAN_STATE --> |True| GET_PPLAN_STATE["Return getPplan_cd_state"]
    PPLAN_STATE --> |False| RETURN_NULL7["Return null"]

    SVC_STAYMD --> SVC_STAYMD_VAL{subkey equals value}
    SVC_STAYMD_VAL --> |True| GET_SVC_STAYMD_VAL["Return getSvc_sta_ymd_value"]
    SVC_STAYMD_VAL --> |False| SVC_STAYMD_STATE{subkey equals state}
    SVC_STAYMD_STATE --> |True| GET_SVC_STAYMD_STATE["Return getSvc_sta_ymd_state"]
    SVC_STAYMD_STATE --> |False| RETURN_NULL8["Return null"]

    GET_SVC_STAT_VAL --> END(["End"])
    GET_SVC_STAT_STATE --> END
    GET_SVC_CD_VAL --> END
    GET_SVC_CD_STATE --> END
    GET_PRC_GRP_VAL --> END
    GET_PRC_GRP_STATE --> END
    GET_PCRS_VAL --> END
    GET_PCRS_STATE --> END
    GET_PPLAN_VAL --> END
    GET_PPLAN_STATE --> END
    GET_SVC_STAYMD_VAL --> END
    GET_SVC_STAYMD_STATE --> END
    RETURN_NULL --> END
    RETURN_NULL2 --> END
    RETURN_NULL3 --> END
    RETURN_NULL4 --> END
    RETURN_NULL5 --> END
    RETURN_NULL6 --> END
    RETURN_NULL7 --> END
    RETURN_NULL8 --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The Japanese business field name that identifies which service-contract-related data field to retrieve. Determines the routing branch. Valid values: `"サービス契約ステータス"` (Service Contract Status — field ID: svc_kei_stat), `"サービスコード"` (Service Code — field ID: svc_cd), `"料金グループコード"` (Price Group Code — field ID: prc_grp_cd), `"料金コースコード"` (Price Course Code — field ID: pcrs_cd), `"料金プランコード"` (Price Plan Code — field ID: pplan_cd), `"サービス開始年月日"` (Service Start Date — field ID: svc_sta_ymd). The `/` separator search (`indexOf("/")`) is performed but the result is unused, suggesting this was a planned extension for nested field paths. |
| 2 | `subkey` | `String` | Specifies the data access mode: `"value"` (case-insensitive) returns the actual field data; `"state"` (case-insensitive) returns the UI validation/error state for the field. Case-insensitive comparison via `equalsIgnoreCase` allows flexible framework-level invocation. |

**External state read:** No instance fields or external state are read in this method. All data is obtained through delegating calls to getter methods on the same bean instance (`this`).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW00810SF03DBean.getSvc_kei_stat_value` | KKW00810SF03DBean | - | Calls `getSvc_kei_stat_value` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getSvc_kei_stat_state` | KKW00810SF03DBean | - | Calls `getSvc_kei_stat_state` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getSvc_cd_value` | KKW00810SF03DBean | - | Calls `getSvc_cd_value` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getSvc_cd_state` | KKW00810SF03DBean | - | Calls `getSvc_cd_state` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getPrc_grp_cd_value` | KKW00810SF03DBean | - | Calls `getPrc_grp_cd_value` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getPrc_grp_cd_state` | KKW00810SF03DBean | - | Calls `getPrc_grp_cd_state` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getPcrs_cd_value` | KKW00810SF03DBean | - | Calls `getPcrs_cd_value` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getPcrs_cd_state` | KKW00810SF03DBean | - | Calls `getPcrs_cd_state` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getPplan_cd_value` | KKW00810SF03DBean | - | Calls `getPplan_cd_value` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getPplan_cd_state` | KKW00810SF03DBean | - | Calls `getPplan_cd_state` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getSvc_sta_ymd_value` | KKW00810SF03DBean | - | Calls `getSvc_sta_ymd_value` in `KKW00810SF03DBean` |
| R | `KKW00810SF03DBean.getSvc_sta_ymd_state` | KKW00810SF03DBean | - | Calls `getSvc_sta_ymd_state` in `KKW00810SF03DBean` |

All 12 method calls within `loadModelData` are **Read** operations — they delegate to simple getter methods on the same bean that return field data or validation state. No external service components (SC), business service beans (CBS), or database operations are invoked. The called getters read from instance fields already populated by the framework during screen initialization or from data retrieved via CBS calls made by the screen's parent bean (`KKW00810SFBean`).

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW00810SF | `KKW00810SFBean` (data-type list init) -> `KKW00810SF03DBean.listKoumokuIds` (class-level metadata) -> `KKW00810SF03DBean.loadModelData` | `getSvc_kei_stat_value [R] field svc_kei_stat` |
| 2 | Screen:KKW00810SF | `KKW00810SFBean.newInstance` (line 189) -> create `KKW00810SF03DBean` instance -> added to `ekk0081a010cbsmsg1list_list` -> framework calls `loadModelData` on each row | `getSvc_*_value/state [R] svc_kei_stat field` |
| 3 | Screen:KKW00810SF | `KKW00810SFBean.newInstance` (line 2691) -> create `KKW00810SF03DBean` -> added to list -> framework invokes `loadModelData` with key/subkey pair | `getSvc_kei_stat_value [R] field svc_kei_stat` |

**Note:** `loadModelData` is a framework-dispatched method — it is called by the X31C/X33V generic data binding infrastructure at runtime, not by explicit Java code in the callers. The X33V framework iterates over data-type list rows and invokes `loadModelData(key, subkey)` for each field the screen template requires.

Downstream screens (KKSV0202, KKSV0452, KKSV0408, KKSV0332, KKSV0059) reference the `EKK0081A010CBSMsg1List` CBS message entity, which shares the same domain fields (svc_cd, prc_grp_cd, svc_kei_no, svc_sta_ymd, etc.) but does NOT directly call `KKW00810SF03DBean.loadModelData`. Instead, those screens operate at the CBS/response level, while KKW00810SF03DBean serves the display/edit layer of screen KKW00810SF.

## 6. Per-Branch Detail Blocks

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

> Guard clause: if either key or subkey is null, return null immediately. This prevents NullPointerException when the framework passes incomplete key data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // Find separator position (result unused, potential future extension) [-> `"-" separator]` |
| 2 | RETURN | `return null;` // Return null when key or subkey is null (key == null OR subkey == null) [-> early exit guard] |

---

**Block 2** — IF-ELSE chain `key.equals("サービス契約ステータス")` [Services Contract Status] (L243)

> Route to Service Contract Status (svc_kei_stat) field data based on subkey.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` [subkey equals "value"] |
| 1 | CALL | `return getSvc_kei_stat_value();` // Returns the service contract status value |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` [subkey equals "state"] — スタブを返す (returns status) (L249) |
| 2 | CALL | `return getSvc_kei_stat_state();` // Returns the validation/error state for the status field |
| 3 | ELSE | (implicit) subkey does not match "value" or "state" |
| 3 | (fall through) | `return null;` // No matching subkey for this key |

---

**Block 3** — ELSE-IF `key.equals("サービスコード")` [Service Code] (L254)

> Route to Service Code (svc_cd) field data based on subkey.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` [subkey equals "value"] |
| 1 | CALL | `return getSvc_cd_value();` // Returns the service code value |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` [subkey equals "state"] — スタブを返す (returns status) (L260) |
| 2 | CALL | `return getSvc_cd_state();` // Returns the validation/error state for the service code field |
| 3 | ELSE | (implicit) |
| 3 | (fall through) | `return null;` // No matching subkey |

---

**Block 4** — ELSE-IF `key.equals("料金グループコード")` [Price Group Code] (L265)

> Route to Price Group Code (prc_grp_cd) field data based on subkey.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` [subkey equals "value"] |
| 1 | CALL | `return getPrc_grp_cd_value();` // Returns the price group code value |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` [subkey equals "state"] — スタブを返す (returns status) (L271) |
| 2 | CALL | `return getPrc_grp_cd_state();` // Returns the validation/error state for the price group code field |
| 3 | ELSE | (implicit) |
| 3 | (fall through) | `return null;` // No matching subkey |

---

**Block 5** — ELSE-IF `key.equals("料金コースコード")` [Price Course Code] (L276)

> Route to Price Course Code (pcrs_cd) field data based on subkey.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` [subkey equals "value"] |
| 1 | CALL | `return getPcrs_cd_value();` // Returns the price course code value |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` [subkey equals "state"] — スタブを返す (returns status) (L282) |
| 2 | CALL | `return getPcrs_cd_state();` // Returns the validation/error state for the price course code field |
| 3 | ELSE | (implicit) |
| 3 | (fall through) | `return null;` // No matching subkey |

---

**Block 6** — ELSE-IF `key.equals("料金プランコード")` [Price Plan Code] (L287)

> Route to Price Plan Code (pplan_cd) field data based on subkey.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` [subkey equals "value"] |
| 1 | CALL | `return getPplan_cd_value();` // Returns the price plan code value |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` [subkey equals "state"] — スタブを返す (returns status) (L293) |
| 2 | CALL | `return getPplan_cd_state();` // Returns the validation/error state for the price plan code field |
| 3 | ELSE | (implicit) |
| 3 | (fall through) | `return null;` // No matching subkey |

---

**Block 7** — ELSE-IF `key.equals("サービス開始年月日")` [Service Start Date] (L298)

> Route to Service Start Date (svc_sta_ymd) field data based on subkey.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` [subkey equals "value"] |
| 1 | CALL | `return getSvc_sta_ymd_value();` // Returns the service start date value |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` [subkey equals "state"] — スタブを返す (returns status) (L304) |
| 2 | CALL | `return getSvc_sta_ymd_state();` // Returns the validation/error state for the service start date field |
| 3 | ELSE | (implicit) |
| 3 | (fall through) | `return null;` // No matching subkey |

---

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

> No known key matched any of the seven data categories. Return null to signal unknown field.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_stat` | Field | Service contract status — indicates the current state of a service contract (e.g., activated, suspended, terminated). The "status" field in the service contract agreement detail. |
| `svc_cd` | Field | Service code — the unique code identifying the telecom service type (e.g., FTTH internet, DSL, co-location). Maps to service category in the order system. |
| `prc_grp_cd` | Field | Price group code — groups services into pricing tiers. Services with the same price group share common pricing rules and billing structures. |
| `pcrs_cd` | Field | Price course code — identifies the specific pricing plan/course within a price group. Defines the exact rate structure and included features. |
| `pplan_cd` | Field | Price plan code — the highest-level pricing plan identifier. Encapsulates the full pricing agreement including discounts, bundling, and contract terms. |
| `svc_sta_ymd` | Field | Service start year/month/date — the date when the service became active (YYYYMMDD format). Used for billing cycle calculation and service history tracking. |
| `ekk0081a010cbsmsg1list` | Field (list) | Service Contract Agreement Detail list — the data-type list on screen KKW00810SF that holds repeated rows of service contract agreement information. Each row is a `KKW00810SF03DBean` instance. |
| "サービス契約ステータス" | Japanese key | Services Contract Status — the display name key for svc_kei_stat field in the screen data binding. |
| "サービスコード" | Japanese key | Service Code — the display name key for svc_cd field in the screen data binding. |
| "料金グループコード" | Japanese key | Price Group Code — the display name key for prc_grp_cd field in the screen data binding. |
| "料金コースコード" | Japanese key | Price Course Code — the display name key for pcrs_cd field in the screen data binding. |
| "料金プランコード" | Japanese key | Price Plan Code — the display name key for pplan_cd field in the screen data binding. |
| "サービス開始年月日" | Japanese key | Service Start Date — the display name key for svc_sta_ymd field in the screen data binding. |
| `loadModelData` | Method | Framework callback to retrieve data from a data bean by key/subkey. Part of the X31C/X33V data-type bean contract. |
| `storeModelData` | Method | Framework callback to store data into a data bean by key/subkey. Companion to loadModelData. |
| X31C / X33V | Framework | Fujitsu's web application framework (X31C = web view tier, X33V = data-type list component). Provides generic data binding, validation state management, and type-safe list iteration. |
| DBean | Abbreviation | Data Bean — a Java class implementing the X31C data binding interface (load/store model data). Represents a single row of structured data for screen display. |
| CBS | Abbreviation | Call Back Service — the enterprise service component that handles business logic and database access. Data beans receive CBS response data as their initial values. |
| KKW00810SF | Screen | Fixed IP Address Payment Result Display screen — the screen where service contract agreement details are displayed and managed. |
