# Business Logic — KKW14301SF03DBean.typeModelData() [91 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA35101SF.KKW14301SF03DBean` |
| Layer | Utility (Data Type Provider) |
| Module | `KKA35101SF` (Package: `eo.web.webview.KKA35101SF`) |

## 1. Role

### KKW14301SF03DBean.typeModelData()

This method serves as the **data type provider** for the X33 Framework's type-safe data binding system, implementing the `X33VDataTypeBeanInterface.typeModelData(String, String)` contract. It answers the question "what Java type does this field have?" — the framework uses the returned `Class<?>` to configure column types in data grids and validate bound data at runtime.

The method implements a **routing/dispatch pattern**: it matches the `key` parameter (a business item name) against a fixed set of six recognized fields. For each recognized field, it then matches the `subkey` parameter (`"value"`, `"enable"`, or `"state"`) and returns the corresponding Java class: `String.class` for value and state, `Boolean.class` for the enabled/disabled flag.

This is a **shared utility** consumed by the X33 grid framework during page rendering. The bean is instantiated as the data type provider for the "Discount/Campaign Code List☆Style" (割引／キャンペーンコードリスト☆スタイル) grid item within the KKA35101SF screen (visit order inquiry information search). Every field follows the same three-subkey pattern, making the bean's data model consistent across all grid columns.

The six key branches and their corresponding item IDs (フィールドID) are:

| Key (Japanese) | English Meaning | Item ID (フィールドID) | Value Type | Enable Type | State Type |
|---|---|---|---|---|---|
| コード | Code | `wrib_svc_cd` | `String.class` | `Boolean.class` | `String.class` |
| 名称 | Name | `wrib_svc_nm` | `String.class` | `Boolean.class` | `String.class` |
| 受付開始日 | Service Start Date | `uk_sta_dtm` | `String.class` | `Boolean.class` | `String.class` |
| 受付終了日 | Service End Date | `uk_end_dtm` | `String.class` | `Boolean.class` | `String.class` |
| 適用方法 | Application Method | `aply_way` | `String.class` | `Boolean.class` | `String.class` |
| 割引／キャンペーンコードリスト☆スタイル | Discount/Campaign Code List☆Style | `wrib_svc_cd_list_style` | `String.class` | `Boolean.class` | `String.class` |

If either `key` or `subkey` is `null`, or no matching branch is found, the method returns `null`, signaling to the framework that no data type is defined for the requested item.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    START --> CHECK_NULL["Check: key == null || subkey == null"]
    CHECK_NULL -->|null| RETURN_NULL["return null"]
    CHECK_NULL -->|not null| SEPARATOR["int separaterPoint = key.indexOf('/')"]
    SEPARATOR --> KEY_CODE["key.equals('コード')?"]
    KEY_CODE -->|true| SUB_KEY_VALUE_1{"subkey.equalsIgnoreCase('value')?"}
    KEY_CODE -->|false| KEY_NAME["key.equals('名称')?"]
    SUB_KEY_VALUE_1 -->|true| RET_STRING_1["return String.class"]
    SUB_KEY_VALUE_1 -->|false| SUB_KEY_ENABLE_1{"subkey.equalsIgnoreCase('enable')?"}
    SUB_KEY_ENABLE_1 -->|true| RET_BOOLEAN_1["return Boolean.class"]
    SUB_KEY_ENABLE_1 -->|false| SUB_KEY_STATE_1{"subkey.equalsIgnoreCase('state')?"}
    SUB_KEY_STATE_1 -->|true| RET_STRING_1A["return String.class"]
    SUB_KEY_STATE_1 -->|false| KEY_NAME
    KEY_NAME -->|true| SUB_KEY_VALUE_2{"subkey.equalsIgnoreCase('value')?"}
    KEY_NAME -->|false| KEY_START_DATE["key.equals('受付開始日')?"]
    SUB_KEY_VALUE_2 -->|true| RET_STRING_2["return String.class"]
    SUB_KEY_VALUE_2 -->|false| SUB_KEY_ENABLE_2{"subkey.equalsIgnoreCase('enable')?"}
    SUB_KEY_ENABLE_2 -->|true| RET_BOOLEAN_2["return Boolean.class"]
    SUB_KEY_ENABLE_2 -->|false| SUB_KEY_STATE_2{"subkey.equalsIgnoreCase('state')?"}
    SUB_KEY_STATE_2 -->|true| RET_STRING_2A["return String.class"]
    SUB_KEY_STATE_2 -->|false| KEY_END_DATE["key.equals('受付終了日')?"]
    KEY_END_DATE -->|true| SUB_KEY_VALUE_3{"subkey.equalsIgnoreCase('value')?"}
    KEY_END_DATE -->|false| KEY_APPLY["key.equals('適用方法')?"]
    SUB_KEY_VALUE_3 -->|true| RET_STRING_3["return String.class"]
    SUB_KEY_VALUE_3 -->|false| SUB_KEY_ENABLE_3{"subkey.equalsIgnoreCase('enable')?"}
    SUB_KEY_ENABLE_3 -->|true| RET_BOOLEAN_3["return Boolean.class"]
    SUB_KEY_ENABLE_3 -->|false| SUB_KEY_STATE_3{"subkey.equalsIgnoreCase('state')?"}
    SUB_KEY_STATE_3 -->|true| RET_STRING_3A["return String.class"]
    SUB_KEY_STATE_3 -->|false| KEY_DISCOUNT["key.equals('割引／キャンペーンコードリスト☆スタイル')?"]
    KEY_DISCOUNT -->|true| SUB_KEY_VALUE_5{"subkey.equalsIgnoreCase('value')?"}
    KEY_DISCOUNT -->|false| RET_NULL_FINAL["return null"]
    SUB_KEY_VALUE_5 -->|true| RET_STRING_5["return String.class"]
    SUB_KEY_VALUE_5 -->|false| SUB_KEY_ENABLE_5{"subkey.equalsIgnoreCase('enable')?"}
    SUB_KEY_ENABLE_5 -->|true| RET_BOOLEAN_5["return Boolean.class"]
    SUB_KEY_ENABLE_5 -->|false| SUB_KEY_STATE_5{"subkey.equalsIgnoreCase('state')?"}
    SUB_KEY_STATE_5 -->|true| RET_STRING_5A["return String.class"]
    SUB_KEY_STATE_5 -->|false| RET_NULL_FINAL
    RET_STRING_1 --> END(["End"])
    RET_BOOLEAN_1 --> END
    RET_STRING_1A --> END
    RET_STRING_2 --> END
    RET_BOOLEAN_2 --> END
    RET_STRING_2A --> END
    RET_STRING_3 --> END
    RET_BOOLEAN_3 --> END
    RET_STRING_3A --> END
    RET_STRING_5 --> END
    RET_BOOLEAN_5 --> END
    RET_STRING_5A --> END
    RET_NULL_FINAL --> END
    RETURN_NULL --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The Japanese item name (項目名) of a grid column. Identifies which field's type to resolve. Values: `"コード"` (Code, item ID: `wrib_svc_cd`), `"名称"` (Name, item ID: `wrib_svc_nm`), `"受付開始日"` (Service Start Date, item ID: `uk_sta_dtm`), `"受付終了日"` (Service End Date, item ID: `uk_end_dtm`), `"適用方法"` (Application Method, item ID: `aply_way`), `"割引／キャンペーンコードリスト☆スタイル"` (Discount/Campaign Code List☆Style, item ID: `wrib_svc_cd_list_style`). Affects processing by routing to the corresponding if/else branch. |
| 2 | `subkey` | `String` | The sub-key identifying which aspect of the field's type metadata to return. Values: `"value"` (returns the field's data type — `String.class`), `"enable"` (returns the field's enabled/disabled toggle type — `Boolean.class`), `"state"` (returns the field's state/status type — `String.class`). Case-insensitive comparison via `equalsIgnoreCase()`. Affects which type class is returned. |

**Instance fields read:** None — this method is stateless. It performs no reads of instance fields, relies solely on its two parameters and returns hardcoded `Class<?>` literals.

## 4. CRUD Operations / Called Services

This method performs **no database operations, no service calls, and no I/O**. It is a pure in-memory lookup utility that returns Java `Class<?>` references.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | (none) | — | — | Pure type resolution — no database or service interaction |

Method calls within `typeModelData`: None. The method contains only conditional logic and `return` statements with class literals.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0143 (KKA35101SF) | `KKW14301SFBean` -> X33 Framework type provider mechanism -> `KKW14301SF03DBean.typeModelData(key, subkey)` | (none — pure type provider) |

**Notes on caller chain:**
- The bean is declared as the data type provider (`X33VDataTypeBeanInterface` implementation) for the "Discount/Campaign Code List☆Style" repeated grid item (`wrib_svc_cd_list`) in the `KKW14301SFBean` class.
- The X33 Framework invokes `typeModelData(key, subkey)` during grid column configuration to determine Java types for data binding.
- The method is defined in both `koptWebA` and `koptWebB` (copied from koptWebB to koptWebA per revision history).

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null check) `(key == null || subkey == null)` (L527)

> If either parameter is null, return null immediately — prevents NullPointerException and signals "no type defined" to the framework.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if(key == null || subkey == null)` |
| 2 | RETURN | `return null;` |

**Block 2** — EXEC (separator extraction) (L528)

> Computes the index of the "/" character in `key`. This value is extracted but **not used** within the method — it is dead code, likely generated by the Web Client tool.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` |

**Block 3** — ELSE-IF `"コード"` (Code field) (L531)

> Handles the item whose item ID is `wrib_svc_cd`. The Japanese key is `"コード"` meaning "Code".

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if(key.equals("コード"))` |

**Block 3.1** — IF `subkey = "value"` (L532)

> Returns `String.class` — the code value is a String.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if(subkey.equalsIgnoreCase("value"))` |
| 2 | RETURN | `return String.class;` |

**Block 3.2** — ELSE-IF `subkey = "enable"` (L535)

> Returns `Boolean.class` — the enabled flag is a boolean.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(subkey.equalsIgnoreCase("enable"))` |
| 2 | RETURN | `return Boolean.class;` |

**Block 3.3** — ELSE-IF `subkey = "state"` (L538)

> Returns `String.class` — the field state/metadata is a String. (Comment: subkeyが"state"の場合、ステータスを返す。)

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(subkey.equalsIgnoreCase("state"))` |
| 2 | RETURN | `return String.class;` |

**Block 4** — ELSE-IF `"名称"` (Name field, item ID: `wrib_svc_nm`) (L543)

> Same three-subkey pattern as Block 3.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(key.equals("名称"))` |
| 2 | CHECK | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 3 | CHECK | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 4 | CHECK | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` |

**Block 5** — ELSE-IF `"受付開始日"` (Service Start Date, item ID: `uk_sta_dtm`) (L555)

> Same three-subkey pattern. (Comment: データタイプがStringの項目)

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(key.equals("受付開始日"))` |
| 2 | CHECK | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 3 | CHECK | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 4 | CHECK | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` |

**Block 6** — ELSE-IF `"受付終了日"` (Service End Date, item ID: `uk_end_dtm`) (L567)

> Same three-subkey pattern.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(key.equals("受付終了日"))` |
| 2 | CHECK | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 3 | CHECK | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 4 | CHECK | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` |

**Block 7** — ELSE-IF `"適用方法"` (Application Method, item ID: `aply_way`) (L579)

> Same three-subkey pattern.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(key.equals("適用方法"))` |
| 2 | CHECK | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 3 | CHECK | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 4 | CHECK | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` |

**Block 8** — ELSE-IF `"割引／キャンペーンコードリスト☆スタイル"` (Discount/Campaign Code List☆Style, item ID: `wrib_svc_cd_list_style`) (L591)

> Same three-subkey pattern. (Comment: データタイプがStringの項目)

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(key.equals("割引／キャンペーンコードリスト☆スタイル"))` |
| 2 | CHECK | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 3 | CHECK | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 4 | CHECK | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` |

**Block 9** — RETURN (fallback, no matching key found) (L606)

> If no key branch matches, return null. (Comment: 条件に合致するプロパティが存在しない場合は、nullを返す。)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `wrib_svc_cd` | Field | Write service code — internal item ID for the "Code" column in the service contract grid |
| `wrib_svc_nm` | Field | Write service name — internal item ID for the "Name" column |
| `uk_sta_dtm` | Field | Acceptance start datetime — the date when service acceptance begins |
| `uk_end_dtm` | Field | Acceptance end datetime — the date when service acceptance ends |
| `aply_way` | Field | Application method — how the service option is applied |
| `wrib_svc_cd_list_style` | Field | Write service code list style — internal item ID for the Discount/Campaign Code List☆Style grid column |
| `key` | Parameter | Item name (項目名) — the Japanese label of a grid field, used to route to the correct type lookup branch |
| `subkey` | Parameter | Sub-key — identifies which metadata aspect of the field ("value", "enable", "state") to resolve |
| X33 Framework | Platform | Fujitsu Futurity Web X33 — a Java-based web application framework providing data binding, grid rendering, and model/view separation |
| `X33VDataTypeBeanInterface` | Interface | X33 interface that beans implement to provide type information for data-bound grid columns; requires implementing `loadModelData`, `storeModelData`, and `typeModelData` |
| `X33VListedBeanInterface` | Interface | X33 interface for beans that can produce a list of column item names via `listKoumokuIds()` |
| `typeModelData` | Method | X33 callback — returns the Java `Class<?>` type for a given item name and sub-key, used by the framework for column type detection |
| コード | Japanese field label | "Code" — the service/writing code field identifier |
| 名称 | Japanese field label | "Name" — the service name field identifier |
| 受付開始日 | Japanese field label | "Service Start Date" — the date when the service becomes available for acceptance |
| 受付終了日 | Japanese field label | "Service End Date" — the date when the service acceptance window closes |
| 適用方法 | Japanese field label | "Application Method" — the method by which the service option is applied |
| 割引／キャンペーンコードリスト☆スタイル | Japanese field label | "Discount/Campaign Code List☆Style" — a grid column displaying discount and campaign code options |
| フィールドID | Term | "Field ID" — the internal Java field name used to identify grid columns in the X33 data binding system |
| null (early return) | Behavior | When key or subkey is null, the method returns null instead of throwing — safe fallback for missing type definitions |
