# Business Logic — JKKPauseChgRsvClCC.pauseTokiPrdChgTran() [78 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.pauseTokiPrdChgTran()

This method performs the **temporary period change transaction for a paused service contract line** within the Fujitsu K-Opticom eo Customer Backbone System. It is the core processing entry point that extends an existing suspension (休止) period by first retrieving the EO optical phone service contract details, validating each line item against a requested new release date, and then issuing two sequential CBS operations when the conditions are met: (1) retrieve the EO optical phone agreement details, and (2) set the transfer temporary key with the updated termination date.

The method handles a single **service type category**: DSL (Digital Subscriber Line) pause with temporary key registration (`ITNTOKI_ADD_CD_PAUSE = "3"`), which represents a service suspension where a transfer temporary key is registered — essentially putting a DSL line on hold for a specified duration.

It implements the **delegation design pattern**, routing data preparation through a mapper component (`JKKPauseChgRsvClMapperCC`), executing service component calls via a central dispatcher (`scCall.run()`), and applying standardized result processing and error checking for each CBS invocation. The method is called from the parent control flow method `pauseChgRsvClCtrlTran()`, acting as a focused transaction handler that processes one phase of the broader pause/change/cancellation workflow.

Its role in the larger system is as a **conditional processor**: it iterates over EO optical phone service contract lines and only triggers downstream operations for those lines that are currently in a pause state AND whose planned temporary key end reservation date is before the user-requested service suspension release date — ensuring the new period fully covers the existing one.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["pauseTokiPrdChgTran"])

    START --> GET_PARAM["Extract request parameter map from param.getData(fixedText)"]
    GET_PARAM --> GET_INMAP["Get inMap from PAUSE_RECEPT_MAP key"]
    GET_INMAP --> GET_SVC_PAUSE_RLS["Read svc_pause_rls_ymd from inMap"]
    GET_SVC_PAUSE_RLS --> CHECK_MSG1{"msgEKK0021C060
not null?"}

    CHECK_MSG1 -->|Yes| GET_MSG1["Get tmpMskmDtlNo from msgEKK0021C060.getString(MSKM_DTL_NO)"]
    CHECK_MSG1 -->|No| GET_MSG2["Get msgEKK1681B001_005 and msgEKK1681B001_006 from resultHash"]

    GET_MSG1 --> CALL_MAPPER_B["Call mapper.editInMsgEKK0191B005(param, fixedText)"]
    GET_MSG2 --> CALL_MAPPER_B

    CALL_MAPPER_B --> CALL_SC_B["Call scCall.run(map, handle)"]
    CALL_SC_B --> EDIT_RP_B["Call mapper.editResultRPEKK0191B005(rslt, param, fixedText)"]
    EDIT_RP_B --> ERRCHK_B["Call errChk(rsltEKK0191B005)"]
    ERRCHK_B --> GET_WORK_B["Call getWorkCAANMsg(rsltEKK0191B005)"]
    GET_WORK_B --> GET_MSG_LIST["Extract msgEKK0191B005List from work message"]

    GET_MSG_LIST --> LOOP_START["Loop: for i = 0 to msgEKK0191B005List.length"]
    LOOP_START --> GET_ITNTOKI["Get itntoki_add_cd from msgEKK0191B005"]
    GET_ITNTOKI --> CHECK_PAUSE{"itntoki_add_cd equals
ITNTOKI_ADD_CD_PAUSE = \"3\""}

    CHECK_PAUSE -->|No| LOOP_NEXT["i++"]
    CHECK_PAUSE -->|Yes| GET_END_RSYMD["Get tntoki_end_rsv_ymd from msgEKK0191B005"]
    GET_END_RSYMD --> CHECK_DATE{"svc_pause_rls_ymd.compareTo(tntoki_end_rsv_ymd) < 0"}

    CHECK_DATE -->|No| LOOP_NEXT
    CHECK_DATE -->|Yes| CALL_MAPPER_A["Call mapper.editInMsgEKK0191A010(param, fixedText, msgEKK0191B005)"]

    CALL_MAPPER_A --> CALL_SC_A["Call scCall.run(map, handle)"]
    CALL_SC_A --> EDIT_RP_A["Call mapper.editResultRPEKK0191A010(rslt, param, fixedText)"]
    EDIT_RP_A --> ERRCHK_A["Call errChk(rsltEKK0191A010)"]
    ERRCHK_A --> GET_WORK_A["Call getWorkCAANMsg(rsltEKK0191A010)"]
    GET_WORK_A --> GET_MSG_A["Extract first msgEKK0191A010 from work message"]
    GET_MSG_A --> CALL_MAPPER_C["Call mapper.editInMsgEKK0191C011(param, fixedText, msgEKK0191A010, tmpMskmDtlNo)"]
    CALL_MAPPER_C --> CALL_SC_C["Call scCall.run(map, handle)"]
    CALL_SC_C --> EDIT_RP_C["Call mapper.editResultRPEKK0191C011(rslt, param, fixedText)"]
    EDIT_RP_C --> ERRCHK_C["Call errChk(rsltEKK0191C011)"]
    ERRCHK_C --> LOOP_NEXT

    LOOP_NEXT --> LOOP_END{"i < msgEKK0191B005List.length"}
    LOOP_END -->|Yes| GET_ITNTOKI
    LOOP_END -->|No| END_NODE(["Return / Next"])
```

**Processing summary:**
1. **Extract request parameters** — obtains the target map and service suspension release date from the input parameter structure.
2. **Obtain application details number (申請明細番号)** — retrieves `tmpMskmDtlNo` from the order application result (`EKK0021C060`) if available, otherwise falls back to the alternate contract list result (`EKK1681B001_005` / `_006`). This number is passed downstream to the final CBS operation.
3. **Retrieve EO optical phone service contract details** — calls the mapper to prepare input, runs the service component, maps the result back, and performs error checking.
4. **Iterate over service contract lines** — for each line, checks if it is a pause-type temporary key registration. If so, compares the user-requested release date against the line's planned temporary key end reservation date. Only when the release date is later does it proceed to the two downstream CBS operations.
5. **Retrieve EO optical phone agreement** — calls the mapper and service component, extracts the result, and checks for errors.
6. **Set transfer temporary key** — uses the agreement data and the application details number to configure the transfer temporary key termination date via the final mapper and service component call.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | The session manager handle containing database connection, transaction context, and security information used to execute service component calls and mapper operations. |
| 2 | `param` | `IRequestParameterReadWrite` | The request parameter object containing the model group and control map. Used to retrieve the target map keyed by `fixedText`, and to store processed results back via the mapper's `editResultRP` methods. |
| 3 | `fixedText` | `String` | A user-specified arbitrary string used as a key to extract the target parameter map from `param` and to pass through to all mapper operations for namespace isolation. |
| 4 | `resultHash` | `HashMap<String, Object>` | A result hash map populated by prior processing stages. Contains previous CBS response messages (`EKK0021C060` for application details, `EKK1681B001_005` / `_006` for alternate contract list results) used to extract the application details number. |

**External state accessed:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `mapper` | `JKKPauseChgRsvClMapperCC` | Mapper component instance used to prepare input messages and map result data for CBS operations EKK0191B005, EKK0191A010, and EKK0191C011. |
| `scCall` | Service Component dispatcher | Central dispatcher for executing CBS (Common Business Service) calls with the given handle. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKPauseChgRsvClMapperCC.editInMsgEKK0191B005` | EKK0191B005 | - | Prepares input message for EO optical phone service contract details query; invokes `scCall.run()` to retrieve service contract line items (pause status, temporary key end reservation date). |
| R | `JKKPauseChgRsvClCC.errChk` | EKK0191B005 | - | Error checking for the EO optical phone service contract details result. |
| R | `JKKPauseChgRsvClMapperCC.editResultRPEKK0191B005` | EKK0191B005 | - | Maps CBS result back to the request parameter structure. |
| R | `JKKPauseChgRsvClCC.getWorkCAANMsg` | EKK0191B005 | - | Extracts work message from the CBS result to access individual contract line entries. |
| R | `JKKPauseChgRsvClMapperCC.editInMsgEKK0191A010` | EKK0191A010 | - | Prepares input message for EO optical phone agreement query; invoked when the pause period change conditions are met. |
| R | `JKKPauseChgRsvClCC.errChk` | EKK0191A010 | - | Error checking for the EO optical phone agreement result. |
| R | `JKKPauseChgRsvClMapperCC.editResultRPEKK0191A010` | EKK0191A010 | - | Maps CBS result back to the request parameter structure. |
| R | `JKKPauseChgRsvClCC.getWorkCAANMsg` | EKK0191A010 | - | Extracts work message from the agreement result to access the first agreement entry. |
| R | `JKKPauseChgRsvClMapperCC.editInMsgEKK0191C011` | EKK0191C011 | - | Prepares input message for transfer temporary key setting; includes the application details number (`tmpMskmDtlNo`) and agreement data. |
| R | `JKKPauseChgRsvClCC.errChk` | EKK0191C011 | - | Error checking for the transfer temporary key setting result. |
| R | `JKKPauseChgRsvClMapperCC.editResultRPEKK0191C011` | EKK0191C011 | - | Maps CBS result back to the request parameter structure. |

**CRUD Classification Rationale:**
- All three CBS operations (EKK0191B005, EKK0191A010, EKK0191C011) are **Read** operations because `scCall.run()` executes service component calls that query existing service contract data. The method prepares input parameters via the mapper but does not create, update, or delete any records directly — it reads the current state of service contracts and uses that data to populate subsequent requests. The mapper's `editInMsg` methods prepare input message structures, and `editResultRP` methods map output data back — both are data transformation/read operations.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKPauseChgRsvClCC.pauseChgRsvClCtrlTran()` | `pauseChgRsvClCtrlTran()` -> `pauseTokiPrdChgTran(handle, param, fixedText, resultHash)` | `errChk` [-], `editResultRPEKK0191C011` [R] EKK0191C011, `editInMsgEKK0191C011` [R] EKK0191C011, `editResultRPEKK0191B005` [R] EKK0191B005, `editInMsgEKK0191B005` [R] EKK0191B005, `getWorkCAANMsg` [R] EKK0191B005, `editResultRPEKK0191A010` [R] EKK0191A010, `editInMsgEKK0191A010` [R] EKK0191A010 |

**Notes:**
- This method is a **private helper** within `JKKPauseChgRsvClCC`, called exclusively by the control flow method `pauseChgRsvClCtrlTran()` which orchestrates the broader pause/change cancellation workflow.
- No direct screen or batch entry point reaches this method — it is always invoked through the parent control method, which itself may be called by various screens (e.g., KKSV0004 or similar) handling pause contract change/cancellation operations.
- The terminal operations form a chain of three CBS reads (EKK0191B005 -> EKK0191A010 -> EKK0191C011) that progressively refine the service contract data needed to update the temporary period for a paused DSL line.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Extract request parameter (L1056)

> Retrieves the target map from the request parameter object using the `fixedText` key, then extracts the reception sub-map using `PAUSE_RECEPT_MAP` and reads the service suspension release date.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `trgtMap = (HashMap) param.getData(fixedText)` // Extract target map [-> fixedText is user-specified key] |
| 2 | SET | `inMap = (HashMap) trgtMap.get(JKKPauseChgRsvClConstCC.PAUSE_RECEPT_MAP)` // Get reception sub-map [-> PAUSE_RECEPT_MAP] |
| 3 | SET | `svc_pause_rls_ymd = (String) inMap.get(JKKPauseChgRsvClConstCC.SVC_PAUSE_RLS_YMD)` // Read service suspension release date [-> SVC_PAUSE_RLS_YMD = "svc_pause_rls_ymd"] |

**Block 2** — [IF/ELSE] Application details number retrieval (L1063–L1082)

> Determines the application details number (`tmpMskmDtlNo`) from one of three possible message sources, with a priority hierarchy: primary order application result first, then alternate contract list results as fallback.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `msgEKK0021C060 = (CAANMsg) resultHash.get("EKK0021C060")` // Get order application result message |
| 2 | IF | `msgEKK0021C060 != null` (L1064) // Check if primary application result is available |

**Block 2.1** — [ELSE] Alternate contract list fallback (L1068)

> When no order application result exists, retrieve both the service contract pause and service contract pause release alternate contract list results. Extract `tmpMskmDtlNo` from the first available source (priority: 005 then 006).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `msgEKK1681B001_005 = (CAANMsg) resultHash.get("EKK1681B001_005")` // Get alternate contract list (service contract pause) [-> "EKK1681B001_005"] |
| 2 | SET | `msgEKK1681B001_006 = (CAANMsg) resultHash.get("EKK1681B001_006")` // Get alternate contract list (service contract pause release) [-> "EKK1681B001_006"] |
| 3 | IF | `msgEKK1681B001_005 != null` (L1075) // Check if pause result exists |
| 4 | SET | `tmpMskmDtlNo = msgEKK1681B001_005.getString(EKK1681B001CBSMsg1List.MSKM_DTL_NO)` // Extract application details number [-> MSKM_DTL_NO] |
| 5 | IF | `msgEKK1681B001_006 != null` (L1079) // Check if pause release result exists |
| 6 | SET | `tmpMskmDtlNo = msgEKK1681B001_006.getString(EKK1681B001CBSMsg1List.MSKM_DTL_NO)` // Override with pause release details number [-> MSKM_DTL_NO] |

**Block 3** — [CALL] EO optical phone service contract details retrieval (L1084–L1090)

> The first CBS operation: retrieves all EO optical phone service contract lines. Prepares input via mapper, executes the service component, maps results back, checks for errors, and extracts the message list for iteration.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `mapEKK0191B005 = this.mapper.editInMsgEKK0191B005(param, fixedText)` // Prepare input for service contract details query |
| 2 | CALL | `rsltEKK0191B005 = this.scCall.run(mapEKK0191B005, handle)` // Execute CBS to retrieve service contract lines |
| 3 | CALL | `this.mapper.editResultRPEKK0191B005(rsltEKK0191B005, param, fixedText)` // Map results back to request parameter |
| 4 | CALL | `errChk(rsltEKK0191B005)` // Check for CBS errors on service contract details |
| 5 | CALL | `workEKK0191B005 = getWorkCAANMsg(rsltEKK0191B005)` // Extract work message from result |
| 6 | SET | `msgEKK0191B005List = workEKK0191B005.getCAANMsgList(EKK0191B005CBSMsg.EKK0191B005CBSMSG1LIST)` // Get contract line array [-> EKK0191B005CBSMSG1LIST] |

**Block 4** — [FOR] Iterate over service contract lines (L1092–L1129)

> Loops through each EO optical phone service contract line retrieved in Block 3. For each line, checks the temporary key registration type and validates date conditions before triggering downstream operations.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `msgEKK0191B005 = msgEKK0191B005List[i]` // Current contract line entry |
| 2 | SET | `itntoki_add_cd = msgEKK0191B005.getString(EKK0191B005CBSMsg1List.DSL_PAUSE_TOKI_ADD_CD)` // Get transfer temporary key registration code [-> DSL_PAUSE_TOKI_ADD_CD] |
| 3 | IF | `ITNTOKI_ADD_CD_PAUSE.equals(itntoki_add_cd)` (L1096) [`ITNTOKI_ADD_CD_PAUSE = "3"` (JKKHakkoSODConstCC.java:903)] // Only process pause-type temporary key registrations |

**Block 4.1** — [SET] Read temporary key end reservation date (L1099–L1102)

> Extracts the planned temporary key termination date and compares it against the user-requested service suspension release date.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `tntoki_end_rsv_ymd = msgEKK0191B005.getString(EKK0191B005CBSMsg1List.DSL_PAUSE_TOKI_END_RSYMD)` // Get transfer temporary key end reservation date [-> DSL_PAUSE_TOKI_END_RSYMD] |
| 2 | IF | `svc_pause_rls_ymd.compareTo(tntoki_end_rsv_ymd) < 0` (L1102) // Release date is after the current planned end date — means the user wants to extend the pause period |

**Block 4.1.1** — [CALL] EO optical phone agreement retrieval (L1104–L1109)

> The second CBS operation: retrieves EO optical phone agreement details for the current contract line. This is only executed when the line is a pause type AND the requested release date extends beyond the current planned temporary key end date.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `mapEKK0191A010 = this.mapper.editInMsgEKK0191A010(param, fixedText, msgEKK0191B005)` // Prepare input for agreement query, passing current line data |
| 2 | CALL | `rsltEKK0191A010 = this.scCall.run(mapEKK0191A010, handle)` // Execute CBS to retrieve EO optical phone agreement |
| 3 | CALL | `this.mapper.editResultRPEKK0191A010(rsltEKK0191A010, param, fixedText)` // Map results back to request parameter |
| 4 | CALL | `errChk(rsltEKK0191A010)` // Check for CBS errors |
| 5 | CALL | `workEKK0191A010 = getWorkCAANMsg(rsltEKK0191A010)` // Extract work message |
| 6 | SET | `msgEKK0191A010 = workEKK0191A010.getCAANMsgList(EKK0191A010CBSMsg.EKK0191A010CBSMSG1LIST)[0]` // Get first agreement entry [-> EKK0191A010CBSMSG1LIST, index [0]] |

**Block 4.1.2** — [CALL] Transfer temporary key setting (L1112–L1119)

> The third and final CBS operation: sets the transfer temporary key with the new termination date. Uses the agreement data from Block 4.1.1 and the application details number (`tmpMskmDtlNo`) obtained in Block 2.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `mapEKK0191C011 = this.mapper.editInMsgEKK0191C011(param, fixedText, msgEKK0191A010, tmpMskmDtlNo)` // Prepare input for transfer temporary key setting with agreement data and application details number |
| 2 | CALL | `rsltEKK0191C011 = this.scCall.run(mapEKK0191C011, handle)` // Execute CBS to set the transfer temporary key |
| 3 | CALL | `this.mapper.editResultRPEKK0191C011(rsltEKK0191C011, param, fixedText)` // Map results back to request parameter |
| 4 | CALL | `errChk(rsltEKK0191C011)` // Check for CBS errors |

**Block 5** — [RETURN] End of method (L1130)

> No explicit return value (void method). Execution flows to the next processing stage in the parent control method `pauseChgRsvClCtrlTran()`.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | RETURN | `return;` // Implicit return — processing complete for this transaction phase |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_pause_rls_ymd` | Field | Service suspension release date (YYYY-MM-DD) — the user-requested date when the service pause should be released/resumed. |
| `PAUSE_RECEPT_MAP` | Constant | Map key for the reception parameter sub-map containing pause-related input parameters [-> "pause_recept_map"]. |
| `SVC_PAUSE_RLS_YMD` | Constant | Map key for the service suspension release date field within the reception map [-> "svc_pause_rls_ymd"]. |
| `tmpMskmDtlNo` | Variable | Temporary variable for the application details number (申請明細番号) — an internal tracking identifier for the order/application. |
| `itntoki_add_cd` | Field | Transfer temporary key registration code (転送トーキ登録コード) — identifies the type of temporary key operation. |
| `ITNTOKI_ADD_CD_PAUSE` | Constant | Transfer temporary key registration code for pause-by-termination: `"3"` — a temporary key registered due to service suspension [JKKHakkoSODConstCC.java:903]. |
| `itntoki_add_cd` (other values) | Field | `1` = normal transfer temporary key registration, `2` = DSL transfer temporary key registration, `3` = pause-by-termination. |
| `tntoki_end_rsv_ymd` | Field | Transfer temporary key end reservation date (転送トーキ終了予定年月日) — the currently planned end date for the temporary key on this service line. |
| `MSKM_DTL_NO` | Field | Application details number (申請明細番号) — a unique identifier for the order detail entry, used to link operations. |
| `EKK0191B005` | SC Code | EO optical phone service contract details — queries service contract line items including pause status and temporary key dates. |
| `EKK0191A010` | SC Code | EO optical phone agreement — retrieves the EO optical phone service agreement data. |
| `EKK0191C011` | SC Code | Transfer temporary key setting — configures the transfer temporary key with termination date information. |
| `EKK0021C060` | Message Key | Order application result message — primary source for the application details number. |
| `EKK1681B001_005` | Message Key | Alternate contract list result for service contract pause — fallback source when no order application result exists. |
| `EKK1681B001_006` | Message Key | Alternate contract list result for service contract pause release — secondary fallback for application details number. |
| DSL | Business term | Digital Subscriber Line — broadband internet service delivered over copper telephone lines. |
| EO optical phone | Business term | "eo光電話" — Fujitsu K-Opticom's optical telephone service bundled with internet connectivity. |
| Temporary key (トーキ) | Business term | Transfer temporary key (転送トーキ) — a telecom feature that forwards incoming calls to an alternate destination during service suspension. |
| `PAUSE_RECEPT_MAP` | Constant | Reception parameter map key used to organize pause-related input data [-> JKKPauseChgRsvClConstCC]. |
| `SC_CODE` | Field | Service Component Code (サービスコンポーネントコード) — identifies which CBS operation to execute. |
| mapper | Component | `JKKPauseChgRsvClMapperCC` — maps between request parameters and CBS input/output messages. |
| `scCall` | Component | Service Component dispatcher that executes CBS operations against the backend system. |
| `errChk` | Method | Error checking utility that validates CBS result data and throws on failure. |
| `getWorkCAANMsg` | Method | Extracts the work message (CAANMsg) from a CBS result, providing structured access to response fields. |
| `fixedText` | Parameter | User-specified arbitrary string used as a namespace key for parameter isolation across multiple processing phases. |
| `resultHash` | Parameter | A hash map carrying results from prior processing stages in the control flow, including CBS messages and intermediate data. |
| `EKK0191B005CBSMSG1LIST` | Constant | Message list key for the EKK0191B005 service contract details result array [-> EKK0191B005CBSMSG1LIST]. |
| `EKK0191A010CBSMSG1LIST` | Constant | Message list key for the EKK0191A010 agreement result array [-> EKK0191A010CBSMSG1LIST]. |
| `DSL_PAUSE_TOKI_ADD_CD` | Field | DSL pause temporary key add code — identifies the type of temporary key registration for DSL pause lines. |
| `DSL_PAUSE_TOKI_END_RSYMD` | Field | DSL pause temporary key end reservation date — the planned end date for the temporary key during pause. |
