# Business Logic — JKKUseFailMapperCC.mappingEKK0961C010InMsg() [36 LOC]

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

## 1. Role

### JKKUseFailMapperCC.mappingEKK0961C010InMsg()

This method performs the message-mapping responsibility for the **Use Stop Period Change** service (EKK0961C010) within the K-Opticom customer infrastructure system. Specifically, it populates a `CAANMsg` template with the data fields required to modify a service's usage stop (suspension) period. In telecom operations, a "usage stop" (利用停止) is a state where a subscriber's service is temporarily suspended — for example, due to non-payment, a customer request to pause service, or a violation of terms. This method transforms internal business parameters into a standardized SIF (Service Interchange Format) message envelope that can be dispatched to downstream CBS (Core Business System) components for actual persistence.

The method implements a **builder pattern** within the broader mapper/dispatch architecture used by `JKKUseFailChgCC`. Rather than containing conditional branches or business-rule decision logic, it acts as a **data transformer and delegator**: first initializing the template with null-safe defaults via `fillCAANMSGNullMapping`, then systematically extracting 10 typed fields from the incoming `resultHash` and writing them into the template using typed `template.set()` calls. The absence of branching makes this method a deterministic, side-effect-free mapping step in a larger failure-period-change workflow.

Within the larger system, this method is a **shared utility** called from multiple operational change-entry points in `JKKSVUseFailChgCC`, including operation failure change, telecom failure change, option failure change, and other variant change flows. It serves as the bridge between screen-level business actions and the CBS message layer, ensuring all required stop-period-change fields are present and correctly typed before the message is sent downstream.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["mappingEKK0961C010InMsg"])
    START --> STEP1["Step 1: Fill all template fields with null"]
    STEP1 --> STEP2["Step 2: Set TEMPLATEID to EKK0961C010"]
    STEP2 --> STEP3["Step 3: Set FUNC_CODE from resultHash"]
    STEP3 --> STEP4["Step 4: Set KEY_USE_STP_PRD_NO from resultHash"]
    STEP4 --> STEP5["Step 5: Set USE_STP_TORIATSU_CD from resultHash"]
    STEP5 --> STEP6["Step 6: Set USE_STP_RSN_MEMO from resultHash"]
    STEP6 --> STEP7["Step 7: Set USE_STP_STA_DTM from resultHash"]
    STEP7 --> STEP8["Step 8: Set USE_STP_END_DTM from resultHash"]
    STEP8 --> STEP9["Step 9: Set USE_STP_PRD_ADD_YMD from resultHash"]
    STEP9 --> STEP10["Step 10: Set UPD_DTM_BF from resultHash"]
    STEP10 --> END_NODE(["Return void"])
```

**Processing flow:**

1. **Initialize template (null mapping):** The method begins by calling `fillCAANMSGNullMapping(template, new EKK0961C010CBSMsg().getContents())`. This pre-populates every field defined in the `EKK0961C010CBSMsg` schema with null/empty values, ensuring no uninitialized fields exist when the message is serialized. This is a null-safety pattern common in SIF-based messaging systems where missing fields can cause downstream CBS parsing failures.

2. **Set TEMPLATEID:** Assigns the service identifier `TEMPLATE_ID_EKK0961C010` (resolved value: `"EKK0961C010"`) to the template. This ID serves as the SIF (Service Interchange Format) message identifier that tells the receiving CBS which service schema to apply.

3. **Map functional fields sequentially (10 fields):** Each of the remaining steps extracts a single value from `resultHash` using a string key and writes it to the template. The fields map to the following business concepts:

| Step | Template Field | Business Description |
|------|---------------|---------------------|
| 3 | `FUNC_CODE` | Function code — identifies the calling operation type (retrieved from `resultHash` under key `"func_code"`) |
| 4 | `KEY_USE_STP_PRD_NO` | Use stop period number — the unique internal tracking identifier for the service suspension period record being modified |
| 5 | `USE_STP_TORIATSU_CD` | Use stop handling code — classifies the type of suspension action (e.g., new suspension, extension, cancellation) |
| 6 | `USE_STP_RSN_MEMO` | Use stop reason memo — free-text field capturing the business reason for the service suspension |
| 7 | `USE_STP_STA_DTM` | Use stop start datetime — the timestamp when the service suspension begins (format: `yyyyMMddHHmmss`) |
| 8 | `USE_STP_END_DTM` | Use stop end datetime — the timestamp when the service suspension ends (note: sourced from `EKK0961D010CBSMsg`, a different CBS message class) |
| 9 | `USE_STP_PRD_ADD_YMD` | Use stop period registration date — the date the suspension period was registered in the system |
| 10 | `UPD_DTM_BF` | Update datetime (before) — the timestamp of the last modification before this change, used for optimistic concurrency control |

There are **no conditional branches** (if/else, switch/case, loops) in this method. It executes all 10 mapping steps sequentially regardless of input values. If any value in `resultHash` is null, the `template.set()` call writes null to that field, which may or may not be acceptable depending on downstream CBS validation.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `template` | `CAANMsg` | The SIF message envelope (template) being constructed. This is the output carrier — a mutable message object that will be handed off to the CBS message converter (`EKK0961C010CBSMsgCV`) for transformation into the wire-format message. After this method returns, the template contains all fields needed for the Use Stop Period Change CBS request. |
| 2 | `resultHash` | `HashMap<String, Object>` | A business-parameter map populated by the calling screen/controller logic (typically `JKKSVUseFailChgCC` after gathering form data or query results). It carries the actual business values for the suspension-period change — including the function code, period number, handling code, reason memo, timestamps, and registration date. Keys are expected to match the CBS field names. |

**External state read:**

| Field | Description |
|-------|-------------|
| `TEMPLATE_ID_EKK0961C010` | Private static constant, value `"EKK0961C010"`, used as the service IF identifier |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKUseFailMapperCC.fillCAANMSGNullMapping` | - | - | Calls `fillCAANMSGNullMapping` in `JKKUseFailMapperCC` — initializes all template fields with null values based on `EKK0961C010CBSMsg` schema. This is a preparatory/local operation, not a database access. |
| R | `EKK0961C010CBSMsg.getContents` | EKK0961C010CBS | - | Calls `getContents()` on a new `EKK0961C010CBSMsg` instance to retrieve the schema definition array (`Object[][]`) describing all template field names and types. This is a schema-read operation, not a database query. |

**Analysis:**

This method performs **no direct database operations** (C/R/U/D). It is purely a message-mapping layer method. Its sole responsibility is to transform in-memory parameters into a properly structured `CAANMsg` object. The actual database reads, writes, and updates are handled by downstream CBS components (`EKK0961C010SC` / `EKK0961C010CBS`) which receive the populated template.

The `fillCAANMSGNullMapping` call is a **local helper** that iterates over the schema definition and sets each field in the template to null. This is a defensive programming pattern to ensure the message envelope is fully initialized before selective field population.

## 5. Dependency Trace

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

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC:JKKSVUseFailChgCC | `kkOpFailChg` → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 2 | CC:JKKSVUseFailChgCC | `kktkFailChg` → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 3 | CC:JKKSVUseFailChgCC | `optionFailChg` → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 4 | CC:JKKSVUseFailChgCC | `seikyOpFailChg` → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 5 | CC:JKKSVUseFailChgCC | `subOpFailChg` → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 6 | CC:JKKSVUseFailChgCC | `ucwkUseFailChg` → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 7 | CC:JKKSVUseFailChgCC | `updateUseStopPrdKaisenKiki` → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 8 | CC:JKKSVUseFailChgCC | `useFailChg` → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 9 | CC:JKKSVUseFailChgCC | (other variants) → `mappingEKK0961C010InMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |

**Notes:**
- All 9 callers reside within `JKKSVUseFailChgCC`, a change-controller class responsible for various "use stop period" (usage suspension period) modification operations.
- The caller method names indicate the specific change variant: operation failure change (`kkOpFailChg`), telecom failure change (`kktkFailChg`), option failure change (`optionFailChg`), delivery operation failure change (`seikyOpFailChg`), sub-operation failure change (`subOpFailChg`), work-use failure change (`ucwkUseFailChg`), and general use failure change (`useFailChg`).
- This method is a leaf mapper — it produces no side effects beyond populating the `template` object. Downstream CBS processing (actual database operations) occurs after the template is returned to the caller.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET / EXEC] `fillCAANMSGNullMapping` (Null Initialization) (L899)

> Pre-populates the entire `template` with null values based on the `EKK0961C010CBSMsg` schema definition. This ensures no undefined fields exist when the message is later serialized and sent to CBS. This is a defensive initialization pattern.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `fillCAANMSGNullMapping(template, new EKK0961C010CBSMsg().getContents())` // Initialize all template fields with null based on CBS schema [-> null mapping for all EKK0961C010CBSMsg fields] |

**Block 2** — [SET] `TEMPLATEID` Assignment (L908)

> Sets the service IF (interchange format) identifier on the template. This ID tells the receiving CBS system which message schema to use for deserialization and processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961C010CBSMsg.TEMPLATEID, TEMPLATE_ID_EKK0961C010)` // [-> TEMPLATE_ID_EKK0961C010 = "EKK0961C010" (Use Stop Period Change service identifier)] |

**Block 3** — [SET] `FUNC_CODE` Assignment (L911)

> Maps the calling function's operation code from the result hash. This identifies what type of change operation triggered this message (e.g., operation change, telecom change, option change).

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961C010CBSMsg.FUNC_CODE, (String)resultHash.get("func_code"))` // Cast and extract function code from resultHash |

**Block 4** — [SET] `KEY_USE_STP_PRD_NO` Assignment (L914)

> Maps the unique identifier for the use stop (suspension) period record. This key is used to locate the exact suspension period row in the database for the subsequent update operation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961C010CBSMsg.KEY_USE_STP_PRD_NO, (String)resultHash.get(EKK0961C010CBSMsg.KEY_USE_STP_PRD_NO))` // Extract use stop period number (internal record key for suspension period) |

**Block 5** — [SET] `USE_STP_TORIATSU_CD` Assignment (L915)

> Maps the handling/action classification code. This code determines the nature of the suspension change — whether it is a new suspension registration, an extension, or a cancellation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961C010CBSMsg.USE_STP_TORIATSU_CD, (String)resultHash.get(EKK0961C010CBSMsg.USE_STP_TORIATSU_CD))` // Extract use stop handling code (action classification) |

**Block 6** — [SET] `USE_STP_RSN_MEMO` Assignment (L918)

> Maps the free-text reason memo for the service suspension. This captures the business justification stored alongside the change for audit and reporting purposes.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961C010CBSMsg.USE_STP_RSN_MEMO, (String)resultHash.get(EKK0961C010CBSMsg.USE_STP_RSN_MEMO))` // Extract use stop reason memo (business justification text) |

**Block 7** — [SET] `USE_STP_STA_DTM` Assignment (L921)

> Maps the suspension start datetime. This is the timestamp (in `yyyyMMddHHmmss` format) when the service suspension takes effect.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961C010CBSMsg.USE_STP_STA_DTM, (String)resultHash.get(EKK0961C010CBSMsg.USE_STP_STA_DTM))` // Extract use stop start datetime (yyyyMMddHHmmss format) |

**Block 8** — [SET] `USE_STP_END_DTM` Assignment (L924)

> Maps the suspension end datetime. Notably, this field is sourced from `EKK0961D010CBSMsg` (a different CBS message class than the others from `EKK0961C010CBSMsg`), suggesting the end datetime field may be defined in a parent or related message schema. This represents the timestamp (in `yyyyMMddHHmmss` format) when the service suspension expires.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961D010CBSMsg.USE_STP_END_DTM, (String)resultHash.get(EKK0961D010CBSMsg.USE_STP_END_DTM))` // Extract use stop end datetime from EKK0961D010CBSMsg schema |

**Block 9** — [SET] `USE_STP_PRD_ADD_YMD` Assignment (L927)

> Maps the registration date for the use stop period. This records when the suspension period was first registered in the system, distinct from the start/end timestamps of the suspension itself.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961C010CBSMsg.USE_STP_PRD_ADD_YMD, (String)resultHash.get(EKK0961C010CBSMsg.USE_STP_PRD_ADD_YMD))` // Extract use stop period registration date (yyyyMMdd format) |

**Block 10** — [SET] `UPD_DTM_BF` Assignment (L930)

> Maps the "update datetime before" field. This captures the timestamp of the last modification to the record prior to this change. It is used for **optimistic concurrency control** — the CBS layer can compare this value against the current database value to detect concurrent modifications and prevent lost updates.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961C010CBSMsg.UPD_DTM_BF, (String)resultHash.get(EKK0961C010CBSMsg.UPD_DTM_BF))` // Extract update datetime (before) for optimistic locking |

**Block 11** — [RETURN] Method Exit (L934)

> Returns `void`. The method completes after all 10 fields have been mapped. The populated `template` object is available to the caller for further processing or dispatch to the CBS message layer.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // (implicit void return) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `use_stp` | Field prefix | Use Stop (利用停止) — Service suspension/suspension period. A state where a telecom subscriber's service is temporarily suspended. |
| `use_stp_prd_no` | Field | Use stop period number — The internal unique tracking ID for a suspension period record in the service management database. |
| `use_stp_toriatsu_cd` | Field | Use stop handling code — Classification code indicating the type of suspension action: new registration, extension, or cancellation. |
| `use_stp_rsn_memo` | Field | Use stop reason memo — Free-text field storing the business reason why the service suspension was applied. |
| `use_stp_sta_dtm` | Field | Use stop start datetime — The timestamp when the service suspension takes effect (format: `yyyyMMddHHmmss`). |
| `use_stp_end_dtm` | Field | Use stop end datetime — The timestamp when the service suspension expires or is lifted (format: `yyyyMMddHHmmss`). |
| `use_stp_prd_add_ymd` | Field | Use stop period registration date — The date (yyyyMMdd) when the suspension period record was first created in the system. |
| `upd_dtm_bf` | Field | Update datetime (before) — The timestamp of the last modification before the current change; used for optimistic concurrency control to detect concurrent updates. |
| `func_code` | Field | Function code — Identifies which operational change type triggered this message (e.g., operation failure change, telecom failure change). |
| `TEMPLATEID` | Field | Template ID — The SIF (Service Interchange Format) message identifier that tells the receiving CBS system which schema to use for the message. |
| `EKK0961C010` | Service code | Use Stop Period Change — CBS service code for modifying a subscriber's service suspension period. The "C010" suffix denotes the specific change variant within the EKK0961 service family. |
| `CAANMsg` | Technical | Core message container — Fujitsu's messaging envelope class used in the SIF (Service Interchange Format) architecture. Acts as a key-value store for CBS message fields. |
| `CBSMsg` | Technical | CBS Message schema class — Extends `CAANSchemaInfo` and defines the field layout (name, type pairs) for a specific CBS service message. |
| `fillCAANMSGNullMapping` | Technical | Null-initialization helper — Fills all fields in a CAANMsg with null values based on a CBSMsg schema definition, ensuring no uninitialized fields in the output. |
| `resultHash` | Technical | Business parameter map — A HashMap carrying runtime business values from the calling screen/controller to the mapper for template population. |
| SIF | Acronym | Service Interchange Format — Fujitsu's service integration messaging protocol used to communicate between application layers and CBS services. |
| CC | Acronym | Change Controller / Common Component — A controller-layer class handling business logic orchestration. In this codebase, CC classes manage change operations and data mapping. |
| KK (K-Opticom) | Acronym | K-Opticom — The telecom service provider. The "KK" prefix is used throughout the codebase for K-Opticom-specific entities and screens. |
| `KKSVUseFailChgCC` | Class | Use Stop Failure Change Controller — The parent change controller class that calls this mapper. Responsible for orchestrating various use stop period change operations. |
