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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00810SF.KKW00810SF03DBean` |
| Layer | Utility / Data Binding (View support — DBean = Data Bean used by the view layer for MVC data binding) |
| Module | `KKW00810SF` (Package: `eo.web.webview.KKW00810SF`) |

## 1. Role

### KKW00810SF03DBean.typeModelData()

This method serves as a **field-type resolution router** for the MVC web framework's data binding subsystem. In this telecom service management system, screens use a generic type model mechanism to determine the Java data type of form-bound fields at runtime, enabling dynamic input validation and data binding without hard-typing every field. The `typeModelData` method receives a field name (`key`) and a subkey (`subkey`) and returns the appropriate `Class<?>` object that declares the field's data type.

The method implements a **routing/dispatch design pattern** — it compares the incoming `key` against a set of hardcoded Japanese field names representing service contract data fields (such as "Service contract status", "Service code", "Price group code", etc.). For each matched field, it further examines the `subkey` to determine the exact sub-property type, supporting two subkeys: `"value"` (the primary data value) and `"state"` (a status/display-state indicator). Both subkeys resolve to `String.class`.

This is a **shared utility method** — it has no side effects, no I/O, no database access, and no mutable state. It is a pure type-resolution function. Similar `typeModelData` implementations exist across dozens of DBean classes in the `FUW009*SF` module family (including `FUW00901SFBean`, `FUW00912SFBean`, `FUW00919SFBean`, `FUW00926SFBean`, `FUW00927SFBean`, `FUW00959SFBean`, and `FUW00964SFBean`), indicating this is a **framework-standard interface method** expected by the view layer's generic data binding machinery.

The method handles seven service contract data fields, all of which are string-typed. If the key does not match any known field (or if either parameter is null), the method returns `null`, signaling the framework that no type information is available for that field.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> C1{key or subkey is null?}

    C1 -->|Yes| R1["Return null"]
    C1 -->|No| K0["Extract separator index from key"]

    K0 --> K1{Is Service contract status?}

    K1 -->|Yes| SUB1["Check subkey"]
    K1 -->|No| K2{Is Service code?}

    SUB1 --> S1_1{subkey equals value?}
    S1_1 -->|Yes| RSC1["Return String.class"]
    S1_1 -->|No| S1_2{subkey equals state?}
    S1_2 -->|Yes| RSC1
    S1_2 -->|No| FALL1["Check next key"]

    K2 -->|Yes| SUB2["Check subkey"]
    K2 -->|No| K3{Is Price group code?}

    SUB2 --> S2_1{subkey equals value?}
    S2_1 -->|Yes| RSC2["Return String.class"]
    S2_1 -->|No| S2_2{subkey equals state?}
    S2_2 -->|Yes| RSC2
    S2_2 -->|No| FALL2["Check next key"]

    K3 -->|Yes| SUB3["Check subkey"]
    K3 -->|No| K4{Is Price course code?}

    SUB3 --> S3_1{subkey equals value?}
    S3_1 -->|Yes| RSC3["Return String.class"]
    S3_1 -->|No| S3_2{subkey equals state?}
    S3_2 -->|Yes| RSC3
    S3_2 -->|No| FALL3["Check next key"]

    K4 -->|Yes| SUB4["Check subkey"]
    K4 -->|No| K5{Is Price plan code?}

    SUB4 --> S4_1{subkey equals value?}
    S4_1 -->|Yes| RSC4["Return String.class"]
    S4_1 -->|No| S4_2{subkey equals state?}
    S4_2 -->|Yes| RSC4
    S4_2 -->|No| FALL4["Check next key"]

    K5 -->|Yes| SUB5["Check subkey"]
    K5 -->|No| K6{Is Service start date?}

    SUB5 --> S5_1{subkey equals value?}
    S5_1 -->|Yes| RSC5["Return String.class"]
    S5_1 -->|No| S5_2{subkey equals state?}
    S5_2 -->|Yes| RSC5
    S5_2 -->|No| FALL5["Check next key"]

    K6 -->|Yes| SUB6["Check subkey"]
    K6 -->|No| K7{No match}

    SUB6 --> S6_1{subkey equals value?}
    S6_1 -->|Yes| RSC6["Return String.class"]
    S6_1 -->|No| S6_2{subkey equals state?}
    S6_2 -->|Yes| RSC6
    S6_2 -->|No| FALL6["Check next key"]

    K7 -->|Yes| RFALL["Return null"]

    RSC1 --> DONE
    RSC2 --> DONE
    RSC3 --> DONE
    RSC4 --> DONE
    RSC5 --> DONE
    RSC6 --> DONE

    FALL1 --> K2
    FALL2 --> K3
    FALL3 --> K4
    FALL4 --> K5
    FALL5 --> K6
    FALL6 --> K7

    DONE --> END(["End"])
    R1 --> END
    RFALL --> END
```

**Processing summary:**

The method follows a **sequential routing pattern** with the following steps:

1. **Null guard** (L432-434): Immediately returns `null` if either parameter is null. This prevents NullPointerException and signals to the framework that no type information is available for missing data.

2. **Separator index extraction** (L436): Calls `key.indexOf("/")` to find a potential path separator. The result is stored in `separaterPoint` (note the typo in the original variable name) but is **never used** in any subsequent logic — it is dead code.

3. **Key-based routing cascade** (L439-L498): Seven sequential if/else-if branches compare the `key` against hardcoded Japanese field names. Each matched field then enters a nested two-way subkey check (value vs. state), both returning `String.class`.

4. **Fallback** (L502): If no key matches, the method returns `null`.

Each key and its business meaning:

| Branch | key (Japanese) | English | Item ID (DB field) |
|--------|---------------|---------|-------------------|
| 1 | ササービス契約ステータス | Service contract status | `svc_kei_stat` |
| 2 | ササービスコード | Service code | `svc_cd` |
| 3 | 料金グループコード | Price group code | `prc_grp_cd` |
| 4 | 料金コースコード | Price course code | `pcrs_cd` |
| 5 | 料金プランコード | Price plan code | `pplan_cd` |
| 6 | サービス開始年月日 | Service start date | `svc_sta_ymd` |

For each field, the method supports two subkeys: `"value"` (the primary data value) and `"state"` (a status indicator). Both resolve to `String.class`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The Japanese-labeled field name identifying which service contract data field's type is being queried. This key acts as the routing discriminator — each value corresponds to a specific business field in the telecom service order management domain. Examples: "Service contract status" (項目ID: `svc_kei_stat`), "Service code" (項目ID: `svc_cd`), "Price group code" (項目ID: `prc_grp_cd`), "Price course code" (項目ID: `pcrs_cd`), "Price plan code" (項目ID: `pplan_cd`), "Service start date" (項目ID: `svc_sta_ymd`). If the key does not match any of these six values, the method returns null. |
| 2 | `subkey` | `String` | The sub-property specifier within the matched field. Accepted values are `"value"` (returns the data type of the primary field value) and `"state"` (returns the data type of the field's status indicator, e.g., display/edit state). The comparison is case-insensitive (`equalsIgnoreCase`). Both subkeys resolve to `String.class`. |

**No instance fields or external state** are read by this method. It is a pure function with no dependencies on object state, configuration, or external resources.

**Dead code note:** The variable `separaterPoint` is assigned the result of `key.indexOf("/")` but is never used afterward. This suggests either a deprecated feature (potentially intended to support path-based key resolution like `"parent/child"`) or leftover code from an earlier design iteration.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations**. It contains no service component calls, no database access, and no persistence operations. It is a pure in-memory type resolution function.

The only method call is `key.indexOf("/")` (L436), which is a standard Java String operation — not a business-level call.

| Type | Detail |
|------|--------|
| External service calls | None |
| Database operations | None |
| Entity/Table access | None |

## 5. Dependency Trace

This method has **no explicit callers found** in the codebase search. The `typeModelData` method follows a **framework-standard interface pattern** — it is expected to be invoked by the MVC web framework's generic data binding layer at runtime, rather than being called explicitly from application-level code.

The `typeModelData` signature is shared across dozens of DBean classes in the `FUW009*SF` module family (`FUW00901SFBean`, `FUW00912SFBean`, `FUW00919SFBean`, `FUW00926SFBean`, `FUW00927SFBean`, `FUW00959SFBean`, `FUW00964SFBean`), each implementing their own key-specific routing logic. The framework invokes this method via the generic type resolution mechanism during screen rendering and data binding setup.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Framework (generic) | View layer -> `DBean.typeModelData(key, subkey)` | None (pure type resolution, no CRUD) |

**Note:** The callers operate through the framework's generic type model resolution mechanism, which iterates over field names and invokes `typeModelData` for each field during data binding initialization. The exact screen entry points are determined at runtime by the framework's view configuration, not by explicit code references.

## 6. Per-Branch Detail Blocks

**Block 1** — `[IF]` null guard `(key == null || subkey == null)` (L432)

> If either parameter is null, return null immediately. This prevents NullPointerException and signals the framework that no type information is available.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key == null || subkey == null)` [guard against null input] |
| 2 | RETURN | `return null;` [no type info available] |

**Block 2** — `[SET]` separator index extraction (L436)

> Extracts the position of "/" in the key string. Note: the variable `separaterPoint` (with the typo in the original name) is assigned but **never used** in any subsequent logic — this is dead code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` [separator index — unused / dead code] |

**Block 3** — `[IF-ELSEIF chain]` key-based routing for field types (L439–L498)

> Six sequential if/else-if branches route on the Japanese field name. Each branch performs a two-level subkey check (value vs. state), both returning `String.class`. The original comments include the English item ID (項目ID).

---

**Block 3.1** — `[IF]` `"Service contract status"` (L439) `[key == "サービス契約ステータス"]`

> Service contract status field. Items ID: `svc_kei_stat`

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("サービス契約ステータス")` [key == "Service contract status"] |
| 2 | IF | `subkey.equalsIgnoreCase("value")` [case-insensitive match] |
| 3 | RETURN | `return String.class;` [primary value type] |
| 4 | ELSEIF | `subkey.equalsIgnoreCase("state")` [status indicator] |
| 5 | RETURN | `return String.class;` [status type] — original comment: subkeyが"state"の場合、ステータスを返す [When subkey is "state", returns the status] |

---

**Block 3.2** — `[ELSE-IF]` `"Service code"` (L453) `[key == "サービスコード"]`

> Service code field. Items ID: `svc_cd`

| # | Type | Code |
|---|------|------|
| 1 | ELSEIF | `key.equals("サービスコード")` [key == "Service code"] |
| 2 | IF | `subkey.equalsIgnoreCase("value")` [case-insensitive match] |
| 3 | RETURN | `return String.class;` [primary value type] |
| 4 | ELSEIF | `subkey.equalsIgnoreCase("state")` [status indicator] |
| 5 | RETURN | `return String.class;` [status type] — original comment: subkeyが"state"の場合、ステータスを返す |

---

**Block 3.3** — `[ELSE-IF]` `"Price group code"` (L467) `[key == "料金グループコード"]`

> Price group code field. Items ID: `prc_grp_cd`

| # | Type | Code |
|---|------|------|
| 1 | ELSEIF | `key.equals("料金グループコード")` [key == "Price group code"] |
| 2 | IF | `subkey.equalsIgnoreCase("value")` [case-insensitive match] |
| 3 | RETURN | `return String.class;` [primary value type] |
| 4 | ELSEIF | `subkey.equalsIgnoreCase("state")` [status indicator] |
| 5 | RETURN | `return String.class;` [status type] — original comment: subkeyが"state"の場合、ステータスを返す |

---

**Block 3.4** — `[ELSE-IF]` `"Price course code"` (L481) `[key == "料金コースコード"]`

> Price course code field. Items ID: `pcrs_cd`

| # | Type | Code |
|---|------|------|
| 1 | ELSEIF | `key.equals("料金コースコード")` [key == "Price course code"] |
| 2 | IF | `subkey.equalsIgnoreCase("value")` [case-insensitive match] |
| 3 | RETURN | `return String.class;` [primary value type] |
| 4 | ELSEIF | `subkey.equalsIgnoreCase("state")` [status indicator] |
| 5 | RETURN | `return String.class;` [status type] — original comment: subkeyが"state"の場合、ステータスを返す |

---

**Block 3.5** — `[ELSE-IF]` `"Price plan code"` (L495) `[key == "料金プランコード"]`

> Price plan code field. Items ID: `pplan_cd`

| # | Type | Code |
|---|------|------|
| 1 | ELSEIF | `key.equals("料金プランコード")` [key == "Price plan code"] |
| 2 | IF | `subkey.equalsIgnoreCase("value")` [case-insensitive match] |
| 3 | RETURN | `return String.class;` [primary value type] |
| 4 | ELSEIF | `subkey.equalsIgnoreCase("state")` [status indicator] |
| 5 | RETURN | `return String.class;` [status type] — original comment: subkeyが"state"の場合、ステータスを返す |

---

**Block 3.6** — `[ELSE-IF]` `"Service start date"` (L509) `[key == "サービス開始年月日"]`

> Service start date field. Items ID: `svc_sta_ymd`

| # | Type | Code |
|---|------|------|
| 1 | ELSEIF | `key.equals("サービス開始年月日")` [key == "Service start date"] |
| 2 | IF | `subkey.equalsIgnoreCase("value")` [case-insensitive match] |
| 3 | RETURN | `return String.class;` [primary value type] |
| 4 | ELSEIF | `subkey.equalsIgnoreCase("state")` [status indicator] |
| 5 | RETURN | `return String.class;` [status type] — original comment: subkeyが"state"の場合、ステータスを返す |

---

**Block 4** — `[ELSE]` no-match fallback (L521)

> If no key matches any of the six known field names, return null. The original comment indicates this means no matching property was found.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | (implicit — end of if/else-if chain) [original comment: 条件に一致するプロパティが存在しない場合は、nullを返す — "If no property matches the condition, return null"] |
| 2 | RETURN | `return null;` [no type info for unknown field] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `typeModelData` | Method | Type model data — framework method that returns the Java Class type for a given field name and subkey, enabling dynamic data binding |
| DBean | Acronym | Data Bean — MVC pattern data transfer object used by the view layer for form data binding and display |
| `key` | Parameter | Field name (in Japanese) — the business label of a data field, used to route to the correct type resolution branch |
| `subkey` | Parameter | Sub-property specifier — identifies which aspect of the field's type to return ("value" for primary data, "state" for status indicator) |
| "サービス契約ステータス" | Field key | Service contract status — the current state of a service contract (e.g., active, suspended, terminated). Item ID: `svc_kei_stat` |
| "サービスコード" | Field key | Service code — unique identifier for a telecom service offering. Item ID: `svc_cd` |
| "料金グループコード" | Field key | Price group code — groups pricing plans into categories for comparison. Item ID: `prc_grp_cd` |
| "料金コースコード" | Field key | Price course code — specific pricing tier or course within a price group. Item ID: `pcrs_cd` |
| "料金プランコード" | Field key | Price plan code — individual pricing plan identifier. Item ID: `pplan_cd` |
| "サービス開始年月日" | Field key | Service start date — the date when the service contract becomes effective, formatted as year-month-day. Item ID: `svc_sta_ymd` |
| `svc_kei_stat` | Field | Service detail status — internal status tracking for service contract line items |
| `svc_cd` | Field | Service code — unique code identifying a telecom service type |
| `prc_grp_cd` | Field | Price group code — classification code grouping pricing plans |
| `pcrs_cd` | Field | Price course code — pricing course/tier identifier |
| `pplan_cd` | Field | Price plan code — individual pricing plan identifier |
| `svc_sta_ymd` | Field | Service start year-month-day — effective date of the service contract |
| `separaterPoint` | Field (dead code) | Separator index — stores the position of "/" in key; assigned but never used (typo in original variable name) |
| MVC | Acronym | Model-View-Controller — software architectural pattern used in the web framework |
| `String.class` | Type | Java class representing the String data type — all routed fields use String as their data type |
| `equalsIgnoreCase` | Method | Case-insensitive string comparison — used to match subkeys "value" and "state" regardless of letter casing |
