# Business Logic — FUW02101SFLogic.chkPayInitialCost() [29 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02101SF.FUW02101SFLogic` |
| Layer | WebLogic (Service/Web View Layer) |
| Module | `FUW02101SF` (Package: `eo.web.webview.FUW02101SF`) |

## 1. Role

### FUW02101SFLogic.chkPayInitialCost()

This method determines whether a customer's service contract incurs an initial fee (initial setup charge) by inspecting the structure of the output map built during price area processing. In the context of the FUW02101SF web screen — which handles internet mansion (NTT apartment building) service contract detail confirmation — the system populates the output map with price area beans from sub-operation service calls. The method checks whether the price area data (keyed under `FUSV005101CC`) contains a populated child list (`EKK0721A010CBSMsg1List`). A non-empty child list signals that the pricing engine has returned line items carrying an initial fee. This boolean result is consumed by the caller `getMansionDiv` to decide whether to display mansion-specific UI sections (via the `MANSION_DIV` message flag). The method implements a simple conditional-inspection pattern, acting as a read-only gate that inspects pre-populated output data without invoking any database or CBS calls.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["chkPayInitialCost outputMap"])
    INIT["res = false
parentMap = null"]
    COND1{"outputMap contains CC_TITLE_FUSV005101"}
    GET_MAP["parentMap = outputMap.get FUSV005101CC"]
    COND2{"parentMap != null AND contains EKK0721A010_LIST"}
    GET_LIST["childList = parentMap.get EKK0721A010CBSMsg1List"]
    COND3{"childList != null AND size greater than 0"}
    SET_TRUE["res = true"]
    SET_FALSE["res = false"]
    RETURN["return res"]

    START --> INIT
    INIT --> COND1
    COND1 -- true --> GET_MAP
    COND1 -- false --> RETURN
    GET_MAP --> COND2
    COND2 -- true --> GET_LIST
    COND2 -- false --> RETURN
    GET_LIST --> COND3
    COND3 -- true --> SET_TRUE
    COND3 -- false --> SET_FALSE
    SET_TRUE --> RETURN
    SET_FALSE --> RETURN
```

**Constant Resolution:**
- `CC_TITLE_FUSV005101` = `"FUSV005101CC"` — the map key under which price area beans from sub-operation service `FUSV005101SC` (Price Area — Sub Option Service Agreement) are stored.
- `EKK0721A010_LIST` = `"EKK0721A010CBSMsg1List"` — the map key for the child detail list containing individual pricing line items (returned by CBS `EKK0721A010CBS`).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `outputMap` | `HashMap` | The response output map populated by prior sub-operation service calls in the FUW02101SF screen processing. It carries price area data beans keyed by constant identifiers. Specifically, this method looks for the `FUSV005101CC` key which holds parent pricing area data, and within that, the `EKK0721A010CBSMsg1List` key which holds a list of child pricing line items. If the child list is non-empty, it indicates that initial fee line items exist for the current service contract. |

**Instance fields / external state read:** None. This method is purely stateless and reads only from the parameter.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations**. It is a pure inspection/read method that examines the structure of an in-memory HashMap. No database queries, CBS calls, or entity operations are invoked.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(none)* | — | — | — | This method inspects only the outputMap structure; no data access occurs. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:FUW02101SF | `doService()` → `getMansionDiv()` → `chkPayInitialCost()` | *(no terminal — pure map inspection)* |

**Caller details:**
- `getMansionDiv()` (same class, line 847) calls `chkPayInitialCost(outputMap)` as part of a compound condition that also checks `chkPayKoteiTanka(bean)` for fixed unit price determination. The result influences the `MANSION_DIV` flag which controls mansion-specific UI display for internet mansion contracts.
- `getMansionDiv()` is called from `doService()` (line 189) which is the main service processing entry point of the FUW02101SF screen.

No other external callers exist. The method is private and only used internally within `FUW02101SFLogic`.

## 6. Per-Branch Detail Blocks

**Block 1** — [ASSIGNMENT] (L998)

> Initializes local variables before inspection.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false` | // Default: no initial fee |
| 2 | SET | `parentMap = null` | // Holds the price area parent map if found |

**Block 2** — [IF] `(outputMap.containsKey(CC_TITLE_FUSV005101))` `[CC_TITLE_FUSV005101 = "FUSV005101CC"]` (L1000)

> Checks whether the output map contains price area parent data from sub-operation service FUSV005101SC.

| # | Type | Code |
|---|------|------|
| 1 | SET | `parentMap = (HashMap)outputMap.get(CC_TITLE_FUSV005101)` | // Cast and retrieve the price area parent map. If the key does not exist, parentMap remains null and the method returns false. |

**Block 2.1** — [ELSE: implicit] — parentMap remains null (L1000)

> If the key is absent, `parentMap` stays null. Control falls through to Block 3's condition.

**Block 3** — [IF] `(null != parentMap && parentMap.containsKey(EKK0721A010_LIST))` `[EKK0721A010_LIST = "EKK0721A010CBSMsg1List"]` (L1005)

> Validates that the parent map is non-null AND contains the child detail list key. The child list holds individual pricing line items returned by CBS EKK0721A010CBS.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childList = (ArrayList)parentMap.get(EKK0721A010_LIST)` | // Cast and retrieve the child pricing list. |

**Block 3.1** — [ELSE: implicit] — condition fails (L1005)

> When either `parentMap` is null or the child list key is absent, `res` remains `false` (no initial fee). Control falls through to Block 5 (return).

**Block 4** — [IF] `(childList != null && childList.size() > 0)` (L1008)

> Checks whether the child pricing list is non-null and contains at least one entry. A non-empty list indicates the presence of initial fee line items.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = true` | // Initial fee exists — set flag. Comment: 初期費用がある場合（無料表示設定) — "Case with initial fee (free display setting)" |

**Block 4.1** — [ELSE] (L1012)

> The child list is either null or empty, meaning no initial fee line items were returned.

| # | Type | Code |
|---|------|------|
| 1 | SET | `res = false` | // No initial fee. Comment: 初期費用がない場合 — "Case without initial fee" |

**Block 5** — [RETURN] (L1017)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return res` | // true = initial fee exists / false = no initial fee |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `chkPayInitialCost` | Method | Check whether an initial setup fee (initial cost) applies to the service contract |
| `CC_TITLE_FUSV005101` | Constant | Map key `"FUSV005101CC"` — identifier for price area parent data from sub-operation service FUSV005101SC |
| `EKK0721A010_LIST` | Constant | Map key `"EKK0721A010CBSMsg1List"` — identifier for child pricing line item list returned by CBS EKK0721A010CBS |
| `FUSV005101SC` | SC Code | Price Area — Sub Option Service Agreement service component. Retrieves pricing area bean data. |
| `EKK0721A010CBS` | CBS Code | Child pricing detail CBS. Returns individual pricing line items including initial fee entries. |
| `outputMap` | Parameter | Response output map carrying processed pricing data from sub-operation service calls. |
| initial fee (初期費用) | Business term | One-time setup charge applied when a customer contracts internet mansion (NTT apartment building) services. The presence of child pricing list entries indicates this fee applies. |
| `getMansionDiv` | Method | Determines whether to display the mansion division section (true = mansion/all-at-once payment, false = otherwise). Uses `chkPayInitialCost` as one of its gating conditions. |
| `MANSION_DIV` | Field/Flag | Mansion division flag. `true` indicates internet mansion (NTT apartment building) type; `false` indicates non-mansion or all-at-once payment scenarios. |
| `doService` | Method | Main service processing entry point of the FUW02101SF web screen. Orchestrates sub-operation calls and bean population. |
| FUSV005101CC | Constant value | The string key under which price area beans are stored in the output map. Named after the sub-operation service FUSV005101SC. |
| EKK0721A010CBSMsg1List | Constant value | The string key for the child detail list containing individual pricing line items. Returns data from CBS EKK0721A010CBS. |
| NTT apartment building (マンション) | Business term | Multi-unit residential building in Japan managed by NTT; internet mansion refers to bundled internet service contracts for such buildings. |
| net mansion (ネットマンション) | Business term | Internet service plan type for NTT apartment buildings. Price group code `CD00133_04` identifies this type. |
