# Business Logic — CRW02702SF02DBean.storeModelData() [21 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.CRW02702SF.CRW02702SF02DBean` |
| Layer | Controller / Web View Data Binding (webview package — presentation layer) |
| Module | `CRW02702SF` (Package: `eo.web.webview.CRW02702SF`) |

## 1. Role

### CRW02702SF02DBean.storeModelData()

This method implements a **data dispatching/routing mechanism** for the web view framework. Its business purpose is to store incoming model data into the appropriate bean property based on a hierarchical key and subkey designation. The Javadoc states "項目名とサブキーからデータを取得します" (Obtain data from an item name and subkey), meaning it acts as a generic setter that routes values to the correct bean field. It implements a **dispatch pattern** — when the `key` parameter matches the special identifier "WEBID" (the web page session identifier field), it dispatches the value to either `setL2_web_id_value` (for the actual value) or `setL2_web_id_state` (for the state flag) depending on the `subkey` parameter. The method serves as a shared utility within the `CRW02702SF` screen module, enabling the framework to populate bean properties dynamically from submitted form data without requiring hardcoded field assignments per screen. This decouples the data binding logic from individual controller code and allows uniform handling of web model attributes across the application.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["storeModelData key, subkey, in_value, isSetAsString"])
    CHECK_NULL["key == null or subkey == null?"]
    EARLY_RETURN(["return / exit"])
    FIND_SLASH["separaterPoint = key.indexOf('/')"]
    CHECK_WEBID["key equals 'WEBID' (全角)"]
    CHECK_VALUE["subkey equalsIgnoreCase 'value'?"]
    SET_VALUE["setL2_web_id_value((String)in_value)"]
    CHECK_STATE["subkey equalsIgnoreCase 'state'?"]
    SET_STATE["setL2_web_id_state((String)in_value)"]
    END_NODE(["Return / Next"])

    START --> CHECK_NULL
    CHECK_NULL -- true --> EARLY_RETURN
    CHECK_NULL -- false --> FIND_SLASH
    FIND_SLASH --> CHECK_WEBID
    CHECK_WEBID -- true --> CHECK_VALUE
    CHECK_WEBID -- false --> END_NODE
    CHECK_VALUE -- true --> SET_VALUE
    CHECK_VALUE -- false --> CHECK_STATE
    CHECK_STATE -- true --> SET_STATE
    CHECK_STATE -- false --> END_NODE
    SET_VALUE --> END_NODE
    SET_STATE --> END_NODE
```

**Processing Summary:**
- The method first validates that both `key` and `subkey` are non-null. If either is null, processing terminates immediately ("key,subkeyがnullの場合、処理を中止" — If key/subkey is null, abort processing).
- It computes `separaterPoint` by finding the first `/` in `key`, though this computed value is not used in the current branch (reserved for future extensibility — "項目ごとに処理を入れる" — insert processing per item).
- If the `key` equals the special value `"WEBID"` (全角 characters for the web identifier item), the method routes based on the `subkey`:
  - When `subkey` matches `"value"` (case-insensitive): calls `setL2_web_id_value` to set the web ID value.
  - When `subkey` matches `"state"` (case-insensitive): calls `setL2_web_id_state` to set the web ID state flag ("subkeyが'state'の場合、ステータスを返す" — When subkey is 'state', return the status).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (項目名) — identifies which bean property to target. Currently only `"WEBID"` is handled. This represents a web model attribute identifier used by the framework to map submitted form data to bean fields. |
| 2 | `subkey` | `String` | The sub-key (サブキー) — further qualifies which aspect of the item to set. For `key="WEBID"`, valid subkeys are `"value"` (the actual web ID value) and `"state"` (the operational state/status flag of the web ID). Case-insensitive comparison is used. |
| 3 | `in_value` | `Object` | The data (データ) — the value to be stored in the bean property. Cast to `String` at assignment time, carrying the actual business data (e.g., a web session identifier value or state code). |
| 4 | `isSetAsString` | `boolean` | A flag indicating whether to set a String-type value into a Long-type item Value property (Long型項目ValueプロパティへString型値の設定を行う場合true). This parameter is accepted but not currently used in the method body — reserved for future use when handling Long-type fields that require string conversion. |

**Instance fields read:** None (method reads no instance state; it only writes via setters).
**External state:** `CRW02702SF02DBean.setL2_web_id_value(String)` — bean property setter for the web ID value.
`CRW02702SF02DBean.setL2_web_id_state(String)` — bean property setter for the web ID state flag.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `CRW02702SF02DBean.setL2_web_id_value` | CRW02702SF02DBean | - | Calls `setL2_web_id_value` in `CRW02702SF02DBean` — sets the web ID value field |
| - | `CRW02702SF02DBean.setL2_web_id_state` | CRW02702SF02DBean | - | Calls `setL2_web_id_state` in `CRW02702SF02DBean` — sets the web ID state flag field |

**Classification rationale:** Both called methods are bean property setters (`set*`) that write data into the current bean instance. They do not perform database CRUD operations (no insert, select, update, or delete to tables). Instead, they update the in-memory model state of the web view bean — this is a **U (Update)** at the model level, updating the bean's internal state to reflect incoming form data. No SC Codes or database entities are involved.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CRW02702SF02DBean (self-call) | `CRW02702SF02DBean.storeModelData` | `setL2_web_id_value`, `setL2_web_id_state` |
| 2 | CRW02702SF02DBean (self-call) | `CRW02702SF02DBean.storeModelData` | `setL2_web_id_value`, `setL2_web_id_state` |

No screen entry points (KKSV*) or batch entry points (KKBV*) were found within 8 hops. The callers listed above are self-referential calls within the same class, indicating the method is used internally by other methods in `CRW02702SF02DBean`. Terminal operations from this method write to `setL2_web_id_state` and `setL2_web_id_value` bean properties, with no further downstream SC/CBS/DB access.

## 6. Per-Branch Detail Blocks

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

Guard clause: validates both key and subkey are non-null. If either is null, processing is aborted immediately. The Javadoc comment "項目名とサブキーからデータを取得します" (Obtain data from item name and subkey) implies both are required for data retrieval.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key == null || subkey == null` |
| 2 | RETURN | `return;` // キー、サブキーがnullの場合、処理を中止 — If key/subkey is null, abort processing |

**Block 2** — [EXEC] `(separaterPoint calculation)` (L165)

Computes the position of the first forward slash in the key string. This variable is assigned but not used in the current implementation — the comment "項目ごとに処理を入れる" (Insert processing per item) indicates this is a scaffold for future routing logic based on hierarchical keys.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/")` // Compute first '/' position — reserved for future use |

**Block 3** — [IF] `(key.equals("WEBID"))` (L168)

Branches on the key matching the special web identifier field name. The comment "データタイプがStringの項目'WEBID'(項目ID:l2_web_id)" (Item 'WEBID' for data type String (item ID: l2_web_id)) indicates this key represents the web page session identifier field, and `l2_web_id` is the internal bean property name.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("WEBID")` // Matches the WEBID item (web ID field) |

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

When the subkey is `"value"`, the method sets the actual web ID value into the bean. This is the primary data storage path for the WEBID item.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setL2_web_id_value((String)in_value)` // Subkeyが"value"の場合、値を設定 — Set the value when subkey is "value" |

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

When the subkey is `"state"`, the method sets the state/status flag for the WEBID item. The comment "subkeyが'state'の場合、ステータスを返す" (When subkey is 'state', return the status) indicates this field tracks the operational state of the web identifier.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setL2_web_id_state((String)in_value)` // ステータスを設定 — Set the status |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `key` | Field | Item name (項目名) — the identifier of a web model attribute to be set on the bean |
| `subkey` | Field | Sub-key (サブキー) — qualifier specifying which property aspect of the item to set (e.g., "value" or "state") |
| `in_value` | Field | Data (データ) — the value being stored into the bean property |
| `isSetAsString` | Field | Boolean flag for String-to-Long conversion — indicates whether to set a String-type value into a Long-type item Value property |
| `WEBID` | Constant | Web ID — the special item name for the web page session identifier field. Full-width (全角) characters used as the key |
| `l2_web_id` | Field | Internal bean property name for the web identifier — the underlying storage field for the web ID value |
| `setL2_web_id_value` | Method | Setter for the web ID value — stores the actual web identifier value in the bean |
| `setL2_web_id_state` | Method | Setter for the web ID state — stores the operational status flag of the web identifier in the bean |
| 全角 (zenkaku) | Term | Full-width characters — Japanese typographic convention; the key "WEBID" is stored using full-width characters in the source |
| Item (項目) | Term | A named data field or attribute within the web view model — the fundamental unit of data binding |
| Web View Bean | Pattern | A DTO-style JavaBean that holds data for a web page/screen — used to transfer model data between controller and view |
| Dispatch Pattern | Pattern | A design approach where a single method routes input to different handlers based on key-based conditions — this method implements a form of this pattern |
