# Business Logic — KKA440SFLogic.initSimpleSectorMap() [14 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA440SF.KKA440SFLogic` |
| Layer | Controller / Webview Logic |
| Module | `KKA440SF` (Package: `eo.web.webview.KKA440SF`) |

## 1. Role

### KKA440SFLogic.initSimpleSectorMap()

This method initializes a HashMap that serves as the template for the **simple sector** (シンプルセクタ) of the API response message. The simple sector is one of two sectors (alongside the common sector) that compose the full response sent to the upstream system in the KKA440SF webview screen, which handles customer information inquiries via API.

The method iterates over the `KEY_RES_PARAM_NM` constant array — a predefined list of 34 response parameter keys — and populates each key with an empty string value. This ensures that every expected field is present in the response map, even when its value is not yet determined. This is a **factory/initialization pattern**: it creates a blank-response structure so that callers can populate only the fields that are relevant (e.g., setting an error code like "9100" in the `KNRYO_CD` field during error handling, or setting normal status codes like "1010", "1030", "1020" in normal flow).

The method is **private** and serves as a shared utility within `KKA440SFLogic`. It is called exclusively from the `init()` method during error-handling branches, where an error-sector response is assembled. The initialized map is then passed to `JKKApiCommon.getSimpleSector()` to format the response message.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initSimpleSectorMap()"])
    MAP["HashMap map = new HashMap()"]
    LOOP["for i = 0 to KEY_RES_PARAM_NM.length"]
    PUT["map.put key, empty string"]
    NEXT["i++"]
    RETURN["return map"]
    END_NODE(["Return / Next"])

    START --> MAP
    MAP --> LOOP
    LOOP --> PUT
    PUT --> NEXT
    NEXT --> LOOP
    LOOP -->|Complete| RETURN
    RETURN --> END_NODE
```

**Processing steps:**

1. **HashMap creation** — Instantiate a new `HashMap<String, Object>` as the response map container.
2. **Iterate over keys** — Loop over the entire `KEY_RES_PARAM_NM` array (34 entries), which defines all expected response parameter names.
3. **Set empty values** — For each key index `i`, call `map.put(KEY_RES_PARAM_NM[i], "")` to register the parameter name as a key with an empty string value. This ensures all expected fields exist in the map even before they are populated by the caller.
4. **Return map** — Return the initialized map to the caller.

This is a **pure initialization routine** with no conditional branches. It applies a blanket empty-value strategy, allowing the caller to selectively overwrite specific keys (e.g., setting error codes, completion codes) with actual data after receiving the map.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It is a zero-arg factory method. |
| - | `KEY_RES_PARAM_NM` | `String[]` (static final) | Response parameter name keys — an array of 34 field names that define the schema of the response message structure. Each index corresponds to a specific field in the response, from search request number (index 0) through phone number (index 34+). |

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and calls **no service components, CBS, or DAO methods**. It is a pure data structure factory.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | - | - | - | No database or service interactions. This method only constructs an in-memory HashMap. |

## 5. Dependency Trace

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

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic: KKA440SFLogic.init() | `init()` catch block -> `initSimpleSectorMap()` -> `JKKApiCommon.getSimpleSector(simpleMap)` | `getSimpleSector [R] Response message sector` |

**Call chain detail:**
The `init()` method contains error handling in its catch block. When a fatal exception occurs (result code "009003"), it:
1. Constructs an error map with exception details.
2. Calls `initSimpleSectorMap()` to get a blank simple-sector response map.
3. Overwrites the completion code field (`KEY_RES_PARAM_NM[1]` = `KNRYO_CD`) with error code "9100".
4. Passes the error map and the initialized simple map to `JKKApiCommon.getCommonSector()` and `JKKApiCommon.getSimpleSector()` to build the full response message.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(variable declaration)` (L567)

> Creates the response HashMap.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap<String, Object> map = new HashMap<String, Object>();` // Initialize response map |

**Block 2** — [FOR LOOP] `(int i = 0; i < KEY_RES_PARAM_NM.length; i++)` (L569)

> Iterates over all response parameter name keys defined in the constant array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int i = 0` // Loop counter |
| 2 | COND | `i < KEY_RES_PARAM_NM.length` // [-> KEY_RES_PARAM_NM length = 34] Continue while true |
| 3 | SET | `map.put(KEY_RES_PARAM_NM[i], "")` // Set empty value for each parameter key [-> See KEY_RES_PARAM_NM values below] |

**Block 2.1** — [LOOP BODY — iteration] (L571)

> Sets empty string value for each response parameter name. The `KEY_RES_PARAM_NM` constant array (resolved values):

| Index | Constant Value | Japanese Comment (English Translation) |
|-------|---------------|----------------------------------------|
| [0] | `KNSK_UKTK_BNGU` | 検索依頼番号 (Search request number) |
| [1] | `KNRYO_CD` | 完了コード (Completion code) |
| [2] | `SHOSI_CD` | 詳細コード (Detail code) |
| [3] | `NETKNSU` | ネット存在件数 (Net existence count) |
| [4] | `PRMT1` | 申込書番号 (Application form number) |
| [5] | `PRMT2` | 契約者氏名（漢字） (Contractor name — Kanji) |
| [6] | `PRMT3` | 契約者氏名（カナ） (Contractor name — Kana) |
| [7] | `PRMT4` | 生年月日 (Date of birth) |
| [8] | `PRMT5` | 利用箇所郵便番号 (Usage location postal code) |
| [9] | `PRMT6` | 利用箇所住所 (Usage location address) |
| [10] | `PRMT7` | 契約者電話番号 (Contractor phone number) |
| [11] | `PRMT8` | ＡＵスマートバリューコード (AU Smart Value code) |
| [12] | `PRMT9` | ネットのスマートバリュー申込可否 (Net Smart Value application eligibility) |
| [13] | `PRMT10` | ネット申込不可理由 (Net application rejection reason) |
| [14] | `PRMT11` | ネットお客様の案内 (Net customer notification) |
| [15] | `PRMT12` | ネットの契約状態 (Net contract status) |
| [16] | `PRMT13` | 解約済エオ光電話のスマホリ申込可否 (Post-termination Eo Light phone smartphone application eligibility) |
| [17] | `PRMT14` | 解約済エオ光電話申込不可理由 (Post-termination Eo Light phone application rejection reason) |
| [18] | `PRMT15` | 解約済エオ光電話のお客様への案内 (Post-termination Eo Light phone customer notification) |
| [19] | `PRMT16` | 解約済エオ光電話の契約状態 (Post-termination Eo Light phone contract status) |
| [20] | `PRMT17` | 解約済エオ光電話番号 (Post-termination Eo Light phone number) |
| [21] | `PRMT18` | エオ光電話１のスマホリ申込可否 (Eo Light Phone 1 smartphone application eligibility) |
| [22] | `PRMT19` | エオ光電話１申込不可理由 (Eo Light Phone 1 application rejection reason) |
| [23] | `PRMT20` | エオ光電話１のお客様への案内 (Eo Light Phone 1 customer notification) |
| [24] | `PRMT21` | エオ光電話１の契約状態 (Eo Light Phone 1 contract status) |
| [25] | `PRMT22` | エオ光電話１の電話番号 (Eo Light Phone 1 phone number) |

> **Note:** The array extends beyond index 25 with additional PRMT fields for phone service details. All keys use empty string (`""`) as the initial value, allowing callers to selectively populate only the fields they need.

**Block 3** — [RETURN] `(return map)` (L576)

> Returns the initialized HashMap with all parameter keys set to empty strings.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return map;` // Return initialized response map |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KNSK_UKTK_BNGU` | Field | Search request number — internal reference ID for the inquiry request |
| `KNRYO_CD` | Field | Completion code — indicates the outcome status of the processing (e.g., "1010" = success, "9100" = error) |
| `SHOSI_CD` | Field | Detail code — further classifies the processing result or operation type |
| `NETKNSU` | Field | Net existence count — number of net service records found |
| `PRMT1`–`PRMT22` | Field | Parameter fields 1–22 — generic response fields carrying customer and contract detail data |
| `KEY_RES_PARAM_NM` | Constant | Response parameter name array — defines the schema of all expected keys in the simple sector response message |
| Simple Sector (シンプルセクタ) | Domain term | A section of the API response message that carries the primary business result data, contrasted with the "common sector" which carries system metadata (error codes, processing type, etc.) |
| Common Sector (共通セクタ) | Domain term | A standardized section of the API response containing system-level metadata such as result type, result code, source class name, line number, and business logic name |
| `JKKApiCommon` | Class | Common API utility class — provides shared response formatting methods including `getCommonSector()`, `getSimpleSector()`, and `getRtype()` |
| RESULT_CD_009003 | Constant | Fatal error result code — indicates a critical/unexpected exception occurred during processing |
| RSP_MSG | Constant | Response message data bean key — the bean name used to set the final response message string |
| Eo Light (エオ光) | Business term | NTT East's fiber-optic internet and phone service brand |
| AU Smart Value (ＡＵスマートバリュー) | Business term | AU's mobile phone discount service for customers who also subscribe to Eo Light internet |
| KKA440SF | Module | Webview screen for API-based customer information inquiry — handles external system requests for customer contract and service status data |
