# Business Logic — KKW00130SF01DBean.typeModelData() [77 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00130SF.KKW00130SF01DBean` |
| Layer | Controller (Web DataBean) |
| Module | `KKW00130SF` (Package: `eo.web.webview.KKW00130SF`) |

## 1. Role

### KKW00130SF01DBean.typeModelData()

This method serves as the **data-type introspection endpoint** for the Fujitsu X33 view framework. It is the core routing method of the `X33VDataTypeBeanInterface` implementation on `KKW00130SF01DBean`, enabling the X33 framework to dynamically determine what Java type a given field holds at runtime. The X33 model-driven UI framework uses this method to perform **data-type binding** — when the framework renders or validates form fields, it queries this method to know whether a field should be treated as a `String`, `Integer`, or another type, so it can construct appropriate UI components and perform type-safe conversions.

The method implements a **dispatch/router design pattern**, branching on the `key` parameter to resolve the type for three distinct business domains: (1) the "添え字" (Addji — Index/Subscript) field, which represents a free-form text entry used for appending index values, (2) the "コードリスト" (CodeList — Code List) array field, which holds a list of selectable code values (populated with `SelectItem` objects for dropdown controls), and (3) the "コード名リスト" (CodeNameList — Code Name List) array field, which holds a list of code name display values. For indexed array fields, the method delegates to the inner element's own `typeModelData()` method via `X33VDataTypeStringBean.typeModelData()`, supporting recursive type resolution through nested list structures.

As a **shared utility** within the DataBean, this method does not perform any business processing, database access, or service calls. Its role is purely structural — it informs the X33 framework about the shape of the bean's data model so the framework can auto-generate form bindings, validate incoming data, and render screen fields with the correct type expectations. It is called internally by the X33 runtime and by other methods within the same bean when the framework needs to inspect field metadata.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    COND_NULL{key or subkey is null?}
    INDEX_SEPARATER["separaterPoint = key.indexOf('/')"]
    COND_ADDJICI{key == Addji}
    SUBKEY_VALUE{subkey equalsIgnoreCase value?}
    RETURN_STRING_1(["return String.class"])
    SUBKEY_STATE{subkey equalsIgnoreCase state?}
    COND_CD_LIST{key == CodeList}
    EXTRACT_KEY["key = key.substring(separaterPoint + 1)"]
    COND_STAR{key equals '*'}
    RETURN_INTEGER(["return Integer.class"])
    TRY_PARSE["tmpIndexInt = Integer.valueOf(key)"]
    CATCH_PARSE{NumberFormatException?}
    RETURN_NULL_1(["return null"])
    COND_INDEX_RANGE{tmpIndex out of range?}
    INNER_CALL["X33VDataTypeStringBean.typeModelData(subkey)"]
    COND_CD_NM_LIST{key == CodeNameList}
    EXTRACT_KEY_2["key = key.substring(separaterPoint + 1)"]
    COND_STAR_2{key equals '*'}
    COND_INDEX_RANGE_2{tmpIndex out of range?}
    INNER_CALL_2["X33VDataTypeStringBean.typeModelData(subkey)"]
    END_NODE(["return null"])

    START --> COND_NULL
    COND_NULL -->|true| RETURN_NULL_1
    COND_NULL -->|false| INDEX_SEPARATER
    INDEX_SEPARATER --> COND_ADDJICI
    COND_ADDJICI -->|true| SUBKEY_VALUE
    SUBKEY_VALUE -->|true| RETURN_STRING_1
    SUBKEY_VALUE -->|false| SUBKEY_STATE
    SUBKEY_STATE -->|true| RETURN_STRING_1
    SUBKEY_STATE -->|false| COND_CD_LIST
    COND_ADDJICI -->|false| COND_CD_LIST
    COND_CD_LIST -->|true| EXTRACT_KEY
    EXTRACT_KEY --> COND_STAR
    COND_STAR -->|true| RETURN_INTEGER
    COND_STAR -->|false| TRY_PARSE
    TRY_PARSE -->|catch| CATCH_PARSE
    CATCH_PARSE -->|true| RETURN_NULL_1
    CATCH_PARSE -->|false| COND_INDEX_RANGE
    COND_INDEX_RANGE -->|true| RETURN_NULL_1
    COND_INDEX_RANGE -->|false| INNER_CALL
    INNER_CALL --> END_NODE
    COND_CD_LIST -->|false| COND_CD_NM_LIST
    COND_CD_NM_LIST -->|true| EXTRACT_KEY_2
    EXTRACT_KEY_2 --> COND_STAR_2
    COND_STAR_2 -->|true| RETURN_INTEGER
    COND_STAR_2 -->|false| TRY_PARSE
    TRY_PARSE -->|catch| CATCH_PARSE
    CATCH_PARSE -->|true| RETURN_NULL_1
    CATCH_PARSE -->|false| COND_INDEX_RANGE_2
    COND_INDEX_RANGE_2 -->|true| RETURN_NULL_1
    COND_INDEX_RANGE_2 -->|false| INNER_CALL_2
    INNER_CALL_2 --> END_NODE
    COND_CD_NM_LIST -->|false| END_NODE
```

**Processing summary:**

The method follows a sequential cascade of three type-resolution branches:

1. **Null guard**: If either `key` or `subkey` is `null`, return `null` immediately. This is a defensive check preventing `NullPointerException` in downstream processing.

2. **Addji (添え字 — Index) branch**: When `key` equals `"添え字"` (the literal string for "Addji"/"Index"), the method inspects `subkey` (case-insensitive) and returns `String.class` for both `"value"` and `"state"` subkeys. The value field carries the actual index text content, while the state field carries the UI state indicator for the index entry.

3. **CodeList (コードリスト) branch**: When `key` equals `"コードリスト"` (the literal string for "Code List"), the method extracts the sub-element from the slash-delimited key (e.g., `"コードリスト/0"` -> `"0"`). If the sub-element is `"*"`, it returns `Integer.class` to indicate the list's element count. Otherwise, it parses the sub-element as an integer index, validates the index against the `cd_list_list` bounds, and delegates to the inner `X33VDataTypeStringBean.typeModelData(subkey)` at that index. If the sub-element is not a valid integer, the index is out of range, or any error occurs, it returns `null`.

4. **CodeNameList (コード名リスト) branch**: When `key` equals `"コード名リスト"` (the literal string for "Code Name List"), the method follows the identical pattern as CodeList — extract the index from the key, handle `"*"` for count queries, parse the integer index, validate bounds against `cd_nm_list_list`, and delegate to the inner `X33VDataTypeStringBean.typeModelData(subkey)`.

5. **Fallback**: If none of the conditions match, return `null`. This handles any unrecognized field names gracefully.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field name (項目名) identifying which data element's type is being queried. Can take the following values: `"添え字"` (Addji/Index — a free-form index entry), `"コードリスト"` (Code List — an array of selectable code values), `"コード名リスト"` (Code Name List — an array of code name display values), or `"コードリスト/{index}"` / `"コード名リスト/{index}"` for indexed access into array elements. A slash (`/`) followed by an integer index or the wildcard `"*"` may be appended to specify an inner element. |
| 2 | `subkey` | `String` | The sub-field identifier used for nested property resolution. For the "添え字" (Index) field, valid values are `"value"` (the text content of the index) and `"state"` (the UI state indicator), both case-insensitive. For indexed CodeList/CodeNameList entries, the subkey is forwarded to the inner `X33VDataTypeStringBean.typeModelData()` to resolve the field type within each list element. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `cd_list_list` | `X33VDataTypeList` | The list of code entries (コードリスト) — each element is an `X33VDataTypeStringBean` representing a selectable code value in a dropdown. Bound to the UI field `cd_list`. |
| `cd_nm_list_list` | `X33VDataTypeList` | The list of code name entries (コード名リスト) — each element is an `X33VDataTypeStringBean` representing a display label for a code. Bound to the UI field `cd_nm_list`. |

## 4. CRUD Operations / Called Services

This method performs **no database operations** (no Create, Read, Update, or Delete). It is a pure type-introspection utility that operates entirely in memory on bean state.

### Method calls within this method

| Type | Method Call | Description |
|------|-------------|-------------|
| EXEC | `X33VDataTypeStringBean.typeModelData(subkey)` | Delegates to inner element's type introspection for indexed CodeList entries (L383) |
| EXEC | `X33VDataTypeStringBean.typeModelData(subkey)` | Delegates to inner element's type introspection for indexed CodeNameList entries (L410) |
| EXEC | `cd_list_list.size()` | Queries the size of the code list array for bounds checking (L382) |
| EXEC | `cd_list_list.get(tmpIndex)` | Retrieves the element at the given index from the code list (L383) |
| EXEC | `cd_nm_list_list.size()` | Queries the size of the code name list array for bounds checking (L409) |
| EXEC | `cd_nm_list_list.get(tmpIndex)` | Retrieves the element at the given index from the code name list (L410) |
| EXEC | `key.substring(separaterPoint + 1)` | Extracts the sub-element from the slash-delimited key string (L361, L388) |
| EXEC | `Integer.valueOf(key)` | Parses the sub-element string as an integer (L367, L394) |
| EXEC | `tmpIndexInt.intValue()` | Converts Integer wrapper to primitive int (L375, L402) |

**CRUD Summary:** No database or service component calls. This method is read-only metadata inspection with no side effects.

## 5. Dependency Trace

The caller search results show that `typeModelData()` is defined across many `DBean` classes throughout the `koptWebR` module. Each of those classes implements the same X33 `X33VDataTypeBeanInterface` contract and follows the identical dispatch pattern. For this specific method on `KKW00130SF01DBean`, the method is called **internally within the same bean class** (as indicated by the pre-computed caller data: `KKW00130SF01DBean.typeModelData()` calling itself via delegation to inner list elements).

The X33 framework runtime is the primary external caller — when the framework renders the screen associated with the `KKW00130SF` module, it invokes this method via the `X33VDataTypeBeanInterface` contract to resolve data types for form binding.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean:KKW00130SF01DBean | `X33VViewBaseBean` framework -> `KKW00130SF01DBean.typeModelData(key, subkey)` | (no CRUD — type introspection only) |
| 2 | Bean:KKW00130SF01DBean (self) | `KKW00130SF01DBean.typeModelData()` -> inner list element -> `X33VDataTypeStringBean.typeModelData(subkey)` | (no CRUD — delegation to inner bean) |

**Cross-beam note:** The same `typeModelData()` pattern is used by dozens of DBeans across screens FUW00901SF, FUW00912SF, FUW00919SF, FUW00926SF, FUW00927SF, FUW00931SF, FUW00959SF, and FUW00964SF — all implementing the same X33 framework contract.

## 6. Per-Branch Detail Blocks

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

> Null guard: if either parameter is null, return null immediately to prevent downstream errors.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // key or subkey is null, return null (key,subkeyがnullの場合、nullを返す) [L340] |

**Block 2** — [EXEC] (L342)

> Locate the first slash (`/`) position in the key for later substring extraction.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` // find first slash position [L342] |

**Block 3** — [IF] `(key.equals("添え字"))` [添え字="添え字"] (L345)

> The "添え字" (Addji / Index) field branch. This field represents a free-form text entry used for appending index values on the screen. For this field type, the method resolves types for the "value" (text content) and "state" (UI state) sub-properties.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` [L346] |
| 1.1 | RETURN | `return String.class;` // value subkey returns String type [L347] |
| 2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [subkey="state"] [L349] |
| 2.1 | RETURN | `return String.class;` // state subkey returns String type — returns state information (subkeyが"state"の場合、ステータスを返す) [L350] |

**Block 4** — [ELSE-IF] `(key.equals("コードリスト"))` [コードリスト="コードリスト"] (L353)

> The "コードリスト" (Code List) array branch. This field holds a list of selectable code values (item ID: `cd_list`), populated as `X33VDataTypeStringBean` instances for use in dropdown controls. The method resolves types for indexed access within this list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // extract sub-element after "/" — e.g., "コードリスト/0" -> "0" (keyの次の要素を取得) [L355] |
| 2 | IF | `key.equals("*")` [wildcard for count query] [L357] |
| 2.1 | RETURN | `return Integer.class;` // "*" specified as subkey, return Integer.class to indicate the number of list elements (*が指定されていたら、リストの要素数を返す) [L358] |
| 3 | SET | `tmpIndexInt = null` // initialize for integer parsing (L362) |
| 4 | TRY | `tmpIndexInt = Integer.valueOf(key)` // parse sub-element as integer (L364) |
| 4.1 | CATCH | `NumberFormatException e` // sub-element is not a valid numeric string (インデックス値が数値文字列でない場合は、ここでnullを返す) [L367] |
| 4.1.1 | RETURN | `return null;` // invalid index format, return null [L368] |
| 5 | IF | `tmpIndexInt == null` [L370] |
| 5.1 | RETURN | `return null;` // parsed value is null, return null [L371] |
| 6 | SET | `tmpIndex = tmpIndexInt.intValue()` // convert Integer to primitive int [L373] |
| 7 | IF | `tmpIndex < 0 || tmpIndex >= cd_list_list.size()` [L374] |
| 7.1 | RETURN | `return null;` // index out of range — exceeds list element count - 1 (インデックス値がリスト個数-1を超える場合、ここでnullを返す) [L375] |
| 8 | CAST | `X33VDataTypeStringBean` cast on `cd_list_list.get(tmpIndex)` (L376) |
| 9 | CALL | `X33VDataTypeStringBean.typeModelData(subkey)` // delegate to inner element's type introspection [L376] |

**Block 5** — [ELSE-IF] `(key.equals("コード名リスト"))` [コード名リスト="コード名リスト"] (L381)

> The "コード名リスト" (Code Name List) array branch. This field holds a list of code name display values (item ID: `cd_nm_list`), populated as `X33VDataTypeStringBean` instances. The resolution logic mirrors the CodeList branch exactly, operating on a different list instance.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // extract sub-element after "/" — e.g., "コード名リスト/0" -> "0" (keyの次の要素を取得) [L383] |
| 2 | IF | `key.equals("*")` [wildcard for count query] [L385] |
| 2.1 | RETURN | `return Integer.class;` // "*" specified as subkey, return Integer.class to indicate the number of list elements (*が指定されていたら、リストの要素数を返す) [L386] |
| 3 | SET | `tmpIndexInt = null` // initialize for integer parsing (L390) |
| 4 | TRY | `tmpIndexInt = Integer.valueOf(key)` // parse sub-element as integer (L392) |
| 4.1 | CATCH | `NumberFormatException e` // sub-element is not a valid numeric string (インデックス値が数値文字列でない場合は、ここでnullを返す) [L395] |
| 4.1.1 | RETURN | `return null;` // invalid index format, return null [L396] |
| 5 | IF | `tmpIndexInt == null` [L398] |
| 5.1 | RETURN | `return null;` // parsed value is null, return null [L399] |
| 6 | SET | `tmpIndex = tmpIndexInt.intValue()` // convert Integer to primitive int [L401] |
| 7 | IF | `tmpIndex < 0 || tmpIndex >= cd_nm_list_list.size()` [L402] |
| 7.1 | RETURN | `return null;` // index out of range — exceeds list element count - 1 (インデックス値がリスト個数-1を超える場合、ここでnullを返す) [L403] |
| 8 | CAST | `X33VDataTypeStringBean` cast on `cd_nm_list_list.get(tmpIndex)` (L404) |
| 9 | CALL | `X33VDataTypeStringBean.typeModelData(subkey)` // delegate to inner element's type introspection [L404] |

**Block 6** — [FALLTHROUGH] (L407)

> No matching field was found. Return null for unrecognized key values.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // no matching property exists — returns null for unrecognized field names (条件に一致するプロパティが存在しない場合は、nullを返す) [L407] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `typeModelData` | Method | Data-type introspection method — part of the X33 `X33VDataTypeBeanInterface` contract that allows the framework to query the Java type of a field at runtime |
| X33 | Acronym | Fujitsu Futurity X33 — a web application framework for building JSF-based screen UIs with model-driven data binding |
| X33VDataTypeBeanInterface | Interface | X33 framework interface that a DataBean must implement to expose its field types for automatic UI binding |
| X33VDataTypeList | Class | X33 framework generic list container that holds typed data elements for list-type UI fields |
| X33VDataTypeStringBean | Class | X33 framework bean wrapping a String data type, used as the element type for string-based list fields |
| DataBean (DBean) | Concept | A UI-level bean that holds screen state, form data, and data-type metadata for a specific screen in the X33 framework |
| `key` | Parameter | Field name — the identifier of the data element whose type is being queried |
| `subkey` | Parameter | Sub-field identifier — used for nested property resolution within compound field types |
| `cd_list_list` | Field | Code List array — holds `X33VDataTypeStringBean` elements representing selectable code values for dropdown UI components (item ID: `cd_list`) |
| `cd_nm_list_list` | Field | Code Name List array — holds `X33VDataTypeStringBean` elements representing display labels for code values (item ID: `cd_nm_list`) |
| 添え字 (Taeji) | Field | Addji / Index — a free-form text entry field used for appending and managing index values on the screen |
| コードリスト (Koodorisuto) | Field | Code List — a list/array of selectable code values, displayed in dropdown or list controls on the screen |
| コード名リスト (Koodonamirisuto) | Field | Code Name List — a list/array of code name display labels that accompany the code list values |
| `index_update` | Field | Index update tracking — internal state for tracking updates to the index field |
| `index_value` | Field | Index value — the actual text content stored in the index field |
| `index_state` | Field | Index state — UI state indicator for the index field's current condition |
| `SelectItem` | Class | JSF standard class for dropdown/select option items, containing a value and a display label |
| `NumberFormatException` | Exception | Java exception thrown when a string cannot be parsed as an integer — caught to gracefully return null for invalid index formats |
