# Business Logic — JKKTvSvcKeiCancelCC.registProgressInfo() [50 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKTvSvcKeiCancelCC` |
| Layer | Common Component (CC) — shared service component for telecom service cancellation |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKTvSvcKeiCancelCC.registProgressInfo()

This method is responsible for **registering progress status information** during the execution of an eo HIKARI TV service contract cancellation workflow. In the Japanese telecom domain, when a customer initiates a service line cancellation (回線内訳キャンセル), the system must track the intermediate processing state so that downstream components and operators can monitor the cancellation's lifecycle. This method builds a CAANMsg (a structured message envelope) targeting the `EKK1091D010CBS` service component — a CBS (Contract Business Service) dedicated to updating the **progress status** (PRG_STAT) of a service contract detail record.

The method follows a **builder-and-delegate** design pattern. It first extracts the cancellation context from the shared request parameter map (identified by `dataMapKey`), then constructs the top-level CBS input message with the function code, service contract number, movement type, system timestamp, provided progress status, and detail number. It iterates over a list of change detail records (ido_list), mapping the displacement reason code (ido_rsn_cd) and displacement reason memo (ido_rsn_memo) from the input data into a structured array — applying a default reason code of "C6" when the input is missing. Finally, it delegates to `callSC` to execute the CBS invocation, passing the fully assembled message to the service component layer.

The method is called directly by `JKKTvSvcKeiCancelCC.cancel()`, the main entry point for TV service cancellation processing. Its role in the larger system is as a **progress checkpoint** — ensuring that before (or during) the core cancellation logic, the system records an authoritative status transition, allowing rollback tracking, audit trails, and operational monitoring of the cancellation flow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["registProgressInfo params"])
    SUB1["Get ccMsg from param.getData dataMapKey"]
    SUB2["Get func_code from ccMsg"]
    SUB3["Create CAANMsg EKK1091D010CBSMsg"]
    SUB4["Set TEMPLATEID to EKK1091D010"]
    SUB5["Set func_code"]
    SUB6["Set svc_kei_no from ccMsg"]
    SUB7["Set ido_div from ccMsg"]
    SUB8["Set ido_dtm to system timestamp"]
    SUB9["Set prgs_status"]
    SUB10["Set mskm_dtl_no"]
    SUB11["Get inList from ccMsg ido_list"]
    SUB12["Create CAANMsg array"]
    LOOP["For each childMap in inList"]
    GET_CHILD["Get childMap from inList i"]
    COND1{"childMap null or
ido_rsn_cd null or empty"}
    SET_DEF["Set IDO_RSN_CD to C6 default"]
    SET_RSN["Set IDO_RSN_CD from childMap"]
    COND2{"childMap null or
ido_rsn_memo null or empty"}
    SET_MEMO["Set IDO_RSN_MEMO to null"]
    SET_MEMO2["Set IDO_RSN_MEMO from childMap"]
    LOOP_INC["Increment i"]
    SET_LIST["Set EKK1091D010CBSMSG1LIST array"]
    CALL["callSC with EKK1091D010CBSMsg"]
    END_NODE(["Return"])

    START --> SUB1 --> SUB2 --> SUB3 --> SUB4 --> SUB5 --> SUB6 --> SUB7 --> SUB8 --> SUB9 --> SUB10 --> SUB11 --> SUB12 --> LOOP --> GET_CHILD --> COND1
    COND1 --> SET_DEF
    COND1 --> SET_RSN
    SET_DEF --> COND2
    SET_RSN --> COND2
    COND2 --> SET_MEMO
    COND2 --> SET_MEMO2
    SET_MEMO --> LOOP_INC
    SET_MEMO2 --> LOOP_INC
    LOOP_INC --> LOOP
    LOOP --> SET_LIST --> CALL --> END_NODE
```

### Processing Steps (Constant Resolution)

1. **Extract ccMsg**: Retrieves a `HashMap<String, Object>` from the request parameter map using `dataMapKey` as the key. This map holds the cancellation context (function code, service contract number, movement type, and detail list).

2. **Extract func_code**: Reads the `func_code` field from the ccMsg map — this identifies the specific business function being executed.

3. **Create CBS input message**: Instantiates a `CAANMsg` targeting `EKK1091D010CBSMsg`, a Contract Business Service message for progress status updates.

4. **Set TEMPLATEID**: Uses constant `TEMPLATE_ID_EKK1091D010 = "EKK1091D010"` — the template identifier for the service component.

5. **Set function code, service number, movement type**: Passes through `func_code`, `svc_kei_no`, and `ido_div` from the ccMsg context map.

6. **Set system timestamp**: Calls `JCCBPCommon.getSysDateTimeStamp()` to obtain the current system datetime as the movement timestamp.

7. **Set progress status**: The `prgsStatus` parameter is directly assigned to the message. The Japanese comment notes: `// 1931: 休止受領登録完了` → *1931: Suspension receipt registration complete*. This indicates the method is used to record that a service suspension has been successfully registered in the cancellation workflow.

8. **Set detail number**: The `mskmDtlNo` parameter (service line detail number) identifies the specific line item within the service contract.

9. **Iterate over change details**: For each record in `ido_list` (a list of movement detail records), extracts the displacement reason code and memo, applying default handling when input is missing.

10. **Default displacement reason code**: When `ido_rsn_cd` is null or empty, the default code `"C6"` is applied. This code represents a standard/unknown change reason, ensuring the CBS always receives a valid reason code.

11. **Default displacement reason memo**: When `ido_rsn_memo` is null or empty, the field is set to null (as opposed to setting a default string value), indicating no additional description is available.

12. **Assemble list into message**: The populated `templateArray` is set as the `EKK1091D010CBSMSG1LIST` list on the parent message.

13. **Execute CBS**: Delegates to `callSC(handle, scCall, param, dataMapKey, ekk1091d010IN)` to invoke the `EKK1091D010CBS` service component, which persists the progress status update to the database.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle providing the transaction context and connection for CBS execution. It carries the session state (transaction ID, user context, database connection pool reference) needed by the service component infrastructure. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service component invocation invoker — the runtime object responsible for dispatching CBS requests to the appropriate service component and returning the response. Acts as the bridge between the CC layer and the CBS execution infrastructure. |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter map — a shared mutable data structure used across the cancellation workflow. Contains the input data map (accessed via `dataMapKey`) that holds cancellation context fields (func_code, svc_kei_no, ido_div, ido_list). Also used by `callSC` for error info and control map management. |
| 4 | `dataMapKey` | `String` | The map key used to retrieve the cancellation context `HashMap` from `param`. Each service cancellation flow registers its working data under a specific key; this parameter identifies which data map to use. |
| 5 | `mskmDtlNo` | `String` | Service line detail number (回線内訳番号) — the unique identifier for a specific line item within a service contract group. Identifies which service line's progress status is being updated. This number links the progress record to the correct cancellation detail. |
| 6 | `prgsStatus` | `String` | Progress status code (進捗状況) — indicates the current state of the cancellation processing. In the source comment, the value `"1931"` is referenced as 休止受領登録完了 (Suspension receipt registration complete). This status code transitions the service detail record to indicate that a suspension registration has been completed during the cancellation flow. |

**Instance fields / external state read:**
- `TEMPLATE_ID_EKK1091D010` (private static final String = `"EKK1091D010"`) — The template ID constant used for the CBS message envelope.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCBPCommon.getSysDateTimeStamp` | JCCBPCommon | - | Calls `getSysDateTimeStamp()` to obtain the current system datetime stamp for the movement timestamp (ido_dtm) field |
| R/U | `callSC` | EKK1091D010CBS | Service contract progress status records | Invokes CBS `EKK1091D010CBS` with the assembled progress status message. This CBS performs a status update on the service contract detail record's progress status field. The message carries the function code, service contract number, movement type, timestamp, progress status code, detail number, and the list of change reason records. |

**Analysis of `callSC` invocation:**
The `callSC` method is a private wrapper in `JKKTvSvcKeiCancelCC` that:
1. Calls `editInMsg(param, inCAANMsg)` to convert the CAANMsg into a `HashMap` for CBS dispatch.
2. Invokes `scCall.run(paramMap, handle)` to execute the CBS.
3. Extracts the return code and status from the result.
4. Calls `editErrorInfoCom` for error processing.
5. Sets error control map data on `param`.
6. Throws `SCCallException` if the return code is non-zero or status is non-zero.

The CBS `EKK1091D010CBS` is a **status update** service component. It receives the progress status and updates the corresponding service contract line detail record.

**Note on the pre-computed evidence list:** The pre-computed graph data shows many SC calls from the broader class context, but the `registProgressInfo` method itself only directly calls `JCCBPCommon.getSysDateTimeStamp()` and `callSC` (which in turn invokes `EKK1091D010CBS`). The other SC calls in the pre-computed evidence belong to different methods within the same class.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `callSC` [R], `set` [U], `set` [U], `set` [U], `set` [U], `set` [U], `set` [U], `setNull` [U], `set` [U], `set` [U], `getSysDateTimeStamp` [R]

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JKKTvSvcKeiCancelCC.cancel() | `cancel()` → `registProgressInfo(handle, scCall, param, dataMapKey, mskmDtlNo, prgsStatus)` | `callSC [R/U] EKK1091D010CBS` → updates service contract detail progress status |

**Caller details:**
- `JKKTvSvcKeiCancelCC.cancel()` — the main cancellation orchestration method in the same class. It coordinates the full TV service cancellation workflow and calls `registProgressInfo` to register the progress checkpoint at the appropriate point in the cancellation sequence. The `prgsStatus` parameter passed is the status code indicating suspension receipt registration completion (1931: 休止受領登録完了).

**Downstream terminal:**
- `EKK1091D010CBS` — This CBS receives the progress status message and updates the service contract detail record. The terminal operation is a Read/Update (R/U) on the service contract progress status data.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Extract cancellation context from param map (L332-L333)

> Retrieves the shared cancellation context HashMap from the parameter map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap<String, Object> ccMsg = (HashMap<String, Object>) param.getData(dataMapKey)` |
| 2 | SET | `String funcCode = (String) ccMsg.get("func_code")` |

**Block 2** — [SET] Build top-level CBS input message (L335-L343)

> Creates the EKK1091D010CBSMsg envelope and populates header fields for the progress status update.

| # | Type | Code |
|---|------|------|
| 1 | SET | `CAANMsg ekk1091d010IN = new CAANMsg(EKK1091D010CBSMsg.class.getName())` |
| 2 | SET | `ekk1091d010IN.set(TEMPLATEID, TEMPLATE_ID_EKK1091D010)` [-> `TEMPLATE_ID_EKK1091D010 = "EKK1091D010"`] |
| 3 | SET | `ekk1091d010IN.set(FUNC_CODE, funcCode)` // Function code from cancellation context |
| 4 | SET | `ekk1091d010IN.set(SVC_KEI_NO, ccMsg.get("svc_kei_no"))` // Service contract number |
| 5 | SET | `ekk1091d010IN.set(IDO_DIV, ccMsg.get("ido_div"))` // Movement type from cancellation context |
| 6 | SET | `ekk1091d010IN.set(IDO_DTM, JCCBPCommon.getSysDateTimeStamp())` // System timestamp |
| 7 | SET | `ekk1091d010IN.set(PRG_STAT, prgsStatus)` // 休止受領登録完了 (Suspension receipt registration complete) |
| 8 | SET | `ekk1091d010IN.set(MSKM_DTL_NO, mskmDtlNo)` // Service line detail number |

**Block 3** — [SET] Prepare child message array from movement detail list (L345-L346)

> Extracts the list of change detail records and creates a corresponding CAANMsg array for the child message list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ArrayList<HashMap<String, Object>> inList = (ArrayList<HashMap<String, Object>>) ccMsg.get("ido_list")` // Movement detail list from cancellation context |
| 2 | SET | `CAANMsg[] templateArray = new CAANMsg[inList.size()]` // Array to hold child CAANMsg objects |

**Block 4** — [FOR] Iterate over movement detail records (L348-L367)

> Loops through each detail record in the movement list, mapping displacement reason code and memo fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `for (int i = 0; i < inList.size(); i++)` |
| 2 | SET | `HashMap<String, Object> childMap = inList.get(i)` |
| 3 | SET | `templateArray[i] = new CAANMsg(EKK1091D010CBSMsg1List.class.getName())` // Child message for detail record |

**Block 4.1** — [IF] Displacement reason code null/empty check (L352-L356)

> Map the change detail's displacement reason code; default to "C6" if missing.
> Japanese comment: リクエストパラメータ.変動理由明細.変動理由コード → 変動理由明細.変動理由コード
> (Request parameter. Displacement reason detail. Displacement reason code → Displacement reason detail. Displacement reason code)

| # | Type | Code |
|---|------|------|
| 1 | IF | `childMap == null || childMap.get("ido_rsn_cd") == null || "".equals(childMap.get("ido_rsn_cd"))` |
| 1.1 | SET (true branch) | `templateArray[i].set(IDO_RSN_CD, "C6")` // Default displacement reason code when input is missing |
| 1.2 | SET (false branch) | `templateArray[i].set(IDO_RSN_CD, (String) childMap.get("ido_rsn_cd"))` // Use input displacement reason code |

**Block 4.2** — [IF] Displacement reason memo null/empty check (L359-L363)

> Map the change detail's displacement reason memo; set to null if missing.
> Japanese comment: リクエストパラメータ.変動理由明細.変動理由メモ → 変動理由明細.変動理由メモ
> (Request parameter. Displacement reason detail. Displacement reason memo → Displacement reason detail. Displacement reason memo)

| # | Type | Code |
|---|------|------|
| 1 | IF | `childMap == null || childMap.get("ido_rsn_memo") == null || "".equals(childMap.get("ido_rsn_memo"))` |
| 1.1 | SET (true branch) | `templateArray[i].setNull(IDO_RSN_MEMO)` // Set to null when input is missing or empty |
| 1.2 | SET (false branch) | `templateArray[i].set(IDO_RSN_MEMO, (String) childMap.get("ido_rsn_memo"))` // Use input displacement reason memo |

**Block 5** — [SET] Assemble child list into parent message (L367)

> Assigns the completed child message array to the parent message as the `EKK1091D010CBSMSG1LIST` list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk1091d010IN.set(EKK1091D010CBSMSG1LIST, templateArray)` // Attach child message array |

**Block 6** — [CALL] Execute CBS via callSC (L369)

> Delegates to the private `callSC` method to invoke the `EKK1091D010CBS` service component. The `callSC` method handles message conversion, CBS execution, error processing, and exception throwing on non-zero return codes.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callSC(handle, scCall, param, dataMapKey, ekk1091d010IN)` // Invokes EKK1091D010CBS CBS to persist progress status |

**Block 7** — [RETURN] Method completion (L371)

> The method is `void` and returns implicitly after `callSC` completes. If `callSC` throws `SCCallException` (on non-zero return code or status), the exception propagates to the caller (`cancel()`).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `// void — implicit return after callSC` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_list` | Field | Movement detail list — a list of change detail records (HashMaps) describing each service line's displacement information within a service contract cancellation |
| `ido_rsn_cd` | Field | Displacement reason code — the code explaining why a service line is being changed/cancelled (e.g., customer request, system error). When missing, defaults to `"C6"` |
| `ido_rsn_memo` | Field | Displacement reason memo — free-text description of the reason for service line change/displacement |
| `ido_div` | Field | Movement type/division — classifies the type of movement (e.g., cancellation, transfer, modification) applied to the service contract detail |
| `ido_dtm` | Field | Movement datetime — the timestamp when the movement (status change) was recorded, set to system time via `getSysDateTimeStamp()` |
| `prgs_status` / `PRG_STAT` | Field | Progress status — the current processing status of the service cancellation, e.g., "1931" (Suspension receipt registration complete) |
| `mskm_dtl_no` | Field | Service line detail number — unique identifier for a specific line item within a service contract group; links the progress record to the correct cancellation detail |
| `svc_kei_no` | Field | Service contract number — the unique identifier for a service contract line item |
| `func_code` | Field | Function code — identifies the specific business function being executed (e.g., cancellation, modification) |
| `PRG_STAT` | Field | Progress status (進捗状況) — the status field on the CBS message that tracks the processing state of the service contract |
| `PRGM_FLG` | Field | Program flag — indicates the processing stage or phase of the service contract operation |
| EKK1091D010CBS | SC Code | CBS (Contract Business Service) for updating service contract progress status. The "D" type indicates a detail-level CBS operation for status transitions |
| EKK1091D010CBSMsg | Entity | CAANMsg class representing the input message structure for CBS EKK1091D010. Contains header fields and a child list |
| EKK1091D010CBSMsg1List | Entity | CAANMsg class for child message items in the EKK1091D010CBS detail list. Each item carries displacement reason code and memo |
| CAANMsg | Technical | A message envelope class used for CBS request/response data transfer. Provides `set()`, `setNull()`, and `get()` methods for typed field access |
| callSC | Method | Private helper method that wraps CBS invocation — converts CAANMsg to HashMap, dispatches via `ServiceComponentRequestInvoker`, handles error info, and throws `SCCallException` on failure |
| C6 | Constant | Default displacement reason code — used when the input reason code is missing or empty. Represents a standard/unknown change reason |
| 1931 | Status code | 休止受領登録完了 (Suspension receipt registration complete) — indicates that the suspension registration for a service line has been successfully recorded |
| 回線内訳 (Rikken Uchiwake) | Japanese term | Service line detail breakdown — the individual service lines within a grouped service contract, each with its own status and detail number |
| 変動理由 (Hendou Riyuu) | Japanese term | Displacement reason — the justification for a service line status change (e.g., cancellation, transfer). Composed of a reason code and optional memo |
| 進捗情報 (Shinseki Jouhou) | Japanese term | Progress information — the intermediate processing state of a cancellation workflow, used for audit trails and operational monitoring |
| 休止受領登録完了 (Yuushi Juryou Touroku Kanryou) | Japanese term | Suspension receipt registration complete — the status indicating that a service suspension has been successfully registered during the cancellation process |
| SessionHandle | Technical | Database session handle providing transaction context, user identity, and connection management for CBS execution |
| ServiceComponentRequestInvoker | Technical | Runtime invoker object that dispatches CBS requests to the service component layer and returns structured results |
| IRequestParameterReadWrite | Technical | Shared mutable request parameter map used across the cancellation workflow for passing data between components |
| eo HIKARI TV | Business term | K-Opticom's fiber-optic television broadband service offering — the product line being cancelled in this workflow |
| CBS | Acronym | Contract Business Service — a backend service component that performs database operations for telecom service contract management |
| CC | Acronym | Common Component — a shared Java class providing reusable business logic across multiple screens/workflows |
| SC | Acronym | Service Component — a logical service layer in the Fujitsu Futurity framework (the SC layer sits between CBS and the presentation) |
