# Business Logic — JKKDslRunCC.runDslPreChk() [9 LOC]

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

## 1. Role

### JKKDslRunCC.runDslPreChk()

This method serves as the **pre-execution validation entry point for DSL (Fiber-To-The-Home) service cancellation processing** within the e-Customer Core System (eo Kyoukai Shisteimu). It prepares and validates the cancellation request context before the actual cancellation logic is dispatched downstream.

The method implements a **delegation pattern**: it first initializes the processing context by calling `init(param, fixedText)` to set up internal mappers and service component invokers, then delegates all substantive work to `JKKBpCommon.runDslPreChk()`, which creates a `JKKDslRun` instance and invokes its business-level `runDslPreChk()` method. The underlying `JKKDslRun.runDslPreChk()` is responsible for the actual cancellation pre-check, which includes clearing reservation cancellation flags, extracting service contract data, and routing into branch logic based on the operation code (`kido_cd`) and modification category (`ido_div`) to determine whether the request originates from screen activation or from a cancellation trigger.

Its **role in the larger system** is that of a shared component utility — this class (JKKDslRunCC) is specifically designed to handle **cancellation execution** (Kaiyaku Jikko) for various service types (FTTH Fiber-To-The-Home, Phone/Denwa, Numbers/Hangakei). Multiple BPM screen operations (KKSV0195, KKSV0464) call into this method through the `JKKBpCommon` facade to perform pre-checks before proceeding with cancellation workflows.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["runDslPreChk(params)"])
    INIT["init(param, fixedText)
Initialize mapper and SC invoker"]
    COMMON["JKKBpCommon.runDslPreChk(handle, param, fixedText)
Delegate to JKKBpCommon
which creates JKKDslRun instance
and calls JKKDslRun.runDslPreChk()"]
    END_NODE["Return param"]

    START --> INIT --> COMMON --> END_NODE
```

**Processing flow:**

1. **Initialize context** — `init(param, fixedText)` is called to lazy-initialize the `mapper` field (`JKKDslRunMapperCC`) and the `scCall` field (`ServiceComponentRequestInvoker`), and to set up date/time stamps (`idoDtm`, `idoDtmSysDateTimeStamp`).

2. **Delegate to downstream pre-check** — `JKKBpCommon.runDslPreChk(handle, param, fixedText)` is invoked. This static method instantiates a `JKKDslRun` object and calls its full `runDslPreChk()` method, which performs the actual cancellation pre-check processing including:
   - Clearing the reservation cancellation flag (`RSV_CANCEL_FLG`) from target data
   - Extracting service key number, operation date, operation code, modification category, service end date, and service DSL calculation date
   - Branching on `KIDO_CD = "1"` (KIDO_CD_ON) to distinguish screen-activation flow from other triggers
   - Further branching on `IDO_DIV` values to determine specific cancellation logic paths

3. **Return** — The original `param` object (potentially mutated during initialization and delegated processing) is returned to the caller.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session management handle containing transaction context, database connection info, and user session data required for service component invocation and database operations. |
| 2 | `param` | `IRequestParameterReadWrite` | Business data acquisition/writing interface object that carries the cancellation request payload, including model group data, control maps, and the `fixedText`-keyed target data map containing service contract details (service key number, operation code, modification category, service end date, etc.). |
| 3 | `fixedText` | `String` | User-defined text string used as a key identifier within the request parameter map. It serves as the lookup key for retrieving the target data map (`trgtData`) and for mapping message templates during cancellation processing. |

**Internal instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `mapper` | `JKKDslRunMapperCC` (via `init`) | Lazy-initialized mapper for editing input/output message maps during cancellation processing. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKDslRunCC.init` | JKKDslRunCC | - | Initializes mapper and SC invoker instance; called within this method |
| - | `JKKBpCommon.runDslPreChk` | JKKBpCommon | - | Static delegation wrapper that creates `JKKDslRun` and calls its `runDslPreChk` |

### Transitive effects via `JKKDslRun.runDslPreChk()`:

The underlying `JKKDslRun.runDslPreChk()` method (called by `JKKBpCommon.runDslPreChk`) performs the following CRUD operations during its full processing:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `editInMsgEKK0081A010` | EKK0081A010 | KK_T_SVC_KEI (Service Contract) | Reads service contract master data to validate cancellation eligibility |
| R | `scCall.run(mapEKK0081A010, handle)` | EKK0081A010SC | KK_T_SVC_KEI, KK_T_SVC_KEI_UCWK | Service Component call — retrieves service contract agreement details (Service Contract Agreement Hearing) |
| U | `editResultRPEKK0081A010` | EKK0081A010 | KK_T_SVC_KEI_UCWK (Service Contract Detail Work) | Writes result back to the request parameter for downstream processing |
| R | `getMappedTemplateEKK0081C180` | EKK0081C180 | KK_T_SVC_KEI, KK_T_ODR_HAKKO (Order Registration) | Reads cancellation template (Service Contract Cancellation Execution) for DSL cancellation flow |

> **Note:** The CRUD operations above are transitive effects of the delegation to `JKKDslRun.runDslPreChk()`. The direct `JKKDslRunCC.runDslPreChk()` method itself contains only initialization and delegation — no direct database access.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0195 | `KKSV0195OPOperation.invokeProcess` -> `JKKBpCommon.runDslPreChk` -> `JKKDslRun.runDslPreChk` | `EKK0081A010SC [R] KK_T_SVC_KEI` |
| 2 | Screen:KKSV0464 | `KKSV0464OPOperation.invokeProcess` -> `JKKBpCommon.runDslPreChk` -> `JKKDslRun.runDslPreChk` | `EKK0081A010SC [R] KK_T_SVC_KEI` |
| 3 | Common:JKKBpCommon | `JKKBpCommon.runDslPreChk` -> `new JKKDslRun().runDslPreChk` | `EKK0081A010SC [R] KK_T_SVC_KEI` |

**Call chain detail:**

1. **KKSV0195** — A BPM screen operation class for DSL cancellation operations. Its `editRunDslPreChkMap()` method prepares parameters, then invokes the pre-check through `JKKBpCommon.runDslPreChk()`.

2. **KKSV0464** — Another BPM screen operation class (likely a variant or alternate flow of KKSV0195) with identical pre-check invocation pattern.

The terminal operations from `JKKDslRun.runDslPreChk()` reach into `EKK0081A010SC` (Service Contract Agreement Processing) which reads from `KK_T_SVC_KEI` (Service Contract Master Table) and `KK_T_SVC_KEI_UCWK` (Service Contract Detail Work Table).

## 6. Per-Branch Detail Blocks

The method `runDslPreChk` in `JKKDslRunCC` contains no conditional branches — it is a flat 9-line sequential method. However, the **delegated downstream method** `JKKDslRun.runDslPreChk()` (which `JKKBpCommon.runDslPreChk` invokes) contains the significant conditional branching logic. Both are documented below.

---

### Block 1 — [Sequential Processing] `(direct calls, no branches)` (L142–L150)

> This is the direct body of `JKKDslRunCC.runDslPreChk()`. It performs initialization then delegates.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `init(param, fixedText);` // Initialize mapper (JKKDslRunMapperCC) and SC invoker (ServiceComponentRequestInvoker); set up date/time stamps |
| 2 | CALL | `JKKBpCommon.runDslPreChk(handle, param, fixedText);` // Delegate to JKKBpCommon which creates JKKDslRun and calls its full runDslPreChk() |
| 3 | RETURN | `return param;` // Return the request parameter object |

---

### Block 2 — [Sequential Processing] `JKKDslRun.runDslPreChk()` (L1244–L1252)

> The downstream method body that performs actual pre-check work. No branches in this initial segment — it prepares all variables.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `init(param, fixedText);` // Re-initialize mapper and SC invoker on the JKKDslRun instance |
| 2 | EXEC | `HashMap<String, Object> trgtData = (HashMap<String, Object>)param.getData(fixedText);` // Get target data map keyed by fixedText |
| 3 | EXEC | `trgtData.remove(RSV_CANCEL_FLG);` // Clear reservation cancellation flag (initialization) [-> RSV_CANCEL_FLG="RSV_CANCEL_FLG"] |
| 4 | SET | `tmpSvcKeiNo = (String)trgtData.get(JKKDslRunConstCC.SVC_KEI_NO);` [-> SVC_KEI_NO="SVC_KEI_NO"] // Service key number |
| 5 | SET | `tmpOpeDate = JCCBPCommon.getOpeDate(null);` // Get current operation date |
| 6 | SET | `tmpKidoCd = (String)trgtData.get(JKKDslRunConstCC.KIDO_CD);` [-> KIDO_CD="KIDO_CD"] // Operation source code |
| 7 | SET | `tmpIdoDiv = (String)trgtData.get(JKKDslRunConstCC.IDO_DIV);` [-> IDO_DIV="IDO_DIV"] // Modification category |
| 8 | SET | `tmpSvcEndymd = (String)trgtData.get(JKKDslRunConstCC.SVC_ENDYMD);` [-> SVC_ENDYMD="SVC_ENDYMD"] // Service end date |
| 9 | SET | `tmpSvcDslKisanYmd = (String)trgtData.get(JKKDslRunConstCC.SVC_DSL_KISAN_YMD);` [-> SVC_DSL_KISAN_YMD="SVC_DSL_KISAN_YMD"] // Service DSL calculation date |
| 10 | SET | `tmpSvcChgEndYmd = addYYYYMMDD(tmpSvcDslKisanYmd, -1);` // Calculate change end date (calculation date minus 1 day) |
| 11 | SET | `tmpSvcDlreMemo = null;` // Service delivery memo (initialized null) |
| 12 | SET | `tmpPnltyHasseiCd = null;` // Penalty occurrence code (initialized null) |

---

### Block 3 — [IF] `(KIDO_CD_ON.equals(tmpKidoCd))` [KIDO_CD_ON="1"] (L1256)

> When the operation source code indicates screen activation (KIDO_CD = "1"), enter the screen-activation cancellation pre-check flow.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | // Enter screen activation processing block — 画面起動の場合 |

#### Block 3.1 — [IF] `(IDO_DIV_DSL.equals(tmpIdoDiv))` [IDO_DIV_DSL="1"] (Within Block 3)

> When the modification category is "cancellation" (Ido - 解約), proceed with cancellation-specific logic.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | // Entering cancellation modification category branch — 異動区分「解約」 |

##### Block 3.1.1 — [IF] `(tmpOpeDate.equals(tmpSvcEndymd))` (Within Block 3.1)

> When the operation date equals the service end date, this is an **instant cancellation** (Sokuhai Kaiyaku) flow — immediate service contract cancellation execution.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapEKK0081A010 = this.mapper.editInMsgEKK0081A010(param, fixedText, tmpSvcKeiNo);` // Prepare input message map for service contract agreement processing |
| 2 | CALL | `rsltEKK0081A010 = this.scCall.run(mapEKK0081A010, handle);` // Invoke Service Component EKK0081A010 — Service Contract Agreement Hearing |
| 3 | EXEC | `this.mapper.editResultRPEKK0081A010(rsltEKK0081A010, param, fixedText);` // Map result back to request parameter |
| 4 | CALL | `errChk(rsltEKK0081A010);` // Error check on SC response |
| 5 | SET | `msgEKK0081A010List = workEKK0081A010.getCAANMsgList(EKK0081A010CBSMsg.EKK0081A010CBSMSG1LIST);` // Extract service contract details list |
| 6 | IF | `if (0 == msgEKK0081A010List.length) { return; }` // Early exit if no contract details found |

##### Block 3.1.2 — [Sequential Processing] (Within Block 3.1, after error check)

> Execute service contract cancellation processing (Service Contract Cancellation Execution — EKK0081C180).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapperEKK0081.getMappedTemplateEKK0081C180(...)` // Create cancellation template (Check mode) |
| 2 | CALL | `mapperEKK0081.createNewSIFRequestMap(param)` // Create SIF request map |
| 3 | SET | `sIFRequest.put(JCMConstants.TEMPLATE_LIST_KEY, ...)` // Add template list to SIF request |

---

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kido_cd` | Field | Operation source code — identifies whether the request originated from screen activation ("1" / KIDO_CD_ON) or from another trigger such as batch or system event. |
| `ido_div` | Field | Modification category — classifies the type of contract modification operation. Values include DSL cancellation ("1" / IDO_DIV_DSL), address change (ADCHG_IDO_DIV_KIKIDSL for machine cancellation during relocation), etc. |
| `svc_kei_no` | Field | Service key number — unique identifier for a service contract line item in the telecom service management system. |
| `svc_endymd` | Field | Service end date and time — the date when the service contract is scheduled to terminate. |
| `svc_dsl_kisan_ymd` | Field | Service DSL calculation date — the date used for DSL (Fiber-To-The-Home) service billing and contract period calculations. |
| `RSV_CANCEL_FLG` | Field | Reservation cancellation flag — a flag cleared during pre-check initialization to ensure clean state for cancellation processing. |
| `KIDO_CD_ON` | Constant | Operation source code = "1" — indicates screen-activation trigger. |
| `IDO_DIV_DSL` | Constant | Modification category = DSL — indicates a cancellation (Kaiyaku - 解約) operation. |
| DSL | Business term | Digital Subscriber Line — in this system, specifically refers to FTTH (Fiber-To-The-Home) broadband service contracts. |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service. |
| JKK | Acronym | Fujitsu-K-Opticom internal prefix — part of the class naming convention for the e-Customer Core System (eo Kyoukai Shisteimu - えお顧客基幹システム). |
| DslRun | Module name | DSL Run — the cancellation processing module for DSL/FTTH service contracts. |
| Kaiyaku | Japanese term | Cancellation — refers to service contract termination processing in the telecom domain. |
| Kaiyaku Jikko | Japanese term | Cancellation Execution — the actual execution phase of service contract termination. |
| Kaiyaku Zenken Chk | Japanese term | Cancellation Pre-Execution Check — validation and preparation performed before committing cancellation. |
| EKK0081A010 | SC Code | Service Contract Agreement Hearing — retrieves service contract agreement details for cancellation validation. |
| EKK0081C180 | CBS Code | Service Contract Cancellation Execution — executes the actual service contract cancellation transaction. |
| KK_T_SVC_KEI | DB Table | Service Contract Master Table — stores main service contract header records. |
| KK_T_SVC_KEI_UCWK | DB Table | Service Contract Detail Work Table — stores service contract line-item/detail work records. |
| KK_T_ODR_HAKKO | DB Table | Order Registration Table — stores order registration/creation records. |
| KKSV0195 | Screen | BPM screen operation for DSL cancellation processing. |
| KKSV0464 | Screen | BPM screen operation for DSL cancellation processing (alternate flow). |
| eo Kyoukai Shisteimu | Japanese term | e-Customer Core System — the core customer management system for K-Opticom telecom services. |
