# Business Logic — FUW00116SF02DBean.typeModelData() [23 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW00116SF.FUW00116SF02DBean` |
| Layer | Service / Data Bean (Webview layer — `eo.web.webview` package) |
| Module | `FUW00116SF` (Package: `eo.web.webview.FUW00116SF`) |

## 1. Role

### FUW00116SF02DBean.typeModelData()

This method serves as a **data type resolution dispatcher** for the webview document placeholder substitution framework. Given an item name (key) and a subkey, it determines the Java type (`Class<?>`) that the framework should use when rendering or processing document template placeholder values. The Javadoc (項目名とサブキーからデータの型情報を取得します) states: "Obtain data type information from an item name and subkey." It implements a **routing/dispatch pattern** — the key acts as a discriminator that directs the flow to specific type-handling branches, while the subkey further refines which specific data aspect is being queried.

Currently, the method handles one business domain: **"本文非定型置換文字" (Main Body Ad-hoc Placeholder Character)** — a document management feature where users can define ad-hoc (non-standard) placeholder text within the main body of a document. For this domain, it resolves `String.class` for two subkey variants: `value` (the actual placeholder text value) and `state` (a status flag associated with the placeholder, ステータスを返す — "returns the status").

This is a **shared utility method** within the `FUW00116SF` module that supports the broader document template substitution system. The framework calls this method at runtime to know how to treat placeholder data during document rendering or editing. The method also computes `separaterPoint` (a separator position within the key via `indexOf("/")`), suggesting the method was designed with extensibility in mind for composite key routing, though this value is not currently consumed by any branch.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData(key, subkey)"])
    CHECK_NULL["Condition: key == null || subkey == null"]
    RETURN_NULL1["return null"]
    FIND_SLASH["int separaterPoint = key.indexOf('/')"]
    CHECK_KEY["Condition: key.equals('本文非定型置換文字')"]
    CHECK_SUBKEY1["Condition: subkey.equalsIgnoreCase('value')"]
    RETURN_STRING1["return String.class"]
    CHECK_SUBKEY2["Condition: subkey.equalsIgnoreCase('state')"]
    RETURN_STRING2["return String.class"]
    RETURN_NULL2["return null"]
    END(["End"])

    START --> CHECK_NULL
    CHECK_NULL -->|Yes| RETURN_NULL1
    CHECK_NULL -->|No| FIND_SLASH
    FIND_SLASH --> CHECK_KEY
    CHECK_KEY -->|Yes| CHECK_SUBKEY1
    CHECK_KEY -->|No| RETURN_NULL2
    CHECK_SUBKEY1 -->|Yes| RETURN_STRING1
    CHECK_SUBKEY1 -->|No| CHECK_SUBKEY2
    CHECK_SUBKEY2 -->|Yes| RETURN_STRING2
    CHECK_SUBKEY2 -->|No| RETURN_NULL2
    RETURN_STRING1 --> END
    RETURN_STRING2 --> END
    RETURN_NULL1 --> END
    RETURN_NULL2 --> END
```

**Processing flow summary:**

1. **Null Guard** — If either `key` or `subkey` is null, return `null` immediately. This is a defensive null-check preventing `NullPointerException` on downstream string operations. (key,subkeyがnullの場合、nullを返す — "If key or subkey is null, return null")

2. **Separator Position Computation** — Compute `separaterPoint` as the index of the first `/` character in `key`. This value is stored but **not consumed** by any subsequent condition, indicating forward-looking architecture for composite key routing.

3. **Key Discrimination — "本文非定型置換文字"** — If `key` equals `"本文非定型置換文字"` (Main Body Ad-hoc Placeholder Character), proceed to subkey branching. This is the only recognized business domain in the current implementation. The comment (項目ごとに処理を入れる。データタイプがStringの項目"本文非定型置換文字"(項目ID:text_htk_ckam_moji)) states: "Insert processing per item. The data type is String for the item 'Main Body Ad-hoc Placeholder Character' (Item ID: text_htk_ckam_moji)."

4. **Subkey Branching** — Within the recognized key:
   - If `subkey.equalsIgnoreCase("value")`: return `String.class` — the placeholder text value is a String.
   - If `subkey.equalsIgnoreCase("state")`: return `String.class` — the placeholder status flag is a String. The comment (subkeyが"state"の場合、ステータスを返す) states: "When subkey is 'state', return the status."
   - Otherwise: fall through to return `null`.

5. **Default — Unknown Key** — If the key does not match any recognized business domain, return `null`. The comment (条件に合致するプロパティが存在しない場合は、nullを返す) states: "If no matching property exists, return null."

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | **Item name** (項目名) — the business domain identifier that determines which placeholder type the framework is querying. Currently only `"本文非定型置換文字"` (Main Body Ad-hoc Placeholder Character) is recognized. This key maps to the internal item ID `text_htk_ckam_moji`. It determines which processing branch the method dispatches to, enabling type-safe template rendering. |
| 2 | `subkey` | `String` | **Subkey** (サブキー) — a sub-identifier within a key that specifies the particular data attribute being queried. Valid values are `"value"` (the actual placeholder text content) and `"state"` (a status indicator for the placeholder). The comparison is case-insensitive (`equalsIgnoreCase`), making the API tolerant of casing variations. |

**External State:** None. This method is stateless — it does not read any instance fields, static state, or external dependencies.

## 4. CRUD Operations / Called Services

This method is **purely a type-resolution utility** and does not invoke any external services, CBS (Coop Business Service) components, or perform any database CRUD operations. It performs in-memory string comparisons and returns `Class<?>` literals.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| N/A | — | — | — | No service calls or database operations. This method operates entirely in memory as a type-dispatcher utility. |

## 5. Dependency Trace

No callers of `typeModelData()` were found in the codebase via search. This method is defined as `public` on `FUW00116SF02DBean`, suggesting it is intended for consumption by the broader webview framework or screen-layer classes within the `FUW00116SF` module.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | *(No callers found)* | — | — |

**Note:** As a `public` method on a `DBean` (Data Bean) class in the `eo.web.webview.FUW00116SF` module, this method is likely called dynamically by a framework-level dispatcher (e.g., reflection-based template processing) or by screen classes that were not included in the current codebase scope. The method itself calls no downstream services.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(key == null || subkey == null)` (L200)

> Null guard: if either parameter is null, return null immediately to prevent downstream NullPointerException. This is a standard defensive programming pattern for public API entry points. (key,subkeyがnullの場合、nullを返す — "If key or subkey is null, return null")

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` |

---

**Block 2** — [ASSIGN] `separaterPoint` computation (L205)

> Compute the index of the first "/" character in `key`. This enables future composite key routing (e.g., "parent/child" key hierarchies), but the value is **not currently consumed** by any condition or branch.

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

---

**Block 3** — [IF] `(key.equals("本文非定型置換文字"))` (L208)

> Key discrimination: checks if the requested item is the "Main Body Ad-hoc Placeholder Character" domain. The comment (項目ごとに処理を入れる。データタイプがStringの項目"本文非定型置換文字"(項目ID:text_htk_ckam_moji)) states: "Insert processing per item. The data type is String for the item 'Main Body Ad-hoc Placeholder Character' (Item ID: text_htk_ckam_moji)." This is the only recognized business domain in the current implementation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `key.equals("本文非定型置換文字")` // String equality comparison |

**Block 3.1** — [IF] `(subkey.equalsIgnoreCase("value"))` (L209)

> Subkey branch: the framework is querying for the actual placeholder text value. Returns `String.class` as the data type.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // Data type for placeholder text value |

**Block 3.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L211)

> Subkey branch: the framework is querying for the placeholder status flag. Returns `String.class` as the data type. The comment (subkeyが"state"の場合、ステータスを返す) states: "When subkey is 'state', return the status."

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // Data type for placeholder status flag |

**Block 3.3** — [ELSE — implicit fallthrough] (L213)

> The subkey did not match `"value"` or `"state"`. Falls through to the end of the method.

---

**Block 4** — [ELSE — implicit] `(key does not match "本文非定型置換文字")` (L213)

> The key did not match any recognized business domain. The comment (条件に合致するプロパティが存在しない場合は、nullを返す) states: "If no matching property exists, return null." This is the default case for unknown item types.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching property — type is unknown |

---

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `key` | Parameter | Item name (項目名) — the business domain identifier used to route to the correct type-resolution branch. Currently only "本文非定型置換文字" is recognized. |
| `subkey` | Parameter | Subkey (サブキー) — a sub-identifier within a key specifying which data attribute is being queried (e.g., "value" or "state"). |
| `本文非定型置換文字` | Field / Constant | Main Body Ad-hoc Placeholder Character — a document management feature where users define custom (non-standard) placeholder text within the main body of a document. |
| `text_htk_ckam_moji` | Item ID | Internal item identifier for "本文非定型置換文字" (Main Body Ad-hoc Placeholder Character). `HTK` likely stands for "HTK" (placeholder/substitution) and `CKAM` for "置換文字" (replacement character). |
| `DBean` | Technical term | Data Bean — a Java class that holds and routes data between the web layer and the business logic layer. In this architecture, DBeans serve as data dispatchers for screen-specific operations. |
| `webview` | Technical term | The web presentation layer module that handles document/template rendering in the UI. |
| `FUW00116SF` | Module | A specific functional module within the webview system, likely handling document template placeholder substitution operations. |
| `separaterPoint` | Variable | Computed index of the first "/" in `key`. Intended for future composite key routing (e.g., hierarchical keys), but not currently consumed. Note: the variable is named "separater" (likely a typo for "separator"). |
| `String.class` | Technical term | Java reflection literal representing the `java.lang.String` type. Returned by this method to indicate that the framework should treat the data as a text string. |
