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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00810SF.KKW00810SF01DBean` |
| Layer | Web / Data Transfer Bean (Web-tier DTO) |
| Module | `KKW00810SF` (Package: `eo.web.webview.KKW00810SF`) |

## 1. Role

### KKW00810SF01DBean.typeModelData()

This method serves as a **type resolution dispatcher** for the KKW00810SF screen's data binding layer. Its business purpose is to map a field name (`key`) — optionally paired with a property descriptor (`subkey`) — to the correct Java runtime `Class<?>` type so that the view tier can perform proper type-safe data binding during form rendering.

The method implements a **routing/dispatch design pattern**, branching on the `key` value to handle six distinct field domains: `SYSID` (System ID), `サービス契約番号` (Service Contract Number), `異動区分` (Transfer Classification), `異動理由コード` (Transfer Reason Code — the only list-type field), and `異動理由メモ` (Transfer Reason Memo). For scalar fields (SYSID, Service Contract Number, Transfer Classification, Transfer Reason Memo), the method resolves `value` and `state` sub-keys to `String.class`. For the list-type field `異動理由コード`, the method extracts an array index from the key (e.g. `"異動理由コード/2"`), validates it against the bounds of `ido_rsn_cd_list`, and delegates to the individual list element's `typeModelData(subkey)` method via `X33VDataTypeStringBean`.

As a shared utility on a Web-tier DTO bean, this method enables the framework to dynamically determine field types for generic data binding operations — such as form validation, display formatting, and input type selection — without hardcoding type information in the view layer. It centralizes the type contract between the screen's data model and its presentation.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData(key, subkey)"])
    
    START --> COND1{"key == null
|| subkey == null?"}
    COND1 -->|true| RET_NULL_1["return null"]
    COND1 -->|false| SEP["separaterPoint = key.indexOf('/')"]
    
    SEP --> COND2{"key equals 'SYSID'?"}
    COND2 -->|true| SYSID_SUB{"subkey equalsIgnoreCase
('value'|'state')?"}
    SYSID_SUB -->|true| RET_SYSID["return String.class"]
    SYSID_SUB -->|false| SYSID_FALL["fall through to final return"]
    
    COND2 -->|false| COND3{"key equals
'サービス契約番号'?"}
    COND3 -->|true| SVC_SUB{"subkey equalsIgnoreCase
('value'|'state')?"}
    SVC_SUB -->|true| RET_SVC["return String.class"]
    SVC_SUB -->|false| SVC_FALL["fall through to final return"]
    
    COND3 -->|false| COND4{"key equals
'異動区分'?"}
    COND4 -->|true| IDO_DIV_SUB{"subkey equalsIgnoreCase
('value'|'state')?"}
    IDO_DIV_SUB -->|true| RET_IDO_DIV["return String.class"]
    IDO_DIV_SUB -->|false| IDO_DIV_FALL["fall through to final return"]
    
    COND4 -->|false| COND5{"key equals
'異動理由コード'?"}
    COND5 -->|true| IDX_PARSE["key = key.substring(separaterPoint + 1)"]
    IDX_PARSE --> IDX_STAR{"key equals '*'}"
    IDX_STAR -->|true| RET_INT["return Integer.class"]
    IDX_STAR -->|false| TRY_PARSE["try { tmpIndexInt = Integer.valueOf(key) }"]
    TRY_PARSE -->|NumberFormatException| RET_NULL_NUM["return null"]
    TRY_PARSE -->|success| IDX_NULL{"tmpIndexInt == null?"}
    IDX_NULL -->|true| RET_NULL_N["return null"]
    IDX_NULL -->|false| IDX_RANGE{"tmpIndex < 0
|| tmpIndex >=
ido_rsn_cd_list.size()"}
    IDX_RANGE -->|true| RET_NULL_R["return null"]
    IDX_RANGE -->|false| DELEGATE["(X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)
.typeModelData(subkey)"]
    
    RET_NULL_1 --> END(["END"])
    RET_SYSID --> END
    SYSID_FALL --> END_FINAL["return null (no match)"]
    RET_SVC --> END
    SVC_FALL --> END_FINAL
    RET_IDO_DIV --> END
    IDO_DIV_FALL --> END_FINAL
    RET_INT --> END
    RET_NULL_NUM --> END
    RET_NULL_N --> END
    RET_NULL_R --> END
    DELEGATE --> END
    END_FINAL --> END
    COND3 -->|false| COND4
    COND5 -->|false| END_FINAL
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field name (item name) of a data element to resolve. Identifies which field's type information is being requested. Can be one of the recognized field identifiers: "SYSID", "サービス契約番号", "異動区分", "異動理由コード", or "異動理由メモ". For list-type fields (e.g., 異動理由コード), the key may contain a slash-separated index (e.g., "異動理由コード/2") to target a specific element within the list. |
| 2 | `subkey` | `String` | A property descriptor within the identified field, typically "value" (the field's data value type) or "state" (the field's UI state type). Used to resolve the specific property type when the field has multiple typed properties. For list-indexed keys (異動理由コード), this is forwarded to the individual list element. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | A list of transfer reason code entries (each element is an `X33VDataTypeStringBean`). Used to resolve type information for individual elements within the "Transfer Reason Code" list field. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `String.indexOf(String)` | (JDK) | - | Finds the position of "/" delimiter within the key string for index extraction on list-type fields |
| - | `String.equals(Object)` | (JDK) | - | Compares the key parameter against recognized field name constants |
| - | `String.equalsIgnoreCase(String)` | (JDK) | - | Case-insensitive comparison of subkey against "value" and "state" |
| - | `String.substring(int)` | (JDK) | - | Extracts the index portion from a slash-delimited key (e.g., "異動理由コード/2" → "2") |
| - | `Integer.valueOf(String)` | (JDK) | - | Parses the index string into an integer value |
| - | `List.size()` | (JDK) | - | Retrieves the number of elements in `ido_rsn_cd_list` for bounds checking |
| - | `List.get(int)` | (JDK) | - | Retrieves the element at the specified index from `ido_rsn_cd_list` |
| - | `X33VDataTypeStringBean.typeModelData(String)` | X33VDataTypeStringBean | - | Delegates type resolution to the individual list element, forwarding the subkey to determine the property type of that specific list item |

No service component (SC) or CBS calls are made by this method. It is a pure type-dispatch utility operating on parameters, local variables, and instance fields.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | KKW00810SF01DBean | `KKW00810SF01DBean.typeModelData` (self-referential / internal dispatch) | None — pure type resolution, no downstream service calls |

Note: The only known direct caller is within the same bean (`KKW00810SF01DBean`), indicating this is an internal helper method used by other methods on the same DTO for runtime type resolution. It may also be invoked dynamically via reflection or framework binding mechanisms not visible at the source code level.

## 6. Per-Branch Detail Blocks

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

> Early-exit guard: if either the field name or property descriptor is null, the method cannot resolve a type and returns null immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // Both key and subkey must be non-null |

---

**Block 2** — EXEC `(key.indexOf("/"))` (L422)

> Compute the position of the slash delimiter for later use when the key contains an index (list-type fields).

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

---

**Block 3** — IF/ELSE-IF `(key equals "SYSID")` (L425)

> Branch: SYSID (System ID) field. This is a scalar String field whose type is resolved based on the subkey property.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (subkey.equalsIgnoreCase("value"))` // Property "value" |
| 2 | RETURN | `return String.class;` // SYSID value is a String |
| 3 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` // Property "state" |
| 4 | RETURN | `return String.class;` // SYSID state is also a String |

---

**Block 4** — ELSE-IF `(key equals "サービス契約番号")` (L437)

> Branch: Service Contract Number (サービス契約番号) field. A scalar String field, same pattern as SYSID.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (subkey.equalsIgnoreCase("value"))` // Property "value" |
| 2 | RETURN | `return String.class;` // Service contract number value is a String |
| 3 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` // Property "state" |
| 4 | RETURN | `return String.class;` // Service contract number state is also a String |

---

**Block 5** — ELSE-IF `(key equals "異動区分")` (L448)

> Branch: Transfer Classification (異動区分) field. A scalar String field, same pattern.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (subkey.equalsIgnoreCase("value"))` // Property "value" |
| 2 | RETURN | `return String.class;` // Transfer classification value is a String |
| 3 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` // Property "state" |
| 4 | RETURN | `return String.class;` // Transfer classification state is also a String |

---

**Block 6** — ELSE-IF `(key equals "異動理由コード")` (L459)

> Branch: Transfer Reason Code (異動理由コード) field. This is the ONLY list-type field — the key may contain a slash-separated index (e.g. "異動理由コード/2") to identify a specific element within the list. Special handling for "*" (returns Integer.class for list count) and index-based access (delegates to individual element).

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // Extract index portion after "/" (e.g., "2" from "異動理由コード/2") [-> key reassignment] |
| 2 | IF | `if (key.equals("*"))` // "*" means request list count type |
| 3 | RETURN | `return Integer.class;` // List size is an Integer |
| 4 | SET | `Integer tmpIndexInt = null;` // Temporary variable for parsed index |
| 5 | TRY | `tmpIndexInt = Integer.valueOf(key);` // Parse index string to integer [NumberFormatException] |
| 6 | CATCH | `catch (NumberFormatException e) { return null; }` // Index is not a valid number — return null |
| 7 | IF | `if (tmpIndexInt == null)` // Parsed index is null |
| 8 | RETURN | `return null;` // Guard against null index |
| 9 | SET | `int tmpIndex = tmpIndexInt.intValue();` // Unbox to primitive int |
| 10 | IF | `if (tmpIndex < 0 || tmpIndex >= ido_rsn_cd_list.size())` // Index out of bounds |
| 11 | RETURN | `return null;` // Index exceeds list size — return null |
| 12 | RETURN | `((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).typeModelData(subkey);` // Cast list element to String bean and delegate type resolution |

---

**Block 7** — ELSE-IF `(key equals "異動理由メモ")` (L483)

> Branch: Transfer Reason Memo (異動理由メモ) field. A scalar String field, same pattern as other scalar fields.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (subkey.equalsIgnoreCase("value"))` // Property "value" |
| 2 | RETURN | `return String.class;` // Transfer reason memo value is a String |
| 3 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` // Property "state" |
| 4 | RETURN | `return String.class;` // Transfer reason memo state is also a String |

---

**Block 8** — ELSE (no matching branch) (L487)

> Default: no matching field name was found. Return null to indicate the type is unresolvable.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching field name — return null |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `SYSID` | Field | System ID — a unique identifier assigned by the system to each record |
| `サービス契約番号` | Field | Service Contract Number — the contract number for a telecom service line |
| `異動区分` | Field | Transfer Classification — the type/category of a service transfer or change operation |
| `異動理由コード` | Field | Transfer Reason Code — a list of codes indicating the reason for a transfer/change operation. Each element in the list is a String bean with its own type model. |
| `異動理由メモ` | Field | Transfer Reason Memo — a free-text memo field for the transfer reason |
| `ido_rsn_cd_list` | Field | Transfer Reason Code List — the instance field holding the list of `X33VDataTypeStringBean` elements for the 異動理由コード field |
| `value` | Subkey | Property descriptor for the field's data value type |
| `state` | Subkey | Property descriptor for the field's UI state type (e.g., editable, visible) |
| `X33VDataTypeStringBean` | Class | A data type bean representing a single-string data element with its own `typeModelData` method for sub-property type resolution |
| `X33VDataTypeList` | Class | A list data type bean that holds multiple `X33VDataTypeStringBean` elements |
| `typeModelData` | Method | Type resolution method — returns the `Class<?>` for a given property of a data element |
| Web-tier DTO | Pattern | Data Transfer Object on the web layer — a bean that carries screen data between the view and controller/service layers |
| KKW00810SF | Module | The screen module name, representing a service transfer/change operation screen |
| `/` delimiter | Pattern | Slash character used to embed an array index within the key string for list-type fields |
