# Business Logic — KKW01037SFBean.listKoumokuIds() [38 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01037SF.KKW01037SFBean` |
| Layer | Service (Web-view Bean, part of the Service/Bean tier) |
| Module | `KKW01037SF` (Package: `eo.web.webview.KKW01037SF`) |

## 1. Role

### KKW01037SFBean.listKoumokuIds()

This method serves as the central item-name router for the KKW01037SF web screen, which manages customer service contract inquiries. It receives a business-level **item name** (key) string and returns the corresponding `ArrayList` of field/item names for that section. When no key is provided (null), it returns the full list of **service-form-level** top-level items — such as "Inquiry SWID", "Inquiry Customer IT", "Referred Contractor Name", "Referred Phone Number", "Referred SWID", "Service Contract List", "Customer Contract Inheritance List", and "Pop-up Mode" — enabling screens to populate dropdowns or form sections without further routing. When a known composite item name is passed (specifically "Service Contract List" or "Customer Contract Inheritance List"), the method dispatches to a **delegate Bean** (`KKW01037SF01DBean` or `KKW01037SF02DBean`) that holds the detailed sub-item definitions for that composite view. For keys matching the common-info-view format (starting with '/'), it delegates to the superclass `listKoumokuIds()` for inheritance. Any unrecognized key returns an empty list, ensuring screens gracefully degrade rather than throw errors. The design pattern is a **routing/dispatch** method with **delegation** to specialized Beans.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["listKoumokuIds(key)"])
    COND_NULL{key == null?}
    PROCESS_NULL["Build hardcoded list<br/>8 service form item names"]
    RETURN_NULL["Return koumokuList"]
    COND_SLASH{key starts with '/'<br/>&& length > 2?}
    CALL_SUPER["super.listKoumokuIds(key)"]
    RETURN_SUPER["Return super result"]
    COND_SERVICE{key.equals<br/>'サービス契約一覧リスト'?}
    CALL_01D["KKW01037SF01DBean.listKoumokuIds()"]
    RETURN_01D["Return KKW01037SF01DBean list"]
    COND_CUST{key.equals<br/>'顧客契約引継リスト'?}
    CALL_02D["KKW01037SF02DBean.listKoumokuIds()"]
    RETURN_02D["Return KKW01037SF02DBean list"]
    RETURN_EMPTY["Return new empty ArrayList"]
    END_NODE(["Return / Next"])

    START --> COND_NULL
    COND_NULL -->|true| PROCESS_NULL
    COND_NULL -->|false| COND_SLASH
    PROCESS_NULL --> RETURN_NULL
    RETURN_NULL --> END_NODE
    COND_SLASH -->|true| CALL_SUPER
    COND_SLASH -->|false| COND_SERVICE
    CALL_SUPER --> RETURN_SUPER
    RETURN_SUPER --> END_NODE
    COND_SERVICE -->|true| CALL_01D
    COND_SERVICE -->|false| COND_CUST
    CALL_01D --> RETURN_01D
    RETURN_01D --> END_NODE
    COND_CUST -->|true| CALL_02D
    COND_CUST -->|false| RETURN_EMPTY
    CALL_02D --> RETURN_02D
    RETURN_02D --> END_NODE
    RETURN_EMPTY --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **item name** (項目名) that identifies which section or view's field list the caller needs. It can be: (a) `null` — request for all top-level service-form items; (b) a key starting with `'/'` with length > 2 — a **common info view** path that delegates to the superclass; (c) the string `"サービス契約一覧リスト"` (Service Contract List) — triggers delegation to `KKW01037SF01DBean` for detailed sub-items of the service contract view; (d) the string `"顧客契約引継リスト"` (Customer Contract Inheritance List) — triggers delegation to `KKW01037SF02DBean` for detailed sub-items of the customer contract inheritance view; (e) any other unrecognized value — returns an empty list as a safe default. |

**Instance fields or external state read:** None directly. The method relies on `super.listKoumokuIds()` (inherited behavior from a parent Bean class) and two static delegate Beans (`KKW01037SF01DBean`, `KKW01037SF02DBean`).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW01037SFBean.listKoumokuIds` | KKW01037SFBean | - | Dispatches to `super.listKoumokuIds(key)` when key matches common info view format (starts with '/'). Returns inherited item list. |
| R | `KKW01037SF01DBean.listKoumokuIds` | KKW01037SF01DBean | - | Delegate Bean for the "Service Contract List" (サービス契約一覧リスト) view. Returns detailed sub-item definitions for service contract screen fields. |
| R | `KKW01037SF02DBean.listKoumokuIds` | KKW01037SF02DBean | - | Delegate Bean for the "Customer Contract Inheritance List" (顧客契約引継リスト) view. Returns detailed sub-item definitions for customer contract inheritance screen fields. |

**Classification:** All operations are **Read** (R) — this method is purely a metadata/router service. It never creates, updates, or deletes data. It resolves item name keys to their corresponding field lists, which are consumed by UI screens to dynamically render form sections and dropdown components.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW01037SF | `KKW01037SFBean.listKoumokuIds(String key)` -> `KKW01037SFBean.listKoumokuIds()` | `super.listKoumokuIds [R] -`, `KKW01037SF01DBean.listKoumokuIds [R] -`, `KKW01037SF02DBean.listKoumokuIds [R] -` |

**Note:** The only known caller is the zero-argument overload `KKW01037SFBean.listKoumokuIds()` (no parameters), which acts as a convenience wrapper — it likely invokes `listKoumokuIds(null)` to retrieve the full set of service-form item names for initial screen population. No external screens, batches, or CBS components directly call this method based on available code graph data.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(key == null)` (L697)

> When key is null, return the complete list of top-level service-form item names. These represent the main sections/fields available on the KKW01037SF inquiry screen. This allows screens to populate a full item selector without knowing specific composite view keys in advance.

| # | Type | Code |
|---|------|------|
| 1 | SET | `koumokuList = new ArrayList<String>()` // Create new list |
| 2 | CALL | `koumokuList.add("インquiry SWID")` // Add "Inquiry SWID" [-> "引き継ぎSWID"] (Line: inherited SWID for inquiry) |
| 3 | CALL | `koumokuList.add("引き継ぎお客様IT")` // Add "Inquiry Customer IT" (Line: customer IT for inquiry) |
| 4 | CALL | `koumokuList.add("被紹介者契約者名")` // Add "Referred Contractor Name" (Line: name of the referred party/contractor) |
| 5 | CALL | `koumokuList.add("被紹介者電話番号")` // Add "Referred Phone Number" (Line: phone number of the referred party) |
| 6 | CALL | `koumokuList.add("被紹介者SWID")` // Add "Referred SWID" (Line: SWID of the referred party) |
| 7 | CALL | `koumokuList.add("サービス契約一覧リスト")` // Add "Service Contract List" (Line: composite item — delegates to KKW01037SF01DBean) |
| 8 | CALL | `koumokuList.add("顧客契約引継リスト")` // Add "Customer Contract Inheritance List" (Line: composite item — delegates to KKW01037SF02DBean) |
| 9 | CALL | `koumokuList.add("ポップアップモード")` // Add "Pop-up Mode" (Line: popup mode indicator) |
| 10 | RETURN | `return koumokuList` // Return the 8-item list |

**Block 2** — [ELSE-IF] `(key.startsWith("/") && key.length() > 2)` (L711)

> When the key follows the common info view format (starts with '/' and has more than 2 characters), delegate to the superclass implementation. This handles inherited item lists from common info view beans.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.listKoumokuIds(key)` // Delegate to parent Bean for common-info-view items |
| 2 | RETURN | `return super.listKoumokuIds(key)` // Return superclass result |

**Block 3** — [ELSE-IF] `(key.equals("サービス契約一覧リスト"))` (L717)

> When the key matches "Service Contract List" (サービス契約一覧リスト), dispatch to the delegate Bean `KKW01037SF01DBean`. This Bean contains the detailed sub-item definitions for the service contract section of the screen — such as contract type, service number, start date, end date, etc.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `KKW01037SF01DBean.listKoumokuIds()` // Delegate to KKW01037SF01DBean for service contract sub-items |
| 2 | RETURN | `return KKW01037SF01DBean.listKoumokuIds()` // Return delegate Bean's list |

**Block 4** — [ELSE-IF] `(key.equals("顧客契約引継リスト"))` (L723)

> When the key matches "Customer Contract Inheritance List" (顧客契約引継リスト), dispatch to the delegate Bean `KKW01037SF02DBean`. This Bean contains the detailed sub-item definitions for the customer contract inheritance section — such as inheritance destination, original contract info, transfer dates, etc.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `KKW01037SF02DBean.listKoumokuIds()` // Delegate to KKW01037SF02DBean for customer contract inheritance sub-items |
| 2 | RETURN | `return KKW01037SF02DBean.listKoumokuIds()` // Return delegate Bean's list |

**Block 5** — [ELSE / FALLBACK] (L727)

> When none of the above conditions match — i.e., an unrecognized key — return an empty list. This ensures graceful degradation: screens using this key will simply render with no items rather than throwing an exception or displaying stale data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `return new ArrayList<String>()` // Return empty list for unrecognized key |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `koumoku` (項目) | Field | Item / field — refers to individual form fields or data columns displayed in the UI |
| `key` (項目名) | Parameter | Item name — a business-level identifier used to look up which set of form fields to display |
| サービス契約一覧リスト | Field | Service Contract List — a composite view item that expands into detailed service contract sub-fields via `KKW01037SF01DBean` |
| 顧客契約引継リスト | Field | Customer Contract Inheritance List — a composite view item that expands into detailed customer contract inheritance sub-fields via `KKW01037SF02DBean` |
| 引き継ぎSWID | Field | Inquiry SWID — the system work ID (SWID) used to identify the inquiry record |
| 引き継ぎお客様IT | Field | Inquiry Customer IT — the customer identifier associated with the inquiry |
| 被紹介者 | Field | Referred Party — a customer introduced by another party (referral source) |
| 被紹介者契約者名 | Field | Referred Contractor Name — the name of the contract party who was referred |
| 被紹介者電話番号 | Field | Referred Phone Number — phone number of the referred party |
| 被紹介者SWID | Field | Referred SWID — the system work ID associated with the referred party |
| ポップアップモード | Field | Pop-up Mode — indicates whether the screen is rendered in a popup dialog mode |
| 共通情報ビュー | Field | Common Info View — a shared view template for common information sections; keys starting with '/' route to this |
| KKW01037SF01DBean | Class | Delegate Bean for the Service Contract List detail view — holds the list of item names for the service contract section |
| KKW01037SF02DBean | Class | Delegate Bean for the Customer Contract Inheritance List detail view — holds the list of item names for the customer contract inheritance section |
| SWID | Acronym | System Work ID — an internal tracking identifier for service operations/work items |
| IT | Acronym | Identifier / index — customer or record identifier within the inquiry context |
| Bean | Pattern | JavaBean — a Java class following conventions (no-arg constructor, getter/setter, serializable) used as a data holder or UI controller |
