# Business Logic — KKW02516SF02DBean.storeModelData() [31 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA16801SF.KKW02516SF02DBean` |
| Layer | Component / Data Bean (Web Layer — `eo.web.webview` package, part of the KKA16801SF screen module) |
| Module | `KKA16801SF` (Package: `eo.web.webview.KKA16801SF`) |

## 1. Role

### KKW02516SF02DBean.storeModelData()

This method serves as a **unified dispatcher and setter** for two business-critical fields within the KKA16801SF screen context: the **Reason Code** (異動理由コード, `ido_rsn_cd`) and the **Reason Memo** (異動理由メモ, `ido_rsn_memo`). In telecom order management systems, an "异动" (ido/movement) refers to a service change event — such as a subscription modification, address change, or termination — where the system requires both a coded reason and an optional free-text memo to explain the change. The method implements a **routing/dispatch pattern**: it inspects the incoming `key` (item name) to determine which business field is being targeted, then inspects the `subkey` to decide whether to set the field's value or its state flag. It supports two item types — "異動理由コード" (Reason Code, item ID: `ido_rsn_cd`) and "異動理由メモ" (Reason Memo, item ID: `ido_rsn_memo`) — each with two sub-modes: `value` (to set the actual data) and `state` (to set the state flag that signals whether the field has been modified). The `isSetAsString` parameter is present in the method signature for general compatibility with the broader bean interface but is not actively used in this implementation. This method is a shared component called by multiple screen handlers that need to populate or modify reason code and memo data in a unified, type-safe manner.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["storeModelData key, subkey, in_value, isSetAsString"])

    START --> CHECK_NULL["key == null || subkey == null"]

    CHECK_NULL -->|Yes| RETURN["Return (early exit)"]
    CHECK_NULL -->|No| CALC_SEP["sep = key.indexOf('/')"]

    CALC_SEP --> BRANCH1["key.equals('異動理由コード')"]

    BRANCH1 -->|Yes| SUB1["subkey.equalsIgnoreCase('value')"]
    BRANCH1 -->|No| BRANCH2["key.equals('異動理由メモ')"]

    SUB1 -->|Yes| SET_VALUE1["setIdo_rsn_cd_value((String)in_value)"]
    SUB1 -->|No| SUB1B["subkey.equalsIgnoreCase('state')"]

    SUB1B -->|Yes| SET_STATE1["setIdo_rsn_cd_state((String)in_value)"]
    SUB1B -->|No| END_NODE1["End (no action)"]

    BRANCH2 -->|Yes| SUB2["subkey.equalsIgnoreCase('value')"]
    BRANCH2 -->|No| END_NODE2["End (no action)"]

    SUB2 -->|Yes| SET_VALUE2["setIdo_rsn_memo_value((String)in_value)"]
    SUB2 -->|No| SUB2B["subkey.equalsIgnoreCase('state')"]

    SUB2B -->|Yes| SET_STATE2["setIdo_rsn_memo_state((String)in_value)"]
    SUB2B -->|No| END_NODE2

    SET_VALUE1 --> END_ALL["End"]
    SET_STATE1 --> END_ALL
    SET_VALUE2 --> END_ALL
    SET_STATE2 --> END_ALL
```

**CRITICAL — Constant Resolution:**
No external constant classes are referenced in this method. All string comparisons use literal values directly:

| Literal String | Business Meaning |
|----------------|-----------------|
| `"/"` | Separator character — the key may contain a sub-item path separated by `/` |
| `"異動理由コード"` | Reason Code — the coded reason for a service movement/change event |
| `"異動理由メモ"` | Reason Memo — free-text memo explaining the service movement/change event |
| `"value"` | The value subkey — sets the actual data field |
| `"state"` | The state subkey — sets the state/flag field indicating modification status |

**Field IDs resolved from constant definitions (e.g., `JKKPauseChgRsvClConstCC.IDO_RSN_CD = "ido_rsn_cd"`, `JKKPauseChgRsvClConstCC.IDO_RSN_MEMO = "ido_rsn_memo"`):**

| Constant | Actual Value | Business Meaning |
|----------|-------------|-----------------|
| `IDO_RSN_CD` | `"ido_rsn_cd"` | Item ID for the Reason Code field |
| `IDO_RSN_MEMO` | `"ido_rsn_memo"` | Item ID for the Reason Memo field |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (フィールド名) that identifies which business field to update. Takes values `"異動理由コード"` (Reason Code — the coded classification of a service movement reason) or `"異動理由メモ"` (Reason Memo — the free-text explanation for a service movement). If the key contains a `/` character, it is split at the separator position (stored in `sep`) but the actual routing only checks the full key string. If `null`, the method returns immediately without action. |
| 2 | `subkey` | `String` | The sub-key that determines the target sub-field within the selected `key`. Takes values `"value"` (to set the actual data value) or `"state"` (to set the state flag that indicates whether the field has been modified). Case-insensitive comparison is used. If `null`, the method returns immediately without action. |
| 3 | `in_value` | `Object` | The data to be stored. Cast to `String` at assignment time. Represents either the reason code value (e.g., a service change reason code like "C01" for customer-initiated cancellation) or the reason memo text (e.g., "Customer requested address change"). |
| 4 | `isSetAsString` | `boolean` | Flag indicating whether to set a Long-typed item's Value property as a String value (Long型項目ValueプロパティへString型値の設定を行う場合 true). Present in the method signature for interface compatibility but is **not used** in this method's implementation. |

**Instance Fields Read:** None — this method only reads parameters and does not access any instance fields.

**Instance Fields Written:** The following setter methods modify instance fields on this bean:
| Field | Setter Method |
|-------|--------------|
| `ido_rsn_cd_value` | `setIdo_rsn_cd_value(String)` |
| `ido_rsn_cd_state` | `setIdo_rsn_cd_state(String)` |
| `ido_rsn_memo_value` | `setIdo_rsn_memo_value(String)` |
| `ido_rsn_memo_state` | `setIdo_rsn_memo_state(String)` |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `KKW02516SF02DBean.setIdo_rsn_cd_value` | KKW02516SF02DBean | - | Sets the Reason Code (`ido_rsn_cd`) value field on this bean instance. Called when `key="異動理由コード"` and `subkey="value"`. |
| U | `KKW02516SF02DBean.setIdo_rsn_cd_state` | KKW02516SF02DBean | - | Sets the Reason Code (`ido_rsn_cd`) state flag on this bean instance. Called when `key="異動理由コード"` and `subkey="state"`. |
| U | `KKW02516SF02DBean.setIdo_rsn_memo_value` | KKW02516SF02DBean | - | Sets the Reason Memo (`ido_rsn_memo`) value field on this bean instance. Called when `key="異動理由メモ"` and `subkey="value"`. |
| U | `KKW02516SF02DBean.setIdo_rsn_memo_state` | KKW02516SF02DBean | - | Sets the Reason Memo (`ido_rsn_memo`) state flag on this bean instance. Called when `key="異動理由メモ"` and `subkey="state"`. |

This method performs **no database operations, no SC (Service Component) calls, and no CBS (Common Business Service) invocations**. All four method calls are local setter operations on the bean itself, making this a pure in-memory data setter with no persistence layer interaction.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `setIdo_rsn_memo_state` [-], `setIdo_rsn_memo_value` [-], `setIdo_rsn_cd_state` [-], `setIdo_rsn_cd_value` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW02516SF02DBean | `KKW02516SF02DBean.storeModelData` (self-call via overloaded overload) | `setIdo_rsn_cd_value [U] -` |
| 2 | Screen:KKW02516SF02DBean | `KKW02516SF02DBean.storeModelData` (self-call via overloaded overload) | `setIdo_rsn_cd_state [U] -` |

The terminal operations are all local bean setter calls with no external database or SC layer interaction. This method is a terminal setter that does not propagate to downstream services or database operations.

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(key == null || subkey == null)` (Early Exit Guard) (L197)

Guard condition that prevents null pointer exceptions. If either `key` or `subkey` is `null`, the method exits immediately without performing any operation.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key == null || subkey == null` // Null guard — abort if either identifier is missing |
| 2 | RETURN | `return;` // No processing if key or subkey is null |

**Block 2** — EXEC `(key.indexOf("/"))` (Separator Calculation) (L200)

Computes the position of the `/` separator character in the `key` string. The result is stored in local variable `sep` but **is not used** in any subsequent logic — this appears to be dead code or a vestige of a previous multi-level key structure.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sep = key.indexOf("/")` // Find separator position (unused — dead code) |

**Block 3** — IF / ELSE-IF `(key.equals("異動理由コード")) / (key.equals("異動理由メモ"))` (Key Routing) (L203)

The main dispatch block. Routes processing based on the `key` (item name) value. The comment says "項目ごとに処理を入れる" (Insert processing per item). Two item types are supported:

- **`"異動理由コード"`** (Reason Code, item ID: `ido_rsn_cd`) — The coded reason for a service movement/change event. Supports subkeys `value` and `state`.
- **`"異動理由メモ"`** (Reason Memo, item ID: `ido_rsn_memo`) — Free-text memo explaining the service movement/change event. Supports subkeys `value` and `state`.

If `key` does not match either literal, the method proceeds to the final `}` with no action (implicit no-op).

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("異動理由コード")` [異動理由コード="Reason Code"] |
| 2 | SET | N/A (routing to Block 3.1 or Block 4) |
| 3 | CHECK | `key.equals("異動理由メモ")` [異動理由メモ="Reason Memo"] |
| 4 | SET | N/A (implicit no-op if neither matches) |

**Block 3.1** — IF / ELSE-IF `(subkey.equalsIgnoreCase("value")) / (subkey.equalsIgnoreCase("state"))` within `key = "異動理由コード"` (Reason Code Field Setter) (L204)

Nested inside the `"異動理由コード"` branch. Determines whether to set the actual Reason Code value or its state flag.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `subkey.equalsIgnoreCase("value")` [value="value"] |
| 2 | CALL | `setIdo_rsn_cd_value((String)in_value)` // Set the Reason Code value — stores the coded reason for the service change |
| 3 | CHECK | `subkey.equalsIgnoreCase("state")` [state="state"] |
| 4 | CALL | `setIdo_rsn_cd_state((String)in_value)` // Set the Reason Code state — flags whether the reason code field has been modified |
| 5 | N/A | No match → falls through to Block 5 (no action) |

**Block 4** — IF / ELSE-IF `(subkey.equalsIgnoreCase("value")) / (subkey.equalsIgnoreCase("state"))` within `key = "異動理由メモ"` (Reason Memo Field Setter) (L212)

Nested inside the `"異動理由メモ"` branch. Determines whether to set the actual Reason Memo value or its state flag.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `subkey.equalsIgnoreCase("value")` [value="value"] |
| 2 | CALL | `setIdo_rsn_memo_value((String)in_value)` // Set the Reason Memo value — stores the free-text explanation for the service change |
| 3 | CHECK | `subkey.equalsIgnoreCase("state")` [state="state"] |
| 4 | CALL | `setIdo_rsn_memo_state((String)in_value)` // Set the Reason Memo state — flags whether the reason memo field has been modified |
| 5 | N/A | No match → falls through to Block 5 (no action) |

**Block 5** — ELSE (Default / No-Op Branch) (L218)

If `key` does not match any supported item name (`"異動理由コード"` or `"異動理由メモ"`), the method reaches the closing brace with no action. This is an implicit no-op — the method silently ignores unrecognized item names.

| # | Type | Code |
|---|------|------|
| 1 | N/A | No action — method ends with `}` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `異動理由コード` | Field | Reason Code — the coded reason for a service movement/change event (e.g., customer cancellation, address change). Item ID: `ido_rsn_cd`. |
| `異動理由メモ` | Field | Reason Memo — free-text memo explaining the reason for a service movement/change event. Item ID: `ido_rsn_memo`. |
| `ido_rsn_cd` | Field ID | Short identifier for the Reason Code field (`IDO_RSN_CD`). Used in constant classes (e.g., `JKKPauseChgRsvClConstCC`). |
| `ido_rsn_memo` | Field ID | Short identifier for the Reason Memo field (`IDO_RSN_MEMO`). Used in constant classes. |
| `value` | Subkey | Target sub-field for setting the actual data value of a reason item. |
| `state` | Subkey | Target sub-field for setting the state flag indicating whether a reason item has been modified. |
| 異動 (Ido) | Business term | Movement/Change — refers to a service modification event in the telecom system (e.g., subscription change, address change, cancellation). |
| `in_value` | Parameter | The data value to be stored in a reason field. Cast to `String` at assignment. |
| `isSetAsString` | Parameter | Flag for Long-type field value-as-String conversion. Present but unused in this method. |
| `KKW02516SF02DBean` | Component | Data Bean — a DTO (Data Transfer Object) for screen `KKW02516SF` that holds model data for reason code and reason memo fields. |
| KKA16801SF | Module | Screen/Module identifier for the telecom order management screen that uses this data bean. |
