# Business Logic — KKA14201SFLogic.setBtnVisibleAtTv() [207 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA14201SF.KKA14201SFLogic` |
| Layer | Service / Logic (inferred from `eo.web.webview` package — web presentation logic layer within the one-stop order screen tier) |
| Module | `KKA14201SF` (Package: `eo.web.webview.KKA14201SF`) |

## 1. Role

### KKA14201SFLogic.setBtnVisibleAtTv()

This method determines the visibility of eight action buttons on the one-stop order entry screen (KKA14201SF) based on the current **operation division** (`ido_div`) and whether an **operation service item list** (`op_svc_kei_list_ari`) is available. It is the central button-state router for the screen's user interaction model in the Japanese telecom order fulfillment system.

The method handles four **operation division categories**: (1) **New Contract / Service Addition** (`ido_div = "00001"` or `"00002"`), where a new service order is being created; (2) **Operation Settings** (`ido_div = "00003"`), where existing service parameters are being configured; (3) **Operation Reservation Cancellation** (`ido_div = "000055"`), where a previously queued operation reservation is being withdrawn; and (4) **Default / No Setup**, an unknown or unclassified division that falls through to the catch-all branch.

Within each division category, the method further branches based on whether an **operation service item list** exists (`op_svc_kei_list_ari`). When service items are present, a richer set of buttons is enabled; when absent, most buttons are disabled because there is no data to operate on. In the Operation Settings branch, it additionally checks the **operation service code** (`op_svc_cd`) to enable the **Change** button for special service types such as **Keypad Teleguide** (`"0290"`) and **NHK Group Unified Payment** (`"0310"`).

The method implements a **routing/dispatch design pattern** with nested conditional branching, acting as a pure business-rule evaluator: it takes structured inputs, computes boolean visibility flags, and outputs them through the data bean message mechanism — without performing any database operations or side effects.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setBtnVisibleAtTv params"])

    INIT["Initialize 8 btn_v_kbn vars to 1
All buttons default visible"]

    COND_DIV{ido_div value}

    START --> INIT
    INIT --> COND_DIV

    COND_DIV --> |"00001 or 00002: New Contract / Service Addition"| BRANCH_NEW["Block 1: New Contract or Service Addition"]
    COND_DIV --> |"00003: Operation Settings"| BRANCH_OPS["Block 2: Operation Settings"]
    COND_DIV --> |"00055: Operation Reservation Cancellation"| BRANCH_RSV["Block 3: Operation Reservation Cancellation"]
    COND_DIV --> |"else: Default No Setup"| BRANCH_DEF["Block 4: Default No Setup"]

    BRANCH_NEW --> BK_DISABLE["bk_btn_v_kbn to 0
Disable Back Button"]

    BRANCH_NEW --> COND_LIST_ARI{op_svc_kei_list_ari true}
    BRANCH_OPS --> BK_ENABLE["bk_btn_v_kbn to 1
Enable Back Button"]
    BRANCH_OPS --> COND_LIST_ARI
    BRANCH_RSV --> BK_ENABLE_RSV["bk_btn_v_kbn to 1
Enable Back Button"]
    BRANCH_RSV --> COND_LIST_ARI
    BRANCH_DEF --> BK_SPECIAL["bk_btn_v_kbn to 3
Special Back Button"]
    BRANCH_DEF --> COND_LIST_ARI

    COND_LIST_ARI --> |true| HAS_OP["op_svc_kei_list_ari branch"]
    COND_LIST_ARI --> |false| NO_OP["op_svc_kei_list_ari false branch"]

    HAS_OP --> BRANCH1_NEW_OP["Block 1.1: With ops
Disable History Change Recovery"]
    NO_OP --> BRANCH1_NO_OP["Block 1.2: No ops
Disable all except Add"]

    BRANCH_OPS_IF{op_svc_cd value}
    BRANCH_OPS_IF --> |"0290 Keypad Teleguide"| OP_CHG_EN["chg_btn_v_kbn to 1
Enable Change"]
    BRANCH_OPS_IF --> |"0310 NHK Unified Payment"| OP_CHG_EN2["chg_btn_v_kbn to 1
Enable Change"]
    BRANCH_OPS_IF --> |else| OP_CHG_DIS["chg_btn_v_kbn to 0
Disable Change"]

    OP_CHG_EN --> BRANCH2_HOP["Block 2.1: With ops
Most enabled except Recovery"]
    OP_CHG_EN2 --> BRANCH2_HOP
    OP_CHG_DIS --> BRANCH2_HOP

    BRANCH2_NO_OP["Block 2.2: No ops
Disable all except Add and Back"]

    BRANCH3_HOP["Block 3.1: With ops
Only History and ResCancel enabled"]
    BRANCH3_NO_OP["Block 3.2: No ops
All buttons disabled"]

    BRANCH4_HOP["Block 4.1: With ops
Only History and Display enabled"]
    BRANCH4_NO_OP["Block 4.2: No ops
All buttons disabled"]

    BRANCH1_NEW_OP --> SEND
    BRANCH1_NO_OP --> SEND
    BRANCH2_HOP --> SEND
    BRANCH2_NO_OP --> SEND
    BRANCH3_HOP --> SEND
    BRANCH3_NO_OP --> SEND
    BRANCH4_HOP --> SEND
    BRANCH4_NO_OP --> SEND

    SEND["Set 8 btn visibility flags via sendMessageString"]
    SEND --> END_NODE(["Return Next"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `OneStopDataBeanAccess[]` | Array of one-stop data bean access objects used as the communication channel between the presentation layer and the logic layer. `paramBean[0]` is the primary bean through which all eight button visibility flags are sent back to the screen via `sendMessageString`. |
| 2 | `ido_div` | `String` | **Operation division code** — classifies the current screen's business context. Possible values: `"00001"` (New Contract / Shikkou Keiyaku), `"00002"` (Service Addition / Saabisu Tsuika), `"00003"` (Operation Settings / Opusheon Settei), `"00055"` (Operation Reservation Cancellation / Opusheon Yoyaku Torikeshi). Other values fall through to the default branch. |
| 3 | `op_svc_cd` | `String` | **Operation service code** — identifies the specific telecom service being configured. Used only in the Operation Settings (`"00003"`) branch. Special values: `"0290"` (Keypad Teleguide / Keyapudo Teleguide) and `"0310"` (NHK Group Unified Payment / NHK Dantai Ikki Bartai) — both enable the Change button. |
| 4 | `op_svc_kei_list_ari` | `boolean` | **Operation service item list availability flag** — indicates whether the current screen context has a populated list of operation service line items. `true` means service items exist (user has selected data to operate on); `false` means no items (user is on a blank or empty screen). Drives the inner branch: with items → richer button set; without items → minimal button set. |

**External state read:** None. This method is pure — it reads no instance fields, static state, or external resources.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `OneStopDataBeanAccess.sendMessageString` | N/A | N/A | Writes 8 button visibility flags back to the data bean. This is a presentation-layer message mechanism, not a database operation. Flags sent: `BK_BTN_V_KBN`, `RSV_CL_BTN_V_KBN`, `KAIHK_BTN_V_KBN`, `DSL_BTN_V_KBN`, `CHG_BTN_V_KBN`, `ADD_BTN_V_KBN`, `SHOKAI_BTN_V_KBN`, `RIREKI_SHOKAI_BTN_V_KBN`. |

**Notes:**
- This method performs **no database CRUD operations** (no reads, creates, updates, or deletes).
- All calls are to `sendMessageString` on the `OneStopDataBeanAccess` parameter, which is a **communication bridge** back to the JSP/screen layer for rendering purposes.
- The SC / CBS classification is N/A because `sendMessageString` is a presentation-layer utility, not a service component (SC) or common business service (CBS).

## 5. Dependency Trace

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

Direct callers of `setBtnVisibleAtTv`:
- `KKA14201SFLogic.setKbnButtonVisible()` — same class

### Call Chain:

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: KKA14201SFLogic | `setKbnButtonVisible` → `setBtnVisibleAtTv` | `sendMessageString [WRITE] KKW02301SFConst` (8 visibility flag values) |

**Notes:**
- No screen (`KKSV*`) or batch entry points were found within the call graph. This method is an **internal utility** within the `KKA14201SFLogic` class.
- The only terminal operation is `sendMessageString` — eight invocations that write button visibility states back to the data bean for screen rendering.

## 6. Per-Branch Detail Blocks

### Block 1 — IF (IDO_DIV = "00001" or "00002") (L5396)

> **Business context:** New Contract (ido_div = "00001") or Service Addition (ido_div = "00002"). The Back button is always disabled in these modes since they represent forward-progressing operations.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "0"` [Disable Back Button] |

#### Block 1.1 — IF (`op_svc_kei_list_ari` is true) (L5407)

> **Business context:** Service items exist. User has data to operate on, so most buttons are enabled. The method selectively disables History Display, Change, Recovery, and Reservation Cancellation as these are not applicable during new contract or service addition.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rrireki_shokai_btn_v_kbn = "0"` [Disable History Display Button — Not Active] |
| 2 | SET | `shokai_btn_v_kbn = "1"` [Enable Display Button] |
| 3 | SET | `add_btn_v_kbn = "1"` [Enable Add Button] |
| 4 | SET | `chg_btn_v_kbn = "0"` [Disable Change Button — Not Active] |
| 5 | SET | `dsl_btn_v_kbn = "1"` [Enable Cancellation Button] |
| 6 | SET | `kaihk_btn_v_kbn = "0"` [Disable Recovery Button — Not Active] |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` [Disable Reservation Cancellation Button — Not Active] |

#### Block 1.2 — ELSE (`op_svc_kei_list_ari` is false) (L5418)

> **Business context:** No service items exist. The screen is empty (no data to operate on), so the method disables nearly all buttons. Only the Add button remains available, allowing the user to initiate a new service entry.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` [Disable History Display — Not Active] |
| 2 | SET | `shokai_btn_v_kbn = "0"` [Disable Display — Not Active] |
| 3 | SET | `add_btn_v_kbn = "1"` [Enable Add Button] |
| 4 | SET | `chg_btn_v_kbn = "0"` [Disable Change — Not Active] |
| 5 | SET | `dsl_btn_v_kbn = "0"` [Disable Cancellation — Not Active] |
| 6 | SET | `kaihk_btn_v_kbn = "0"` [Disable Recovery — Not Active] |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` [Disable Reservation Cancellation — Not Active] |

---

### Block 2 — ELSE-IF (IDO_DIV = "00003") (L5430)

> **Business context:** Operation Settings (Opusheon Settei). The Back button is enabled since users may need to navigate away from settings. Additional logic checks the specific service code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "1"` [Enable Back Button] |

#### Block 2.1 — IF (`op_svc_kei_list_ari` is true) (L5441)

> **Business context:** Service items exist in operation settings. Most buttons are enabled. The method further checks the operation service code to conditionally enable the Change button.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` [Enable History Display] |
| 2 | SET | `shokai_btn_v_kbn = "1"` [Enable Display] |
| 3 | SET | `add_btn_v_kbn = "1"` [Enable Add] |
| 4 | SET | `dsl_btn_v_kbn = "1"` [Enable Cancellation] |
| 5 | SET | `kaihk_btn_v_kbn = "0"` [Disable Recovery — Not Active] |
| 6 | SET | `rsv_cl_btn_v_kbn = "1"` [Enable Reservation Cancellation] |

##### Block 2.1.1 — IF (`op_svc_cd = "0290"`) (L5453)

> **Business context:** Keypad Teleguide service. The Change button is enabled because this service type supports modification of settings.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "1"` [Enable Change Button] [-> `JKKCommonConst.OP_SVC_CD_VALUE_0290 = "0290"` (Keypad Teleguide)] |

##### Block 2.1.2 — ELSE-IF (`op_svc_cd = "0310"`) (L5457)

> **Business context:** NHK Group Unified Payment. The Change button is enabled because this service type supports modification of settings.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "1"` [Enable Change Button] [-> `JKKCommonConst.OP_SVC_CD_VALUE_0310 = "0310"` (NHK Group Unified Payment)] |

##### Block 2.1.3 — ELSE (Other service codes) (L5461)

> **Business context:** Operation settings for a service code not listed above. The Change button is disabled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chg_btn_v_kbn = "0"` [Disable Change Button — Not Active] |

#### Block 2.2 — ELSE (`op_svc_kei_list_ari` is false) (L5466)

> **Business context:** No service items exist during operation settings. Nearly all buttons are disabled. Only Add and Back remain active.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` [Disable History Display — Not Active] |
| 2 | SET | `shokai_btn_v_kbn = "0"` [Disable Display — Not Active] |
| 3 | SET | `add_btn_v_kbn = "1"` [Enable Add] |
| 4 | SET | `chg_btn_v_kbn = "0"` [Disable Change — Not Active] |
| 5 | SET | `dsl_btn_v_kbn = "0"` [Disable Cancellation — Not Active] |
| 6 | SET | `kaihk_btn_v_kbn = "0"` [Disable Recovery — Not Active] |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` [Disable Reservation Cancellation — Not Active] |

---

### Block 3 — ELSE-IF (IDO_DIV = "00055") (L5478)

> **Business context:** Operation Reservation Cancellation (Opusheon Yoyaku Torikeshi). The Back button is enabled. This mode is specifically for withdrawing previously queued operation reservations.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "1"` [Enable Back Button] |

#### Block 3.1 — IF (`op_svc_kei_list_ari` is true) (L5489)

> **Business context:** Service items exist. Only History Display and Reservation Cancellation buttons are enabled — all others (Display, Add, Change, Cancellation, Recovery) are disabled since the sole purpose of this screen mode is to cancel reservations.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` [Enable History Display] |
| 2 | SET | `shokai_btn_v_kbn = "0"` [Disable Display — Not Active] |
| 3 | SET | `add_btn_v_kbn = "0"` [Disable Add — Not Active] |
| 4 | SET | `chg_btn_v_kbn = "0"` [Disable Change — Not Active] |
| 5 | SET | `dsl_btn_v_kbn = "0"` [Disable Cancellation — Not Active] |
| 6 | SET | `kaihk_btn_v_kbn = "0"` [Disable Recovery — Not Active] |
| 7 | SET | `rsv_cl_btn_v_kbn = "1"` [Enable Reservation Cancellation] |

#### Block 3.2 — ELSE (`op_svc_kei_list_ari` is false) (L5500)

> **Business context:** No service items exist during reservation cancellation. All buttons are disabled since there is nothing to cancel.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` [Disable History Display — Not Active] |
| 2 | SET | `shokai_btn_v_kbn = "0"` [Disable Display — Not Active] |
| 3 | SET | `add_btn_v_kbn = "0"` [Disable Add — Not Active] |
| 4 | SET | `chg_btn_v_kbn = "0"` [Disable Change — Not Active] |
| 5 | SET | `dsl_btn_v_kbn = "0"` [Disable Cancellation — Not Active] |
| 6 | SET | `kaihk_btn_v_kbn = "0"` [Disable Recovery — Not Active] |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` [Disable Reservation Cancellation — Not Active] |

---

### Block 4 — ELSE (Default / No Setup) (L5512)

> **Business context:** An unclassified or unknown `ido_div` value. The Back button is set to `"3"` — a special state (set via ANK-2121 modification in 2014) that likely signals a non-standard display mode rather than simple enable/disable.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bk_btn_v_kbn = "3"` [Special Back Button State — ANK-2121-00-00 Modification, replacing old value `"0"` (Closed)] |

#### Block 4.1 — IF (`op_svc_kei_list_ari` is true) (L5525)

> **Business context:** Service items exist in an unclassified mode. History Display and Display buttons are enabled; all operational buttons (Add, Change, Cancellation, Recovery, Reservation Cancellation) are disabled since the system does not know how to handle this mode safely.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "1"` [Enable History Display] |
| 2 | SET | `shokai_btn_v_kbn = "1"` [Enable Display] |
| 3 | SET | `add_btn_v_kbn = "0"` [Disable Add — Not Active] |
| 4 | SET | `chg_btn_v_kbn = "0"` [Disable Change — Not Active] |
| 5 | SET | `dsl_btn_v_kbn = "0"` [Disable Cancellation — Not Active] |
| 6 | SET | `kaihk_btn_v_kbn = "0"` [Disable Recovery — Not Active] |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` [Disable Reservation Cancellation — Not Active] |

#### Block 4.2 — ELSE (`op_svc_kei_list_ari` is false) (L5536)

> **Business context:** No service items in an unclassified mode. All buttons are disabled — no safe operation can be assumed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rireki_shokai_btn_v_kbn = "0"` [Disable History Display — Not Active] |
| 2 | SET | `shokai_btn_v_kbn = "0"` [Disable Display — Not Active] |
| 3 | SET | `add_btn_v_kbn = "0"` [Disable Add — Not Active] |
| 4 | SET | `chg_btn_v_kbn = "0"` [Disable Change — Not Active] |
| 5 | SET | `dsl_btn_v_kbn = "0"` [Disable Cancellation — Not Active] |
| 6 | SET | `kaihk_btn_v_kbn = "0"` [Disable Recovery — Not Active] |
| 7 | SET | `rsv_cl_btn_v_kbn = "0"` [Disable Reservation Cancellation — Not Active] |

---

### Terminal Output — SendMessageString Calls (L5543–L5550)

After all conditional logic resolves, the method sends all eight button visibility flags back to the data bean for screen rendering.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(BK_BTN_V_KBN, DATABEAN_SET_VALUE, bk_btn_v_kbn)` [Write Back Button visibility] |
| 2 | EXEC | `paramBean[0].sendMessageString(RSV_CL_BTN_V_KBN, DATABEAN_SET_VALUE, rsv_cl_btn_v_kbn)` [Write Reservation Cancellation button visibility] |
| 3 | EXEC | `paramBean[0].sendMessageString(KAIHK_BTN_V_KBN, DATABEAN_SET_VALUE, kaihk_btn_v_kbn)` [Write Recovery button visibility] |
| 4 | EXEC | `paramBean[0].sendMessageString(DSL_BTN_V_KBN, DATABEAN_SET_VALUE, dsl_btn_v_kbn)` [Write Cancellation button visibility] |
| 5 | EXEC | `paramBean[0].sendMessageString(CHG_BTN_V_KBN, DATABEAN_SET_VALUE, chg_btn_v_kbn)` [Write Change button visibility] |
| 6 | EXEC | `paramBean[0].sendMessageString(ADD_BTN_V_KBN, DATABEAN_SET_VALUE, add_btn_v_kbn)` [Write Add button visibility] |
| 7 | EXEC | `paramBean[0].sendMessageString(SHOKAI_BTN_V_KBN, DATABEAN_SET_VALUE, shokai_btn_v_kbn)` [Write Display button visibility] |
| 8 | EXEC | `paramBean[0].sendMessageString(RIREKI_SHOKAI_BTN_V_KBN, DATABEAN_SET_VALUE, rireki_shokai_btn_v_kbn)` [Write History Display button visibility] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_div` | Field | **Operation Division** — Classifies the current screen's business mode. Values: `"00001"` (New Contract), `"00002"` (Service Addition), `"00003"` (Operation Settings), `"00055"` (Operation Reservation Cancellation) |
| `op_svc_cd` | Field | **Operation Service Code** — Identifies the specific telecom service type being configured in the current session |
| `op_svc_kei_list_ari` | Field | **Operation Service Item List Existence Flag** — Japanese naming (`kei` = detail/line item, `ari` = exists). Indicates whether the current screen context has a populated list of service line items to operate on |
| `btn_v_kbn` | Field | **Button Visibility Classification** — Generic suffix for the eight visibility flag variables. `"1"` = visible, `"0"` = hidden/inactive, `"3"` = special state |
| `BK_BTN_V_KBN` | Field | **Back Button Display Classification** — Controls visibility of the Back (return) navigation button |
| `RSV_CL_BTN_V_KBN` | Field | **Reservation Cancellation Button Display Classification** — Controls visibility of the Operation Reservation Cancellation button |
| `KAIHK_BTN_V_KBN` | Field | **Recovery Button Display Classification** — Controls visibility of the Recovery button |
| `DSL_BTN_V_KBN` | Field | **Cancellation Button Display Classification** — Controls visibility of the Cancellation button |
| `CHG_BTN_V_KBN` | Field | **Change Button Display Classification** — Controls visibility of the Change (modify) button |
| `ADD_BTN_V_KBN` | Field | **Add Button Display Classification** — Controls visibility of the Add (new entry) button |
| `SHOKAI_BTN_V_KBN` | Field | **Display Button Display Classification** — Controls visibility of the Display (view) button |
| `RIREKI_SHOKAI_BTN_V_KBN` | Field | **History Display Button Display Classification** — Controls visibility of the History Display button |
| `OneStopDataBeanAccess` | Class | **One-Stop Data Bean Access** — The communication bridge between the logic layer and the JSP/screen layer. Uses `sendMessageString` to push key-value pairs for screen rendering |
| `sendMessageString` | Method | **Send Message String** — Presentation-layer method that writes a key-value pair into the data bean for the screen to consume |
| `0290` | Constant | **Keypad Teleguide** — A telecom service code for remote guidance/teleguide operations via keypad |
| `0310` | Constant | **NHK Group Unified Payment** — A telecom service code for NHK broadcasting fee group unified payment collection |
| `00001` | Constant | **New Contract** — Operation division for creating a new service contract |
| `00002` | Constant | **Service Addition** — Operation division for adding a new service to an existing contract |
| `00003` | Constant | **Operation Settings** — Operation division for configuring existing service parameters |
| `00055` | Constant | **Operation Reservation Cancellation** — Operation division for withdrawing a previously queued operation reservation |
| DATABEAN_SET_VALUE | Constant | **Data Bean Set Value** — Standard key value used in `sendMessageString` to indicate the value should be set on the data bean |
| FTTH | Business term | **Fiber To The Home** — Fiber-optic internet service (mentioned in broader KKA14201SF module context) |
| SOD | Acronym | **Service Order Data** — Telecom order fulfillment entity |
| JSP | Acronym | **JavaServer Pages** — Presentation layer technology consuming the data bean output |
