# Business Logic — FUW02601SFLogic.getMansionDiv() [62 LOC]

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

## 1. Role

### FUW02601SFLogic.getMansionDiv()

This method determines whether a subscriber's property qualifies as a **Mansion Division (マンション区分)** — a bundled property-level fiber-optic service type for multi-unit residential buildings (apartments/condominiums) under **eo Light Net** — and whether the subscription generates charges requiring payment. The business context is a mass-market broadband offering deployed in apartment complexes, where the ISP negotiates a single contract covering all units (全戸一括 — "all-household lump-sum billing") under a specific price group.

The method implements a **guard-check / flag-determination pattern**. It navigates through a hierarchical data-bean structure (`commoninfoBean` → WEB Change Info → Current Customer Contract Info → Service Contract Info) to extract the **price group code** and **payment method code**, verifying they match the mansion-type profile (price group code `"04"` for *eo Light Net Mansion Type*, payment method `"003"` for *All-Units Lump Sum*). If the subscription matches this profile, it then evaluates financial indicators — **mailing list stock count** relative to **free option service count**, and **unit price (tanka)** — to decide whether the mansion flag should be set to `true`.

Additionally, it inspects the `outputMap` for **temporary payment charge details** (一時払料金) associated with the `FUSV006001CC` component. If an initial fee has been incurred (non-empty temporary payment list), the mansion flag is set to `true` regardless of the stock count check, ensuring customers with setup fees are correctly flagged.

The method returns `true` when: the subscription is mansion-type (all-household lump-sum) AND either (a) the customer has exhausted free mailing list stock with a positive unit price, OR (b) initial fees have been incurred. It returns `false` for non-mansion subscriptions or mansion subscriptions with no charges. This flag is consumed by calling code to drive UI rendering, pricing display logic, and eligibility determination for mansion-specific features.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getMansionDiv commoninfoBean, bean, outputMap"])
    START --> INIT["mansionDiv = false"]

    INIT --> NAV1["Extract WEB_CHG_INFO from commoninfoBean.getDataBeanArray()"]
    NAV1 --> NAV2["Extract GEN_CUST_KEI_INFO from webChgInfoBean.getDataBeanArray()"]
    NAV2 --> NAV3["Extract SVC_KEI_INFO from genCustKeiInfoBean.getDataBeanArray()"]
    NAV3 --> NAV4["Get freeValue from bean MRYO_OP_SVC_CNT"]
    NAV4 --> NAV5["Get nowMllistStkuCnt from bean NOW_MLLIST_STKU_CNT"]
    NAV5 --> NAV6["Get tanka from bean PPLAN_KOTEI_AMNT"]
    NAV6 --> NAV7["Get prcGrpCd from svcKeiInfoBean PRC_GRP_CD_23"]
    NAV7 --> NAV8["Get kanyuKeiPayHoshikiCd from svcKeiInfoBean KANYU_KEI_PAY_HOSHIKI_CD_23"]
    NAV8 --> COND1{prcGrpCd = CD00133_04 and kanyuKeiPayHoshikiCd = CD01216_003?}
    COND1 -->|No| RET_MFALSE["mansionDiv = false"]
    COND1 -->|Yes| PARENT["parentMap = null, childList = null"]
    PARENT --> CHECK_MAP{outputMap.containsKey CC_TITLE_FUSV006001?}
    CHECK_MAP -->|Yes| GET_PARENT["parentMap = outputMap.get CC_TITLE_FUSV006001"]
    CHECK_MAP -->|No| CHECK_CHILD
    GET_PARENT --> CHECK_CHILD{parentMap != null and contains EKK0721A010CBSMSG1LIST?}
    CHECK_CHILD -->|Yes| GET_CHILD["childList = parentMap.get EKK0721A010CBSMSG1LIST"]
    CHECK_CHILD -->|No| CHECK_STOCK
    GET_CHILD --> CHECK_STOCK{nowMllistStkuCnt >= freeValue and tanka > 0?}
    CHECK_STOCK -->|Yes| SET_TRUE["mansionDiv = true"]
    CHECK_STOCK -->|No| CHECK_CHILD_LIST{childList != null and childList.size > 0?}
    CHECK_CHILD_LIST -->|Yes| SET_TRUE_CHILD["mansionDiv = true initial fee incurred"]
    CHECK_CHILD_LIST -->|No| SET_FALSE["mansionDiv = false"]
    SET_TRUE --> RET["return mansionDiv"]
    SET_TRUE_CHILD --> RET
    SET_FALSE --> RET
    RET_MFALSE --> RET

    classDef startend fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef process fill:#e1f5e1,stroke:#333,stroke-width:1px
    classDef decision fill:#fff3e0,stroke:#f57c00,stroke-width:2px
    classDef return fill:#e1bee7,stroke:#333,stroke-width:2px
    class START,RET startend
    class INIT,NAV1,NAV2,NAV3,NAV4,NAV5,NAV6,NAV7,NAV8,PARENT,GET_PARENT,GET_CHILD,SET_TRUE,SET_TRUE_CHILD,SET_FALSE process
    class COND1,CHECK_MAP,CHECK_CHILD,CHECK_STOCK,CHECK_CHILD_LIST decision
    class RET_MFALSE return
```

**Branch summary:**

1. **Outer guard (L593–594):** `prcGrpCd = "04"` (eo Light Net Mansion Type) **AND** `kanyuKeiPayHoshikiCd = "003"` (All-Units Lump Sum). If either code differs, the method skips the mansion logic entirely and returns `false`. This ensures only subscriptions matching the exact mansion-bundle profile proceed.

2. **Parent map extraction (L619–621):** If `outputMap` contains the key `"FUSV006001CC"`, retrieves the parent HashMap. This key links to the `FUSV0060` component's title data.

3. **Child list extraction (L624–626):** If `parentMap` is non-null and contains the key for temporary payment charges (`"一時払料金一括照"`), retrieves the ArrayList of temporary payment details.

4. **Stock count check (L630–632):** Compares `nowMllistStkuCnt` (current mailing list stock count) against `freeValue` (free option service count). If stock count meets or exceeds the free allowance AND `tanka` (unit price) is positive, sets `mansionDiv = true`. This indicates the customer has exhausted free services and incurs charges.

5. **Initial fee check (L634–637):** If the stock count check fails, checks whether `childList` (temporary payment charges) is non-null and non-empty. If initial fees have been incurred, still flags as mansion (`true`).

6. **Default (L639–640):** If neither financial indicator triggers, `mansionDiv = false`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commoninfoBean` | `X31SDataBeanAccess` | Shared common information bean containing the hierarchical data structure for the current session. Navigated through nested layers: **WEB Change Info** → **Current Customer Contract Info** → **Service Contract Info** to extract price group and payment method codes. Represents the global context for the screen session. |
| 2 | `bean` | `X31SDataBeanAccess` | Screen-specific data bean holding Mansion-type subscription parameters. Used to query the **free option service count** (`MRYO_OP_SVC_CNT`), **current mailing list stock count** (`NOW_MLLIST_STKU_CNT`), and **price plan fixed amount / unit price** (`PPLAN_KOTEI_AMNT`). Determines whether the subscriber has exhausted free services or has a positive unit price. |
| 3 | `outputMap` | `HashMap<String, Object>` | Output data map shared across components. Checked for the presence of `CC_TITLE_FUSV006001` (key `"FUSV006001CC"`) to access the parent map, which may contain temporary payment charge details (`EKK0721A010CBSMSG1LIST`). Used to detect if initial setup fees have been incurred. |

**Referenced instance fields / constants (local to `FUW02601SFLogic`):**

| Field / Constant | Type | Value | Business Meaning |
|-----------------|------|-------|------------------|
| `CC_TITLE_FUSV006001` | `String` | `"FUSV006001CC"` | Key referencing the FUSV006001 component title data within `outputMap` |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `X31SDataBeanAccess.getDataBeanArray` | - | - | Reads WEB_CHG_INFO nested data bean array from commoninfoBean |
| R | `X31SDataBeanAccess.getDataBean` | - | - | Reads specific data bean at index 0 from the array (WEB change info → current customer contract → service contract) |
| R | `X31SDataBeanAccess.sendMessageLong` | - | - | Queries bean for free option service count, mailing list stock count, and price plan fixed amount values |
| R | `X31SDataBeanAccess.sendMessageString` | - | - | Queries service contract info for price group code (PRC_GRP_CD_23) and subscription payment method code (KANYU_KEI_PAY_HOSHIKI_CD_23) |
| R | `HashMap.containsKey` | - | - | Checks if outputMap contains the FUSV006001CC component key |
| R | `HashMap.get` | - | - | Retrieves parentMap and childList (temporary payment charge details) from outputMap |
| R | `ArrayList.size` | - | - | Checks if temporary payment charge list is non-empty |

**Note:** This method performs **purely read operations** (R). It navigates in-memory data-bean structures to extract business flags. It does not invoke any Service Component (SC) or CBS layer methods, does not execute database operations, and does not perform C/U/D operations. It is a **read-only flag determination method** operating entirely on data already loaded in the session.

## 5. Dependency Trace

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

**Notes:**
- This method is called privately by `FUW02601SFLogic.init()` within the same class.
- No screen/batch entry points (e.g., `KKSV*` screens) invoke this method directly — it is an internal logic helper consumed by the `init()` method of the same class.
- The `FUW02601SF` module corresponds to the Mansion (マンション) screen, handling property-bundled broadband subscription flows.
- All terminal operations are read-only bean queries — no SC/CBS or database layer is reached from this method.

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L588)

> Initialize the mansion flag to `false` as the default.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mansionDiv = false` |

**Block 2** — [DATA NAVIGATION] (L590–592)

> Navigate the hierarchical data-bean structure to extract service contract info. The bean hierarchy is: `commoninfoBean` → WEB Change Info → Current Customer Contract Info → Service Contract Info.

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

**Block 3** — [VALUE EXTRACTION FROM BEAN] (L595–598)

> Extract three numeric values from the screen-specific bean: free option service count, current mailing list stock count, and unit price.

| # | Type | Code |
|---|------|------|
| 1 | SET | `freeValue = bean.sendMessageLong(FUW02601SFConst.MRYO_OP_SVC_CNT, X31CWebConst.DATABEAN_GET_VALUE).intValue()` // 無料オプションサービス数 [Free Option Service Count] |
| 2 | SET | `nowMllistStkuCnt = bean.sendMessageLong(FUW02601SFConst.NOW_MLLIST_STKU_CNT, X31CWebConst.DATABEAN_GET_VALUE).intValue()` // 現在のメーリングリスト取得数 [Current Mailing List Stock Count] |
| 3 | SET | `tanka = bean.sendMessageLong(FUW02601SFConst.PPLAN_KOTEI_AMNT, X31CWebConst.DATABEAN_GET_VALUE).intValue()` // 料金プラン固定金額 [Price Plan Fixed Amount / Unit Price] |

**Block 4** — [CODE EXTRACTION FROM SERVICE CONTRACT] (L601–603)

> Extract the price group code and payment method code from service contract info to identify the subscription type.

| # | 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)` // 加入契約支払方式コード [Subscription Contract Payment Method Code] |

**Block 5** — [OUTER GUARD: MANSION TYPE CHECK] — [IF] `(JFUStrConst.CD00133_04.equals(prcGrpCd) && JFUStrConst.CD01216_003.equals(kanyuKeiPayHoshikiCd)) [JFUStrConst.CD00133_04="04" (eo Light Net Mansion Type), JFUStrConst.CD01216_003="003" (All-Units Lump Sum)] (L593–641)`

> This is the primary guard: the method only proceeds with mansion-type logic if both the price group code is "04" (eo Light Net Mansion Type / eo光ネットマンションタイプ) AND the payment method code is "003" (All-Units Lump Sum / 全戸一括). If either condition fails, the method falls through to return `false`, indicating the subscription is not a mansion-type bundle. This ensures the mansion flag is only set for the specific property-bundled broadband profile.

| # | Type | Code |
|---|------|------|
| 1 | SET | `parentMap = null` // Local variable initialization |
| 2 | SET | `childList = null` // Local variable initialization |

**Block 5.1** — [PARENT MAP RETRIEVAL] — [IF] `(outputMap.containsKey(CC_TITLE_FUSV006001)) [CC_TITLE_FUSV006001="FUSV006001CC"] (L619–621)`

> Checks if the outputMap contains the FUSV006001CC component key. If present, retrieves the parent HashMap which holds temporary payment charge data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `parentMap = (HashMap) outputMap.get(CC_TITLE_FUSV006001)` // Cast and retrieve parent map |

**Block 5.2** — [CHILD LIST RETRIEVAL] — [IF] `(null != parentMap && parentMap.containsKey(EKK0721A010CBSMSG1LIST)) [EKK0721A010CBSMSG1LIST="一時払料金一括照" (Temporary Payment Charge Consolidation Lookup)] (L624–626)`

> Checks if the parent map is non-null and contains temporary payment charge details. If present, retrieves the ArrayList of one-time payment charge items.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childList = (ArrayList) parentMap.get(EKK0721A010CBSMSG1LIST)` // Cast and retrieve child list of temporary payment charges |

**Block 5.3** — [STOCK COUNT CHECK] — [IF] `(nowMllistStkuCnt >= freeValue && tanka > 0) (L630–632)`

> **Condition:** Current mailing list stock count is greater than or equal to the free option service count AND the unit price is positive.
> **Business meaning:** The customer has exhausted their free mailing list allowance AND has a positive unit price, indicating they are now incurring charges. This is the primary financial indicator for mansion-type subscriptions with active usage.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mansionDiv = true` // マンション区分設定 [Mansion Division Flag Set — stock count exhausted with positive unit price] |

**Block 5.4** — [INITIAL FEE CHECK] — [ELSE-IF] `(childList != null && childList.size() > 0) (L634–637)`

> **Condition:** The temporary payment charge list is non-null and contains at least one entry.
> **Business meaning:** An initial fee (初期費用) has been incurred for this subscription. Even if the stock count check did not trigger, the presence of a setup charge indicates a charge-generating mansion subscription.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mansionDiv = true` // 初期費用が発生する場合 [Mansion Division Flag Set — initial fee incurred] |

**Block 5.5** — [DEFAULT CASE] — [ELSE] (L639–640)

> Neither the stock count condition nor the initial fee condition triggered. The subscription does not generate charges.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mansionDiv = false` // No charges, not a charge-generating mansion subscription |

**Block 6** — [RETURN] (L643)

> Return the computed mansion flag to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return mansionDiv` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mansionDiv` | Field | Mansion Division Flag — boolean indicator that the subscriber's property qualifies as a bundled mansion-type broadband subscription generating charges |
| `prcGrpCd` | Field | Price Group Code — classifies the service pricing tier; `"04"` identifies *eo Light Net Mansion Type* |
| `kanyuKeiPayHoshikiCd` | Field | Subscription Contract Payment Method Code — `"003"` identifies *All-Units Lump Sum* billing for mansion complexes |
| `freeValue` | Field | Free Option Service Count — maximum number of free option services included with the subscription |
| `nowMllistStkuCnt` | Field | Current Mailing List Stock Count — number of mailing list items currently available in the customer's stock allowance |
| `tanka` | Field | Unit Price / Price Plan Fixed Amount — per-unit charge for the service plan; `> 0` indicates a chargeable subscription |
| `parentMap` | Field | Parent HashMap in the component hierarchy, holding data for the `FUSV006001CC` component |
| `childList` | Field | ArrayList of temporary payment charge detail entries held within the parent map |
| `WEB_CHG_INFO` | Constant | WEB変更情報 [WEB Change Information] — key for the WEB change info data-bean array in commoninfoBean |
| `GEN_CUST_KEI_INFO` | Constant | 現顧客契約情報 [Current Customer Contract Information] — key for the current customer contract data-bean array |
| `SVC_KEI_INFO` | Constant | サービス契約情報 [Service Contract Information] — key for the service contract data-bean array |
| `PRC_GRP_CD_23` | Constant | 料金グループコード [Price Group Code] — key for the price group code field in service contract info |
| `KANYU_KEI_PAY_HOSHIKI_CD_23` | Constant | 加入契約支払方式コード [Subscription Contract Payment Method Code] — key for the payment method code field |
| `MRYO_OP_SVC_CNT` | Constant | 無料オプションサービス数 [Free Option Service Count] — key for querying the free service allowance |
| `NOW_MLLIST_STKU_CNT` | Constant | 現在のメーリングリスト取得数 [Current Mailing List Stock Count] — key for querying current stock count |
| `PPLAN_KOTEI_AMNT` | Constant | 料金プラン固定金額 [Price Plan Fixed Amount] — key for querying the unit price |
| `CC_TITLE_FUSV006001` | Constant | `"FUSV006001CC"` — component key in outputMap for the FUSV006001 component's title data |
| `EKK0721A010CBSMSG1LIST` | Constant | 一時払料金一括照 [Temporary Payment Charge Consolidation Lookup] — key for the temporary payment charge list in the parent map |
| `CD00133_04` | Constant | `"04"` — price group code value representing *eo Light Net Mansion Type* (eo光ネットマンションタイプ) |
| `CD01216_003` | Constant | `"003"` — payment method code value representing *All-Units Lump Sum* (全戸一括) |
| eo Light Net | Business term | Fiber-optic broadband service offered by K-Opticom; "Mansion Type" refers to property-bundled deployment in apartment complexes |
| マンション区分 | Business term | Mansion Division — classification of a subscription as a multi-unit property broadband service |
| 全戸一括 | Business term | All-Units Lump Sum — single-billing arrangement covering all units in a multi-plex building |
| 初期費用 | Business term | Initial Fee / Setup Fee — one-time charge incurred for new service activation |
| 一時払料金 | Business term | Temporary Payment Charge — one-off payment entry for initial setup or miscellaneous fees |
| X31SDataBeanAccess | Technical class | Shared data-bean access class providing `getDataBeanArray()`, `getDataBean()`, `sendMessageLong()`, and `sendMessageString()` methods for hierarchical data navigation |
| X31CWebConst.DATABEAN_GET_VALUE | Constant | Reserved command value passed to `sendMessage*` methods to request data retrieval from a data bean |
| FUSV006001CC | Technical key | Component identifier linking to the FUSV0060 family's temporary payment charge processing component |
