# Business Logic — KKW14301SF01DBean.storeModelData() [50 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA35101SF.KKW14301SF01DBean` |
| Layer | Utility / Data Access Bean (Web layer, package `eo.web.webview.KKA35101SF`) |
| Module | `KKA35101SF` (Package: `eo.web.webview.KKA35101SF`) |

## 1. Role

### KKW14301SF01DBean.storeModelData()

This method is a **generic field-based bean setter** (router/dispatcher) that stores model data into `KKW14301SF01DBean` properties based on a field name (`key`) and sub-key (`subkey`) pair. It implements a **routing/dispatch design pattern**: the caller passes a logical field identifier (e.g., "TV Tuner", "Course Selection", "Count") and a sub-key (e.g., "value", "enable", "state"), and the method dispatches to the appropriate strongly-typed setter on the bean.

The method handles **three service-type categories** used in K-Opticom's order entry / visit inquiry screens:

| Service Category | Domain Description |
|------------------|-------------------|
| STB TV Tuner | Set-top-box TV tuner configuration for fiber (FTTH) service delivery |
| Course Selection | Customer course / plan selection for telecom services |
| Count | General counter fields used in service contract tracking |

Each category supports three sub-key types: `value` (the actual data value), `enable` (boolean UI enablement flag), and `state` (a string representation of the current state, e.g., "visible", "disabled", "readonly"). The `isSetAsString` parameter is accepted but **not used** within this method's logic.

This method plays a central role in the **data-binding layer** of the visit inquiry screen (KKSV0004). It allows the screen/controller to push arbitrary field data into the bean in a type-safe manner, rather than each screen having its own bespoke setter logic. It is called from within the same bean (`KKW14301SF01DBean.storeModelData()`) via self-referential dispatch.

## 2. Processing Pattern (Detailed Business Logic)

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

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

    CHECK_NULL -->|true| RETURN_NULL["Return early (no processing)"]

    CHECK_NULL -->|false| FIND_SEP["sep = key.indexOf('/')"]

    FIND_SEP --> BRANCH_TV["Check: key equals 'N号項目\xef\xbd\xa5STBテレビチューナー（STB）'"]

    BRANCH_TV -->|true| TV_SUBKEY["Check: subkey equalsIgnoreCase"]

    TV_SUBKEY -->|"value"| TV_SET_VALUE["setKcat_n_cnt_tv_tuner_value(String)"]
    TV_SUBKEY -->|"enable"| TV_SET_ENABLE["setKcat_n_cnt_tv_tuner_enabled(Boolean)"]
    TV_SUBKEY -->|"state"| TV_SET_STATE["setKcat_n_cnt_tv_tuner_state(String)"]

    BRANCH_TV -->|false| BRANCH_COURSE["Check: key equals 'N号項目\xef\xbd\xa5コース選択'"]

    BRANCH_COURSE -->|true| COURSE_SUBKEY["Check: subkey equalsIgnoreCase"]

    COURSE_SUBKEY -->|"value"| COURSE_SET_VALUE["setKcat_n_course_choice_value(String)"]
    COURSE_SUBKEY -->|"enable"| COURSE_SET_ENABLE["setKcat_n_course_choice_enabled(Boolean)"]
    COURSE_SUBKEY -->|"state"| COURSE_SET_STATE["setKcat_n_course_choice_state(String)"]

    BRANCH_COURSE -->|false| BRANCH_COUNT["Check: key equals 'N号項目\xef\xbd\xa5カウント'"]

    BRANCH_COUNT -->|true| COUNT_SUBKEY["Check: subkey equalsIgnoreCase"]

    COUNT_SUBKEY -->|"value"| COUNT_SET_VALUE["setKcat_n_cnt_value(String)"]
    COUNT_SUBKEY -->|"enable"| COUNT_SET_ENABLE["setKcat_n_cnt_enabled(Boolean)"]
    COUNT_SUBKEY -->|"state"| COUNT_SET_STATE["setKcat_n_cnt_state(String)"]

    BRANCH_COUNT -->|false| END_NODE["End (no matching branch)"]

    TV_SET_VALUE --> END_NODE
    TV_SET_ENABLE --> END_NODE
    TV_SET_STATE --> END_NODE
    COURSE_SET_VALUE --> END_NODE
    COURSE_SET_ENABLE --> END_NODE
    COURSE_SET_STATE --> END_NODE
    COUNT_SET_VALUE --> END_NODE
    COUNT_SET_ENABLE --> END_NODE
    COUNT_SET_STATE --> END_NODE
    RETURN_NULL --> END_NODE
```

**Processing Summary:**

1. **Null guard** — If `key` or `subkey` is `null`, the method returns immediately (no processing). Japanese comment: `key,subkeyがnullの場合、処理を中止` (English: If key/subkey is null, abort processing).
2. **Separator extraction** — The method computes `sep = key.indexOf("/")` to identify a potential separator character in the key, but the result is not used further in this method. This field is effectively a **dead code variable**.
3. **Branch on field identifier (`key`)** — The method checks if `key` matches one of three known field names (using `String.equals`):
   - **Branch TV Tuner**: `key` equals "N號項目\xefbd\xa5STBテレビチューナー（STB）" (N-field: STB TV Tuner (STB))
   - **Branch Course Selection**: `key` equals "N號項目\xefbd\xa5コース選択" (N-field: Course Selection)
   - **Branch Count**: `key` equals "N號項目\xefbd\xa5カウント" (N-field: Count)
4. **Sub-key dispatch**: Within each field branch, the method checks `subkey` (case-insensitive) and dispatches to the appropriate typed setter:
   - `"value"` — Sets the data value as a `String`
   - `"enable"` — Sets the enabled flag as a `Boolean`
   - `"state"` — Sets the state as a `String` (e.g., "visible", "disabled")

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | Field identifier that determines which bean property to set. Can be "N號項目\xefbd\xa5STBテレビチューナー（STB）" (STB TV Tuner), "N號項目\xefbd\xa5コース選択" (Course Selection), or "N號項目\xefbd\xa5カウント" (Count). Affects which setter branch is taken. |
| 2 | `subkey` | `String` | Property selector within the identified field. Valid values (case-insensitive): `"value"` (sets the actual data), `"enable"` (sets the UI enabled state), `"state"` (sets the state string). Affects which typed setter is called. |
| 3 | `in_value` | `Object` | The data to store. Cast to `String` for `value`/`state` subkeys, or to `Boolean` for `enable` subkey. Carries the actual field value from the calling screen/controller. |
| 4 | `isSetAsString` | `boolean` | Flag indicating whether to set the Long-type field's `Value` property as a `String` type value (per Javadoc: `Long型項目ValueプロパティへString型値の設定を行う場合true`). **Note:** This parameter is **accepted but never used** within this method's logic — all values are cast to `String` or `Boolean` regardless of this flag. |

**Instance fields accessed:**

| Field | Access Type | Description |
|-------|-------------|-------------|
| `kcat_n_cnt_tv_tuner_value` | Write (via setter) | STB (Set-Top-Box) TV tuner data value |
| `kcat_n_cnt_tv_tuner_enabled` | Write (via setter) | STB TV tuner enabled/disabled flag |
| `kcat_n_cnt_tv_tuner_state` | Write (via setter) | STB TV tuner UI state |
| `kcat_n_course_choice_value` | Write (via setter) | Course selection data value |
| `kcat_n_course_choice_enabled` | Write (via setter) | Course selection enabled/disabled flag |
| `kcat_n_course_choice_state` | Write (via setter) | Course selection UI state |
| `kcat_n_cnt_value` | Write (via setter) | Count data value |
| `kcat_n_cnt_enabled` | Write (via setter) | Count enabled/disabled flag |
| `kcat_n_cnt_state` | Write (via setter) | Count UI state |

## 4. CRUD Operations / Called Services

All called methods are internal bean setters within `KKW14301SF01DBean` — no external SC/CBS, database, or entity operations.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `KKW14301SF01DBean.setKcat_n_cnt_tv_tuner_value` | — | — | Sets the STB TV tuner data value field |
| U | `KKW14301SF01DBean.setKcat_n_cnt_tv_tuner_enabled` | — | — | Sets the STB TV tuner enabled/disabled flag |
| U | `KKW14301SF01DBean.setKcat_n_cnt_tv_tuner_state` | — | — | Sets the STB TV tuner UI state |
| U | `KKW14301SF01DBean.setKcat_n_course_choice_value` | — | — | Sets the course selection data value field |
| U | `KKW14301SF01DBean.setKcat_n_course_choice_enabled` | — | — | Sets the course selection enabled/disabled flag |
| U | `KKW14301SF01DBean.setKcat_n_course_choice_state` | — | — | Sets the course selection UI state |
| U | `KKW14301SF01DBean.setKcat_n_cnt_value` | — | — | Sets the count data value field |
| U | `KKW14301SF01DBean.setKcat_n_cnt_enabled` | — | — | Sets the count enabled/disabled flag |
| U | `KKW14301SF01DBean.setKcat_n_cnt_state` | — | — | Sets the count UI state |

**Classification rationale:** All operations are **Update (U)** — these are bean property setters that mutate internal state. No database reads, creates, or deletes occur in this method.

## 5. Dependency Trace

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods (both are self-referential calls within `KKW14301SF01DBean`).

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_cnt_tv_tuner_value()` | `setKcat_n_cnt_tv_tuner_value [U] bean-property` |
| 2 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_cnt_tv_tuner_enabled()` | `setKcat_n_cnt_tv_tuner_enabled [U] bean-property` |
| 3 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_cnt_tv_tuner_state()` | `setKcat_n_cnt_tv_tuner_state [U] bean-property` |
| 4 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_course_choice_value()` | `setKcat_n_course_choice_value [U] bean-property` |
| 5 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_course_choice_enabled()` | `setKcat_n_course_choice_enabled [U] bean-property` |
| 6 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_course_choice_state()` | `setKcat_n_course_choice_state [U] bean-property` |
| 7 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_cnt_value()` | `setKcat_n_cnt_value [U] bean-property` |
| 8 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_cnt_enabled()` | `setKcat_n_cnt_enabled [U] bean-property` |
| 9 | Self: `KKW14301SF01DBean.storeModelData()` | `KKW14301SF01DBean.storeModelData(key, subkey, in_value, isSetAsString)` → `setKcat_n_cnt_state()` | `setKcat_n_cnt_state [U] bean-property` |

**Note:** The method is called from within the same bean class (`KKW14301SF01DBean.storeModelData()`), meaning it is invoked as a self-referential dispatch pattern. The callers use the same method signature to route data to the appropriate typed setter.

## 6. Per-Branch Detail Blocks

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

> Null check on field identifier and sub-key. If either is null, processing is aborted immediately.
> Japanese comment: `key,subkeyがnullの場合、処理を中止` (English: If key/subkey is null, abort processing)

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key == null \|\| subkey == null` |
| 2 | RETURN | `return;` |

**Block 2** — SET (separator extraction, unused) (L268)

> Extracts the position of '/' in the key. The result is computed but never used — dead code.
> Japanese comment: `項目ごとに処理を入れる。` (English: Processing is applied per field.)

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

**Block 3** — IF (TV Tuner branch) `(key.equals("N號項目\xefbd\xa5STBテレビチューナー（STB）"))` (L270)

> Identifies the STB TV Tuner field and dispatches to its typed setters.
> Japanese comment: `データタイプがStringの項目"N號項目\xefbd\xa5STBテレビチューナー（STB）" (項目ID:kcat_n_cnt_tv_tuner)` (English: Field with String data type "N-field: STB TV Tuner (STB)" (field ID: kcat_n_cnt_tv_tuner))

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("N號項目\xefbd\xa5STBテレビチューナー（STB）")` |

**Block 3.1** — IF-ELSE-IF (TV Tuner subkey dispatch) (L271)

> Dispatches to STB TV Tuner setters based on subkey type.
> Japanese comment: `データタイプがStringの項目"N號項目\xefbd\xa5STBテレビチューナー（STB）" (項目ID:kcat_n_cnt_tv_tuner)` (English: Field with String data type "N-field: STB TV Tuner (STB)" (field ID: kcat_n_cnt_tv_tuner))

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `subkey.equalsIgnoreCase("value")` |
| 2 | CALL | `setKcat_n_cnt_tv_tuner_value((String)in_value)` |
| 3 | CHECK | `else if subkey.equalsIgnoreCase("enable")` |
| 4 | CALL | `setKcat_n_cnt_tv_tuner_enabled((Boolean)in_value)` |
| 5 | CHECK | `else if subkey.equalsIgnoreCase("state")` |
| 6 | CALL | `setKcat_n_cnt_tv_tuner_state((String)in_value)` |

**Block 3.1.1** — IF (TV Tuner "enable" subkey) `(subkey.equalsIgnoreCase("enable"))` (L274)

> Japanese comment: `subkeyが"enable"の場合、kcat_n_cnt_tv_tuner_enabledのsetterを実行する。` (English: When subkey is "enable", execute the setter for kcat_n_cnt_tv_tuner_enabled.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setKcat_n_cnt_tv_tuner_enabled((Boolean)in_value)` |

**Block 3.1.2** — IF (TV Tuner "state" subkey) `(subkey.equalsIgnoreCase("state"))` (L277)

> Japanese comment: `subkeyが"state"の場合、ステータスを返す。` (English: When subkey is "state", set the status.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setKcat_n_cnt_tv_tuner_state((String)in_value)` |

**Block 4** — ELSE IF (Course Selection branch) `(key.equals("N號項目\xefbd\xa5コース選択"))` (L283)

> Identifies the Course Selection field and dispatches to its typed setters.
> Japanese comment: `データタイプがStringの項目"N號項目\xefbd\xa5コース選択" (項目ID:kcat_n_course_choice)` (English: Field with String data type "N-field: Course Selection" (field ID: kcat_n_course_choice))

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("N號項目\xefbd\xa5コース選択")` |

**Block 4.1** — IF-ELSE-IF (Course Selection subkey dispatch) (L284)

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `subkey.equalsIgnoreCase("value")` |
| 2 | CALL | `setKcat_n_course_choice_value((String)in_value)` |
| 3 | CHECK | `else if subkey.equalsIgnoreCase("enable")` |
| 4 | CALL | `setKcat_n_course_choice_enabled((Boolean)in_value)` |
| 5 | CHECK | `else if subkey.equalsIgnoreCase("state")` |
| 6 | CALL | `setKcat_n_course_choice_state((String)in_value)` |

**Block 4.1.1** — IF (Course Selection "enable" subkey) `(subkey.equalsIgnoreCase("enable"))` (L287)

> Japanese comment: `subkeyが"enable"の場合、kcat_n_course_choice_enabledのsetterを実行する。` (English: When subkey is "enable", execute the setter for kcat_n_course_choice_enabled.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setKcat_n_course_choice_enabled((Boolean)in_value)` |

**Block 4.1.2** — IF (Course Selection "state" subkey) `(subkey.equalsIgnoreCase("state"))` (L290)

> Japanese comment: `subkeyが"state"の場合、ステータスを返す。` (English: When subkey is "state", set the status.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setKcat_n_course_choice_state((String)in_value)` |

**Block 5** — ELSE IF (Count branch) `(key.equals("N號項目\xefbd\xa5カウント"))` (L296)

> Identifies the Count field and dispatches to its typed setters.
> Japanese comment: `データタイプがStringの項目"N號項目\xefbd\xa5カウント" (項目ID:kcat_n_cnt)` (English: Field with String data type "N-field: Count" (field ID: kcat_n_cnt))

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("N號項目\xefbd\xa5カウント")` |

**Block 5.1** — IF-ELSE-IF (Count subkey dispatch) (L297)

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `subkey.equalsIgnoreCase("value")` |
| 2 | CALL | `setKcat_n_cnt_value((String)in_value)` |
| 3 | CHECK | `else if subkey.equalsIgnoreCase("enable")` |
| 4 | CALL | `setKcat_n_cnt_enabled((Boolean)in_value)` |
| 5 | CHECK | `else if subkey.equalsIgnoreCase("state")` |
| 6 | CALL | `setKcat_n_cnt_state((String)in_value)` |

**Block 5.1.1** — IF (Count "enable" subkey) `(subkey.equalsIgnoreCase("enable"))` (L300)

> Japanese comment: `subkeyが"enable"の場合、kcat_n_cnt_enabledのsetterを実行する。` (English: When subkey is "enable", execute the setter for kcat_n_cnt_enabled.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setKcat_n_cnt_enabled((Boolean)in_value)` |

**Block 5.1.2** — IF (Count "state" subkey) `(subkey.equalsIgnoreCase("state"))` (L303)

> Japanese comment: `subkeyが"state"の場合、ステータスを返す。` (English: When subkey is "state", set the status.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setKcat_n_cnt_state((String)in_value)` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `key` | Parameter | Field identifier — routes data to the appropriate bean property (TV Tuner, Course Selection, or Count) |
| `subkey` | Parameter | Property selector within a field — "value" (data), "enable" (UI enabled flag), "state" (UI state string) |
| `in_value` | Parameter | The actual data to store in the bean property, cast to String or Boolean depending on subkey |
| `isSetAsString` | Parameter | Flag for Long-type field value-as-String setting (currently unused in this method) |
| `kcat_n_cnt_tv_tuner_value` | Field | STB (Set-Top-Box) TV tuner value — the data value for the TV tuner setting |
| `kcat_n_cnt_tv_tuner_enabled` | Field | STB TV tuner enabled flag — whether the TV tuner UI element is enabled |
| `kcat_n_cnt_tv_tuner_state` | Field | STB TV tuner state — the current UI state string (e.g., visible, disabled) |
| `kcat_n_course_choice_value` | Field | Course selection value — the selected course/plan data |
| `kcat_n_course_choice_enabled` | Field | Course selection enabled flag — whether the course selection UI is enabled |
| `kcat_n_course_choice_state` | Field | Course selection state — the current UI state string |
| `kcat_n_cnt_value` | Field | Count value — the data value for a general counter field |
| `kcat_n_cnt_enabled` | Field | Count enabled flag — whether the count UI element is enabled |
| `kcat_n_cnt_state` | Field | Count state — the current UI state string for the count field |
| STB | Acronym | Set-Top-Box — hardware device for receiving and decoding broadcast signals in FTTH (Fiber To The Home) service delivery |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service provided by K-Opticom |
| N項目 | Field prefix | "N-field" — a naming convention for the Nth item/field in a screen layout; the half-width katakana after it disambiguates which N-field variant |
| コース選択 | Japanese | Course selection — the customer's chosen telecom service plan/course |
| カウント | Japanese | Count — a numeric counter used in service contract tracking |
| DBean | Acronym | Data Bean — a JavaBean used to carry data between the web controller and presentation layer |
| KKA35101SF | Module | K-Opticom service screen module — the source module for visit inquiry / order entry web screens |
