# Business Logic — JKKUseFailMapperCC.mappingEKK0961B001SCInMsg() [39 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.mappingEKK0961B001SCInMsg()

This method prepares and populates a `CAANMsg` message template for the **Service Failure/Stop Condition** service component `EKK0961B001SC`. It acts as a **data mapper** (adapter pattern) that transforms business input from a `HashMap<String, Object>` into the structured message format expected by the downstream service component. Specifically, it maps service contract identifiers — including the main service contract number, detail work number, KK-TK (Kinkaku) service contract, option contract, sub-option contract, billing option contract, and KK-option contract — onto the template. This method serves as a **shared utility** called by multiple screen handlers across the system for both **add** and **change** operations on service failure/stop products. It is invoked by roughly 17 methods across `JKKSVUseFailAddCC` and `JKKSVUseFailChgCC` classes, which handle screen-level data preparation for product failure registration, failure modification, option failure changes, billing option failure changes, sub-option failure changes, and work-order usage failure changes. The method first clears all fields to null (sanitization step) before selectively setting the relevant condition fields, ensuring no stale data leaks into the service request.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["mappingEKK0961B001SCInMsg(template, inHash)"])
    START --> STEP1["S1: fillCAANMSGNullMapping(template, new EKK0961B001CBSMsg().getContents())"]
    STEP1 --> STEP2["S2: template.set(TEMPLATEID, EKK0961B001)"]
    STEP2 --> STEP3["S3: template.set(FUNC_CODE, FUNC_CODE_ONE = 1)"]
    STEP3 --> STEP4["S4: template.set(KEY_SVC_KEI_NO, svc_kei_no from inHash)"]
    STEP4 --> STEP5["S5: template.set(KEY_SVC_KEI_UCWK_NO, svc_kei_ucwk from inHash)"]
    STEP5 --> STEP6["S6: template.set(KEY_KKTK_SVC_KEI_NO, kktk_svc_kei from inHash)"]
    STEP6 --> STEP7["S7: template.set(KEY_OP_SVC_KEI_NO, op_svc_kei_no from inHash)"]
    STEP7 --> STEP8["S8: template.set(KEY_SBOP_SVC_KEI_NO, sbop_svc_kei_no from inHash)"]
    STEP8 --> STEP9["S9: template.set(KEY_SEIOPSVC_KEI_NO, seiopsvc_kei_no from inHash)"]
    STEP9 --> STEP10["S10: template.set(KEY_KKOP_SVC_KEI_NO, kkop_svc_kei_no from inHash)"]
    STEP10 --> END(["Return void"])
```

**Constant Resolution:**
- `FUNC_CODE_ONE` = `JPCModelConstant.FUNC_CD_1` = `"1"` — Function code for "Service Contract Details Inquiry" (サービス契約内容照会)
- `EKK0961B001` — Template ID identifying this as the EKK0961 Service Failure/Stop Condition message type

**Processing flow:**
1. **Null-mapping (sanitization):** Clear all fields in the template to null values using `fillCAANMSGNullMapping`, ensuring the message starts clean before populating fields.
2. **Set template ID:** Assign the hardcoded template ID `"EKK0961B001"` to identify this message's format.
3. **Set function code:** Assign `"1"` to indicate the operation type is Service Contract Details Inquiry.
4. **Map service contract keys:** Sequentially extract 7 distinct service contract identifiers from the input hash and set them onto the template. Each key represents a different contract hierarchy level (main, detail, KK-TK, option, sub-option, billing option, KK-option).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `template` | `CAANMsg` | The message template to be populated with condition fields for the EKK0961B001SC service component call. This is the output object — fields are set on it for the downstream service. |
| 2 | `inHash` | `HashMap<String, Object>` | Input data hash containing service contract identifiers. The method extracts specific keys from this map: `svc_kei_no`, `svc_kei_ucwk`, `kktk_svc_kei`, `op_svc_kei_no`, `sbop_svc_kei_no`, `seiopsvc_kei_no`, and `kkop_svc_kei_no`. These keys correspond to different levels of the service contract hierarchy used in telecom service management. |

**External state / instance fields read:**
- `FUNC_CODE_ONE` (static final String = `"1"`) — Function code constant defining the operation type as "Service Contract Details Inquiry"

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKUseFailMapperCC.fillCAANMSGNullMapping` | - | - | Calls `fillCAANMSGNullMapping` to clear all fields in the template to null values, sanitizing the message before population. |
| R | `EKK0961B001CBSMsg.getContents` | EKK0961B001SC | - | Calls `getContents()` on a new `EKK0961B001CBSMsg` instance to retrieve the field metadata schema (field names and types) needed for null-mapping. |

**Note:** This method is a **pure mapper** — it does not perform any direct database CRUD operations. It transforms input data into a message format for the `EKK0961B001SC` service component, which handles the actual data operations downstream.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 17 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:JKKSV072963MappingCC | `JKKSV072963MappingCC.execute()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 2 | CC:JKKSV072965MappingCC | `JKKSV072965MappingCC.execute()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 3 | CC:JKKSVUseFailAddCC | `JKKSVUseFailAddCC.getEKK0961B001()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 4 | CC:JKKSVUseFailAddCC | `JKKSVUseFailAddCC.kktkFailAdd()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 5 | CC:JKKSVUseFailAddCC | `JKKSVUseFailAddCC.registerUseStopPrdKaisenKiki()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 6 | CC:JKKSVUseFailChgCC | `JKKSVUseFailChgCC.getEKK0961B001()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 7 | CC:JKKSVUseFailChgCC | `JKKSVUseFailChgCC.kkOpFailChg()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 8 | CC:JKKSVUseFailChgCC | `JKKSVUseFailChgCC.kktkFailChg()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 9 | CC:JKKSVUseFailChgCC | `JKKSVUseFailChgCC.optionFailChg()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 10 | CC:JKKSVUseFailChgCC | `JKKSVUseFailChgCC.seikyOpFailChg()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 11 | CC:JKKSVUseFailChgCC | `JKKSVUseFailChgCC.subOpFailChg()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |
| 12 | CC:JKKSVUseFailChgCC | `JKKSVUseFailChgCC.ucwkUseFailChg()` -> `mappingEKK0961B001SCInMsg` | `fillCAANMSGNullMapping [-]`, `getContents [R]` |

**Caller Categories:**
- **JKKSVUseFailAddCC**: Handles product failure/stop registration (add) operations — general get, KK-TK failure add, and product line failure registration.
- **JKKSVUseFailChgCC**: Handles product failure/stop modification (change) operations — general get, KK-option failure change, KK-TK failure change, option failure change, billing option failure change, sub-option failure change, and work-order usage failure change.
- **JKKSV072963MappingCC / JKKSV072965MappingCC**: Screen-level mapping controllers that invoke this method as part of their execute flow.

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] (sanitization: clear all template fields to null) (L1231)

> Clean the template by setting all fields defined in the EKK0961B001CBSMsg schema to null. This ensures no stale data from previous uses leaks into the current service request.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `fillCAANMSGNullMapping(template, new EKK0961B001CBSMsg().getContents())` // Clear all template fields to null [-> EKK0961B001CBSMsg schema fields] |

**Block 2** — [SET] (set template ID) (L1234)

> Assign the hardcoded template identifier "EKK0961B001" to the TEMPLATEID field, identifying this message as the EKK0961 Service Failure/Stop Condition type.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.TEMPLATEID, "EKK0961B001")` // テンプレートID(SIFのID) — Template ID (SIF ID) |

**Block 3** — [SET] (set function code) (L1237)

> Assign function code `"1"` (`FUNC_CODE_ONE = JPCModelConstant.FUNC_CD_1`), indicating the operation type is "Service Contract Details Inquiry" (サービス契約内容照会).

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.FUNC_CODE, FUNC_CODE_ONE)` // 機能コード -- サービス契約内容照会 [-> FUNC_CODE_ONE = "1"] |

**Block 4** — [SET] (map main service contract number) (L1240)

> Extract the main service contract number from the input hash under key `"svc_kei_no"` and set it on the template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.KEY_SVC_KEI_NO, inHash.get("svc_kei_no"))` // KKIP サービス契約番号 — KKIP Service Contract Number |

**Block 5** — [SET] (map main service contract detail work number) (L1243)

> Extract the service contract detail work number from the input hash under key `"svc_kei_ucwk"` and set it on the template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.KEY_SVC_KEI_UCWK_NO, inHash.get("svc_kei_ucwk"))` // KKIP サービス契約内容番号 — KKIP Service Contract Detail Number |

**Block 6** — [SET] (map KK-TK service contract number) (L1246)

> Extract the KK-TK (Kinkaku) service contract number from the input hash under key `"kktk_svc_kei"` and set it on the template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.KEY_KKTK_SVC_KEI_NO, inHash.get("kktk_svc_kei"))` // KKIP 機器提供サービス契約番号 — KKIP Equipment Provisioning Service Contract Number |

**Block 7** — [SET] (map option service contract number) (L1249)

> Extract the option service contract number from the input hash under key `"op_svc_kei_no"` and set it on the template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.KEY_OP_SVC_KEI_NO, inHash.get("op_svc_kei_no"))` // KKIP オプションサービス契約番号 — KKIP Option Service Contract Number |

**Block 8** — [SET] (map sub-option service contract number) (L1252)

> Extract the sub-option service contract number from the input hash under key `"sbop_svc_kei_no"` and set it on the template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.KEY_SBOP_SVC_KEI_NO, inHash.get("sbop_svc_kei_no"))` // KKIP サブオプションサービス契約番号 — KKIP Sub-Option Service Contract Number |

**Block 9** — [SET] (map billing option service contract number) (L1255)

> Extract the billing option service contract number from the input hash under key `"seiopsvc_kei_no"` and set it on the template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.KEY_SEIOPSVC_KEI_NO, inHash.get("seiopsvc_kei_no"))` // KKIP 請求オプションサービス契約番号 — KKIP Billing Option Service Contract Number |

**Block 10** — [SET] (map KK-option service contract number) (L1258)

> Extract the KK-option service contract number from the input hash under key `"kkop_svc_kei_no"` and set it on the template. This field was added per ANK-1578 change request in December 2013 (KURATA).

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0961B001CBSMsg.KEY_KKOP_SVC_KEI_NO, inHash.get("kkop_svc_kei_no"))` // KKIP 機器オプションサービス契約番号 — KKIP Equipment Option Service Contract Number [ANK-1578-00-00 2013.12.06 KURATA] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the top-level service contract identifier in the KKIP system |
| `svc_kei_ucwk` | Field | Service contract detail work number — internal tracking ID for service contract line items / detail work |
| `kktk_svc_kei` | Field | KK-TK (Kinkaku) service contract number — service contract associated with equipment provisioning by KK-TK division |
| `op_svc_kei_no` | Field | Option service contract number — service contract for optional/add-on services |
| `sbop_svc_kei_no` | Field | Sub-option service contract number — service contract for sub-level optional services (tiered options) |
| `seiopsvc_kei_no` | Field | Billing option service contract number — service contract for billing-related optional services |
| `kkop_svc_kei_no` | Field | KK-option service contract number — service contract for equipment-level optional services (added 2013-12-06 via ANK-1578) |
| `EKK0961B001SC` | SC Code | Service Component for Service Failure/Stop Condition — manages conditions for service failure and stop product handling |
| `FUNC_CODE_ONE` | Constant | Function code "1" — represents "Service Contract Details Inquiry" (サービス契約内容照会) operation type |
| `template` | Parameter | CAANMsg message template — the message object being prepared for the EKK0961B001SC service component |
| `inHash` | Parameter | Input data hash — HashMap carrying service contract identifiers from the calling screen/business logic |
| SIF | Acronym | System Integration Framework — Fujitsu's middleware framework for message-based service communication |
| CAANMsg | Class | Message object class — a key-value based message structure used for inter-component communication in the KKIP platform |
| CBS | Acronym | Component-Based Service — the service component tier that handles business logic and data access |
| KKIP | Acronym | Fujitsu's telecom service management platform (Kinkaku IP Platform) — the enterprise system for managing telecom service contracts |
| CC | Acronym | Common Component — shared business logic classes reused across multiple screens and services |
| Kinkaku (KK-TK) | Business term | 金庫 (vault/cabinet) — refers to the equipment provisioning division within Fujitsu's telecom operations |
