# Business Logic — FUW02001SFLogic.getMansionDiv() [27 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02001SF.FUW02001SFLogic` |
| Layer | Service (Web Logic) |
| Module | `FUW02001SF` (Package: `eo.web.webview.FUW02001SF`) |

## 1. Role

### FUW02001SFLogic.getMansionDiv()

This method determines whether the current service contract is for a **Mansion (Full-Unit Bundle)** — a special housing type where an entire apartment building is subscribed collectively under a single service agreement (マンション全戸一括). It acts as a business classification utility called during the initialization phase of the Mail Alias Settings Application screen (FUW02001), where it is invoked by `init()` to set the `MANSION_DIV` flag on the service form bean. This flag controls downstream UI behavior, pricing display logic, and eligibility rules specific to full-unit mansion subscriptions. The method navigates through a nested bean hierarchy — starting from the common info bean, traversing into web change info, then to existing customer contract info, and finally to service contract info — to extract two key code values: the **fee group code** and the **contract payment method code**. It then evaluates a compound condition: the fee group must be "04" (eo Hikari Net Mansion Type), the contract payment method must be "003" (Full-Unit Bundle), and the `payFlag` (indicating the presence of paid fees such as fixed unit price or initial charges) must be true. Only when all three conditions hold does the method return `true`, signaling that the current subscription is a full-unit mansion subscription with applicable charges. The method returns `false` in all other cases, covering single-family homes, non-full-unit apartments, ADSL, mobile, and other service types.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getMansionDiv"])
    
    step6["Initialize mansionDiv = false"]
    
    step1["Extract WEB_CHG_INFO from commoninfoBean"]
    step2["Extract GEN_CUST_KEI_INFO from webChgInfoBean"]
    step3["Extract SVC_KEI_INFO from genCustKeiInfoBean"]
    step4["Get prcGrpCd from svcKeiInfoBean"]
    step5["Get kanyuKeiPayHoshikiCd from svcKeiInfoBean"]
    
    cond1{prcGrpCd=04<br/>AND<br/>kanyuKeiPayHoshikiCd=003<br/>AND<br/>payFlag}
    
    trueBranch["Set mansionDiv = true"]
    
    ret["Return mansionDiv"]
    END(["Return Boolean"])
    
    START --> step6
    step6 --> step1
    step1 --> step2
    step2 --> step3
    step3 --> step4
    step4 --> step5
    step5 --> cond1
    cond1 -->|true| trueBranch
    cond1 -->|false| ret
    trueBranch --> ret
    ret --> END
```

**CRITICAL — Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|-----------------|
| `JFUStrConst.CD00133_04` | `"04"` | Fee Group Code: eo Hikari Net Mansion Type (eo光ネットマンションタイプ) |
| `JFUStrConst.CD01216_003` | `"003"` | Contract Payment Method Code: Full-Unit Bundle (全戸一括) |

**Processing Steps:**

1. **Initialize** — The method begins by setting `mansionDiv` to `false`, establishing a default outcome for all non-mansion or non-full-unit-subscription scenarios.

2. **Navigate Bean Hierarchy** — The method traverses three levels of nested data beans:
   - Extract `WEB_CHG_INFO` (Web Change Information) from the root `commoninfoBean`
   - Extract `GEN_CUST_KEI_INFO` (Existing Customer Contract Information) from the web change info bean
   - Extract `SVC_KEI_INFO` (Service Contract Information) from the existing customer contract info bean

3. **Extract Fee Group Code** — From the service contract info bean, retrieve `PRC_GRP_CD_23` (Fee Group Code at path index 23). This code identifies the type of service/fee grouping (e.g., eo Hikari Net Mansion Type, eo Hikari Net Home Type, eo ADSL, eo Mobile, etc.).

4. **Extract Contract Payment Method Code** — From the same service contract info bean, retrieve `KANYU_KEI_PAY_HOSHIKI_CD_23` (Contract Payment Method Code at path index 23). This code identifies whether the subscription is a full-unit bundle (all units in a building subscribed together), resident bundle, individual, or base.

5. **Evaluate Compound Condition** — Check if all three conditions are met simultaneously:
   - `prcGrpCd` equals `"04"` (eo Hikari Net Mansion Type)
   - `kanyuKeiPayHoshikiCd` equals `"003"` (Full-Unit Bundle)
   - `payFlag` is `true` (indicating paid fees such as fixed unit price or initial charges are applicable)

6. **Set Result** — If all conditions are met, set `mansionDiv` to `true`. Otherwise, it retains the default `false` value.

7. **Return** — Return the `mansionDiv` boolean result to the caller.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commoninfoBean` | `X31SDataBeanAccess` | The root shared form data bean containing the full customer context hierarchy. It serves as the entry point to access nested data including web change information, existing customer contract details, and service contract information. This bean is passed down from the screen entry point and contains all shared state across the business logic flow. |
| 2 | `outputMap` | `HashMap<String, Object>` | A map used to pass output values and configuration data within the screen processing context. While this method reads data from the bean hierarchy rather than writing directly to this map, it is passed as a parameter to maintain consistency with the calling convention of other methods in the class (notably `init()` which uses it for pricing and mapping operations). |
| 3 | `payFlag` | `boolean` | A flag indicating whether the service has applicable paid charges (such as fixed unit price fees or initial setup fees). When `true`, it means the customer's subscription includes charges beyond free services. This flag is determined earlier in the `init()` method by calling `setPayFlg()`, which evaluates the pricing configuration for the current service. Combined with the mansion-type codes, it ensures that the mansion division flag is only set to `true` when the full-unit mansion has actual charges (not a promotional free plan). |

**External State / Instance Fields:**
None — this method is purely functional with no instance field dependencies.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `OneStopDataBeanAccessArray.getDataBean` | - | - | Retrieves the web change info data bean array from `commoninfoBean` using the `WEB_CHG_INFO` key, then extracts the first element (index 0). This navigates the bean hierarchy to reach the web-level change information container. |
| R | `OneStopDataBeanAccess.getDataBean` | - | - | Extracts the existing customer contract info data bean (index 0) from the web change info bean using the `GEN_CUST_KEI_INFO` key. This moves one level deeper in the shared bean hierarchy. |
| R | `OneStopDataBeanAccess.getDataBean` | - | - | Extracts the service contract info data bean (index 0) from the existing customer contract info bean using the `SVC_KEI_INFO` key. This reaches the leaf level where fee group and payment method codes are stored. |
| R | `OneStopDataBeanAccess.sendMessageString` | - | - | Reads the fee group code (`PRC_GRP_CD_23`) from the service contract info bean as a string value. This value identifies the service type (e.g., eo Hikari Net Mansion Type = "04"). |
| R | `OneStopDataBeanAccess.sendMessageString` | - | - | Reads the contract payment method code (`KANYU_KEI_PAY_HOSHIKI_CD_23`) from the service contract info bean as a string value. This value identifies the subscription form (e.g., Full-Unit Bundle = "003"). |

**Notes on Classification:**
- All operations are **Read (R)** — this method performs zero writes, creates, updates, or deletes. It is a pure classification/determination method.
- No SC codes (e.g., `EKK0361A010SC`) or database tables are involved. This method operates entirely in-memory on data beans that were previously populated by other service components.
- `sendMessageString` with `X31CWebConst.DATABEAN_GET_VALUE` is a data bean accessor — it retrieves a string field value from the bean at a specific path/key.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.

The method is called exclusively from within the same class, during the initialization phase of the Mail Alias Settings Application screen.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | FUW02001SFLogic.init() | `FUW02001SFLogic.init()` -> `getMansionDiv(commoninfoBean, outputMap, payFlag)` | `sendMessageString` [R] prcGrpCd, `sendMessageString` [R] kanyuKeiPayHoshikiCd, `getDataBean` [R] WEB_CHG_INFO, `getDataBean` [R] GEN_CUST_KEI_INFO, `getDataBean` [R] SVC_KEI_INFO |

**Caller Details:**
- `FUW02001SFLogic.init()` is the initialization method of the same logic class, invoked when the Mail Alias Settings Application (FUW02001) screen is first displayed. During `init()`, after setting up pricing information and determining the registration/change division flag, `getMansionDiv()` is called to determine the mansion division flag (`MANSION_DIV`) which is then written to the service form bean. This flag is subsequently used by the view layer to conditionally render mansion-specific UI elements, pricing tables, and eligibility indicators.

**Note:** Other classes (`FUW10721SFLogic`, `FUW10801SFLogic`, `FUW03701SFLogic`, `FUW04001SFLogic`) each have their own similarly-named `getMansionDiv` method (different signatures and implementations) for their respective screens. These are not callers of this method but independent implementations in different logic classes.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(Initialize default value)` (L687)

> Sets the default return value to `false`. This represents the assumption that the subscription is NOT a full-unit mansion, which is the correct default for single-family homes, non-full-unit apartments, ADSL, mobile, and other service types.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Boolean mansionDiv = false` // Default: not a mansion full-unit bundle |

**Block 2** — [EXEC] `(Extract WEB_CHG_INFO from commoninfoBean)` (L690)

> Navigates the first level of the bean hierarchy to retrieve web change information. This is the container for all web-form-related data that has been modified during the current session.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X31SDataBeanAccess webChgInfoBean = commoninfoBean.getDataBeanArray(CommonInfoCFConst.WEB_CHG_INFO).getDataBean(0)` // WEB Change Information |

**Block 3** — [EXEC] `(Extract GEN_CUST_KEI_INFO from webChgInfoBean)` (L692)

> Navigates to the second level — existing customer contract information. This contains the contractual relationship data for customers who already have active subscriptions with the provider.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X31SDataBeanAccess genCustKeiInfoBean = webChgInfoBean.getDataBeanArray(CommonInfoCFConst.GEN_CUST_KEI_INFO).getDataBean(0)` // Existing Customer Contract Information |

**Block 4** — [EXEC] `(Extract SVC_KEI_INFO from genCustKeiInfoBean)` (L694)

> Navigates to the third and final level — service contract information. This is the deepest level in the bean hierarchy and contains the specific service-level details including fee group codes and payment method codes.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X31SDataBeanAccess svcKeiInfoBean = genCustKeiInfoBean.getDataBeanArray(CommonInfoCFConst.SVC_KEI_INFO).getDataBean(0)` // Service Contract Information |

**Block 5** — [EXEC] `(Get prcGrpCd from svcKeiInfoBean)` (L697)

> Reads the fee group code from the service contract info bean. This code determines the type of service product. The constant `PRC_GRP_CD_23` refers to path index 23 in the bean structure.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `String prcGrpCd = svcKeiInfoBean.sendMessageString(CommonInfoCFConst.PRC_GRP_CD_23, X31CWebConst.DATABEAN_GET_VALUE)` // Fee Group Code |

**Block 6** — [EXEC] `(Get kanyuKeiPayHoshikiCd from svcKeiInfoBean)` (L699)

> Reads the contract payment method code from the service contract info bean. This code identifies how the building/apartment units are subscribed — full-unit bundle, resident bundle, or individual. The constant `KANYU_KEI_PAY_HOSHIKI_CD_23` refers to path index 23.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `String kanyuKeiPayHoshikiCd = svcKeiInfoBean.sendMessageString(CommonInfoCFConst.KANYU_KEI_PAY_HOSHIKI_CD_23, X31CWebConst.DATABEAN_GET_VALUE)` // Contract Payment Method Code |

**Block 7** — [IF] `(Compound condition check: Mansion Type AND Full-Unit Bundle AND Paid)` (L702)

> Evaluates whether the subscription qualifies as a full-unit mansion subscription with applicable charges. Three conditions must ALL be true:
> - `prcGrpCd` equals `"04"` (eo Hikari Net Mansion Type) — resolved from `JFUStrConst.CD00133_04`
> - `kanyuKeiPayHoshikiCd` equals `"003"` (Full-Unit Bundle) — resolved from `JFUStrConst.CD01216_003`
> - `payFlag` is `true` (paid fees are applicable)

| # | Type | Code |
|---|------|------|
| 1 | IF | `JFUStrConst.CD00133_04.equals(prcGrpCd)` // Fee Group Code = "04" (eo Hikari Net Mansion Type) [-> JFUStrConst.CD00133_04="04"] |
| 2 | AND | `JFUStrConst.CD01216_003.equals(kanyuKeiPayHoshikiCd)` // Contract Payment Method = "003" (Full-Unit Bundle) [-> JFUStrConst.CD01216_003="003"] |
| 3 | AND | `payFlag` // Paid flag is true (fixed unit price or initial fees applicable) |

**Block 7.1** — [ELSE-IF / TRUE BRANCH] `(All conditions met)` (L704)

> When all three conditions are satisfied, the subscription is confirmed as a full-unit mansion subscription. Set the result flag to `true`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mansionDiv = true` // Confirmed: Mansion (Full-Unit Bundle) |

**Block 8** — [RETURN] `(Return result)` (L707)

> Returns the computed `mansionDiv` flag. `true` indicates a full-unit mansion subscription with applicable charges; `false` covers all other cases including single-family homes, non-full-unit apartments, ADSL, mobile, free plans, and other service types.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return mansionDiv` // true = Mansion (Full-Unit Bundle), false = Non-Mansion or Non-Full-Unit-Bundle |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mansionDiv` | Field | Mansion Division Flag — boolean indicator of whether the current subscription is a full-unit mansion (マンション全戸一括) type. `true` = full-unit mansion; `false` = all other types. |
| `prcGrpCd` | Field | Payment Group Code — identifies the fee grouping for the service product (e.g., eo Hikari Net Mansion, Home, ADSL, Mobile). |
| `kanyuKeiPayHoshikiCd` | Field | Contract Payment Method Code — identifies how units in a building subscribe: full-unit bundle (all units together), resident bundle, individual, or base. |
| `payFlag` | Field | Payment Flag — indicates whether the service has applicable paid charges (fixed unit price, initial setup fees). Derived from pricing evaluation in `setPayFlg()`. |
| `WEB_CHG_INFO` | Field | Web Change Information — the data container for web-form modification data carried in the shared form bean hierarchy. |
| `GEN_CUST_KEI_INFO` | Field | Existing Customer Contract Information — contract details for customers with active existing subscriptions (as opposed to new customer registrations). |
| `SVC_KEI_INFO` | Field | Service Contract Information — the service-level contract data including product codes, fee group codes, and payment method codes. |
| `PRC_GRP_CD_23` | Field | Fee Group Code at path index 23 — the bean path key for retrieving the fee group classification. |
| `KANYU_KEI_PAY_HOSHIKI_CD_23` | Field | Contract Payment Method Code at path index 23 — the bean path key for retrieving the subscription form code. |
| `CD00133_04` | Constant | Fee Group Code "04" — eo Hikari Net Mansion Type (eo光ネットマンションタイプ). Refers to fiber optic service subscriptions for apartment buildings. |
| `CD01216_003` | Constant | Contract Payment Method Code "003" — Full-Unit Bundle (全戸一括). All units in a building are subscribed under a single collective contract. |
| `MANSION_DIV` | Field | Mansion Division data bean key — the bean field name used to store the mansion division flag result for UI consumption. |
| MANSION | Business term | Apartment/Condominium building — in this context, refers to multi-unit residential buildings with collective internet service subscriptions. |
| Full-Unit Bundle | Business term | 全戸一括 (Zen-Koto Ikkatsu) — a subscription model where all units in a building are subscribed collectively under one contract, as opposed to each unit subscribing individually. |
| eo Hikari Net | Business term | eo光ネット — K-Opticom's fiber-optic broadband internet service. Mansion Type specifically refers to the building-wide fiber installation variant. |
| X31SDataBeanAccess | Technical | The data bean access wrapper class used throughout the eo customer base system to navigate and retrieve data from the shared form bean hierarchy. |
| X31CWebConst.DATABEAN_GET_VALUE | Constant | The accessor constant used to read a value from a data bean via `sendMessageString`. |
| init() | Method | The screen initialization method of `FUW02001SFLogic` that sets up all initial data, pricing, and flags (including `MANSION_DIV`) when the Mail Alias Settings Application screen is displayed. |
| FUW02001SF | Module | Mail Alias Settings Application — the screen/module for configuring and applying mail alias settings for customers. |
| MAIL_ALIAS | Business term | メールエイリアス — an email forwarding/aliasing service that allows customers to use alternative email addresses that forward to their primary mailbox. |
