# Business Logic — JKKKyoseiDslRunMapperCC.editkkopUsekkUpdCC() [77 LOC]

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

## 1. Role

### JKKKyoseiDslRunMapperCC.editkkopUsekkUpdCC()

This method is the **mapper component** for forced termination (強制解約) of a K-Opticom DSL service contract line. Its business purpose is to construct a structured data payload (`trgt_data_list`) that will be consumed by the subsequent service contract update operation (`JKKKkopSvcUseKeiUpdCC.updateKkopSvcKeiTran`). The method collects three pre-fetched result hashes from prior service components (SC): a standard service agreement inquiry (`EKK0081A010`), a device-provided service agreement inquiry (`EKK0341A010`), and a penalty occurrence inquiry (`EKK0771A010`). It then assembles a single work map containing all data required to process the forced termination — including service contract number, device-provided service contract number, order detail number, forced-termination divergence code, and a penalty flag derived from the penalty inquiry result.

The method implements a **data assembly (builder) pattern**: it reads multiple input data sources, normalizes them into a common work map structure, and stores the result in a work parameter that the caller then passes to the update business component. It handles one conditional branch — whether a penalty (違約金) has been incurred — by reading the penalty occurrence flag from the `EKK0771A010` result hash and mapping it to the appropriate penalty code (`CD01375_PNLTY_HASSEI = "1"` for penalty incurred, `CD01375_PNLTY_NASHI = "0"` for no penalty).

The method is the shared data-mapping layer for the forced termination execution flow, called by `JKKKKyoseiDslRunCC.executekkopUsekkUpdCC()` which is invoked during the forced termination batch process (e.g., from screen `KKSV0167` for manual execution).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editkkopUsekkUpdCC start"])
    START --> WORKFIX_INIT["Initialize workFixedText HashMap if null"]
    WORKFIX_INIT --> RESULT_HASH_1["Get eKK0081A010Hash from resultHash"]
    RESULT_HASH_1 --> RESULT_HASH_2["Get eKK0341A010Hash from resultHash"]
    RESULT_HASH_2 --> RESULT_HASH_3["Get eKK0771A010Hash from resultHash"]
    RESULT_HASH_3 --> PNLTY_DEFAULT["Set pnltyHasseiUm to CD_DIV_UM_NASHI"]
    PNLTY_DEFAULT --> PNLTY_CHECK{eKK0771A010Hash != null}
    PNLTY_CHECK -->|Yes| PNLTY_READ["Read PNLTY_HASSEI_UM from eKK0771A010Hash"]
    PNLTY_CHECK -->|No| PNLTY_SKIP["Keep default penalty code"]
    PNLTY_READ --> BUILD_MAP["Create workMap"]
    PNLTY_SKIP --> BUILD_MAP
    BUILD_MAP --> SVC_KEI["Put KEY_SVC_KEI_NO from eKK0081A010Hash"]
    SVC_KEI --> IDO_DIV["Put KEY_IDO_DIV with IDO_DIV_KYOSEI value"]
    IDO_DIV --> KKTK_SVC["Put KEY_KKTK_SVC_KEI_NO from eKK0341A010Hash"]
    KKTK_SVC --> MSKM["Put KEY_MSKM_DTL_NO from inHash"]
    MSKM --> PNLTY_BRANCH{pnltyHasseiUm equals CD_DIV_UM_ARI}
    PNLTY_BRANCH -->|Yes| PNLTY_YES["Put KEY_PNLTY_HASSEI_CD = CD01375_PNLTY_HASSEI"]
    PNLTY_BRANCH -->|No| PNLTY_NO["Put KEY_PNLTY_HASSEI_CD = CD01375_PNLTY_NASHI"]
    PNLTY_YES --> SVC_END["Put KEY_SVC_ENDYMD from inHash"]
    PNLTY_NO --> SVC_END
    SVC_END --> SVC_CHRG["Put KEY_SVC_CHRG_ENDYMD from inHash"]
    SVC_CHRG --> UPD_DTM["Put KEY_UPD_DTM_BF from svcKeiUpdDtm"]
    UPD_DTM --> ADD_ARRAY["Add workMap to workArray"]
    ADD_ARRAY --> OUT_MAP_PUT["Put workArray into outMap as trgt_data_list"]
    OUT_MAP_PUT --> END(["editkkopUsekkUpdCC end"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Business data I/F object that carries work parameters. Used to read/write the `workFixedText` work area HashMap which holds the `trgt_data_list` output. Represents the request parameter context passed through the processing pipeline. |
| 2 | `fixedText` | `String` | User-defined arbitrary string for the forced termination operation. Passed to the work area initialization check but not directly used in data mapping for this method. Represents free-form notes or comments attached to the termination. |
| 3 | `workFixedText` | `String` | Work area key name (e.g., `"workkkopUsekkDataKey"`). Used as the key to store/retrieve the work HashMap from `param`. Identifies the scoped work space for this forced termination data assembly. |
| 4 | `svcKeiUpdDtm` | `String` | Service contract update date/time (YYYYMMDDHHmmss format, before update). Carries the timestamp of the last service contract update. Used as the `upd_dtm_bf` (before update datetime) field to track the state before forced termination is applied. |
| 5 | `inHash` | `HashMap<String, Object>` | Input hash carrying the order detail number (`MSKM_DTL_NO`), service end date (`REQYMD`), and service charge end date (`SVC_CHRG_ENDYMD`). Represents the input data context for the termination — dates and order references from the calling screen/batch. |
| 6 | `resultHash` | `HashMap<String, Object>` | Result hash containing pre-fetched inquiry results from prior service component executions. The method retrieves three entries: `EKK0081A010` (standard service agreement), `EKK0341A010` (device-provided service agreement), and `EKK0771A010` (penalty occurrence inquiry). These represent the outputs of SC template calls executed before this mapper runs. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | JBSbatAKKshkmRsltInfoTukiawsday | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiawsday` |
| - | `JBSbatAKKshkmRsltInfoTukiaws.setData` | JBSbatAKKshkmRsltInfoTukiaws | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiaws` |
| - | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | JBSbatAKKshkmRsltInfoTukiawsRealSkh | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiawsRealSkh` |
| - | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | JBSbatAKKshkmRsltInfTkCvsNCnsl | - | Calls `setData` in `JBSbatAKKshkmRsltInfTkCvsNCnsl` |
| R | `JBSbatDKNyukaFinAdd.getData` | JBSbatDKNyukaFinAdd | - | Calls `getData` in `JBSbatDKNyukaFinAdd` |
| - | `JBSbatKKGetCTITelno.setData` | JBSbatKKGetCTITelno | - | Calls `setData` in `JBSbatKKGetCTITelno` |
| R | `JFUeoTelOpTransferCC.getData` | JFUeoTelOpTransferCC | - | Calls `getData` in `JFUeoTelOpTransferCC` |
| R | `JFUTransferCC.getData` | JFUTransferCC | - | Calls `getData` in `JFUTransferCC` |
| R | `JFUTransferListToListCC.getData` | JFUTransferListToListCC | - | Calls `getData` in `JFUTransferListToListCC` |
| R | `KKW12701SFLogic.getData` | KKW12701SFLogic | - | Calls `getData` in `KKW12701SFLogic` |

**CRUD analysis for methods actually called within this method:**

This method (`editkkopUsekkUpdCC`) does **not** directly call any service components (SC) or business components (CBS). It is a pure **mapper method** that performs data assembly — reading from `param`, `inHash`, and `resultHash`, and constructing an output HashMap. The pre-computed list above represents method calls found in the broader call graph of this method's caller, not direct calls within `editkkopUsekkUpdCC` itself.

The actual operations are parameter reads and local HashMap writes:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `param.getData(workFixedText)` | - | - | Reads the work HashMap from the request parameter (or initializes if null) |
| R | `resultHash.get(TEMPLATE_ID_EKK0081A010)` | - | - | Reads the standard service agreement inquiry result hash |
| R | `resultHash.get(TEMPLATE_ID_EKK0341A010)` | - | - | Reads the device-provided service agreement inquiry result hash |
| R | `resultHash.get(TEMPLATE_ID_EKK0771A010)` | - | - | Reads the penalty occurrence inquiry result hash |
| R | `eKK0771A010Hash.get(PNLTY_HASSEI_UM)` | - | - | Reads the penalty occurrence flag from the EKK0771A010 result |
| R | `eKK0081A010Hash.get(SVC_KEI_NO)` | - | - | Reads the service contract number from the EKK0081A010 result |
| R | `eKK0341A010Hash.get(KKTK_SVC_KEI_NO)` | - | - | Reads the device-provided service contract number from the EKK0341A010 result |
| R | `inHash.get(MSKM_DTL_NO)` | - | - | Reads the order detail number from input hash |
| R | `inHash.get(REQYMD)` | - | - | Reads the service end date from input hash |
| R | `inHash.get(SVC_CHRG_ENDYMD)` | - | - | Reads the service charge end date from input hash |
| W | `param.setData(workFixedText, new HashMap)` | - | - | Initializes work HashMap if not present |
| W | `workMap.put(...)` (×8) | - | - | Writes mapped data fields into work map |
| W | `workArray.add(workMap)` | - | - | Appends work map to work array |
| W | `outMap.put("trgt_data_list", workArray)` | - | - | Stores final data list for the caller to consume |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 6 methods.
Terminal operations from this method: `getData` [R], `getData` [R], `getData` [R], `getData` [R], `getData` [R], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `getData` [R], `getData` [R], `getData` [R], `getData` [R], `getData` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JKKKyoseiDslRunCC.executekkopUsekkUpdCC() | `executekkopUsekkUpdCC(handle, param, requestParam, resultHash, fixedText, workkkopUsekkDataKey)` -> `mapper.editkkopUsekkUpdCC(param, fixedText, workkkopUsekkDataKey, svcKeiUpdDtm, requestParam, resultHash)` -> reads from `param`, `resultHash`, `inHash`; writes `trgt_data_list` to work map | `param.getData [R]`, `resultHash.get [R]` (EKK0081A010, EKK0341A010, EKK0771A010), `workMap.put [W]` (svc_kei_no, ido_div, kktk_svc_kei_no, msKm_dtl_no, pnlty_hassei_cd, svc_endymd, svc_chrg_endymd, upd_dtm_bf), `outMap.put [W]` (trgt_data_list) |

**Caller context:** The method is called by `JKKKKyoseiDslRunCC.executekkopUsekkUpdCC()` at line 8792. This caller is a business component (CBS) that orchestrates the forced termination of DSL service contracts. After calling `editkkopUsekkUpdCC`, the caller retrieves the assembled `trgt_data_list` and passes it to `JKKKkopSvcUseKeiUpdCC.updateKkopSvcKeiTran()` which performs the actual database update of service contract data.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `param.getData(workFixedText) == null` (L3790)

> Initialize the work area HashMap if the `workFixedText` work space has not yet been created.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.setData(workFixedText, new HashMap<String, Object>())` // Create empty work HashMap [-> workFixedText is a key identifier] |
| 2 | SET | `outMap = (HashMap)param.getData(workFixedText)` // Read the work HashMap into local reference |

**Block 2** — [SET] Initialize local variables and work structures (L3794–L3805)

> Prepare local variables for the three inquiry result hashes and initialize the work array and work map data structures.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workArray = new ArrayList<HashMap>()` // Initialize target data list: 対象データリスト [L3794] |
| 2 | SET | `workMap = new HashMap<String, Object>()` // Initialize per-contract work map: 機器オプションサービス契約更新マップ [L3797] |
| 3 | SET | `eKK0081A010Hash = null` // Service agreement inquiry result: サービス契約一意照会結果 [L3799] |
| 4 | SET | `eKK0081A010Hash = (HashMap)resultHash.get(JKKKyoseiDslRunCC.TEMPLATE_ID_EKK0081A010)` // Retrieve from resultHash [-> "EKK0081A010"] |
| 5 | SET | `eKK0341A010Hash = null` // Device-provided service agreement result: 機器提供サービス契約一意照会結果 [L3802] |
| 6 | SET | `eKK0341A010Hash = (HashMap)resultHash.get(JKKKyoseiDslRunCC.TEMPLATE_ID_EKK0341A010)` // Retrieve from resultHash [-> "EKK0341A010"] |
| 7 | SET | `eKK0771A010Hash = null` // Device-provided service inquiry result: 機器提供サービス一意照会結果 [L3805] |
| 8 | SET | `eKK0771A010Hash = (HashMap)resultHash.get(JKKKyoseiDslRunCC.TEMPLATE_ID_EKK0771A010)` // Retrieve from resultHash [-> "EKK0771A010"] |

**Block 3** — [SET] Default penalty code assignment (L3806)

> Set the penalty occurrence flag to the default "no penalty" value before checking the inquiry result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `pnltyHasseiUm = JKKStrConst.CD_DIV_UM_NASHI` // Penalty occurrence flag default [-> "0" = no penalty] |

**Block 4** — [IF] `eKK0771A010Hash != null` (L3807)

> Conditional branch: if the penalty inquiry result is present, read the actual penalty occurrence flag from it.

**Block 4.1** — [ELSE-IF branch body: penalty hash present] (L3808–L3810)

| # | Type | Code |
|---|------|------|
| 1 | SET | `pnltyHasseiUm = (String)eKK0771A010Hash.get(EKK0771A010CBSMsg1List.PNLTY_HASSEI_UM)` // Read penalty occurrence flag [-> "pnlty_hassei_um"] |

**Block 4.2** — [ELSE branch body: penalty hash absent] — implicit, `pnltyHasseiUm` retains its default value of `CD_DIV_UM_NASHI = "0"` (penalty not occurred) [L3807]

**Block 5** — [SET] Build workMap: service contract number (L3813)

> Map the service contract number from the EKK0081A010 inquiry result.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_SVC_KEI_NO, eKK0081A010Hash.get(EKK0081A010CBSMsg1List.SVC_KEI_NO))` // Map service contract number [-> KEY = "svc_kei_no", source = "svc_kei_no"] |

**Block 6** — [SET] Build workMap: divergence code for forced termination (L3816)

> Set the divergence code to indicate this is a forced termination operation (強制解約).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_IDO_DIV, JKKKyoseiDslRunCC.IDO_DIV_KYOSEI)` // Fixed divergence code for forced termination [-> KEY = "ido_div", VALUE = "00064"] |

**Block 7** — [SET] Build workMap: device-provided service contract number (L3819)

> Map the device-provided service contract number from the EKK0341A010 inquiry result.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_KKTK_SVC_KEI_NO, eKK0341A010Hash.get(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_NO))` // Map device-provided service contract number [-> KEY = "kktk_svc_kei_no", source = "kktk_svc_kei_no"] |

**Block 8** — [SET] Build workMap: order detail number (L3822)

> Map the order detail number from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_MSKM_DTL_NO, inHash.get(JKKKyoseiDslRunCC.MSKM_DTL_NO))` // Map order detail number [-> KEY = "mskm_dtl_no"] |

**Block 9** — [IF/ELSE] Penalty code mapping (L3825–L3832)

> Conditional branch: determine whether a penalty (違約金) was incurred and map the appropriate penalty code. This is the only branching logic in the method.

**Block 9.1** — [IF] `JKKStrConst.CD_DIV_UM_ARI.equals(pnltyHasseiUm)` (`pnltyHasseiUm == "1"`) (L3825)

> Penalty HAS occurred. Set the penalty code to indicate penalty incidence.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_PNLTY_HASSEI_CD, JKKStrConst.CD01375_PNLTY_HASSEI)` // Penalty incurred [-> KEY = "pnlty_hassei_cd", VALUE = "1"] |

**Block 9.2** — [ELSE] `pnltyHasseiUm != "1"` (no penalty) (L3828)

> Penalty has NOT occurred. Set the penalty code to indicate no penalty.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_PNLTY_HASSEI_CD, JKKStrConst.CD01375_PNLTY_NASHI)` // No penalty [-> KEY = "pnlty_hassei_cd", VALUE = "0"] |

**Block 10** — [SET] Build workMap: service end date (L3835)

> Map the service end date from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_SVC_ENDYMD, inHash.get(JKKKyoseiDslRunCC.REQYMD))` // Service end date (サービス終了年月日) [-> KEY = "svc_endymd"] |

**Block 11** — [SET] Build workMap: service charge end date (L3838)

> Map the service charge end date from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_SVC_CHRG_ENDYMD, inHash.get(JKKKyoseiDslRunCC.SVC_CHRG_ENDYMD))` // Service charge end date (サービス課金終了年月日) [-> KEY = "svc_chrg_endymd"] |

**Block 12** — [SET] Build workMap: update datetime before (L3841)

> Map the service contract update timestamp prior to the forced termination update.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workMap.put(JKKKkopSvcUseKeiUpdCC.KEY_UPD_DTM_BF, svcKeiUpdDtm)` // Update datetime before update (更新年月日時分秒(更新前)) [-> KEY = "upd_dtm_bf"] |

**Block 13** — [SET] Finalize workArray and store in outMap (L3843–L3845)

> Append the completed work map to the work array, then store the array in the output work area HashMap as `trgt_data_list`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workArray.add(workMap)` // Add assembled work map to target data list |
| 2 | EXEC | `outMap.put("trgt_data_list", workArray)` // Store target data list in work area HashMap |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the unique identifier for a customer's service contract line item |
| `kktk_svc_kei_no` | Field | Device-provided service contract number — contract number for services tied to specific equipment (e.g.,ONU, router) provided by the operator |
| `mskm_dtl_no` | Field | Order detail number — detail line item number within a service order |
| `ido_div` | Field | Divergence code — classifies the type of contract state change (e.g., termination, suspension, change) |
| `ido_div_kyosei` | Field | Forced termination divergence code — value `"00064"` indicating a强制 termination initiated by the operator |
| `pnlty_hassei_cd` | Field | Penalty occurrence code — `"1"` means penalty (違約金) was incurred, `"0"` means no penalty |
| `svc_endymd` | Field | Service end date — the date when the service contract terminates |
| `svc_chrg_endymd` | Field | Service charge end date — the date until which the customer is still billed for the service |
| `upd_dtm_bf` | Field | Update datetime before — the timestamp of the service contract record before this forced termination update |
| `trgt_data_list` | Field | Target data list — the output key holding an ArrayList of work maps, one per service contract line being terminated |
| `workFixedText` | Field | Work area key name — identifies the scoped work HashMap within the request parameter |
| TEMPLATE_ID_EKK0081A010 | Constant | Template ID for standard service agreement inquiry SC — retrieves the core service contract data |
| TEMPLATE_ID_EKK0341A010 | Constant | Template ID for device-provided service agreement inquiry SC — retrieves equipment-linked service contract data |
| TEMPLATE_ID_EKK0771A010 | Constant | Template ID for penalty occurrence inquiry SC — determines whether termination penalty applies |
| CD_DIV_UM_NASHI | Constant | "No penalty / no occurrence" flag value — `"0"` |
| CD_DIV_UM_ARI | Constant | "Penalty occurred" flag value — `"1"` |
| CD01375_PNLTY_HASSEI | Constant | Penalty incurred code — `"1"` |
| CD01375_PNLTY_NASHI | Constant | No penalty code — `"0"` |
| EKK0081A010 | SC | Service agreement single-item inquiry service component |
| EKK0341A010 | SC | Device-provided service agreement single-item inquiry service component |
| EKK0771A010 | SC | Penalty occurrence inquiry service component |
| 強制解約 (Kyozei Kaishaku) | Business term | Forced termination — operator-initiated cancellation of a service contract, typically due to non-payment or contract breach |
| 違約金 (Iyakkin) | Business term | Penalty / breach-of-contract fee — financial penalty charged to a customer for early or forced contract termination |
| JKKKyoseiDslRunCC | Component | Forced DSL execution business component — orchestrates the overall forced termination batch/screen process |
| JKKKkopSvcUseKeiUpdCC | Component | K-Op option service contract update business component — performs the actual database update of service contract status after data mapping |
| K-Opticom | Business term | Japanese telecommunications operator offering DSL, fiber, and bundled communication services |
| ANK | Acronym | System change request ticket prefix (e.g., ANK-1578, ANK-1988) — used in change management tracking |
