# Business Logic — KKW01030SF01DBean.typeModelData() [100 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA15101SF.KKW01030SF01DBean` |
| Layer | Service / View Data Bean (Web view data type bean, part of the X33 framework's data binding layer) |
| Module | `KKA15101SF` (Package: `eo.web.webview.KKA15101SF`) |

## 1. Role

### KKW01030SF01DBean.typeModelData()

This method serves as the **data type router** for the KKW01030SF01 screen's data bean, implementing the `X33VDataTypeBeanInterface` contract. It determines the Java `Class<?>` type associated with a given field key and optional subkey, enabling the X33 framework to perform compile-safe data binding and type coercion during view rendering. In business terms, the method supports seven distinct **application fields** (項目) — SYSID (item ID), service contract number (サービス契約番号), division (区分), reason code (理由コード), reason memo (理由memo), application number (申請番号), and application detail number (申請詳細番号) — each classified as a String-type data item, except for the reason code list which also returns Integer.class when requesting the list count (indicated by "*" as the subkey). The method implements a **dispatch/routing pattern**: it branches on the `key` parameter to identify the target field, then further branches on the `subkey` to return the appropriate model attribute type (`"value"` → the actual data value type, `"state"` → the UI state type). For the reason code field specifically, it supports **indexed list access** — parsing the subkey as an index to delegate type resolution to the individual `X33VDataTypeStringBean` instance within the `ido_rsn_cd_list` collection. Its role in the larger system is that of a **shared metadata lookup utility**: it is called by the parent bean `KKW01030SFBean` (which has its own `typeModelData(String, String)` method that delegates to the sub-bean), enabling the X33 framework to introspect field types during dynamic view data loading.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> CHECK_NULL["Check: key or subkey is null?"]
    CHECK_NULL -->|Yes| RET_NULL1["Return null"]
    CHECK_NULL -->|No| FIND_SLASH["Find separator in key: indexOf('/')"]

    FIND_SLASH --> CHECK_SYSID["IF: key equals 'SYSID' (sysid)"]
    CHECK_SYSID -->|Yes| SYSID_BRANCH["SYSID branch"]
    SYSID_BRANCH --> SYSID_SUB1["IF: subkey equals 'value'"]
    SYSID_SUB1 -->|Yes| SYSID_RET1["Return String.class"]
    SYSID_SUB1 -->|No| SYSID_SUB2["IF: subkey equals 'state'"]
    SYSID_SUB2 -->|Yes| SYSID_RET2["Return String.class"]

    SYSID_BRANCH -->|No| CHECK_SVC["ELSE IF: key equals 'サービス契約番号' (svc_kei_no)"]
    CHECK_SVC -->|Yes| SVC_BRANCH["Svc_kei_no branch"]
    SVC_BRANCH --> SVC_SUB1["IF: subkey equals 'value'"]
    SVC_SUB1 -->|Yes| SVC_RET1["Return String.class"]
    SVC_SUB1 -->|No| SVC_SUB2["IF: subkey equals 'state'"]
    SVC_SUB2 -->|Yes| SVC_RET2["Return String.class"]

    SVC_BRANCH -->|No| CHECK_IDO_DIV["ELSE IF: key equals '区分' (ido_div)"]
    CHECK_IDO_DIV -->|Yes| IDO_DIV_BRANCH["Ido_div branch"]
    IDO_DIV_BRANCH --> IDO_SUB1["IF: subkey equals 'value'"]
    IDO_SUB1 -->|Yes| IDO_DIV_RET1["Return String.class"]
    IDO_SUB1 -->|No| IDO_SUB2["IF: subkey equals 'state'"]
    IDO_SUB2 -->|Yes| IDO_DIV_RET2["Return String.class"]

    IDO_DIV_BRANCH -->|No| CHECK_IDO_RSN["ELSE IF: key equals '理由コード'"]
    CHECK_IDO_RSN -->|Yes| IDO_RSN_BRANCH["Ido_rsn_cd branch (list item)"]
    IDO_RSN_BRANCH --> SUBSTRING["Extract: key = key.substring(separator + 1)"]
    SUBSTRING --> CHECK_STAR["IF: key equals '*'"]
    CHECK_STAR -->|Yes| STAR_RET["Return Integer.class"]
    CHECK_STAR -->|No| PARSE_INT["Parse: Integer.valueOf(key)"]
    PARSE_INT --> CATCH_NUM["Catch: NumberFormatException"]
    CATCH_NUM -->|Exception| RET_NULL2["Return null"]
    CATCH_NUM -->|OK| CHECK_INDEX["Check: index bounds valid?"]
    CHECK_INDEX -->|No| RET_NULL3["Return null"]
    CHECK_INDEX -->|Yes| DELEGATE_CALL["Delegate: typeModelData(subkey) on X33VDataTypeStringBean"]

    IDO_RSN_BRANCH -->|No| CHECK_IDO_MEMO["ELSE IF: key equals '理由memo'"]
    CHECK_IDO_MEMO -->|Yes| IDO_MEMO_BRANCH["Ido_rsn_memo branch"]
    IDO_MEMO_BRANCH --> MEMO_SUB1["IF: subkey equals 'value'"]
    MEMO_SUB1 -->|Yes| MEMO_RET1["Return String.class"]
    MEMO_SUB1 -->|No| MEMO_SUB2["IF: subkey equals 'state'"]
    MEMO_SUB2 -->|Yes| MEMO_RET2["Return String.class"]

    IDO_MEMO_BRANCH -->|No| CHECK_MSKM_NO["ELSE IF: key equals '申請番号'"]
    CHECK_MSKM_NO -->|Yes| MSKM_NO_BRANCH["Mskm_no branch"]
    MSKM_NO_BRANCH --> MSKM_SUB1["IF: subkey equals 'value'"]
    MSKM_SUB1 -->|Yes| MSKM_RET1["Return String.class"]
    MSKM_SUB1 -->|No| MSKM_SUB2["IF: subkey equals 'state'"]
    MSKM_SUB2 -->|Yes| MSKM_RET2["Return String.class"]

    MSKM_NO_BRANCH -->|No| CHECK_MSKM_DTL["ELSE IF: key equals '申請詳細番号'"]
    CHECK_MSKM_DTL -->|Yes| MSKM_DTL_BRANCH["Mskm_dtl_no branch"]
    MSKM_DTL_BRANCH --> MSKM_DTL_SUB1["IF: subkey equals 'value'"]
    MSKM_DTL_SUB1 -->|Yes| MSKM_DTL_RET1["Return String.class"]
    MSKM_DTL_SUB1 -->|No| MSKM_DTL_SUB2["IF: subkey equals 'state'"]
    MSKM_DTL_SUB2 -->|Yes| MSKM_DTL_RET2["Return String.class"]

    MSKM_DTL_BRANCH -->|No| CHECK_PROP["No matching property"]
    CHECK_PROP --> RET_NULL4["Return null"]
```

**Processing Summary:**
The method follows a flat routing pattern with 7 key-based branches, each handling a specific application field. For most fields, processing is uniform: check if the subkey is `"value"` (return the data value type) or `"state"` (return the UI state type), both mapping to `String.class`. The exception is the reason code field (理由コード), which supports indexed list item access — it parses a numeric subkey as an array index, validates bounds, and delegates to the specific list element's `typeModelData` method.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **field identifier** (項目名) — identifies which application field to resolve the type for. Acceptable values: `"SYSID"` (sysid - system identifier), `"サービス契約番号"` (svc_kei_no - service contract number), `"区分"` (ido_div - division/category code), `"理由コード"` (ido_rsn_cd - reason code, may include `"/<index>"` suffix for list items), `"理由memo"` (ido_rsn_memo - reason memo), `"申請番号"` (mskm_no - application number), or `"申請詳細番号"` (mskm_dtl_no - application detail number). The key may contain a `"/"` separator for list-indexed fields. |
| 2 | `subkey` | `String` | The **model attribute sub-key** (サブキー) — specifies which aspect of the field's model data to return. Acceptable values: `"value"` (the actual data value type), `"state"` (the UI state type such as enable/disable flag). For the reason code list field, `subkey` is passed through to the indexed list element, and may also accept `"*"` to request the list's element count type (`Integer.class`), or a numeric string to represent the list index. |

**Instance fields read by this method:**
| Field Name | Type | Business Description |
|------------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | List of reason code entries — holds `X33VDataTypeStringBean` instances representing individual reason codes. Accessed only in the reason code (理由コード) branch for indexed list item resolution. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `KKW01030SF01DBean.typeModelData` | KKW01030SF01DBean | - | Recursive delegation: calls `typeModelData(String subkey)` on an `X33VDataTypeStringBean` element within the `ido_rsn_cd_list` (reason code list) |

**Analysis:** This method performs **no direct CRUD operations** against the database or external services. It is a pure metadata type-resolution method. The only method call it makes is a delegation to `typeModelData(subkey)` on an element within the `ido_rsn_cd_list` collection (an in-memory `X33VDataTypeList` containing `X33VDataTypeStringBean` instances), when the key is `"理由コード"` (reason code) and the subkey specifies a list index. All other branches are simple conditional checks returning class literals — no external I/O, no service component calls, no entity access.

## 5. Dependency Trace

### Upstream Callers (who calls this method)

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Notes |
|---|----------------------|--------------------------------------|-------|
| 1 | Class: `KKW01030SF01DBean` (self-delegate) | `KKW01030SF01DBean.typeModelData(String key, String subkey)` → delegates to `(X33VDataTypeStringBean)ido_rsn_cd_list.get(index).typeModelData(subkey)` | Internal recursive delegation for list element type resolution |

### Downstream (what this method calls)

| # | Called Method | Called Class | Called From Branch | Description |
|---|--------------|-------------|-------------------|-------------|
| 1 | `typeModelData(String subkey)` | `X33VDataTypeStringBean` | Reason code branch (理由コード) | Delegates type model resolution to the specific list element at the parsed index |

**Context:** This method is called from the parent bean `KKW01030SFBean` which has its own `typeModelData(String key, String subkey)` method that delegates to the sub-bean's implementation. The X33 framework calls this method during view data loading to resolve field types for dynamic data binding. It is also referenced in `KKW01030SFBean.listKoumokuIds()` for field metadata introspection and in bean instantiation patterns within the parent bean.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] Null check `(key == null || subkey == null)` (L506)

Guard clause: returns null if either parameter is null, preventing NPE on subsequent processing.

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

**Block 2** — [EXEC] Separator calculation (L512)

Parses the first `"/"` position in the key. This is used by the reason code branch to extract the list index from the subkey.

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

**Block 3** — [IF/ELSE-IF] Field routing (SYSID) `(key.equals("SYSID"))` (L516)

Branch for the **SYSID field** (項目ID: sysid) — a String-type data item holding the system identifier.

**Block 3.1** — [IF/ELSE-IF] SYSID subkey check `("value")` (L517)

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

**Block 3.2** — [ELSE-IF] SYSID subkey check `("state")` (L520)

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

**Block 4** — [ELSE-IF] Field routing (サービス契約番号) `(key.equals("サービス契約番号"))` (L525)

Branch for the **service contract number field** (項目ID: svc_kei_no) — a String-type data item.

**Block 4.1** — [IF/ELSE-IF] Svc_kei_no subkey check `("value")` (L526)

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

**Block 4.2** — [ELSE-IF] Svc_kei_no subkey check `("state")` (L529)

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

**Block 5** — [ELSE-IF] Field routing (区分) `(key.equals("区分"))` (L534)

Branch for the **division field** (項目ID: ido_div) — a String-type data item.

**Block 5.1** — [IF/ELSE-IF] Ido_div subkey check `("value")` (L535)

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

**Block 5.2** — [ELSE-IF] Ido_div subkey check `("state")` (L538)

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

**Block 6** — [ELSE-IF] Field routing (理由コード - Reason Code List) `(key.equals("理由コード"))` (L543)

Branch for the **reason code field** (項目ID: ido_rsn_cd) — a String-type **list item**. Unlike other fields, this key is an indexed list: the subkey portion after `"/"` may be `"*"` (list count), a numeric index (individual item), or invalid.

**Block 6.1** — [SET] Substring extraction (L545)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // Extract element after first "/" — e.g., "理由コード/0" becomes "0" |

**Block 6.2** — [IF/ELSE-IF] List index check `("*")` (L547)

Returns `Integer.class` to indicate the subkey represents the list count (number of elements).

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if (key.equals("*"))` // If "*" is specified instead of an index value |
| 2 | RETURN | `return Integer.class;` // Return type for list element count |

**Block 6.3** — [TRY-CATCH] Integer index parsing (L550-L560)

Attempts to parse the subkey as a numeric index. On failure, returns null.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null;` // Local index variable |
| 2 | EXEC | `tmpIndexInt = Integer.valueOf(key);` // Parse numeric index |
| 3 | CATCH | `catch (NumberFormatException e)` // Index value is not a numeric string |
| 4 | RETURN | `return null;` // Return null for invalid index format |

**Block 6.4** — [IF] Null index guard (L561)

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

**Block 6.5** — [IF] Bounds check (L564)

Validates the parsed index is within the range of the `ido_rsn_cd_list`. Uses the instance field `ido_rsn_cd_list` (of type `X33VDataTypeList`) to check the list size.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int tmpIndex = tmpIndexInt.intValue();` // Convert to primitive |
| 2 | CHECK | `if (tmpIndex < 0 || tmpIndex >= ido_rsn_cd_list.size())` // Index exceeds list size |
| 3 | RETURN | `return null;` // Return null for out-of-bounds index |

**Block 6.6** — [CALL] Delegated list element type resolution (L567)

Delegates to the specific list element's `typeModelData` method, extracting the type information from the `X33VDataTypeStringBean` at the given index.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return ((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).typeModelData(subkey);` // Delegate to list element |

**Block 7** — [ELSE-IF] Field routing (理由memo) `(key.equals("理由memo"))` (L572)

Branch for the **reason memo field** (項目ID: ido_rsn_memo) — a String-type data item.

**Block 7.1** — [IF/ELSE-IF] Ido_rsn_memo subkey check `("value")` (L573)

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

**Block 7.2** — [ELSE-IF] Ido_rsn_memo subkey check `("state")` (L576)

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

**Block 8** — [ELSE-IF] Field routing (申請番号) `(key.equals("申請番号"))` (L581)

Branch for the **application number field** (項目ID: mskm_no) — a String-type data item.

**Block 8.1** — [IF/ELSE-IF] Mskm_no subkey check `("value")` (L582)

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

**Block 8.2** — [ELSE-IF] Mskm_no subkey check `("state")` (L585)

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

**Block 9** — [ELSE-IF] Field routing (申請詳細番号) `(key.equals("申請詳細番号"))` (L590)

Branch for the **application detail number field** (項目ID: mskm_dtl_no) — a String-type data item.

**Block 9.1** — [IF/ELSE-IF] Mskm_dtl_no subkey check `("value")` (L591)

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

**Block 9.2** — [ELSE-IF] Mskm_dtl_no subkey check `("state")` (L594)

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

**Block 10** — [RETURN] No matching property (L599)

Fallback: returns null when the key does not match any known field.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching property found |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sysid` | Field | System identifier — internal tracking ID for the application/screen instance |
| `svc_kei_no` | Field | Service contract number — the primary identifier for a service contract line item |
| `ido_div` | Field | Division/category code — classifies the type of division or category |
| `ido_rsn_cd` | Field | Reason code — code indicating the reason for a deviation or exception (e.g., service cancellation reason) |
| `ido_rsn_cd_list` | Field | Reason code list — a list collection (`X33VDataTypeList`) holding individual reason code entries |
| `ido_rsn_memo` | Field | Reason memo — free-text description of the deviation/exemption reason |
| `mskm_no` | Field | Application number — identifier for a service application/submission |
| `mskm_dtl_no` | Field | Application detail number — sub-identifier for a specific line item within an application |
| `key` | Parameter | Field identifier (項目名) — identifies which application field to resolve the data type for |
| `subkey` | Parameter | Model attribute sub-key (サブキー) — specifies which aspect of the field's model data (`value` or `state`) |
| `value` | Subkey | The actual data value type of the field |
| `state` | Subkey | The UI state type (e.g., enabled/disabled, visible/hidden) of the field |
| `*` | Subkey | Wildcard indicating the request is for the list element count type (returns Integer.class) |
| X33 | Framework | Fujitsu Futurity X33 — a web application framework for Java EE providing data-binding components |
| X33VDataTypeList | Class | Framework list data type — a dynamic list container holding typed data bean instances |
| X33VDataTypeStringBean | Class | Framework String data type bean — a data wrapper for String values with type metadata support |
| X33VDataTypeBeanInterface | Interface | Framework contract defining type metadata methods (including `typeModelData`) that data beans must implement |
| X33VListedBeanInterface | Interface | Framework contract for beans that support list-based indexed data items |
| KKA15101SF | Module | Service screen module — a K-Opticom service screen responsible for application management |
| KKW01030SF01DBean | Class | Data bean — view-layer data holder implementing the X33 data type bean interface for the KKA15101SF screen |
| SYSID | Key value | System identifier field — the system identifier for the current application/screen context |
| サービス契約番号 | Key value | Service contract number field — identifies a service contract in the business domain |
| 区分 | Key value | Division/category field — represents a classification or category code |
| 理由コード | Key value | Reason code field — a list of reason codes for deviations (supports indexed access) |
| 理由memo | Key value | Reason memo field — free-text memo associated with a deviation reason |
| 申請番号 | Key value | Application number field — identifies a submitted application |
| 申請詳細番号 | Key value | Application detail number field — identifies a detail line item within an application |
