# Business Logic — FUW02101SFLogic.getMansionDiv() [28 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02101SF.FUW02101SFLogic` |
| Layer | Service (Webview Business Logic — `eo.web.webview` package under `koptWebF`) |
| Module | `FUW02101SF` (Package: `eo.web.webview.FUW02101SF`) |

## 1. Role

### FUW02101SFLogic.getMansionDiv()

The `getMansionDiv` method determines whether a current customer's service contract qualifies as an "eo Light Mansion Type" (eo光マンションタイプ) with whole-building bulk payment arrangements and applicable fees. It navigates a nested data-bean hierarchy — `CommonInfoBean` → `WEB_CHG_INFO` (WEB Change Info) → `GEN_CUST_KEI_INFO` (Current Customer Contract Info) → `SVC_KEI_INFO` (Service Contract Info) — to extract the price group code (`prcGrpCd`) and the contract payment method code (`kanyuKeiPayHoshikiCd`). The method implements a business guard: if the price group is "04" (eo Light Mansion Type) **and** the payment method is "003" (Whole-Building Bulk Contract) **and** either a fixed monthly unit price (`chkPayKoteiTanka`) or an initial charge (`chkPayInitialCost`) is payable, the method returns `false` to signal that this is **not** a plain-text-display mansion variant. In all other cases, it returns the default `false` (the mansion division flag remains unmodified). This method is invoked by `init()` and the result is stored in the `MANSION_DIV` output bean key, feeding downstream UI rendering logic that differentiates mansion-specific display modes.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getMansionDiv begins"])
    CHECK_COMMON(["Verify commoninfoBean is valid"])
    GET_WEB_CHG["Get WEB_CHG_INFO from commoninfoBean"]
    GET_GEN_CUST["Get GEN_CUST_KEI_INFO from webChgInfoBean"]
    GET_SVC_KEI["Get SVC_KEI_INFO from genCustKeiInfoBean"]
    GET_PRG["Get prcGrpCd - Price Group Code from svcKeiInfoBean"]
    GET_PAY["Get kanyuKeiPayHoshikiCd - Contract Payment Method Code from svcKeiInfoBean"]
    CHECK_PRG["prcGrpCd equals 04 - eoLight mansion type"]
    CHECK_PAY["kanyuKeiPayHoshikiCd equals 003 - whole-building bulk"]
    CHECK_FEES["chkPayKoteiTanka or chkPayInitialCost is true"]
    SET_FALSE["Set mansionDiv = false"]
    RETURN_FALSE(["Return false"])
    RETURN_DEFAULT(["Return mansionDiv = false default"])

    START --> CHECK_COMMON --> GET_WEB_CHG --> GET_GEN_CUST --> GET_SVC_KEI --> GET_PRG --> GET_PAY --> CHECK_PRG
    CHECK_PRG -- "Yes" --> CHECK_PAY
    CHECK_PRG -- "No" --> RETURN_DEFAULT
    CHECK_PAY -- "Yes" --> CHECK_FEES
    CHECK_PAY -- "No" --> RETURN_DEFAULT
    CHECK_FEES -- "Yes" --> SET_FALSE --> RETURN_FALSE
    CHECK_FEES -- "No" --> RETURN_DEFAULT
```

**CRITICAL — Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `CommonInfoCFConst.WEB_CHG_INFO` | `"WEB変更情報"` | WEB Change Info — the bean path to web modification data |
| `CommonInfoCFConst.GEN_CUST_KEI_INFO` | `"現顧客契約情報"` | Current Customer Contract Info — bean path to existing customer data |
| `CommonInfoCFConst.SVC_KEI_INFO` | `"サービス契約情報"` | Service Contract Info — bean path to service contract line items |
| `CommonInfoCFConst.PRC_GRP_CD_23` | `"料金グループコード"` | Price Group Code — field name to extract pricing group |
| `CommonInfoCFConst.KANYU_KEI_PAY_HOSHIKI_CD_23` | `"加入契約支払方式コード"` | Contract Payment Method Code — field name to extract payment type |
| `JFUStrConst.CD00133_04` | `"04"` | Code for "eo光マンションタイプ" (eo Light Mansion Type) |
| `JFUStrConst.CD01216_003` | `"003"` | Code for "全戸一括" (Whole-Building Bulk Contract) |
| `X31CWebConst.DATABEAN_GET_VALUE` | `"GET"` | Constant for reading a value from a data bean |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commoninfoBean` | `X31SDataBeanAccess` | The common information data bean holding the top-level shared context for the web screen. It contains nested sub-beans including `WEB_CHG_INFO` (web change/modification info), `GEN_CUST_KEI_INFO` (current customer contract info), and `SVC_KEI_INFO` (service contract info). This bean is the root of a nested hierarchy traversed to reach service-level pricing data. |
| 2 | `outputMap` | `HashMap<String, Object>` | A map used to pass data between processing stages. Specifically passed to `chkPayInitialCost()` to evaluate whether an initial charge (初期費用) is applicable. Contains fee-related context used by the cost-checking helper. |
| 3 | `bean` | `X31SDataBeanAccess` | The data bean associated with the current service contract context. Passed to `chkPayKoteiTanka()` to check whether a fixed monthly unit price (固定単価) is applicable. Contains service-level fields that determine fee eligibility. |

**Instance/External State:**
- `chkPayKoteiTanka(X31SDataBeanAccess)` — private helper method (same class) that checks whether a fixed monthly unit price is payable.
- `chkPayInitialCost(HashMap<String, Object>)` — private helper method (same class) that checks whether an initial charge is payable.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X31SDataBeanAccess.getDataBeanArray` | - | - | Bean hierarchy navigation — extracts sub-bean arrays from the common info bean. No DB interaction. |
| - | `X31SDataBeanAccess.getDataBean(int)` | - | - | Bean hierarchy navigation — retrieves the 0th element from a sub-bean array. No DB interaction. |
| - | `X31SDataBeanAccess.sendMessageString(String, String)` | - | - | Bean field accessor — reads string-typed field values (`PRC_GRP_CD_23`, `KANYU_KEI_PAY_HOSHIKI_CD_23`) from the service contract bean. No DB interaction. |
| - | `FUW02101SFLogic.chkPayKoteiTanka` | FUW02101SFLogic | - | Helper method call — evaluates whether a fixed monthly unit price (固定単価) is payable for the given service bean. |
| - | `FUW02101SFLogic.chkPayInitialCost` | FUW02101SFLogic | - | Helper method call — evaluates whether an initial charge (初期費用) is applicable from the output map context. |

**Notes:**
- This method performs **no direct database operations**. All data is sourced from in-memory data beans (X31SDataBeanAccess) that have already been populated by prior screen-mapping logic (e.g., `FUSV*OPDBMapper` classes).
- `chkPayKoteiTanka` and `chkPayInitialCost` are private helper methods in the same class that perform additional bean-level checks to determine fee eligibility. Their full CRUD impact depends on their internal implementations but they operate on the same in-memory bean structures.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `FUW02101SFLogic.init()` | `init()` → `getMansionDiv(commoninfoBean, outputMap, bean)` | `chkPayKoteiTanka [R] bean`, `chkPayInitialCost [R] outputMap` |

**Details:**
- The method `getMansionDiv` is called exactly once, from `init()` (line 189 of `FUW02101SFLogic.java`).
- `init()` is the screen initialization method for the `FUW02101SF` screen, which processes mansion (condominium) type service contracts.
- The result is stored as a boolean in `FUW02101SFConst.MANSION_DIV` ("マンション区分") on the output bean, controlling whether mansion-specific UI branches should be rendered.

## 6. Per-Branch Detail Blocks

**Block 1** — [VARIABLE DECLARATION] (L850)

> Initializes the mansion division flag to the default value `false`. This is the method's return variable, declared early so it can be reassigned in the conditional branch below.

| # | Type | Code |
|---|------|------|
| 1 | SET | `boolean mansionDiv = false;` // Default: not a plain-text mansion type |

**Block 2** — [BEAN TRAVERSAL] (L853–L857)

> Navigates the nested data-bean hierarchy from the common info bean down to the service contract bean. Each `.getDataBeanArray()` call extracts a named sub-bean collection, and `.getDataBean(0)` retrieves the first element.

| # | Type | Code |
|---|------|------|
| 1 | SET | `webChgInfoBean = commoninfoBean.getDataBeanArray(CommonInfoCFConst.WEB_CHG_INFO).getDataBean(0);` // WEB変更情報 (WEB Change Info) [-> "WEB変更情報"] |
| 2 | SET | `genCustKeiInfoBean = webChgInfoBean.getDataBeanArray(CommonInfoCFConst.GEN_CUST_KEI_INFO).getDataBean(0);` // 現顧客情報 (Current Customer Info) [-> "現顧客契約情報"] |
| 3 | SET | `svcKeiInfoBean = genCustKeiInfoBean.getDataBeanArray(CommonInfoCFConst.SVC_KEI_INFO).getDataBean(0);` // サービス契約情報 (Service Contract Info) [-> "サービス契約情報"] |

**Block 3** — [FIELD EXTRACTION] (L860–L864)

> Extracts two business-critical code values from the service contract bean: the price group code and the contract payment method code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prcGrpCd = svcKeiInfoBean.sendMessageString(CommonInfoCFConst.PRC_GRP_CD_23, X31CWebConst.DATABEAN_GET_VALUE);` // 料金グループコード (Price Group Code) [-> "料金グループコード"] |
| 2 | SET | `kanyuKeiPayHoshikiCd = svcKeiInfoBean.sendMessageString(CommonInfoCFConst.KANYU_KEI_PAY_HOSHIKI_CD_23, X31CWebConst.DATABEAN_GET_VALUE);` // 加入契約支払方式コード (Contract Payment Method Code) [-> "加入契約支払方式コード"] |

**Block 4** — [CONDITIONAL: price group code equals "04" (eo Light Mansion Type)] (L867)

> First condition of a three-part conjunction. Checks if the price group code is "04" which corresponds to JFUStrConst.CD00133_04 = "04" (eo光マンションタイプ = eo Light Mansion Type). This is the primary classification that identifies a mansion (condominium) service type.

| # | Type | Code |
|---|------|------|
| 1 | COND | `JFUStrConst.CD00133_04.equals(prcGrpCd)` // [-> CD00133_04="04"] price group is eo Light Mansion Type |

**Block 4.1** — [NESTED CONDITIONAL: payment method code equals "003" (Whole-Building Bulk)] (L868)

> Second condition: verifies that the payment method is "003" which corresponds to JFUStrConst.CD01216_003 = "003" (全戸一括 = Whole-Building Bulk Contract). This identifies a multi-unit condominium where a single payment covers all units.

| # | Type | Code |
|---|------|------|
| 1 | COND | `JFUStrConst.CD01216_003.equals(kanyuKeiPayHoshikiCd)` // [-> CD01216_003="003"] whole-building bulk payment method |

**Block 4.1.1** — [NESTED CONDITIONAL: fees are payable] (L868–L869)

> Third condition: either the fixed monthly unit price is payable OR the initial charge is payable. These are checked via the private helper methods `chkPayKoteiTanka(bean)` and `chkPayInitialCost(outputMap)`. If any fee is applicable, this innermost condition evaluates to true.

| # | Type | Code |
|---|------|------|
| 1 | COND | `chkPayKoteiTanka(bean)` // Fixed monthly unit price (固定単価) is payable |
| 2 | COND | `chkPayInitialCost(outputMap)` // Initial charge (初期費用) is payable |
| 3 | OR | Either condition from 4.1.1.1 or 4.1.1.2 is true |

**Block 4.1.1.1** — [IF TRUE: set mansionDiv = false] (L871)

> All three conditions are met: (a) price group is "04" (eo Light Mansion Type), (b) payment method is "003" (Whole-Building Bulk), and (c) a fee (fixed unit price or initial charge) is payable. In this case, the method sets `mansionDiv = false`. The Japanese comment `（文言非表示設定）` translates to "(non-plain-text display setting)". This indicates the system should NOT use plain-text display for this mansion type — likely because mansion-type contracts require special rendering/formatting due to their bulk-structure.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mansionDiv = false;` // （文言非表示設定）- Non-plain-text display setting |

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

> Returns the `mansionDiv` value. If none of the conditions were met, the variable remains `false` (its default). If all conditions were met, it is explicitly set to `false` in Block 4.1.1.1. In both paths, the method returns `false` in the current implementation.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return mansionDiv;` // false in all execution paths |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `prcGrpCd` | Field | Price Group Code — classifies the pricing group of a service contract (e.g., "01" = eo64 Area, "02" = eo Light Home Type, "04" = eo Light Mansion Type, "05" = eo ADSL) |
| `kanyuKeiPayHoshikiCd` | Field | Contract Payment Method Code — classifies how a new customer contract is paid (e.g., "001" = Base, "002" = Individual, "003" = Whole-Building Bulk, "004" = Resident Bulk) |
| `WEB_CHG_INFO` | Field | WEB Change Info — bean path key for web modification/change data |
| `GEN_CUST_KEI_INFO` | Field | Current Customer Contract Info — bean path key for existing customer contract data |
| `SVC_KEI_INFO` | Field | Service Contract Info — bean path key for service contract line item data |
| `MANSION_DIV` | Field | Mansion Division — output flag indicating whether the service is a mansion (condominium) type requiring special display handling |
| `CD00133_04` | Constant | "04" — Code for eo Light Mansion Type (eo光マンションタイプ), a fiber-optic broadband service for multi-unit residential buildings |
| `CD01216_003` | Constant | "003" — Code for Whole-Building Bulk Contract (全戸一括), where a single payment covers all units in a condominium |
| `DATABEAN_GET_VALUE` | Constant | "GET" — Parameter value to read a field from a data bean |
| `chkPayKoteiTanka` | Method | Checks whether a fixed monthly unit price (固定単価) is payable for the service |
| `chkPayInitialCost` | Method | Checks whether an initial charge (初期費用) is applicable for the service |
| eo光マンションタイプ | Business term | eo Light Mansion Type — NTT FLET'S fiber-optic broadband service tailored for multi-unit residential (mansion/condominium) buildings |
| 全戸一括 | Business term | Whole-Building Bulk — a payment method where all units in a condominium building are covered under a single service contract/payment |
| 固定単価 | Business term | Fixed Monthly Unit Price — a recurring monthly fee with a fixed rate (as opposed to usage-based billing) |
| 初期費用 | Business term | Initial Charge — one-time setup/installation fee for a service contract |
| 文言非表示設定 | Business term | Non-plain-text display setting — a UI configuration flag indicating that the system should use special/format-based display rather than raw text |
| X31SDataBeanAccess | Technical | X31 Framework data bean access class — the standardized bean structure for passing screen-level data between mapper and logic layers |
| FUW02101SF | Module | Screen module for mansion-type service contract processing (F = front-screen, W = web, 02101 = screen ID, SF = screen flow) |
