# Business Logic — KKW05501SF01DBean.typeModelData() [133 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW05501SF.KKW05501SF01DBean` |
| Layer | Web View / Data Bean (Controller) |
| Module | `KKW05501SF` (Package: `eo.web.webview.KKW05501SF`) |

## 1. Role

### KKW05501SF01DBean.typeModelData()

This method is the **data-type introspection dispatcher** for the KKW05501SF screen's web view data beans. It operates within the Fujitsu Futurity X33V web framework, which uses a typed bean architecture where each UI field (item) has a declared Java type (`Class<?>`) that governs how the framework renders, validates, and binds data. The method answers the question: "Given a field name (`key`) and a sub-property (`subkey`), what Java type should the framework use?"

The method handles **two categories of fields**: (1) **Scalar fields** — simple single-value fields such as code type codes, code type names, and selection indices, each of which exposes `value` (the data), `enable` (boolean editability), and `state` (display status); and (2) **List fields** — repeated/iterative items like initial setup codes, code type code value lists, and code type name lists, which use slash-separated index notation (e.g., `初期設定コード/0`) to access individual list elements. For list fields, the method optionally returns `Integer.class` when the subkey is `"*"` to indicate the type of the list element count.

This method implements the **routing/dispatch design pattern** — it branches on the `key` string to identify the field category, then branches on the `subkey` to identify the specific property, returning the appropriate `Class<?>` instance. For list fields, it **delegates** to the child bean's `typeModelData` method via casting to `X33VDataTypeStringBean`.

Its role in the larger system is that of a **shared UI metadata supplier**. The parent bean `KKW05501SFBean` calls this method through the `typeModelData(String key, String subkey)` delegation chain to resolve type information during screen rendering. The framework uses these type declarations to perform data binding, input validation, and view rendering without runtime type errors.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    START --> checkNull{"key or subkey
null?"}
    checkNull -->|"Yes"| retNull1([return null])
    checkNull -->|"No"| findSep["find '/' index in key"]

    findSep --> codeTypeCd{"key equals
'コードタイプコード'?"}
    codeTypeCd -->|"Yes"| codeTypeCdCheck{"subkey equals
value/enable/state?"}
    codeTypeCdCheck -->|"value"| retStr1([return String.class])
    codeTypeCdCheck -->|"enable"| retBool1([return Boolean.class])
    codeTypeCdCheck -->|"state"| retStr2([return String.class])
    codeTypeCd -->|"No"| codeTypeNm{"key equals
'コードタイプ名称'?"}
    codeTypeNm -->|"Yes"| codeTypeNmCheck{"subkey equals
value/enable/state?"}
    codeTypeNmCheck -->|"value"| retStr3([return String.class])
    codeTypeNmCheck -->|"enable"| retBool2([return Boolean.class])
    codeTypeNmCheck -->|"state"| retStr4([return String.class])
    codeTypeNm -->|"No"| selIdx{"key equals
'選択インデックス'?"}
    selIdx -->|"Yes"| selIdxCheck{"subkey equals
value/enable/state?"}
    selIdxCheck -->|"value"| retStr5([return String.class])
    selIdxCheck -->|"enable"| retBool3([return Boolean.class])
    selIdxCheck -->|"state"| retStr6([return String.class])
    selIdx -->|"No"| initCd{"key equals
'初期設定コード'?"}
    initCd -->|"Yes"| initCdParse["parse key after '/'"]
    initCdParse --> checkAsterisk1{"key equals '*'
(list count request)?"}
    checkAsterisk1 -->|"Yes"| retInt1([return Integer.class])
    checkAsterisk1 -->|"No"| parseIdx1["Integer.valueOf(key)"]
    parseIdx1 --> tryParse1{NumberFormatException?}
    tryParse1 -->|"Yes"| retNull2([return null])
    tryParse1 -->|"No"| boundCheck1{"index valid
in default_cd_list?"}
    boundCheck1 -->|"No"| retNull3([return null])
    boundCheck1 -->|"Yes"| callDefaultCD["((X33VDataTypeStringBean)
default_cd_list.get(index))
.typeModelData(subkey)"]
    initCd -->|"No"| cdCdList{"key equals
'コードタイプコード値リスト'?"}
    cdCdList -->|"Yes"| cdCdListParse["parse key after '/'"]
    cdCdListParse --> checkAsterisk2{"key equals '*'
(list count request)?"}
    checkAsterisk2 -->|"Yes"| retInt2([return Integer.class])
    checkAsterisk2 -->|"No"| parseIdx2["Integer.valueOf(key)"]
    parseIdx2 --> tryParse2{NumberFormatException?}
    tryParse2 -->|"Yes"| retNull4([return null])
    tryParse2 -->|"No"| boundCheck2{"index valid
in cd_div_cd_list_list?"}
    boundCheck2 -->|"No"| retNull5([return null])
    boundCheck2 -->|"Yes"| callCdCdList["((X33VDataTypeStringBean)
cd_div_cd_list_list.get(index))
.typeModelData(subkey)"]
    cdCdList -->|"No"| cdNmList{"key equals
'コードタイプ名称リスト'?"}
    cdNmList -->|"Yes"| cdNmListParse["parse key after '/'"]
    cdNmListParse --> checkAsterisk3{"key equals '*'
(list count request)?"}
    checkAsterisk3 -->|"Yes"| retInt3([return Integer.class])
    checkAsterisk3 -->|"No"| parseIdx3["Integer.valueOf(key)"]
    parseIdx3 --> tryParse3{NumberFormatException?}
    tryParse3 -->|"Yes"| retNull6([return null])
    tryParse3 -->|"No"| boundCheck3{"index valid
in cd_div_nm_list_list?"}
    boundCheck3 -->|"No"| retNull7([return null])
    boundCheck3 -->|"Yes"| callCdNmList["((X33VDataTypeStringBean)
cd_div_nm_list_list.get(index))
.typeModelData(subkey)"]
    cdNmList -->|"No"| retNull8([return null])

    retNull1 --> END
    retStr1 --> END
    retBool1 --> END
    retStr2 --> END
    retStr3 --> END
    retBool2 --> END
    retStr4 --> END
    retStr5 --> END
    retBool3 --> END
    retStr6 --> END
    retInt1 --> END
    retInt2 --> END
    retInt3 --> END
    retNull2 --> END
    retNull3 --> END
    retNull4 --> END
    retNull5 --> END
    retNull6 --> END
    retNull7 --> END
    retNull8 --> END
    callDefaultCD --> END
    callCdCdList --> END
    callCdNmList --> END
    END(["Return / Next"])
```

**Processing description:**

The method begins by validating that both `key` and `subkey` are non-null — if either is null, it returns null immediately. If both are present, it searches for a `/` separator in the key (to distinguish scalar fields from indexed list fields). It then dispatches through a chain of 7 conditional branches:

1. **Scalar — Code Type Code** (`"コードタイプコード"`): Returns `String.class` for `value`/`state`, `Boolean.class` for `enable`.
2. **Scalar — Code Type Name** (`"コードタイプ名称"`): Same pattern as above.
3. **Scalar — Selection Index** (`"選択インデックス"`): Same pattern as above.
4. **List — Initial Setup Code** (`"初期設定コード"`): Parses the index from the key after the `/` separator. If the index is `"*"`, returns `Integer.class` (list count type). Otherwise, validates bounds against `default_cd_list` and delegates to the child bean's `typeModelData`.
5. **List — Code Type Code Value List** (`"コードタイプコード値リスト"`): Same pattern as (4), delegating to `cd_div_cd_list_list`.
6. **List — Code Type Name List** (`"コードタイプ名称リスト"`): Same pattern as (4), delegating to `cd_div_nm_list_list`.
7. **Fallback**: Returns `null` for unrecognized field names.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **field name** (項目名) identifying which UI data field the framework should resolve the type for. Can be a scalar field identifier (e.g., `"コードタイプコード"`, `"コードタイプ名称"`, `"選択インデックス"`, `"初期設定コード"`) or a list field with an index suffix (e.g., `"初期設定コード/0"`). When the index portion is `"*"`, it requests the list element count type instead of a specific element's type. |
| 2 | `subkey` | `String` | The **sub-property** (サブキー) of the field, specifying which attribute's type is being queried. For scalar fields, valid values are `"value"` (the data value type), `"enable"` (the editability flag type), or `"state"` (the display status type). For list fields, this is forwarded to the child bean's `typeModelData` to resolve the typed property of the specific list element at the given index. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `default_cd_list` | `X33VDataTypeList` | The list of initial setup code items (初期設定コード). Each element is an `X33VDataTypeStringBean` representing a single setup code entry in the repeating section. |
| `cd_div_cd_list_list` | `X33VDataTypeList` | The list of code type code values (コードタイプコード値リスト). Each element is an `X33VDataTypeStringBean` for a single code value entry in the repeating section. |
| `cd_div_nm_list_list` | `X33VDataTypeList` | The list of code type names (コードタイプ名称リスト). Each element is an `X33VDataTypeStringBean` for a single code name entry in the repeating section. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeStringBean.typeModelData` | (X33V Framework) | - | Delegates type resolution to the child bean for a specific list element. Called when the key references an indexed list field (e.g., `"初期設定コード/0"`). |
| - | `KKW05501SF01DBean.typeModelData` | KKW05501SF01DBean | - | This method itself — called by the parent bean `KKW05501SFBean` via the typeModelData delegation chain for screen rendering metadata resolution. |

**No direct database or SC (Service Component) calls are made by this method.** It is a pure type-introspection utility that operates on in-memory bean state only. The `X33VDataTypeList` fields (`default_cd_list`, `cd_div_cd_list_list`, `cd_div_nm_list_list`) are populated earlier in the screen lifecycle by the framework or parent bean, and this method merely queries their types.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class:KKW05501SFBean | `KKW05501SFBean.typeModelData(key, subkey)` | (no downstream calls — type introspection only) |
| 2 | Class:KKW05501SF02DBean | `KKW05501SF02DBean.typeModelData(key, subkey)` (independent override, same signature) | (no downstream calls — type introspection only) |
| 3 | Class:KKW05501SF03DBean | `KKW05501SF03DBean.typeModelData(key, subkey)` (independent override, same signature) | (no downstream calls — type introspection only) |
| 4 | Class:KKW05501SF04DBean | `KKW05501SF04DBean.typeModelData(key, subkey)` (independent override, same signature) | (no downstream calls — type introspection only) |

**Note:** The pre-computed caller analysis shows that the same `typeModelData(String, String)` method signature is defined independently across all DBean variants of the KKW05501SF module (01DBean, 02DBean, 03DBean, 04DBean). Each variant handles its own set of field keys tailored to its specific screen responsibilities. The parent `KKW05501SFBean` is the main entry point that routes typeModelData requests to the appropriate DBean.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null guard) `(key == null || subkey == null)` (L554)

> If either parameter is null, return null immediately. This prevents NPE when the framework queries type info with incomplete parameters.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // Both key and subkey must be non-null [-> early return on null guard] |

**Block 2** — PROCESS (separator detection) (L557)

> Compute the position of the first `/` character in the key. This determines whether the key references a scalar field (no `/`) or a list field with index (contains `/`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // Find first slash separator [-> used by list field branches below] |

**Block 3** — IF/ELSE-IF chain — Scalar field resolution (L560–L612)

> This is a three-way conditional branching block. Each branch handles one scalar field type. All three follow the same subkey-dispatch pattern: return String for value/state, Boolean for enable.

**Block 3.1** — IF `[key.equals("コードタイプコード")]` (L560)

> Scalar field: Code Type Code (コードタイプコード). This field identifies a code type in the system.

| # | Type | Code |
|---|------|------|
| 1 | IF-ELSE-IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` [-> The data value is a String] |
| 2 | IF-ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` [-> The editability flag is a Boolean] |
| 3 | IF-ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkey="state" returns status [-> The display status is a String] |

**Block 3.2** — ELSE-IF `[key.equals("コードタイプ名称")]` (L573)

> Scalar field: Code Type Name (コードタイプ名称). This field holds the human-readable name of a code type.

| # | Type | Code |
|---|------|------|
| 1 | IF-ELSE-IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` [-> The data value is a String] |
| 2 | IF-ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` [-> The editability flag is a Boolean] |
| 3 | IF-ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkey="state" returns status [-> The display status is a String] |

**Block 3.3** — ELSE-IF `[key.equals("選択インデックス")]` (L586)

> Scalar field: Selection Index (選択インデックス). This field holds the index of a selected item in a dropdown or list.

| # | Type | Code |
|---|------|------|
| 1 | IF-ELSE-IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` [-> The data value is a String] |
| 2 | IF-ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` [-> The editability flag is a Boolean] |
| 3 | IF-ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkey="state" returns status [-> The display status is a String] |

**Block 4** — ELSE-IF `[key.equals("初期設定コード")]` (L599)

> List field: Initial Setup Code (初期設定コード). This is a repeating section of setup code entries. The key includes a `/` followed by the list index (e.g., `"初期設定コード/0"`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // Extract elements after the first '/' [-> "初期設定コード/0" → "0"] |
| 2 | IF | `if(key.equals("*"))` → `return Integer.class;` // "*" specifies list element count [-> Return Integer.class for list size type] |
| 3 | TRY-CATCH | `try { tmpIndexInt = Integer.valueOf(key); } catch(NumberFormatException e) { return null; }` // Parse index; return null if not a numeric string [-> Handle non-numeric index gracefully] |
| 4 | IF | `if(tmpIndexInt == null) { return null; }` |
| 5 | SET | `int tmpIndex = tmpIndexInt.intValue();` |
| 6 | IF | `if(tmpIndex < 0 || tmpIndex >= default_cd_list.size()) { return null; }` // Index exceeds list size - 1, return null [-> Bounds check: 0 <= index < list size] |
| 7 | RETURN | `return ((X33VDataTypeStringBean)default_cd_list.get(tmpIndex)).typeModelData(subkey);` // Delegate to child bean's typeModelData [-> Cast list element to X33VDataTypeStringBean and forward subkey] |

**Block 5** — ELSE-IF `[key.equals("コードタイプコード値リスト")]` (L631)

> List field: Code Type Code Value List (コードタイプコード値リスト). This is a repeating section of code type code value entries. Same structure as Block 4 but operates on `cd_div_cd_list_list`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // Extract elements after the first '/' [-> "コードタイプコード値リスト/0" → "0"] |
| 2 | IF | `if(key.equals("*"))` → `return Integer.class;` // "*" specifies list element count [-> Return Integer.class for list size type] |
| 3 | TRY-CATCH | `try { tmpIndexInt = Integer.valueOf(key); } catch(NumberFormatException e) { return null; }` // Parse index; return null if not a numeric string |
| 4 | IF | `if(tmpIndexInt == null) { return null; }` |
| 5 | SET | `int tmpIndex = tmpIndexInt.intValue();` |
| 6 | IF | `if(tmpIndex < 0 || tmpIndex >= cd_div_cd_list_list.size()) { return null; }` // Index exceeds list size - 1, return null |
| 7 | RETURN | `return ((X33VDataTypeStringBean)cd_div_cd_list_list.get(tmpIndex)).typeModelData(subkey);` // Delegate to child bean [-> Same delegation pattern as Block 4] |

**Block 6** — ELSE-IF `[key.equals("コードタイプ名称リスト")]` (L658)

> List field: Code Type Name List (コードタイプ名称リスト). This is a repeating section of code type name entries. Same structure as Blocks 4 and 5 but operates on `cd_div_nm_list_list`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // Extract elements after the first '/' [-> "コードタイプ名称リスト/0" → "0"] |
| 2 | IF | `if(key.equals("*"))` → `return Integer.class;` // "*" specifies list element count |
| 3 | TRY-CATCH | `try { tmpIndexInt = Integer.valueOf(key); } catch(NumberFormatException e) { return null; }` // Parse index; return null if not a numeric string |
| 4 | IF | `if(tmpIndexInt == null) { return null; }` |
| 5 | SET | `int tmpIndex = tmpIndexInt.intValue();` |
| 6 | IF | `if(tmpIndex < 0 || tmpIndex >= cd_div_nm_list_list.size()) { return null; }` // Index exceeds list size - 1, return null |
| 7 | RETURN | `return ((X33VDataTypeStringBean)cd_div_nm_list_list.get(tmpIndex)).typeModelData(subkey);` // Delegate to child bean [-> Same delegation pattern as Blocks 4 and 5] |

**Block 7** — ELSE (unrecognized key) (L680)

> No matching field name was found. Return null to signal that the framework should treat this as an unknown/untyped field.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching property exists [-> Fallback: field name not recognized by any branch] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `コードタイプコード` | Field | Code Type Code — internal identifier for a classification category (e.g., service type, equipment type) |
| `コードタイプ名称` | Field | Code Type Name — human-readable display name for a code type category |
| `選択インデックス` | Field | Selection Index — the numeric index of a selected item in a dropdown list or radio group |
| `初期設定コード` | Field | Initial Setup Code — a setup configuration code entry, managed as a repeating list |
| `コードタイプコード値リスト` | Field | Code Type Code Value List — a repeating list of code type code entries |
| `コードタイプ名称リスト` | Field | Code Type Name List — a repeating list of code type name entries |
| `value` | Subkey | The data value property of a field (e.g., the actual code string or name string) |
| `enable` | Subkey | The editability flag of a field (true = user can edit, false = read-only) |
| `state` | Subkey | The display status property of a field (e.g., visible/hidden, normal/error state) |
| `*` | Subkey | Asterisk — a special value meaning "return the type of the list count" (i.e., Integer) rather than a specific element |
| X33V | Framework | Fujitsu Futurity X33V web framework — a typed view bean framework for Java EE web applications. Uses data type beans (X33VDataTypeBeanInterface) to declare field types at the view layer. |
| DBean | Class type | Data Bean — a view-layer bean that represents the data model of a web screen page. Implements X33V data type interfaces for framework integration. |
| `default_cd_list` | Instance Field | The X33VDataTypeList container holding initial setup code bean entries. |
| `cd_div_cd_list_list` | Instance Field | The X33VDataTypeList container holding code type code value bean entries. |
| `cd_div_nm_list_list` | Instance Field | The X33VDataTypeList container holding code type name bean entries. |
| `X33VDataTypeStringBean` | Class | A data type bean representing a string-typed field in the X33V framework. Used for list elements that have their own nested type structure (value, enable, state). |
| `X33VDataTypeList` | Class | A typed list container in the X33V framework that holds multiple beans of the same type, supporting indexed access. |
| KKW05501SF | Module | K-Opticom web screen module 05501 — a service configuration/maintenance screen in the K-Opticom telecommunications management system. |
| SC | Acronym | Service Component — a backend service class that performs database CRUD operations. Not called directly by this method. |
| SC Code | Field | Service Content Code — a classification code that categorizes the type of service or order operation in the telecom system. |
