# Business Logic — KKW00816SF01DBean.typeModelData() [80 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00816SF.KKW00816SF01DBean` |
| Layer | Utility / Data Type Bean (webview package, implements X33VDataTypeBeanInterface) |
| Module | `KKW00816SF` (Package: `eo.web.webview.KKW00816SF`) |

## 1. Role

### KKW00816SF01DBean.typeModelData()

This method serves as the **data type resolver** for the X33V data binding framework within the KKW00816SF screen module. It implements the `X33VDataTypeBeanInterface.typeModelData(String key, String subkey)` contract, which enables the X33V framework to dynamically determine the Java type of any bound field at runtime. In business terms, it answers the question: "What Java type should the framework use to store or render this particular field?"

The method implements a **routing/dispatch pattern** — it branches on the `key` parameter (field name) to determine which business entity the field belongs to, then branches on the `subkey` (typically `"value"` or `"state"`) to return the appropriate type descriptor. Fields that hold user-editable text data (such as System ID, Service Contract Number, Move Classification, and Move Reason Memo) all resolve to `String.class`. A move reason code list item resolves to `Integer.class` when the subkey is `"*"` (requesting the list size), and delegates further resolution into the individual list item's own `typeModelData` method.

This is a **shared utility** used by the X33V view framework during data binding setup. It is not invoked from business logic directly but is called by the framework to wire up form fields to backing bean properties. It is the **entry point for type introspection** that allows the X33V data binding engine to properly instantiate field data types, handle list items, and manage state tracking for the screen's input fields.

The method handles **six distinct field categories**: システムID (System ID), サービス契約番号 (Service Contract Number), 異動区分 (Move Classification), 異動理由コード (Move Reason Code — with special list handling), 異動理由メモ (Move Reason Memo), and an unknown-field fallback. Each category has a well-defined response profile based on the subkey.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> N1{"key or subkey is null"}
    N1 -->|Yes| RNULL1(["return null"])

    N1 -->|No| SPLIT["int separaterPoint = key.indexOf('/')"]

    SPLIT --> C1{"key is SYSTEMID"}
    C1 -->|Yes| K_SYSID["sysid branch"]
    C1 -->|No| C2{"key is SVC_CONTRACT"}

    K_SYSID --> S1{"subkey is value"}
    S1 -->|Yes| R1(["return String.class"])
    S1 -->|No| S2{"subkey is state"}
    S2 -->|Yes| R2(["return String.class"])
    S2 -->|No| C2

    C2 -->|Yes| K_SVC["svc_kei_no branch"]
    C2 -->|No| C3{"key is IDO_DIV"}

    K_SVC --> S3{"subkey is value"}
    S3 -->|Yes| R3(["return String.class"])
    S3 -->|No| S4{"subkey is state"}
    S4 -->|Yes| R4(["return String.class"])
    S4 -->|No| C3

    C3 -->|Yes| K_IDO_DIV["ido_div branch"]
    C3 -->|No| C4{"key is IDO_RSN_CD"}

    K_IDO_DIV --> S5{"subkey is value"}
    S5 -->|Yes| R5(["return String.class"])
    S5 -->|No| S6{"subkey is state"}
    S6 -->|Yes| R6(["return String.class"])
    S6 -->|No| C4

    C4 -->|Yes| K_IDO_RSN["ido_rsn_cd branch"]

    K_IDO_RSN --> SUB1["key = key.substring(separaterPoint+1)"]
    SUB1 --> STAR{"key equals '*'"}
    STAR -->|Yes| R7(["return Integer.class"])
    STAR -->|No| TRY1["Integer.valueOf(key)"]

    TRY1 --> CATCH{"NumberFormatException"}
    CATCH -->|Yes| RNULL2(["return null"])
    CATCH -->|No| C8{"tmpIndexInt == null"}

    C8 -->|Yes| RNULL3(["return null"])
    C8 -->|No| C9{"index out of range"}

    C9 -->|Yes| RNULL4(["return null"])
    C9 -->|No| DELEGATE["get tmpIndex from list"]

    DELEGATE --> D1["X33VDataTypeStringBean.typeModelData"]
    D1 --> RDEL(["return delegated result"])

    C4 -->|No| C5{"key is IDO_RSN_MEMO"}

    C5 -->|Yes| K_IDO_MEMO["ido_rsn_memo branch"]
    C5 -->|No| RNULL5(["return null"])

    K_IDO_MEMO --> S8{"subkey is value"}
    S8 -->|Yes| R8(["return String.class"])
    S8 -->|No| S9{"subkey is state"}
    S9 -->|Yes| R9(["return String.class"])
    S9 -->|No| RNULL5
```

**Processing summary:**

The method begins with a null guard — if either `key` or `subkey` is null, it returns null immediately. Otherwise, it pre-computes the position of the first `/` character in `key` for later substring extraction.

The method then enters a cascading if-else-if chain that dispatches on the `key` parameter, matching against six Japanese field name literals:
- `システムID` ("システムID" = System ID, field ID: `sysid`)
- `サービス契約番号` ("サービス契約番号" = Service Contract Number, field ID: `svc_kei_no`)
- `異動区分` ("異動区分" = Move Classification, field ID: `ido_div`)
- `異動理由コード` ("異動理由コード" = Move Reason Code, field ID: `ido_rsn_cd`)
- `異動理由メモ` ("異動理由メモ" = Move Reason Memo, field ID: `ido_rsn_memo`)
- Unknown fields (default)

For the first four and the last field, each sub-branch checks whether the `subkey` is `"value"` (returns `String.class`) or `"state"` (returns `String.class` — the comment notes "subkeyが'state'の場合、ステータスを返す" = "When subkey is 'state', returns the status").

The **異動理由コード (Move Reason Code)** branch is special: it performs array-style index resolution. It extracts the substring after the `/` character from key (e.g., `"異動理由コード/0"` yields `"0"`). If the extracted value is `"*"`, it returns `Integer.class` to indicate the caller should expect a list size. Otherwise, it parses the extracted value as an integer index, validates it against the bounds of `ido_rsn_cd_list`, and delegates into the retrieved `X33VDataTypeStringBean`'s own `typeModelData(subkey)` method.

If no key matches any branch, the method returns null as a safe fallback.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field name in Japanese, identifying which data binding field the framework is querying the type for. It can be a plain field name (e.g., `"システムID"`) or a list-style qualified name (e.g., `"異動理由コード/0"` for indexed access into the Move Reason Code list). The format supports a `/` separator for sub-indexing. |
| 2 | `subkey` | `String` | A qualifier within the field that specifies which property to query. Typically `"value"` (returns the data type for the field's value) or `"state"` (returns the type for the field's state/status tracking property). For the list branch, it is passed through to the individual list item's `typeModelData` method. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | The dynamic list of Move Reason Code items. Each element is a `X33VDataTypeStringBean` that independently answers type queries for its own fields. Used only in the `ido_rsn_cd` branch for index-based delegation. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `String.substring` | (JDK) | - | Calls `substring(int)` on the `key` parameter to extract the index portion after the `/` separator |
| - | `Integer.valueOf(String)` | (JDK) | - | Converts the extracted index string to an Integer, wrapped in try-catch |
| - | `KKW00816SF01DBean.typeModelData` | KKW00816SF01DBean | - | Calls `typeModelData` on each element of `ido_rsn_cd_list` (delegation to inner bean) |
| - | `X33VDataTypeList.size` | X33VDataTypeList | - | Reads the size of the move reason code list for bounds validation |
| - | `X33VDataTypeList.get(int)` | X33VDataTypeList | - | Retrieves the element at the requested index from the move reason code list |

This method performs **no database CRUD operations**. It is purely a type-introspection utility that routes field name lookups to their corresponding Java type descriptors. It does not read, create, update, or delete any entity data.

The only external calls are:
- **JDK String/Integer operations** for substring extraction and numeric parsing
- **X33V framework collection operations** on the `ido_rsn_cd_list` to resolve list item types
- **Delegated typeModelData call** into each `X33VDataTypeStringBean` element for nested field resolution

## 5. Dependency Trace

**Direct callers:**

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0004 (inferred) | X33V Framework data binding -> `KKW00816SF01DBean.typeModelData` | typeModelData [N/A] (type introspection only) |

**Analysis:** This method is an interface implementation of `X33VDataTypeBeanInterface.typeModelData()`. It is called **by the X33V framework itself** during screen initialization and data binding setup — not directly from business logic. The code graph shows only one direct caller entry: the framework framework's data binding layer. The method is part of the screen's definition bean (`KKW00816SF01DBean`) which is associated with screen KKSV0004 (the KKW00816SF screen module).

**What this method ultimately calls:**

The method performs type routing and index resolution. It never invokes service components (SC), CBS, or database access methods. Its only external interaction is delegating nested field queries into the `ido_rsn_cd_list` elements.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null guard) (L410)

Guard clause: if either parameter is null, return null immediately.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key == null || subkey == null)` // null guard for both parameters |
| 2 | RETURN | `return null` |

**Block 2** — SET (separator computation) (L414)

Pre-compute the `/` position in the key for later index extraction in the list branch.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/")` // position of first '/' separator |

**Block 3** — ELSE-IF (システムID / System ID branch) (L417)

Branch for the System ID field. Handles both `"value"` and `"state"` subkey lookups, both returning `String.class`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key.equals("システムID"))` // システムID = System ID (field ID: sysid) |
| 2 | IF | `if (subkey.equalsIgnoreCase("value"))` // query for value type |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` // subkeyが'state'の場合、ステータスを返す (When subkey is 'state', returns the status) |
| 5 | RETURN | `return String.class` |

**Block 4** — ELSE-IF (サービス契約番号 / Service Contract Number branch) (L424)

Branch for the Service Contract Number field. Same pattern as Block 3: `"value"` and `"state"` both return `String.class`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `else if (key.equals("サービス契約番号"))` // サービス契約番号 = Service Contract Number (field ID: svc_kei_no) |
| 2 | IF | `if (subkey.equalsIgnoreCase("value"))` // query for value type |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` // subkeyが'state'の場合、ステータスを返す (When subkey is 'state', returns the status) |
| 5 | RETURN | `return String.class` |

**Block 5** — ELSE-IF (異動区分 / Move Classification branch) (L431)

Branch for the Move Classification field. Same value/state pattern.

| # | Type | Code |
|---|------|------|
| 1 | IF | `else if (key.equals("異動区分"))` // 異動区分 = Move Classification (field ID: ido_div) |
| 2 | IF | `if (subkey.equalsIgnoreCase("value"))` // query for value type |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` // subkeyが'state'の場合、ステータスを返す (When subkey is 'state', returns the status) |
| 5 | RETURN | `return String.class` |

**Block 6** — ELSE-IF (異動理由コード / Move Reason Code list branch) (L438)

The most complex branch. Handles index-based access into the `ido_rsn_cd_list`. This is a list-style field where the key takes the format `"異動理由コード/N"` (e.g., `"異動理由コード/0"`, `"異動理由コード/1"`).

**Block 6.1** — SET (extract index substring) (L441)

Extract the portion after the `/` character from the key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // Extracts substring after the first '/' (e.g., from "異動理由コード/0" gets "0") |

**Block 6.2** — IF (star wildcard: return list size type) (L443)

When the extracted portion is `"*"`, the caller is requesting the type for the list size — return `Integer.class`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key.equals("*"))` // keyの次の要素を取得 — "リストの要素数を返す" (key's next element; returns the list element count) |
| 2 | RETURN | `return Integer.class` |

**Block 6.3** — TRY-CATCH (parse index as integer) (L447)

Parse the extracted key portion as an integer index for list access.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null` |
| 2 | SET | `tmpIndexInt = Integer.valueOf(key)` // Attempt to parse the key as an integer index |
| 3 | CATCH | `catch (NumberFormatException e)` // インデックス値が数値文字列でない場合は、ここでnullを返す (If the index value is not a numeric string, return null here) |
| 4 | RETURN | `return null` |

**Block 6.4** — IF (null index check) (L452)

Redundant null check (since `Integer.valueOf` never returns null for a valid parse), but defensive.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (tmpIndexInt == null)` // null guard on parsed index |
| 2 | RETURN | `return null` |

**Block 6.5** — IF (bounds check) (L456)

Validate the parsed index is within the bounds of the `ido_rsn_cd_list`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int tmpIndex = tmpIndexInt.intValue()` |
| 2 | IF | `if (tmpIndex < 0 || tmpIndex >= ido_rsn_cd_list.size())` // インデックス値がリスト個数-1を超える場合、ここでnullを返す (If the index value exceeds list size - 1, return null here) |
| 3 | RETURN | `return null` |
| 4 | CALL | `((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).typeModelData(subkey)` // Delegate type query to the individual list item bean |
| 5 | RETURN | `return <delegated result>` |

**Block 7** — ELSE-IF (異動理由メモ / Move Reason Memo branch) (L464)

Branch for the Move Reason Memo field. Same value/state pattern as Blocks 3–5.

| # | Type | Code |
|---|------|------|
| 1 | IF | `else if (key.equals("異動理由メモ"))` // 異動理由メモ = Move Reason Memo (field ID: ido_rsn_memo) |
| 2 | IF | `if (subkey.equalsIgnoreCase("value"))` // query for value type |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` // subkeyが'state'の場合、ステータスを返す (When subkey is 'state', returns the status) |
| 5 | RETURN | `return String.class` |

**Block 8** — ELSE (unknown field fallback) (L474)

If no key matches any of the six defined field names, return null as a safe default.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // 条件に一致するプロパティが存在しない場合は、nullを返す (If no matching property exists, return null) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sysid` | Field | System ID — internal system identifier field on the screen |
| `sysid_value` | Field | The string value of the System ID field |
| `sysid_state` | Field | State/status tracking metadata for the System ID field |
| `sysid_update` | Field | Update flag or timestamp for the System ID field |
| `svc_kei_no` | Field | Service Contract Number — the identifier for a service contract line item |
| `svc_kei_ucwk_no` | Field | Service Detail Work Number — internal tracking ID for service contract line items |
| `ido_div` | Field | Move Classification (異動区分) — categorizes the type of change/move operation (e.g., transfer, cancellation, suspension) |
| `ido_div_value` | Field | The string value of the Move Classification field |
| `ido_div_state` | Field | State tracking metadata for the Move Classification field |
| `ido_rsn_cd` | Field | Move Reason Code (異動理由コード) — a reason code for the move operation, stored as a list of items |
| `ido_rsn_cd_list` | Field | Dynamic list of `X33VDataTypeStringBean` items representing individual Move Reason Code entries |
| `ido_rsn_memo` | Field | Move Reason Memo (異動理由メモ) — a free-text memo field for describing the move reason |
| `ido_rsn_memo_value` | Field | The string value of the Move Reason Memo field |
| `ido_rsn_memo_state` | Field | State tracking metadata for the Move Reason Memo field |
| `ido_rsn_memo_update` | Field | Update flag for the Move Reason Memo field |
| `システムID` | Business term | System ID — the Japanese label for the `sysid` field displayed on the screen |
| `サービス契約番号` | Business term | Service Contract Number — the Japanese label for the `svc_kei_no` field |
| `異動区分` | Business term | Move Classification — the Japanese label for the `ido_div` field; categorizes change operations |
| `異動理由コード` | Business term | Move Reason Code — the Japanese label for the `ido_rsn_cd` list field |
| `異動理由メモ` | Business term | Move Reason Memo — the Japanese label for the `ido_rsn_memo` field |
| X33V | Framework | Fujitsu's X33V web presentation framework — provides data binding, type introspection, and view bean infrastructure |
| X33VDataTypeBeanInterface | Interface | X33V interface defining `typeModelData()` for dynamic type resolution of bound fields |
| X33VDataTypeList | Class | X33V collection type used to hold dynamically-typed list items |
| X33VDataTypeStringBean | Class | X33V bean representing a single data-bound string field; each element in `ido_rsn_cd_list` |
| X33VListedBeanInterface | Interface | X33V interface marking beans that support list-based data binding |
| SC | Acronym | Service Component — a mid-tier business logic component in the application architecture |
| CBS | Acronym | Common Business Service — shared business logic service in the application architecture |
| KKW00816SF | Module | Screen module identifier — KKW00816SF handles move/change order processing screens |
