# Business Logic — KKW00846SF01DBean.typeModelData() [90 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA18001SF.KKW00846SF01DBean` |
| Layer | Utility / Data-Binding (Web presentation-layer bean implementing X33V framework interfaces) |
| Module | `KKA18001SF` (Package: `eo.web.webview.KKA18001SF`) |

## 1. Role

### KKW00846SF01DBean.typeModelData()

This method is the core **type-model routing dispatcher** for the `KKW00846SF01DBean` data bean, which is part of the X33V web framework's data-binding infrastructure. Its business purpose is to resolve the Java runtime type (`Class<?>`) of any given data property on the screen based on a **key** (the property name/label) and a **subkey** (the property attribute, such as `"value"` or `"state"`). It is called by the X33V framework at runtime to dynamically determine how to render and bind form fields for the service contract modification screen (KKA18001SF).

The method handles **six distinct service data types** (fields): System ID (`システムID`), Service Contract Number (`サービス契約番号`), Move Classification (`異動区分`), Move Reason Code list (`異動理由コード`), Move Reason Memo (`異動理由メモ`), and Processing Classification (`処理区分`). All of these are String-typed data fields in the business domain, with the exception of the Move Reason Code list, which supports index-based integer list operations.

The design pattern implemented is a **routing/dispatch pattern** — the method uses a cascading if-else chain to route the incoming key to the correct handling branch. For the Move Reason Code (`異動理由コード`) field, which is a dynamic list, it further implements a **delegation pattern** by extracting an index from the key string, locating the corresponding `X33VDataTypeStringBean` in the `ido_rsn_cd_list`, and delegating the type resolution to that bean's own `typeModelData` method.

Its role in the larger system is that of a **shared utility** invoked by the X33V framework's `X33VDataTypeBeanInterface` contract, enabling the framework to dynamically build form models without hardcoding type information.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData Entry Point"])

    START --> COND_NULL{key or subkey is null?}

    COND_NULL -->|Yes| RET_NULL_1["return null"]
    COND_NULL -->|No| FIND_SLASH["separaterPoint = key.indexOf('/')"]

    FIND_SLASH --> COND_SYSID{key equals 'システムID'?}

    COND_SYSID -->|Yes| SYSID_SUB{subkey equals 'value'?}
    SYSID_SUB -->|Yes| RET_SYSID_VAL["return String.class"]
    SYSID_SUB -->|No| SYSID_STATE{subkey equals 'state'?}
    SYSID_STATE -->|Yes| RET_SYSID_ST["return String.class"]
    SYSID_STATE -->|No| FALL1["Fall through to default"]

    COND_SYSID -->|No| COND_SVC{key equals 'サービス契約番号'?}

    COND_SVC -->|Yes| SVC_SUB{subkey equals 'value'?}
    SVC_SUB -->|Yes| RET_SVC_VAL["return String.class"]
    SVC_SUB -->|No| SVC_STATE{subkey equals 'state'?}
    SVC_STATE -->|Yes| RET_SVC_ST["return String.class"]
    SVC_STATE -->|No| FALL2["Fall through to default"]

    COND_SVC -->|No| COND_IDO_DIV{key equals '異動区分'?}

    COND_IDO_DIV -->|Yes| IDO_DIV_SUB{subkey equals 'value'?}
    IDO_DIV_SUB -->|Yes| RET_IDO_DIV_VAL["return String.class"]
    IDO_DIV_SUB -->|No| IDO_DIV_STATE{subkey equals 'state'?}
    IDO_DIV_STATE -->|Yes| RET_IDO_DIV_ST["return String.class"]
    IDO_DIV_STATE -->|No| FALL3["Fall through to default"]

    COND_IDO_DIV -->|No| COND_IDO_RSN{key equals '異動理由コード'?}

    COND_IDO_RSN -->|Yes| SUBSTR_KEY["key = key.substring(separaterPoint + 1)"]

    SUBSTR_KEY --> COND_STAR{key equals '*'?}
    COND_STAR -->|Yes| RET_STAR["return Integer.class"]
    COND_STAR -->|No| TRY_PARSE["Integer.valueOf(key)"]

    TRY_PARSE --> CATCH_NFE["catch NumberFormatException
return null"]
    TRY_PARSE --> PARSED["tmpIndexInt = Integer.valueOf(key)"]

    PARSED --> COND_INDEX_NULL{tmpIndexInt == null?}
    COND_INDEX_NULL -->|Yes| RET_NULL_2["return null"]
    COND_INDEX_NULL -->|No| GET_INT["tmpIndex = tmpIndexInt.intValue()"]

    GET_INT --> COND_BOUNDS{tmpIndex out of bounds?}
    COND_BOUNDS -->|Yes| RET_NULL_3["return null"]
    COND_BOUNDS -->|No| DELEGATE["delegate.typeModelData(subkey)"]

    DELEGATE --> RET_DELEGATE["return delegate result"]

    COND_IDO_RSN -->|No| COND_MEMO{key equals '異動理由メモ'?}

    COND_MEMO -->|Yes| MEMO_SUB{subkey equals 'value'?}
    MEMO_SUB -->|Yes| RET_MEMO_VAL["return String.class"]
    MEMO_SUB -->|No| MEMO_STATE{subkey equals 'state'?}
    MEMO_STATE -->|Yes| RET_MEMO_ST["return String.class"]
    MEMO_STATE -->|No| FALL4["Fall through to default"]

    COND_MEMO -->|No| COND_TRAN{key equals '処理区分'?}

    COND_TRAN -->|Yes| TRAN_SUB{subkey equals 'value'?}
    TRAN_SUB -->|Yes| RET_TRAN_VAL["return String.class"]
    TRAN_SUB -->|No| TRAN_STATE{subkey equals 'state'?}
    TRAN_STATE -->|Yes| RET_TRAN_ST["return String.class"]
    TRAN_STATE -->|No| FALL5["Fall through to default"]

    COND_TRAN -->|No| RET_NULL_DEFAULT["return null
No matching property"]

    RET_NULL_1 --> END(["End"])
    RET_SYSID_VAL --> END
    RET_SYSID_ST --> END
    FALL1 --> END
    RET_SVC_VAL --> END
    RET_SVC_ST --> END
    FALL2 --> END
    RET_IDO_DIV_VAL --> END
    RET_IDO_DIV_ST --> END
    FALL3 --> END
    RET_STAR --> END
    CATCH_NFE --> END
    RET_NULL_2 --> END
    RET_NULL_3 --> END
    RET_DELEGATE --> END
    RET_MEMO_VAL --> END
    RET_MEMO_ST --> END
    FALL4 --> END
    RET_TRAN_VAL --> END
    RET_TRAN_ST --> END
    FALL5 --> END
    RET_NULL_DEFAULT --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The property name or label that identifies which data field's type is being queried. It can be a simple label like `"システムID"` (System ID), or for the Move Reason Code list field, it takes a list-qualified form like `"異動理由コード/0"` where the part after `/` specifies a list index or `"*"` for the list size. |
| 2 | `subkey` | `String` | The property attribute being queried within the identified field. Common values are `"value"` (to retrieve the data value's type) and `"state"` (to retrieve the state/flag type). Both fields return `String.class` in the X33V framework. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | The dynamic list of Move Reason Code entries — a list of `X33VDataTypeStringBean` objects representing individual move reason code items in the modification screen's reason code list. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeStringBean.typeModelData` | X33VFramework | - | Delegates type resolution to a list element's own typeModelData method (framework internal call for list items) |
| - | `X33VDataTypeList.get(int)` | X33VFramework | - | Retrieves the element at the specified index from the move reason code list |
| - | `List.size()` | X33VFramework | - | Returns the number of elements in the move reason code list for bounds validation |
| - | `String.indexOf(String)` | Java SE | - | Finds the position of "/" separator in the key string |
| - | `String.substring(int)` | Java SE | - | Extracts the substring after the "/" separator from the key |
| - | `String.equals(String)` | Java SE | - | Compares key against known property labels |
| - | `String.equalsIgnoreCase(String)` | Java SE | - | Compares subkey against "value" or "state" in a case-insensitive manner |
| - | `Integer.valueOf(String)` | Java SE | - | Parses the key substring as an integer index |
| - | `X33VDataTypeList.size()` | X33VFramework | - | Returns list size for bounds checking |

**Notes:** This method does **not** perform any database CRUD operations (Create/Read/Update/Delete) directly. It is a pure type-resolution utility. The only external interaction is delegating to the X33V framework's `X33VDataTypeStringBean.typeModelData()` for list element resolution.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Utility:KKW00846SF01DBean | X33V framework `X33VDataTypeBeanInterface.typeModelData()` -> `KKW00846SF01DBean.typeModelData` | `delegate.typeModelData` (framework call) |

**Notes:** The pre-computed call graph shows only internal callers within the same bean class. The actual callers of this method are the X33V framework itself, which invokes it through the `X33VDataTypeBeanInterface` contract to resolve field types during screen model building. The method is also invoked internally by the X33V framework when processing the `ido_rsn_cd_list` elements. No explicit screen classes (KKSV*) or batch programs directly call this method.

## 6. Per-Branch Detail Blocks

### Block 1 — IF (null check) (L458)

Guard clause: returns null if either parameter is null.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key == null || subkey == null)` // Returns null early if inputs are null |
| 2 | RETURN | `return null;` |

### Block 2 — EXEC (separator position) (L463)

Finds the position of "/" in the key string for later use by the list-type branch.

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

### Block 3 — IF-ELSE chain (key routing)

Cascading if-else if structure routing by key property name.

### Block 3.1 — IF (key equals "システムID") (L466)

System ID field — all String type data fields.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key.equals("システムID"))` // Data type is String field "System ID" (field ID: sysid) |
| 2.1 | IF-ELSEIF (subkey == "value") (L467) | `if (subkey.equalsIgnoreCase("value"))` // Returns String.class for the value attribute |
| 2.1 | RETURN | `return String.class;` |
| 2.2 | ELSEIF (subkey == "state") (L470) | `else if (subkey.equalsIgnoreCase("state"))` // Returns String.class for the state attribute |
| 2.2 | RETURN | `return String.class;` |

### Block 3.2 — ELSE-IF (key equals "サービス契約番号") (L474)

Service Contract Number field — all String type data fields.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (key.equals("サービス契約番号"))` // Data type is String field "Service Contract Number" (field ID: svc_kei_no) |
| 2.1 | IF (subkey == "value") (L475) | `if (subkey.equalsIgnoreCase("value"))` |
| 2.1 | RETURN | `return String.class;` |
| 2.2 | ELSEIF (subkey == "state") (L478) | `else if (subkey.equalsIgnoreCase("state"))` // Returns String.class for the state attribute |
| 2.2 | RETURN | `return String.class;` |

### Block 3.3 — ELSE-IF (key equals "異動区分") (L482)

Move Classification field — all String type data fields.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (key.equals("異動区分"))` // Data type is String field "Move Classification" (field ID: ido_div) |
| 2.1 | IF (subkey == "value") (L483) | `if (subkey.equalsIgnoreCase("value"))` |
| 2.1 | RETURN | `return String.class;` |
| 2.2 | ELSEIF (subkey == "state") (L486) | `else if (subkey.equalsIgnoreCase("state"))` // Returns String.class for the state attribute |
| 2.2 | RETURN | `return String.class;` |

### Block 3.4 — ELSE-IF (key equals "異動理由コード") (L490)

Move Reason Code field — a **list/dynamic** field (not a simple String). This is the most complex branch, handling list index resolution and delegation to list element beans.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (key.equals("異動理由コード"))` // Distribution field "Move Reason Code" (String type, field ID: ido_rsn_cd) |
| 2 | SET | `key = key.substring(separaterPoint + 1);` // Extract element after the first "/" from "異動理由コード/0" |
| 3 | IF (list size wildcard) (L494) | `if (key.equals("*"))` // If "*" is specified instead of an index, return the list element count type |
| 3 | RETURN | `return Integer.class;` |
| 4 | TRY-CATCH (index parsing) (L497-L504) | Parse key as an integer index |
| 4.1 | TRY | `try { tmpIndexInt = Integer.valueOf(key); }` |
| 4.2 | CATCH (NumberFormatException) (L501) | `catch (NumberFormatException e) { return null; }` // Returns null if index value is not a numeric string |
| 5 | IF (index null check) (L505) | `if (tmpIndexInt == null) { return null; }` |
| 6 | SET | `int tmpIndex = tmpIndexInt.intValue();` // Extract primitive int from Integer wrapper |
| 7 | IF (bounds check) (L507) | `if (tmpIndex < 0 || tmpIndex >= ido_rsn_cd_list.size())` // If index exceeds list count - 1, return null |
| 7 | RETURN | `return null;` |
| 8 | RETURN (delegate) (L508) | `return ((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).typeModelData(subkey);` |

> **Block 3.4 Business Description:** This branch handles the Move Reason Code list, which is a dynamic, multi-element field on the modification screen. The caller passes the key in the format `"異動理由コード/index"` where index is either `"*"` (requesting the list count type) or a numeric index. The method extracts the index, validates it, and delegates type resolution to the corresponding list element bean.

### Block 3.5 — ELSE-IF (key equals "異動理由メモ") (L512)

Move Reason Memo field — all String type data fields.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (key.equals("異動理由メモ"))` // Data type is String field "Move Reason Memo" (field ID: ido_rsn_memo) |
| 2.1 | IF (subkey == "value") (L513) | `if (subkey.equalsIgnoreCase("value"))` |
| 2.1 | RETURN | `return String.class;` |
| 2.2 | ELSEIF (subkey == "state") (L516) | `else if (subkey.equalsIgnoreCase("state"))` // Returns String.class for the state attribute |
| 2.2 | RETURN | `return String.class;` |

### Block 3.6 — ELSE-IF (key equals "処理区分") (L520)

Processing Classification field — all String type data fields.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (key.equals("処理区分"))` // Data type is String field "Processing Classification" (field ID: tran_div) |
| 2.1 | IF (subkey == "value") (L521) | `if (subkey.equalsIgnoreCase("value"))` |
| 2.1 | RETURN | `return String.class;` |
| 2.2 | ELSEIF (subkey == "state") (L524) | `else if (subkey.equalsIgnoreCase("state"))` // Returns String.class for the state attribute |
| 2.2 | RETURN | `return String.class;` |

### Block 4 — RETURN (default null) (L528)

No matching property found — returns null as a safe default.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `システムID` | Field label | System ID — the internal system identifier for the service contract line item |
| `sysid` | Field ID | Internal field identifier for System ID (Java field name: `sysid_value`, `sysid_update`, `sysid_state`) |
| `サービス契約番号` | Field label | Service Contract Number — the contract identifier for the telecom service |
| `svc_kei_no` | Field ID | Internal field identifier for Service Contract Number (Japanese: `svc_kei` = service detail) |
| `異動区分` | Field label | Move Classification — classifies the type of service contract change/movement (e.g., new, cancel, modify) |
| `ido_div` | Field ID | Internal field identifier for Move Classification (Japanese: `ido` = move/change, `div` = division/type) |
| `異動理由コード` | Field label | Move Reason Code — the code specifying the reason for a service contract change/movement |
| `ido_rsn_cd` | Field ID | Internal field identifier for Move Reason Code (Japanese: `ido` = move, `rsn` = reason, `cd` = code) |
| `ido_rsn_cd_list` | Instance field | Dynamic list of Move Reason Code entries — an `X33VDataTypeList` containing `X33VDataTypeStringBean` elements for each reason code in the list |
| `異動理由メモ` | Field label | Move Reason Memo — free-text memo explaining the reason for a service contract change |
| `ido_rsn_memo` | Field ID | Internal field identifier for Move Reason Memo |
| `処理区分` | Field label | Processing Classification — classifies the processing type (e.g., registration, modification, cancellation) |
| `tran_div` | Field ID | Internal field identifier for Processing Classification (Japanese: `tran` = transaction/processing, `div` = division/type) |
| `X33VDataTypeBeanInterface` | Interface | X33V framework interface that defines the `typeModelData` contract for type-resolving data bean properties |
| `X33VDataTypeList` | Class | X33V framework class representing a typed, indexed list data structure for dynamic form fields |
| `X33VDataTypeStringBean` | Class | X33V framework class representing a typed String data element, used as list element type for `ido_rsn_cd_list` |
| `"value"` | Subkey | Property attribute requesting the data value's type |
| `"state"` | Subkey | Property attribute requesting the state/flag type (e.g., whether the field has been modified) |
| `"*"` | Subkey (list) | Special wildcard index requesting the list element count type (returns `Integer.class`) |
| KKA18001SF | Module | Service contract modification screen module — the screen where service contract changes (moves) are processed |
| X33V | Framework | Fujitsu Futurity X33V — a Java EE web application framework for building JSF-based data entry screens |
