# Business Logic — JKKKeiNewCmnLogicUtil.judgeHhs_Cschpsb_Mans() [25 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.commonOneStop.JKKKeiNewCmnLogicUtil` |
| Layer | Utility / Common Component |
| Module | `commonOneStop` (Package: `eo.web.webview.commonOneStop`) |

## 1. Role

### JKKKeiNewCmnLogicUtil.judgeHhs_Cschpsb_Mans()

This method determines whether an optical wiring course (光配線コース) change is available for a specific apartment building (マンション) based on its coverage pattern code. It acts as a **business rule gate** that allows course changes only when the apartment building's type matches a predefined pattern — specifically, when the `tk_hoshiki_pattern_cd` (coverage pattern code) equals `"53"`, which corresponds to the **HHS CSCHPSB** (Hikari Home Service - Coverage Planning Building) category. The method retrieves pre-fetched mansion search results from the `outputMap` (populated earlier by the `KKKGetMansionSearchCC` component) and evaluates a single eligibility condition. Its role in the larger system is to serve as a shared utility that multiple screen logic classes call during their initialization and data reload phases, enabling or disabling the apartment building's optical wiring course change capability depending on the building type.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["judgeHhs_Cschpsb_Mans outputMap, fixedText"])

    START --> CHECK_NULL["Check: outputMap != null AND containsKey fixedText"]
    CHECK_NULL -->|true| GET_MAP["Get JKKGetMansionSearchCCMap from outputMap"]
    CHECK_NULL -->|false| RETURN_FALSE["Return false"]

    GET_MAP --> CHECK_MAP_NULL["Check: JKKGetMansionSearchCCMap != null"]
    CHECK_MAP_NULL -->|true| GET_PATTERN["Get kk089101_tk_hoshiki_pattern_cd from map"]
    CHECK_MAP_NULL -->|false| RETURN_FALSE

    GET_PATTERN --> CHECK_PATTERN["Check: tk_hoshiki_pattern_cd == TK_HOSHIKI_PATTERN_CD_53 = '53'"]
    CHECK_PATTERN -->|true| RETURN_TRUE["Return true"]
    CHECK_PATTERN -->|false| RETURN_FALSE

    RETURN_TRUE --> END_NODE(["End"])
    RETURN_FALSE --> END_NODE
```

**Processing Summary:**

1. **Null-safety check** — Verifies that `outputMap` is not null and contains the key specified by `fixedText`. This prevents `NullPointerException` when the mansion search component has not yet populated the map.
2. **Map extraction** — Retrieves the `KKKGetMansionSearchCCMap` object from `outputMap` using the `fixedText` key. This map was previously populated by the `KKKGetMansionSearchCC` (マンション検索コンポーネント — Mansion Search Component) during the apartment building lookup process.
3. **Extracted map null check** — Ensures the retrieved map reference itself is not null, providing an additional safety layer.
4. **Pattern code extraction** — Retrieves the `kk089101_tk_hoshiki_pattern_cd` value from the extracted map. This field represents the building's coverage pattern classification code returned from the mansion search.
5. **Eligibility evaluation** — Compares the pattern code against `TK_HOSHIKI_PATTERN_CD_53 = "53"`. Only when the code matches exactly does the method return `true`, indicating that the apartment building's optical wiring course can be changed. Any other value (or null) results in `false`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `outputMap` | `HashMap<String, Object>` | A shared data container (照会マップ — inquiry map) passed through the screen logic layer. It holds results from various business components, keyed by `fixedText`. In this method, it is expected to contain the mansion search result map (`KKKGetMansionSearchCCMap`) populated by the `KKKGetMansionSearchCC` component. The map is queried via `containsKey(fixedText)` to check if the mansion search has been executed and returned a result. |
| 2 | `fixedText` | `String` | The map key (照会マップキー — inquiry map key) used to locate the mansion search result within `outputMap`. This key is the same one used by `KKKGetMansionSearchCC` to store its result, allowing this method to retrieve the correct data. It acts as the pointer to the mansion search payload inside the shared output map. |

**External State / Instance Fields:**
- None. This is a purely static method with no dependency on instance fields.

## 4. CRUD Operations / Called Services

This method performs **no direct CRUD operations**. It is a pure business rule evaluation method that reads from the `outputMap` parameter (which was populated by other components earlier in the processing chain).

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R (indirect) | `KKKGetMansionSearchCC` | N/A | N/A | The `outputMap` is expected to contain results previously fetched by the `KKKGetMansionSearchCC` (マンション検索コンポーネント — Mansion Search Component), which performs the actual mansion data retrieval. This method only reads the pre-stored result. |

## 5. Dependency Trace

### Callers

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW00101 | `KKW00101SFLogic.init()` → `judgeHhs_Cschpsb_Mans(outputMap, fixedText)` | N/A (pure logic evaluation, no direct DB access) |
| 2 | Screen:KKW00121 | `KKW00121SFLogic.init()` → `judgeHhs_Cschpsb_Mans(outputMap, fixedText)` | N/A (pure logic evaluation, no direct DB access) |
| 3 | Screen:KKW00121 | `KKW00121SFLogic.reloadData()` → `judgeHhs_Cschpsb_Mans(outputMap, fixedText)` | N/A (pure logic evaluation, no direct DB access) |

**Call Chain Details:**
- The method is called directly from screen logic classes (`KKW00101SFLogic` and `KKW00121SFLogic`) during their `init()` and `reloadData()` methods.
- These callers are screen logic controllers for optical wiring course management screens, where this method determines whether the apartment building's course can be modified.
- No intermediate CBS (Common Business Service) layers exist — this is a direct call to the shared utility.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null-safety check) `(outputMap != null && outputMap.containsKey(fixedText))` (L18217)

> Japanese: JKKGetMansionSearchCCの結果が取得できた場合、以下を実行。
> Translation: "If the result from KKKGetMansionSearchCC was successfully obtained, execute the following."

This block verifies that the output map exists and contains the expected key before attempting any data access. It is the primary guard clause that prevents exceptions when the mansion search has not been performed.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outputMap != null` — Check map is not null |
| 2 | EXEC | `outputMap.containsKey(fixedText)` — Check key exists in map |

**Block 1.1** — SET (map extraction) (L18219)

> Japanese: JKKGetMansionSearchCCの処理結果を取得する。
> Translation: "Retrieve the processing result of KKKGetMansionSearchCC."

Extracts the mansion search result map from the output map using the `fixedText` key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `KKKGetMansionSearchCCMap = (HashMap<String, Object>)outputMap.get(fixedText)` |

**Block 1.1.1** — IF (extracted map null check) `(KKKGetMansionSearchCCMap != null)` (L18221)

Ensures the extracted map reference is not null before accessing its contents.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tk_hoshiki_pattern_cd = (String)KKKGetMansionSearchCCMap.get("kk089101_tk_hoshiki_pattern_cd")` |

**Block 1.1.2** — IF (pattern code comparison) `(KKStrConst.TK_HOSHIKI_PATTERN_CD_53.equals(tk_hoshiki_pattern_cd))` (L18224) `[KKStrConst.TK_HOSHIKI_PATTERN_CD_53="53"]`

This is the core business rule: the pattern code must equal `"53"` for the apartment building to be eligible for optical wiring course changes. The constant `TK_HOSHIKI_PATTERN_CD_53` represents the **HHS CSCHPSB** (Hikari Home Service - Coverage Planning Building) pattern classification.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` — Course change is eligible (KKStrConst.TK_HOSHIKI_PATTERN_CD_53 = "53") |

**Block 2** — ELSE (implicit, all other paths) (L18235)

> Japanese: 判定結果 (Judge result)
> Translation: "Judgment result."

All paths that do not reach the pattern code match return `false`. This includes: `outputMap` is null, `fixedText` key not found, extracted map is null, or pattern code does not equal `"53"`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` — Course change is NOT eligible |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `tk_hoshiki_pattern_cd` | Field | Coverage pattern code — Classifies the building type and wiring infrastructure pattern for Hikari (光) service delivery. Value `"53"` indicates a building eligible for optical wiring course changes. |
| `kk089101_tk_hoshiki_pattern_cd` | Field | The map key used to store the coverage pattern code within the mansion search result map. The `kk089101` prefix identifies the specific search component that populated this value. |
| `fixedText` | Field | Inquiry map key — The key string used to locate data within the shared `outputMap`. Acts as the bridge between the mansion search component and this evaluation method. |
| `outputMap` | Field | Shared data container (照会マップ — inquiry map) — A HashMap that accumulates results from various business components during screen processing. Serves as a data-passing mechanism between components. |
| HHS | Business term | Hikari Home Service — NTT's fiber-optic home internet service brand. "HHS CSCHPSB" refers to a specific building category within this service. |
| CSCHPSB | Business term | Coverage Planning Service Building — A classification for apartment buildings where the wiring infrastructure supports flexible optical wiring course selection. |
| TK | Acronym | Transmission Kit / Transmission Plan (伝送回線 — transmission line) — Refers to the transmission plan or wiring configuration for the building. |
| HOSHIKI | Business term | Coverage/Deployment (铺设) — Refers to the building's wiring coverage pattern or deployment classification. |
| KKKGetMansionSearchCC | Component | Mansion Search Common Component — A business component that retrieves apartment building information including wiring patterns, building type, and eligibility data. |
| 光配線コース変更 | Business term | Optical Wiring Course Change — The ability to modify the fiber-optic wiring configuration for an apartment building, allowing tenants to switch between different service types. |
| マンション | Business term | Apartment Building / Condominium — A multi-unit residential building where multiple tenants share shared wiring infrastructure. |
| 照会マップ | Business term | Inquiry Map — A shared data structure (HashMap) used to pass results between business components within a screen processing flow. |
| KKW00101SFLogic | Class | Screen Logic for KKW00101 — Screen controller for the optical wiring course management screen (KKW00101). |
| KKW00121SFLogic | Class | Screen Logic for KKW00121 — Screen controller for the optical wiring course management screen (KKW00121), with additional reload capability. |
