# Business Logic — KKW02701SFLogic.isNetKojiRnkiCheckResult() [43 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02701SF.KKW02701SFLogic` |
| Layer | Logic / Business Logic (Package: `eo.web.webview.KKW02701SF`) |
| Module | `KKW02701SF` (Package: `eo.web.webview.KKW02701SF`) |

## 1. Role

### KKW02701SFLogic.isNetKojiRnkiCheckResult()

This method performs a **network construction reservation linkage confirmation check** — a validation gate that ensures work orders (construction tasks) associated with an **eo Light Net** (eo光ネット, fiber-optic broadband service) subscription are in an appropriate state before allowing the reservation cancellation flow to proceed. Specifically, it inspects the work order status entries produced by the `KKSV039527SC` service component to determine whether any work order exists in a non-terminal status (registered "120", accepted "130", or pending assignment "200"). If any such work order is found, the method returns `false` to block further processing; otherwise, it returns `true` to allow the flow to continue.

The method serves as the **Net-specific counterpart** to `isKojiRnkiCheckResult()` (which validates work orders for TV service lines). It follows the **guard clause / gatekeeper** design pattern: early returns for safe conditions (missing data means pass), then iterative validation, and a final aggregated result. Within the larger system, it is called as part of the `forwardRsvClCfm()` service processing method in the **Service Contract Cancellation** screen (`KKW02701SF`) — a critical screen where customers cancel their subscription and the system must ensure no active or in-progress work orders will be orphaned by the cancellation.

The business operation enforces data integrity: a customer cannot cancel their subscription while a construction work order is still pending or in progress. This prevents operational conflicts where field technicians might arrive to perform installation work after the service has already been terminated.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isNetKojiRnkiCheckResult"])
    START --> CHECK_KKSV039527SC{"outputMap contains KKSV039527SC?"}
    CHECK_KKSV039527SC -->|No| RETURN_TRUE_1["return true"]
    CHECK_KKSV039527SC -->|Yes| EXTRACT_KOJIMSG["kojiMsg = outputMap.get KKSV039527SC"]
    EXTRACT_KOJIMSG --> CALL_GETLIST["kojiList = getArrayListMap with EKU0011B090CBSMsg1List"]
    CALL_GETLIST --> CHECK_LIST{"kojiList is null or empty?"}
    CHECK_LIST -->|Yes| RETURN_TRUE_2["return true"]
    CHECK_LIST -->|No| INIT_FLG["checkFlg = false"]
    INIT_FLG --> LOOP_START["for workMap in kojiList"]
    LOOP_START --> CHECK_STATUS{"workMap contains kojiak_stat?"}
    CHECK_STATUS -->|No| LOOP_END_1{More items?}
    CHECK_STATUS -->|Yes| GET_STAT["kojiak_stat = workMap.get kojiak_stat"]
    GET_STAT --> CHECK_COND{"kojiak_stat != 120 AND != 130 AND != 200"}
    CHECK_COND -->|True| SET_FLG["checkFlg = true"]
    SET_FLG --> BREAK["break"]
    CHECK_COND -->|False| LOOP_END_1
    BREAK --> LOOP_END_1
    LOOP_END_1 --> CHECK_FLG{"checkFlg is true?"}
    CHECK_FLG -->|Yes| RETURN_FALSE["return false"]
    CHECK_FLG -->|No| RETURN_TRUE_3["return true"]
    RETURN_TRUE_1 --> END(["End"])
    RETURN_TRUE_2 --> END
    RETURN_TRUE_3 --> END
    RETURN_FALSE --> END
```

**Processing summary:**

1. **Early-exit guard** — If `outputMap` does not contain the `KKSV039527SC` key, the method returns `true` immediately. This means: no service component produced work order data, so there is nothing to check — the validation passes by default.

2. **Data extraction** — Retrieves the `kojiMsg` HashMap from the output map using the `KKSV039527SC` key, then calls the internal `getArrayListMap()` helper to extract the `EKU0011B090CBSMsg1List` list of work order detail records.

3. **Empty-list guard** — If the extracted list is `null` or empty, return `true`. This is the same early-exit pattern: no work orders exist, so the check passes.

4. **Iterative status validation** — For each work order in the list, extracts the `kojiak_stat` (work order status) field and checks whether it falls into one of the three "active" status codes: `120` (Registered / 登録済), `130` (Accepted / 受付済), or `200` (Pending / 指定済). If any work order has a status **outside** these three values (i.e., status `140`/Request Sent / 依頼済, `150`/In Progress / 施工中, `180`/Completed / 完了, or any other terminal state), the flag is set to `true` and the loop breaks early.

5. **Final aggregation** — If `checkFlg` was set to `true` during iteration, return `false` (validation fails — a terminal-status work order exists, meaning the customer has already moved past the point where construction work would occur). Otherwise, return `true` (all work orders are in an active/pre-terminal state, meaning they are still relevant and would be affected by cancellation).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `outputMap` | `HashMap<String, Object>` | The service processing result map containing all outputs from invoked service components (SCs). Specifically expected to contain the `KKSV039527SC` key, which holds a HashMap of work-in-progress work order details for the Net service line. This map is populated during `forwardRsvClCfm()` after calling `invokeService()`, which triggers various SC-level operations including `KKSV039527SC` (work order list retrieval for the service contract number). |

**Instance fields / external state read:**
- None directly. The method is stateless with respect to instance fields; it operates entirely on the provided `outputMap` parameter and its internal helper `getArrayListMap()`.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW02701SFLogic.getArrayListMap` | KKW02701SFLogic | - | Calls `getArrayListMap()` in `KKW02701SFLogic` — extracts an ArrayList from a HashMap by key. Pure in-memory map operation, no DB access. |
| R | `KKSV039527SC` | KKSV039527SC | EKU0011B090CBS (Work Order List View) | The `KKSV039527SC` service component (referenced via the outputMap key) was invoked earlier by the caller `forwardRsvClCfm()`. It retrieves the work-in-progress work order summary list for the service contract number, producing `EKU0011B090CBSMsg1List` records. The CBS message entity `EKU0011B090CBSMsg1List` maps to the work order detail fields including `kojiak_stat`, `kojiak_no`, and `svc_kei_kaisen_ucwk_no`. |

**Classification rationale:**
- `getArrayListMap()`: **R** (Read) — extracts data from an existing HashMap structure. No data modification.
- `KKSV039527SC`: **R** (Read) — This service component retrieves work order information from the back-end CBS. It does not create, update, or delete work orders.

**Entity/DB source for `EKU0011B090CBS`:**
- The CBS message `EKU0011B090CBSMsg1List` is defined in the back-end CBS module (`eo.ejb.cbs.cbsmsg.EKU0011B090CBSMsg1List`).
- Key fields in this entity include: `KOJIAK_NO` (work order number), `KOJIAK_STAT` (work order status), `SVC_KEI_KAISEN_UCWK_NO` (service detail revision work number).
- The mapper `KKSV0395_KKSV0395OP_EKU0011B090BSMapper` maps CBS records into the HashMap entries containing `kojiak_stat`, `kojiak_no`, and related fields.

## 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 | Screen:KKW02701 | `KKW02701SFLogic.forwardRsvClCfm()` -> `KKW02701SFLogic.isNetKojiRnkiCheckResult(outputMap)` | `getArrayListMap [R] in-memory HashMap` |

**Call chain detail:**
The caller `forwardRsvClCfm()` (also in `KKW02701SFLogic`) is the main processing method for the **Service Contract Cancellation Flow** screen. Within its execution path, after invoking the underlying services and performing several linkage checks (sku-par status, error codes, CS operations), it reaches a section that branches by service code (`svcCd`). When the service code matches `SVC_CD_NET` (eo Light Net / eo光ネット), it calls `isNetKojiRnkiCheckResult(outputMap)` as part of the "Construction Linkage Confirmation Check" (工事連携確認チェック).

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(outputMap.containsKey("KKSV039527SC"))` (L1483)

> Guard clause: If the output map does not contain the KKSV039527SC key (work order details map), there is no work order data to validate. Return true to allow the cancellation flow to proceed.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outputMap.containsKey("KKSV039527SC")` // Check if work order map exists |
| 2 | RETURN | `return true` // No work order data — validation passes |

---

**Block 2** — IF (else branch) `(outputMap contains "KKSV039527SC")` (L1488)

> The output map does contain the work order data. Extract the work message map and retrieve the work order list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kojiMsg = (HashMap<String, Object>)outputMap.get("KKSV039527SC")` [-> KKSV039527SC = "KKSV039527SC" (Work-in-progress Work Order Details Map for Service Contract Number)] |
| 2 | CALL | `kojiList = getArrayListMap(kojiMsg, "EKU0011B090CBSMsg1List")` // Extract work order detail list from the map |

**Block 2.1** — Nested SET (`getArrayListMap` helper method, L1545)

| # | Type | Code |
|---|------|------|
| 1 | SET | `list = (ArrayList<HashMap<String, Object>>)map.get(key)` // Extract ArrayList from map by key |
| 2 | IF | `list == null || list.size() == 0` // Check if list is empty |
| 3 | RETURN | `return null` // Null or empty list returned to caller |

---

**Block 3** — IF `(null == kojiList || kojiList.size() <= 0)` (L1492)

> Guard clause: If the work order list is null or empty, there are no work orders to validate. Return true to allow the flow.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `null == kojiList || kojiList.size() <= 0` // Check empty/null list |
| 2 | RETURN | `return true` // No work orders — validation passes |

---

**Block 4** — FOR LOOP `for (HashMap<String, Object> workMap : kojiList)` (L1496)

> Iterative validation: Iterate through each work order in the list to check its status. If any work order has a status NOT in the "active" set {120, 130, 200}, set the failure flag and break.

| # | Type | Code |
|---|------|------|
| 1 | SET | `checkFlg = false` // Initialize failure flag |
| 2 | EXEC | `for (HashMap<String, Object> workMap : kojiList)` // Iterate over work order records |

**Block 4.1** — Nested IF `(workMap.containsKey("kojiak_stat"))` [KOJIAK_STAT = "kojiak_stat"] (L1498)

> Check if the current work order record contains the status field.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.containsKey("kojiak_stat")` // Check for work order status field |

**Block 4.1.1** — Nested IF (else branch) — Status extraction and validation (L1500)

> Extract the work order status and check if it falls outside the "active" status codes.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kojiak_stat = (String)workMap.get("kojiak_stat").toString()` [-> KOJIAK_STAT = "kojiak_stat" (Work Order Status)] |
| 2 | IF | `!KOJIAK_STAT_120.equals(kojiak_stat) && !KOJIAK_STAT_130.equals(kojiak_stat) && !KOJIAK_STAT_200.equals(kojiak_stat)` |

**Block 4.1.1.1** — Nested IF (true branch) — Status is NOT an active status (L1505)

> The work order status is not 120, 130, or 200 — meaning it's in a terminal/completed state (e.g., 140 Request Sent, 150 In Progress, 180 Completed). This means the customer has moved past the active construction phase, so flag as failed.

- `KOJIAK_STAT_120 = "120"` — Registered (登録済)
- `KOJIAK_STAT_130 = "130"` — Accepted (受付済)
- `KOJIAK_STAT_200 = "200"` — Pending/Assigned (指定済)

These three statuses represent **active, pre-terminal** work orders. A work order in any of these states means the customer still has an active construction task.

| # | Type | Code |
|---|------|------|
| 1 | SET | `checkFlg = true` [-> KOJIAK_STAT_120 = "120" (Registered), KOJIAK_STAT_130 = "130" (Accepted), KOJIAK_STAT_200 = "200" (Pending)] |
| 2 | EXEC | `break` // Exit loop early — already found a non-active status |

**Block 4.1.1.2** — Nested IF (false branch) — Status IS an active status (L1502-1504)

> The work order status IS one of the active statuses (120, 130, or 200). Continue to the next work order. No action needed — this work order is in an acceptable state.

| # | Type | Code |
|---|------|------|
| 1 | (implicit) | (continue loop to next workMap) |

---

**Block 5** — IF `(checkFlg)` (L1512)

> After iterating through all work orders, check if any had a non-active status.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `checkFlg` // True if any work order had status != 120/130/200 |

**Block 5.1** — IF (true branch) (L1513)

> A non-active status was found. Return false to indicate the linkage check failed.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` // Work order in terminal status — check fails |

**Block 5.2** — IF (false branch) (L1517)

> All work orders (if any) are in active statuses. Return true to indicate the linkage check passed.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // All work orders in active state — check passes |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kojiak_stat` | Field | Work Order Status — a numeric code indicating the current state of a construction work order. Values include: "120" (Registered), "130" (Accepted), "140" (Request Sent), "150" (In Progress), "180" (Completed), "200" (Pending/Assigned). |
| `kojiak_no` | Field | Work Order Number — the unique identifier for a construction work order record. |
| `svc_kei_kaisen_ucwk_no` | Field | Service Detail Revision Work Number — internal tracking ID for revisions to service contract details. |
| `KKSV039527SC` | SC Code | Work Order In-Progress Details Service Component — retrieves the list of work orders associated with a service contract number. Its output is stored in `outputMap` under the key "KKSV039527SC". |
| `EKU0011B090CBSMsg1List` | CBS Message | Work Order List View CBS Message — the CBS-level message type representing a list of work order detail records. Each record contains fields like `kojiak_stat`, `kojiak_no`, and `svc_kei_kaisen_ucwk_no`. |
| `KOJIAK_STAT_120` | Constant | Work Order Status Code "120" — Registered (登録済). The initial state when a work order is created. |
| `KOJIAK_STAT_130` | Constant | Work Order Status Code "130" — Accepted (受付済). The work order has been accepted for processing. |
| `KOJIAK_STAT_200` | Constant | Work Order Status Code "200" — Pending/Assigned (指定済). The work order has been assigned but not yet begun. |
| `KOJIAK_STAT` | Constant | The map key string "kojiak_stat" used to access the work order status field in HashMap records. |
| eo Light Net (eo光ネット) | Business term | Fiber-optic broadband internet service provided by K-Opticom (formerly Fujitsu Personal Systems / KDDI). |
| `SVC_CD_NET` | Constant | Service Code for eo Light Net — used to branch processing logic for the Net service line specifically. |
| `forwardRsvClCfm` | Method | Service Contract Reservation Cancellation Confirmation — the main processing method of screen KKW02701SF that handles the cancellation flow for service subscriptions. |
| 工事連携確認 (Koji Renkei Kakunin) | Japanese term | Construction Linkage Confirmation — a validation step ensuring that construction work orders are in an appropriate state before proceeding with subscription changes or cancellations. |
| 工事案件 (Koji Anken) | Japanese term | Work Order / Construction Case — a record representing a field construction task (installation, maintenance, repair). |
| 登録済 (Tourokuzumi) | Japanese term | Registered — status "120", meaning the work order has been registered in the system. |
| 受付済 (Uketsukezumi) | Japanese term | Accepted — status "130", meaning the work order has been accepted for processing. |
| 依頼済 (Irai-zumi) | Japanese term | Request Sent — status "140", meaning the work order request has been sent to the field. |
| 完了 (Kanryo) | Japanese term | Completed — terminal status indicating the construction work is finished. |
| getArrayListMap | Helper method | Internal utility method that extracts an `ArrayList<HashMap<String, Object>>` from a parent map by key. Returns `null` if the list is null or empty. |
| checkFlg | Local variable | Check flag — a boolean that accumulates the result of the work order status validation across all items in the list. `true` means at least one work order has a non-active (terminal) status. |
