# Business Logic — JKKPauseChgRsvClCC.executeHakkoSodCC() [88 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKPauseChgRsvClCC` |
| Layer | CC / Common Component |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKPauseChgRsvClCC.executeHakkoSodCC()

This method is the **SOD (Service Order Data) issuance processing** routine for pause-change-reservation-close operations. It constructs SOD payload data from service contract information and delegates the actual order issuance to `JKKHakkoSODCC.hakkoSOD()`. The method implements a **builder pattern** — it assembles a hierarchical map structure containing basic SOD info, service contract info, and service contract detail info for each eligible service line item in the input list. 

A key business concern is filtering out stale or irrelevant service contract lines when the method is invoked during "pause start from reserving operation change" (異動予約反映からの休止開始時) scenarios — specifically for FTTH authentication and temporary suspension operations (休止変更・解除). In such cases, it skips entries whose service contract detail status is neither active (TKC = "100") nor suspended (STP = "220"), preventing unnecessary SODs from being issued for cancelled service contracts. The method serves as a **shared common component** called by the parent control method `pauseChgRsvClCtrlTran()`, acting as the data preparation bridge between the pause-change-reservation business flow and the generic SOD issuance engine.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeHakkoSodCC"])
    INIT["Initialize local maps and lists"]
    CREATE_USER["createUserData with workFixedText"]
    GET_OUT_MAP["Get outMap from param.getData"]
    NEW_HAKKO["New JKKHakkoSODCC instance"]
    LOOP_START["Loop each msgEKK0161B004"]
    GET_MSG["Get msgEKK0161B004 from list"]
    CHECK_DIV["hakkoSodIdoDiv equals CD00576_PAUSE_CHG_RSV_CL"]
    GET_SVC_STAT["Get svcKeiUcwkStat from msg"]
    CHECK_TKC["svcKeiUcwkStat equals SVC_KEI_STAT_TKC"]
    CHECK_STP["svcKeiUcwkStat equals SVC_KEI_STAT_STP"]
    SKIP["continue skip this item"]
    RESET_MAPS["Reset all SOD maps"]
    PUT_MAP_DATA["Set SOD map fields"]
    PUT_IDO_DIV["Map ido_div from hakkoSodIdoDiv"]
    PUT_SYSID["Map sysid from msgEKK0081A010"]
    PUT_SVC_NO["Map svc_kei_no from msgEKK0081A010"]
    PUT_UCWK_NO["Map svc_kei_ucwk_no from msgEKK0161B004"]
    PUT_ADD_DTM["Map chaf_svc_kei_ucwk_gene_add_dtm"]
    BUILD_SOD_MAP["Build sod_map with three sub-maps"]
    ADD_LIST["Add sod_map to trgt_data_list"]
    LOOP_END["End loop iteration"]
    PUT_FUNC["outMap put func_code"]
    PUT_LIST_RESULT["outMap put trgt_data_list"]
    CALL_HAKKO["hakkoSODCC.hakkoSOD call"]
    CLEANUP["if workHakkoSODDataKeyFlg removeData"]
    RETURN["Return 0"]
    END(["End"])

    START --> INIT --> CREATE_USER --> GET_OUT_MAP --> NEW_HAKKO --> LOOP_START
    LOOP_START --> GET_MSG --> CHECK_DIV
    CHECK_DIV -->|True| GET_SVC_STAT --> CHECK_TKC
    CHECK_TKC -->|True| CHECK_STP -->|True| SKIP --> LOOP_END
    CHECK_TKC -->|False| PUT_MAP_DATA
    CHECK_STP -->|False| PUT_MAP_DATA
    CHECK_DIV -->|False| PUT_MAP_DATA
    PUT_MAP_DATA --> PUT_IDO_DIV --> PUT_SYSID --> PUT_SVC_NO --> PUT_UCWK_NO --> PUT_ADD_DTM --> BUILD_SOD_MAP --> ADD_LIST --> LOOP_END
    LOOP_END --> PUT_FUNC --> PUT_LIST_RESULT --> CALL_HAKKO --> CLEANUP --> RETURN --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle containing session manager context — provides the runtime session environment for service component invocations during SOD issuance |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object containing a model group and control map. Acts as the central data carrier: SOD data is written here via `putData`, and work-specific maps are retrieved via `getData` using the `workFixedText` key (`"HakkoSODCC"`) |
| 3 | `msgEKK0081A010` | `CAANMsg` | Contract message carrying customer-level service contract header information — provides `SYSID` (system ID) and `SVC_KEI_NO` (service contract number) used as foundational SOD data |
| 4 | `msgEKK0161B004List` | `CAANMsg[]` | Array of service contract detail messages — each entry represents a service contract line item (内訳情報). The method iterates over all entries, building one SOD record per eligible detail item. The `SVC_KEI_UCWK_STAT` field of each entry is used for filtering |
| 5 | `hakkoSodIdoDiv` | `String` | SOD issuance transfer classification (SOD発行用異動区分) — determines the business operation type being issued. When equal to `CD00576_PAUSE_CHG_RSV_CL = "00025"`, status-based filtering is applied to skip cancelled/suspended service lines. Also placed directly into the SOD map as `ido_div` |

**Instance fields / external state read:**
- `SVC_KEI_STAT_TKC = "100"` — local constant defining "service provision active" status [-> SVC_KEI_STAT_TKC="100" (JKKPauseChgRsvClCC.java:88)]
- `SVC_KEI_STAT_STP = "220"` — local constant defining "service provision suspended" status [-> SVC_KEI_STAT_STP="220" (JKKPauseChgRsvClCC.java:92)]
- `JKKStrConst.CD00576_PAUSE_CHG_RSV_CL = "00025"` — constant defining "pause change reservation close" operation type [-> CD00576_PAUSE_CHG_RSV_CL="00025" (JKKStrConst.java:1534)]

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `JKKPauseChgRsvClCC.createUserData` | N/A | - | Creates user-specific SOD work data map and stores it in the parameter object under key `"HakkoSODCC"`; returns boolean indicating whether cleanup is needed |
| R | `JKKHakkoSODCC.hakkoSOD` | N/A | - | Invokes the generic SOD issuance engine with the prepared data map, triggering downstream SOD creation across multiple service types |
| R | `param.getData` | N/A | - | Retrieves the work data map from the parameter object for later writing of `func_code` and `trgt_data_list` |
| R | `param.removeData` | N/A | - | Cleans up the work data map from the parameter object if `createUserData` flagged it as needing removal |

**Notes on SC Codes and Entities:**
- The actual SC Codes and DB table references are determined inside `JKKHakkoSODCC.hakkoSOD()`, which is a larger method that dispatches to multiple SC classes (e.g., `JBSbatDKNyukaFinAdd`, `JBSbatFUCaseFileRnkData`, etc.) based on the order content codes contained in the SOD data. This method does not directly access DB tables — it delegates all persistence operations to `hakkoSOD()`.
- SC Codes and CBS references are inferred from the `hakkoSOD` chain of calls, which processes the `trgt_data_list` and creates service orders across FTTH, Mail, and other telecom service types.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0004 (Pause Change Reservation Close screen) | `JKKPauseChgRsvClCC.pauseChgRsvClCtrlTran()` -> `executeHakkoSodCC()` | `hakkoSOD -> JBSbatDKNyukaFinAdd [C] -> KK_T_SOD_*; JBSbatFUCaseFileRnkData [R] -> KK_T_SVC_KEI_*; JBSbatFUMoveNaviData [R]` |

**Call chain explanation:** The pause change reservation close screen (`KKSV0004`) invokes the controller method `pauseChgRsvClCtrlTran()`, which calls `executeHakkoSodCC()` to prepare and issue SODs for service line items that require order generation (e.g., service status changes, suspension/resumption).

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (L1698)

> Initialize local data structures for SOD data building and map creation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sod_map = new HashMap<String, Object>()` // SOD map (SODマップ) |
| 2 | SET | `trgt_data_list = new ArrayList<Object>()` // Target data list (対象データリスト) |
| 3 | SET | `sod_kihon_info_Map = new HashMap<String, Object>()` // SOD basic info map (SOD基本情報マップ) |
| 4 | SET | `svc_kei_info_Map = new HashMap<String, Object>()` // Service contract info map (サービス契約情報マップ) |
| 5 | SET | `svc_kei_ucwk_info_Map = new HashMap<String, Object>()` // Service contract detail info map (サービス契約内訳情報マップ) |

**Block 2** — [SET] (L1703)

> Define the fixed work identifier text and create user data, then retrieve the output map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workFixedText = "HakkoSODCC"` // SOD issuance work prefix (SOD発行用eworkPrefix) |
| 2 | CALL | `createUserData(param, workFixedText)` // Creates user-specific work data; returns boolean flag [-> SVC_KEI_STAT_TKC="100" (JKKPauseChgRsvClCC.java:88); -> SVC_KEI_STAT_STP="220" (JKKPauseChgRsvClCC.java:92)] |
| 3 | SET | `workHakkoSODDataKeyFlg = createUserData(...)` // Cleanup flag |
| 4 | SET | `hakkoSODCC = new JKKHakkoSODCC()` // Instantiate SOD issuance component |
| 5 | SET | `outMap = (HashMap)param.getData(workFixedText)` // Retrieve work data map from param |

**Block 3** — [FOR LOOP + IF CONDITION] (L1706–1763)

> Iterate over all service contract detail messages and build SOD records. When the operation type is "pause change reservation close" (CD00576_PAUSE_CHG_RSV_CL = "00025"), filter out detail items that are neither active nor suspended, preventing unnecessary SODs for cancelled contracts.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0; i < msgEKK0161B004List.length; i++` // Loop over detail message array |
| 2 | SET | `msgEKK0161B004 = msgEKK0161B004List[i]` // Get current detail message |

**Block 3.1** — [IF] `JKKStrConst.CD00576_PAUSE_CHG_RSV_CL.equals(hakkoSodIdoDiv)` (L1713)

> When the operation type is "pause change from reserving operation change" (異動予約反映からの休止開始), validate service line item status to avoid issuing SODs for cancelled service contracts.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiUcwkStat = msgEKK0161B004.getString(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_STAT)` // Get service contract detail status |
| 2 | IF | `!SVC_KEI_STAT_TKC.equals(svcKeiUcwkStat) && !SVC_KEI_STAT_STP.equals(svcKeiUcwkStat)` [-> SVC_KEI_STAT_TKC="100" (JKKPauseChgRsvClCC.java:88); -> SVC_KEI_STAT_STP="220" (JKKPauseChgRsvClCC.java:92)] |

**Block 3.1.1** — [ELSE BRANCH OF IF] (L1729)

> Service status is neither active nor suspended — skip this line item to avoid creating unnecessary SODs for cancelled contracts.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip to next iteration — do not issue SOD for this detail item |

**Block 3.2** — [ELSE BRANCH OF BLOCK 3.1 IF] (implicit, falls through)

> Service status is valid (active or suspended), or the operation type is not the pause-change-reservation-close type — proceed with SOD map construction.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sod_kihon_info_Map = new HashMap<String, Object>()` // Reset basic info map (SOD基本情報マップ設定) |
| 2 | SET | `sod_kihon_info_Map.put("ido_div", hakkoSodIdoDiv)` // Transfer classification from parameter [-> CD00576_PAUSE_CHG_RSV_CL="00025" (JKKStrConst.java:1534)] |
| 3 | SET | `sod_kihon_info_Map.put("sysid", msgEKK0081A010.getString(EKK0081A010CBSMsg1List.SYSID))` // System ID (SYSID) |
| 4 | SET | `svc_kei_info_Map = new HashMap<String, Object>()` // Reset service contract info map (サービス契約情報マップ設定) |
| 5 | SET | `svc_kei_info_Map.put("svc_kei_no", msgEKK0081A010.getString(EKK0081A010CBSMsg1List.SVC_KEI_NO))` // Service contract number (サービス契約番号) |
| 6 | SET | `svc_kei_ucwk_info_Map = new HashMap<String, Object>()` // Reset service contract detail info map (サービス契約内訳情報マップ設定) |
| 7 | SET | `svc_kei_ucwk_info_Map.put("svc_kei_ucwk_no", msgEKK0161B004.getString(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_NO))` // Service contract detail number (サービス契約内訳番号) |
| 8 | SET | `svc_kei_ucwk_info_Map.put("chaf_svc_kei_ucwk_gene_add_dtm", msgEKK0161B004.getString(EKK0081A010CBSMsg1List.GENE_ADD_DTM))` // Changed service contract detail registration datetime (変更後サービス契約内訳世代登録年月日時分秒) |
| 9 | SET | `sod_map = new HashMap<String, Object>()` // Reset SOD map (SODマップ設定) |
| 10 | SET | `sod_map.put("sod_kihon_info", sod_kihon_info_Map)` // Attach basic info sub-map |
| 11 | SET | `sod_map.put("svc_kei_info", svc_kei_info_Map)` // Attach service contract info sub-map |
| 12 | SET | `sod_map.put("svc_kei_ucwk_info", svc_kei_ucwk_info_Map)` // Attach service contract detail info sub-map |
| 13 | EXEC | `trgt_data_list.add(sod_map)` // Add to target data list |

**Block 4** — [SET] (L1766)

> Set the function code and target data list into the output map for the SOD issuance engine.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.put("func_code", JPCModelConstant.FUNC_CD_1)` // Set function code to 1 |
| 2 | SET | `outMap.put("trgt_data_list", trgt_data_list)` // Set accumulated target SOD data list |

**Block 5** — [CALL] (L1769)

> Delegate to the SOD issuance component to process the assembled data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `hakkoSODCC.hakkoSOD(handle, param, workFixedText)` // Issue SOD for assembled data (SOD発行処理) |

**Block 6** — [IF CONDITION] (L1772)

> If `createUserData` flagged the work data key as needing cleanup, remove it from the parameter.

| # | Type | Code |
|---|------|------|
| 1 | IF | `workHakkoSODDataKeyFlg` // True if the work data key was created by this call |
| 2 | EXEC | `param.removeData(workFixedText)` // Clean up the work data map |

**Block 7** — [RETURN] (L1775)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return 0` // Return success code |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| SOD | Acronym | Service Order Data — telecom order fulfillment entity used to trigger downstream service provisioning operations |
| 異動区分 (Ido Kubun) | Field | Transfer/operation classification — indicates the type of business operation (e.g., pause change, cancellation) |
| 発行 (Hakko) | Field | Issuance / generation — in this context, creating a new SOD record |
| 内訳情報 (Uchiwaku Joho) | Field | Service contract detail information — line-level breakdown of a service contract (e.g., individual services within a bundle) |
| 休止変更・解除 (Shuushi Henko Kaijo) | Business term | Pause modification and cancellation — the business operation of modifying or releasing a service suspension |
| CD00576_PAUSE_CHG_RSV_CL | Constant | Operation type code "00025" — indicates "pause change from reserving operation change" flow |
| SVC_KEI_STAT_TKC | Constant | Service contract detail status "100" — service provision active / in service |
| SVC_KEI_STAT_STP | Constant | Service contract detail status "220" — service provision suspended |
| SYSID | Field | System ID — identifies the system within the K-Opticom network |
| SVC_KEI_NO | Field | Service contract number — unique identifier for a service contract header |
| SVC_KEI_UCWK_NO | Field | Service contract detail number — unique identifier for a service contract line item |
| chaf_svc_kei_ucwk_gene_add_dtm | Field | Changed service contract detail generation registration datetime — timestamp when the service contract detail record was created/modified |
| func_code | Field | Function code — indicates the type of function being invoked; value "1" signifies a specific operation mode |
| trgt_data_list | Field | Target data list — accumulator of SOD records to be issued in this transaction |
| workFixedText | Field | Work identifier string — key used to store and retrieve temporary work data; value `"HakkoSODCC"` for this method |
| JKKHakkoSODCC | Class | SOD issuance component — the central service that dispatches SOD creation across all telecom service types |
