# Business Logic — JKKPauseReceptCC.addMskmTran() [32 LOC]

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

## 1. Role

### JKKPauseReceptCC.addMskmTran()

The `addMskmTran()` method is a core business processing step within the **Pause Reception (休止受付け)** service contract workflow — specifically handling the **Application Content Acceptance Registration (申込内容承認登録)** and **Application Detail Number Retrieval and Post-Processing Request (申込明細照会・後続業務依頼)**. This method acts as a **delegation orchestrator**, routing through two distinct Service Component (SC) calls: first `callEKK0011D020` to register and obtain the application content acceptance, then `callEKK0021C060` (in live mode) to query the application details and delegate to downstream processing. It also implements a **check-mode gate** that bypasses the detail query step when `isCheckMode` is enabled (used in preview/test scenarios). The method returns the application detail number (`mskm_dtl_no`), which serves as a tracking identifier for the service contract line item in subsequent workflow stages. The `mskm_no` application number obtained from the first SC call is also persisted back into the parameter object for downstream consumers.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["addMskmTran call"])
    MSG_EKK0081A010["Extract msgEKK0081A010 from resultHash"]
    CALL_EKK0011D020["callEKK0011D020(handle, param, fixedText, mskmUkDtm, msgEKK0081A010)"]
    GET_MSG_EKK0011D020["getWorkCAANMsg(rsltEKK0011D020)"]
    GET_MSKM_NO["Extract mskmNo from msgEKK0011D020.getString(mskm_no)"]
    SET_MSKM_NO["param.setData(mskm_no, mskmNo)"]
    MSKM_DTL_NO_NULL["mskmDtlNo = null"]
    CHECK_MODE{"isCheckMode"}
    CALL_EKK0021C060["callEKK0021C060(handle, param, fixedText, msgEKK0011D020)"]
    GET_MSKM_DTL_NO["getWorkCAANMsg(rsltEKK0021C060).getString(EKK0021C060CBSMsg.MSKM_DTL_NO)"]
    RETURN(["Return mskmDtlNo"])

    START --> MSG_EKK0081A010
    MSG_EKK0081A010 --> CALL_EKK0011D020
    CALL_EKK0011D020 --> GET_MSG_EKK0011D020
    GET_MSG_EKK0011D020 --> GET_MSKM_NO
    GET_MSKM_NO --> SET_MSKM_NO
    SET_MSKM_NO --> MSKM_DTL_NO_NULL
    MSKM_DTL_NO_NULL --> CHECK_MODE
    CHECK_MODE --> |true| RETURN
    CHECK_MODE --> |false| CALL_EKK0021C060
    CALL_EKK0021C060 --> GET_MSKM_DTL_NO
    GET_MSKM_DTL_NO --> RETURN
```

**Processing Flow:**
1. Extract the pre-built `CAANMsg` (service contract agreement meeting result) for SC `EKK0081A010` from the incoming `resultHash` map.
2. Call `callEKK0011D020` to perform **Application Content Acceptance Registration** — this registers the application details and returns a `CAANMsg` containing the generated application number (`mskm_no`).
3. Retrieve the `mskm_no` application number from the SC response and persist it back into the `param` data map for downstream use.
4. If `isCheckMode` is **false** (live execution), call `callEKK0021C060` to perform **Application Detail Query and Post-Processing Request**, then extract the `mskm_dtl_no` (application detail number) from the response.
5. If `isCheckMode` is **true** (preview/test), skip the SC call entirely — `mskmDtlNo` remains `null`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session manager handle carrying database session context and transactional state — used by all downstream SC invocations. |
| 2 | `param` | `IRequestParameterReadWrite` | Parameter object containing the model group and control map; serves as the shared data carrier throughout the method. After processing, the application number (`mskm_no`) is written back into this object via `setData()` for downstream consumers. |
| 3 | `fixedText` | `String` | User-defined arbitrary string — passed through to the SC calls as a business-level identifier or reference text (e.g., for audit trail or log correlation). |
| 4 | `mskmUkDtm` | `String` | Application time (申込時刻) — the timestamp of the application submission, used in SC registration to record when the application was made. |
| 5 | `resultHash` | `HashMap<String, Object>` | Result hash map containing pre-built SC responses (specifically the `CAANMsg` for `EKK0081A010` under key `EKK0081A010`). Acts as a shared context carrying data from preceding method calls. |

**Instance fields read by this method:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `isCheckMode` | `boolean` | Preview/test mode flag — when `true`, the application detail query SC call is skipped, making the method suitable for screen preview without side effects. Set by the `init()` method based on the function code from the request. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `callEKK0011D020(handle, param, fixedText, mskmUkDtm, msgEKK0081A010)` | `EKK0011D020` | — | Calls SC `EKK0011D020` to register application content acceptance (申込内容承認登録). This SC creates a new application record and returns the generated application number (`mskm_no`). |
| - | `getWorkCAANMsg(rsltEKK0011D020)` | — | — | Extracts the `CAANMsg` response wrapper from the SC return map for message-oriented data extraction. |
| - | `msgEKK0011D020.getString("mskm_no")` | — | — | Reads the generated application number from the SC response message. |
| - | `param.setData("mskm_no", mskmNo)` | — | — | Stores the application number back into the shared parameter data for downstream access. |
| - | `callEKK0021C060(handle, param, fixedText, msgEKK0011D020)` | `EKK0021C060` | — | Calls SC `EKK0021C060` to query application details and delegate post-processing. This SC performs the application detail lookup and triggers downstream business processing. |
| - | `getWorkCAANMsg(rsltEKK0021C060).getString(EKK0021C060CBSMsg.MSKM_DTL_NO)` | — | — | Reads the application detail number from the SC response for return to the caller. |
| R | `JESC0101B010TPMA.getString` | — | — | Reads data from the `JESC0101B010TPMA` transfer object (via `resultHash` context). |
| R | `JESC0101B020TPMA.getString` | — | — | Reads data from the `JESC0101B020TPMA` transfer object (via `resultHash` context). |
| R | `JBSbatFUCaseFileRnkData.getString` | — | — | Reads case file rank data from the `JBSbatFUCaseFileRnkData` transfer object. |
| R | `JBSbatFUMoveNaviData.getString` | — | — | Reads navigation movement data from the `JBSbatFUMoveNaviData` transfer object. |
| R | `JBSbatZMAdDataSet.getString` | — | — | Reads advertisement data set from the `JBSbatZMAdDataSet` transfer object. |
| R | `JKKPauseReceptCC.getWorkCAANMsg` | — | — | Internal helper to extract `CAANMsg` from SC return maps. |
| - | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | — | — | Called within the SC chain to set daily application detail result info. |
| - | `JBSbatAKKshkmRsltInfoTukiaws.setData` | — | — | Called within the SC chain to set daily application detail result data. |
| - | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | — | — | Called within the SC chain to set real schedule application detail result data. |
| - | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | — | — | Called within the SC chain to set CVS/non-consolidated application detail result data. |
| - | `JBSbatKKGetCTITelno.setData` | — | — | Called within the SC chain to set CTI telephone number data. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKPauseReceptCC.pauseReceptTran()` | `pauseReceptTran(handle, param, fixedText, mskmUkDtm, resultHash)` → `addMskmTran(handle, param, fixedText, mskmUkDtm, resultHash)` | `callEKK0011D020 [-]`, `callEKK0021C060 [-]`, `getWorkCAANMsg [R]`, `getString [R]`, `setData [-]` |

**Explanation:** The `addMskmTran()` method is called by `pauseReceptTran()` within the same class `JKKPauseReceptCC`. This is the primary (and observed) caller — `pauseReceptTran()` is itself a CC-level method invoked by screens that handle pause reception processing. The terminal operations reached from this method include SC calls to `EKK0011D020` (application content acceptance registration) and `EKK0021C060` (application detail query/post-processing), along with multiple transfer object reads and data writes through the SC chain.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(extract service contract agreement meeting result)` (L779-L780)

> Retrieves the pre-built `CAANMsg` (service contract agreement meeting result) from the `resultHash` under the key `RESULT_KEY_EKK0081A010` (= `"EKK0081A010"`). This message contains data from a preceding SC call that is required as input for the application content acceptance registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `msgEKK0081A010 = (CAANMsg)resultHash.get(RESULT_KEY_EKK0081A010)` // Extract CAANMsg from resultHash [-> RESULT_KEY_EKK0081A010="EKK0081A010"] |

**Block 2** — [CALL] `(application content acceptance registration)` (L782-L784)

> Calls `callEKK0011D020` to register the application content acceptance (申込内容承認登録). This SC call creates the application record, assigns an application number (`mskm_no`), and returns a `Map` containing the response `CAANMsg`. Then extracts the `CAANMsg` wrapper for message-oriented data access.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rsltEKK0011D020 = callEKK0011D020(handle, param, fixedText, mskmUkDtm, msgEKK0081A010)` // Application Content Acceptance Registration |
| 2 | SET | `msgEKK0011D020 = getWorkCAANMsg(rsltEKK0011D020)` // Extract CAANMsg wrapper |

**Block 3** — [SET / EXEC - ANK-2737-00-00] `(extract and store application number)` (L786-L789)

> As part of the Consumer Protection Law compliance update (ANK-2737-00-00), extracts the generated application number (`mskm_no`) from the SC response and stores it back into the shared parameter object so downstream components can access it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmNo = msgEKK0011D020.getString("mskm_no")` // Extract application number [-> ANK-2737-00-00 ADD START/END] |
| 2 | EXEC | `param.setData("mskm_no", mskmNo)` // Store application number in param for downstream |

**Block 4** — [SET] `(initialize detail number variable)` (L791)

> Initializes the return value variable to `null`. This ensures that if the check mode skips the SC call, the method returns `null` as a valid result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmDtlNo = null` // Initialize return value |

**Block 5** — [IF] `(isCheckMode conditional gate)` (L792-L804)

> Controls whether the application detail query SC call is executed. When `isCheckMode` is `true` (preview/test mode), the detail query and post-processing request are skipped entirely. When `isCheckMode` is `false` (live execution), the full SC call chain is invoked. This flag is set by the `init()` method based on the function code in the request — specifically, it is `true` when `func_code` equals `JPCModelConstant.FUNC_CD_2`.

**Block 5.1** — [ELSE-IF branch: isCheckMode == false] `(live execution path)` (L795-L802)

> Executes the **Application Detail Query and Post-Processing Request** (申込明細照会・後続業務依頼) by calling `callEKK0021C060`. This SC call queries the application details created in Block 2 and triggers downstream business processing. The returned application detail number (`mskm_dtl_no`) is extracted and stored.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rsltEKK0021C060 = callEKK0021C060(handle, param, fixedText, msgEKK0011D020)` // Application Detail Query & Post-Processing Request |
| 2 | SET | `mskmDtlNo = getWorkCAANMsg(rsltEKK0021C060).getString(EKK0021C060CBSMsg.MSKM_DTL_NO)` // Extract application detail number [-> EKK0021C060CBSMsg.MSKM_DTL_NO] |

**Block 5.2** — [IF branch: isCheckMode == true] `(preview/test mode path)` (L792-L804, implicit)

> When `isCheckMode` is `true`, this block is implicitly taken — no additional processing occurs. `mskmDtlNo` remains `null`, which will be returned to the caller. This allows the screen to be rendered in preview mode without executing actual business logic or creating records.

**Block 6** — [RETURN] `(return application detail number)` (L805)

> Returns the application detail number (`mskmDtlNo`) to the caller. In preview mode this is `null`; in live mode it is the detail number assigned to the application record.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return mskmDtlNo` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mskm_no` | Field | Application number — the unique identifier assigned to an application (申込) record upon registration in SC EKK0011D020. |
| `mskm_dtl_no` | Field | Application detail number — the unique identifier for a specific application line item/detail, returned by SC EKK0021C060. Used as the return value of this method. |
| `mskmUkDtm` | Field | Application timestamp — the date/time when the application was submitted. |
| `fixedText` | Field | User-defined arbitrary string — passed through as business context/identifier to SC calls, typically used for audit trail or log correlation. |
| `isCheckMode` | Field | Preview/test mode flag — when `true`, application detail query SC calls are skipped; set based on function code `FUNC_CD_2` to enable non-persistent preview processing. |
| `RESULT_KEY_EKK0081A010` | Constant | Result map key constant with value `"EKK0081A010"` — identifies the pre-built `CAANMsg` in `resultHash` containing service contract agreement meeting results from a preceding SC call. |
| `EKK0011D020` | SC Code | Service Component for Application Content Acceptance Registration (申込内容承認登録) — creates the application record and assigns `mskm_no`. |
| `EKK0021C060` | SC Code | Service Component for Application Detail Query and Post-Processing Request (申込明細照会・後続業務依頼) — queries the created application and delegates to downstream business processing. |
| `EKK0081A010` | SC Code | Service Component for Service Contract Agreement Meeting — produces the agreement meeting result (`CAANMsg`) carried in `resultHash`. |
| `CAANMsg` | Technical | Fujuti common message class — a message-oriented data container used for SC request/response passing, providing typed `getString()`, `setData()` accessors. |
| `ServiceComponentRequestInvoker` | Technical | SC invocation component — the reusable infrastructure for calling Service Components from within Common Component methods. |
| `pauseReceptTran` | Method | Pause Reception Transaction — the parent CC method that orchestrates the full pause reception workflow, of which `addMskmTran` is a step. |
| 申込内容承認登録 | Field | Application Content Acceptance Registration — the business operation of registering an application's content details and obtaining acceptance approval. |
| 申込明細照会・後続業務依頼 | Field | Application Detail Query and Post-Processing Request — the business operation of querying application details and delegating to downstream processing. |
| 休止受付け | Field | Pause Reception — the overarching business process for handling customer service pause (suspension) requests. |
| `EKK0021C060CBSMsg.MSKM_DTL_NO` | Constant | Message key constant for the application detail number field in the EKK0021C060 CBS response message. |
| `FUNC_CD_2` | Constant | Function code constant (`JPCModelConstant.FUNC_CD_2`) — when present in the request, indicates preview mode (`isCheckMode = true`). |
| `SessionHandle` | Technical | Database session handle — carries database connection context, transaction state, and metadata for SC invocations. |
| `IRequestParameterReadWrite` | Technical | Parameter interface — shared data carrier holding model group data and control map across method invocations within a transaction. |
| SC | Acronym | Service Component — a reusable business logic module in the enterprise architecture, typically implementing a single business operation. |
| CBS | Acronym | Core Business System — the underlying business service layer; CBSMsg classes define request/response message schemas for SC invocations. |
| ANK-2737-00-00 | Change ticket | Consumer Protection Law compliance update — added the `mskm_no` extraction and storage to support Consumer Protection Law review requirements (消費者保護ルール見直し対応). |
