# Business Logic — JKKOpsvkeiTelIktAddCC.mappingEKK0371D010InMsg() [88 LOC]

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

## 1. Role

### JKKOpsvkeiTelIktAddCC.mappingEKK0371D010InMsg()

This method maps input parameters into a CAANMsg template for the EKK0371D010 service component, which handles **Option Service Contract Registration for Telephone** (オプションサービス契約＜電話＞一括登録). It acts as a data transformation and preparation step within the telephone option service registration workflow operated by the K-Opticom eo customer base system. The method reads from three input HashMaps (`inHash`, `jkkOpsvkeiTelIktAddCC`, `resultHash`) — each carrying different business data sets — and writes mapped field values into a `CAANMsg` template that serves as the SIF (Service Interface Format) request payload. It implements the **builder pattern**, initializing the template with null-safe defaults and then populating each field through structured set operations. The method includes a conditional branch based on the option service code: when the code equals `B072` (Call Fee Limit Notification / 通話料上限通知), it sets the operating date as the desired service start date and populates the call fee limit commitment amount; otherwise, it uses the standard use-start date and nullifies the call fee field. The template is subsequently passed to `callEKK0371D010SC()` for invocation of the SC (Service Component) that persists the registration.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["mappingEKK0371D010InMsg(params)"])

    START --> STEP1["fillCAANMSGNullMapping<br/>Initialize all template fields to null"]

    STEP1 --> STEP2["Set TEMPLATEID = EKK0371D010"]

    STEP2 --> STEP3["Set FUNC_CODE from inHash"]

    STEP3 --> STEP4["Set OP_SVC_CD from jkkOpsvkeiTelIktAddCC"]

    STEP4 --> STEP5["Set PCRS_CD from jkkOpsvkeiTelIktAddCC"]

    STEP5 --> STEP6["Set PPLAN_CD from jkkOpsvkeiTelIktAddCC"]

    STEP6 --> STEP7["Set OYA_KEI_SKBT_CD from inHash"]

    STEP7 --> STEP8["Set SYSID from inHash"]

    STEP8 --> STEP9["Set IDO_DIV from inHash"]

    STEP9 --> STEP10["Set SVC_KEI_NO = null"]

    STEP10 --> STEP11["Set SVC_KEI_UCWK_NO from inHash"]

    STEP11 --> STEP12["Set SEIKY_KEI_NO from inHash"]

    STEP12 --> STEP13["Set UPD_DTM_BF from inHash"]

    STEP13 --> STEP14["Set MSKM_DTL_NO from inHash"]

    STEP14 --> COND{OP_SVC_CD<br/>= B072?}

    COND -->|Yes: Call fee limit notification| TWRYO_YES["Set TWRYO_STIAM_TTU_TCHI_STIAM<br/>from jkkOpsvkeiTelIktAddCC"]

    TWRYO_YES --> SVC_USE_UNYO["Set SVC_USE_STA_KIBO_YMD<br/>= UNYO_YMD (operating date)"]

    SVC_USE_UNYO --> STEP15

    COND -->|No: Other option service| TWRYO_NO["Set TWRYO_STIAM_TTU_TCHI_STIAM<br/>= null"]

    TWRYO_NO --> SVC_USE_USE["Set SVC_USE_STA_KIBO_YMD<br/>= USE_START_YMD (use start date)"]

    SVC_USE_USE --> STEP15

    STEP15["Set DSP_SVCTK_STAYMD<br/>= USE_START_YMD"]

    STEP15 --> END(["Return void"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `template` | `CAANMsg` | The SIF (Service Interface Format) message template to populate with EKK0371D010 input conditions. This object serves as the request payload for the option service contract registration SC. It is initialized to all-null state at the start of processing. |
| 2 | `inHash` | `HashMap<String, Object>` | Input condition map carrying data from the screen/UI layer. Contains values such as the parent contract identification code, system ID, move separation code, service contract detail work number, billing contract number, previous update timestamp, application details number, and date parameters (operating date or use start date). |
| 3 | `jkkOpsvkeiTelIktAddCC` | `HashMap<String, Object>` | The primary processing target hash containing the telephone option service contract data being registered. Includes the option service code (`op_svc_cd`), price code (`pcrs_cd`), price plan code (`pplan_cd`), and — when the option service code is B072 — the call fee limit commitment amount. |
| 4 | `resultHash` | `HashMap<String, Object>` | Result condition map for returning processing outcomes. Not directly used in this method (the method only writes to `template`), but passed for consistency with the broader call pattern of this component class. |

**Instance fields read by this method:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `CONTENTS_LIST` | `Object[][]` | Matrix of template IDs mapped to their corresponding CBSMsg contents, used by `fillCAANMSGNullMapping` to initialize all fields of a template to null. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKOpsvkeiTelIktAddCC.fillCAANMSGNullMapping` | JKKOpsvkeiTelIktAddCC | - | Calls `fillCAANMSGNullMapping` in `JKKOpsvkeiTelIktAddCC` |
| R | `JKKOpsvkeiTelIktAddCC.getContents` | JKKOpsvkeiTelIktAddCC | - | Calls `getContents` in `JKKOpsvkeiTelIktAddCC` |

This method is a **pure data mapping/transformation method**. It does not perform any direct database CRUD operations (Create, Read, Update, Delete). Instead, it prepares a `CAANMsg` request template by reading data from input HashMaps and setting fields on the template object. The actual service invocation (and any resulting database operations) occurs in the caller method `callEKK0371D010SC()`, which receives the prepared template and invokes the EKK0371D010SC service component. The primary called methods are:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `fillCAANMSGNullMapping(template, new EKK0371D010CBSMsg().getContents())` | JKKOpsvkeiTelIktAddCC | - | Initializes all fields in the CAANMsg template to null values, using the content specification from `EKK0371D010CBSMsg` as the schema reference. This ensures null-safe handling before populating specific fields. |
| - | `template.set(key, value)` | EKK0371D010CBSMsg | - | Sets individual fields on the CAANMsg template. Invoked 16 times across processing for fields including TEMPLATEID, FUNC_CODE, OP_SVC_CD, PCRS_CD, PPLAN_CD, OYA_KEI_SKBT_CD, SYSID, IDO_DIV, SVC_KEI_NO, SVC_KEI_UCWK_NO, SEIKY_KEI_NO, UPD_DTM_BF, MSKM_DTL_NO, TWRYO_STIAM_TTU_TCHI_STIAM, SVC_USE_STA_KIBO_YMD, and DSP_SVCTK_STAYMD. |
| - | `template.setNull(key)` | EKK0371D010CBSMsg | - | Explicitly sets fields to null. Called for `SVC_KEI_NO` (per requirement IT1-2012-0002376 — telephone option service contract does not set service contract number) and for `TWRYO_STIAM_TTU_TCHI_STIAM` when the option service code is not B072. |

## 5. Dependency Trace

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

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: callEKK0371D010SC | `callEKK0371D010SC` → `mappingEKK0371D010InMsg` | `fillCAANMSGNullMapping` [-], `template.set()` [-], `template.setNull()` [-] |

The caller `callEKK0371D010SC()` is invoked from the main registration method of `JKKOpsvkeiTelIktAddCC` (around line 713), which handles the option service contract <telephone> bulk registration. The flow is: the caller invokes `mappingEKK0371D010InMsg()` to build the request template, then passes it to the EKK0371D010SC service component for actual service execution.

## 6. Per-Branch Detail Blocks

**Block 1** — EXEC `(null)` (L1205)

> Initialize all template fields to null using fillCAANMSGNullMapping. This prepares a clean template by clearing all fields to their null state, using the content schema from EKK0371D010CBSMsg.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `fillCAANMSGNullMapping(template, new EKK0371D010CBSMsg().getContents())` | // Initialize all fields to null [-> TEMPLATE_ID_EKK0371D010="EKK0371D010"] |

**Block 2** — EXEC `(null)` (L1208)

> Set the template ID (SIF ID) to identify this message as an EKK0371D010 registration request.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.TEMPLATEID, TEMPLATE_ID_EKK0371D010)` | // Template ID (SIF ID) [-> "EKK0371D010"] |

**Block 3** — EXEC `(null)` (L1211)

> Set the function code from the input hash for access control / routing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.FUNC_CODE, inHash.get(FUNC_CODE))` | // Function code [-> FUNC_CODE="func_code"] |

**Block 4** — EXEC `(null)` (L1214-1229)

> Set option service-related codes from the processing target hash. This includes the option service code, price code, and price plan code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.OP_SVC_CD, jkkOpsvkeiTelIktAddCC.get(OP_SVC_CD))` | // Option service code [-> OP_SVC_CD="op_svc_cd"] |
| 2 | SET | `template.set(EKK0371D010CBSMsg.PCRS_CD, jkkOpsvkeiTelIktAddCC.get(PCRS_CD))` | // Price code [-> PCRS_CD="pcrs_cd"] |
| 3 | SET | `template.set(EKK0371D010CBSMsg.PPLAN_CD, jkkOpsvkeiTelIktAddCC.get(PPLAN_CD))` | // Price plan code [-> PPLAN_CD="pplan_cd"] |

**Block 5** — EXEC `(null)` (L1232-1245)

> Set parent contract, system ID, and move separation from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.OYA_KEI_SKBT_CD, inHash.get(OYA_KEI_SKBT_CD))` | // Parent contract identification code [-> OYA_KEI_SKBT_CD="oya_kei_skbt_cd"] |
| 2 | SET | `template.set(EKK0371D010CBSMsg.SYSID, inHash.get(SYSID))` | // System ID [-> SYSID="sysid"] |
| 3 | SET | `template.set(EKK0371D010CBSMsg.IDO_DIV, inHash.get(IDO_DIV))` | // Move separation [-> IDO_DIV="ido_div"] |

**Block 6** — EXEC `(null)` (L1248-1253)

> Set service contract number to null. Per requirement IT1-2012-0002376 (telephone option service contract does not set service contract number), this field is explicitly cleared.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.setNull(EKK0371D010CBSMsg.SVC_KEI_NO)` | // Service contract number — explicitly null per IT1-2012-0002376 [-> SVC_KEI_NO="svc_kei_no"] |

**Block 7** — EXEC `(null)` (L1256)

> Set service contract detail work number from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.SVC_KEI_UCWK_NO, inHash.get(SVC_KEI_UCWK_NO))` | // Service contract detail work number [-> SVC_KEI_UCWK_NO="svc_kei_ucwk_no"] |

**Block 8** — EXEC `(null)` (L1259)

> Set billing contract number from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.SEIKY_KEI_NO, inHash.get(SEIKY_KEI_NO))` | // Billing contract number [-> SEIKY_KEI_NO="seiky_kei_no"] |

**Block 9** — EXEC `(null)` (L1262)

> Set the previous update timestamp (before-update datetime) for audit/change tracking.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.UPD_DTM_BF, inHash.get(EX_UPD_DTM))` | // Previous update datetime [-> EX_UPD_DTM="ex_upd_dtm"] |

**Block 10** — EXEC `(null)` (L1265-1266)

> Set application details number from the input hash, retrieved as a String cast.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String mskm_dtl_no = (String) inHash.get(EX_MSKM_DTL_NO)` | // Application details number [-> EX_MSKM_DTL_NO="mksm_dtl_noNOW"] |
| 2 | SET | `template.set(EKK0371D010CBSMsg.MSKM_DTL_NO, mskm_dtl_no)` | // Set into template [-> 2012-02-21] |

**Block 11** — IF-ELSE `(OP_SVC_CD_VALUE_TWRYO_STIAM.equals(jkkOpsvkeiTelIktAddCC.get(OP_SVC_CD)))` [`OP_SVC_CD_VALUE_TWRYO_STIAM` = "B072"] (L1268)

> Branch on the option service code to handle call fee limit notification (B072) differently from other option services.

**Block 11.1** — IF-THEN `(OP_SVC_CD = "B072" — Call fee limit notification) (L1269)`

> When the option service is the call fee limit notification type, set the call fee limit commitment amount from the processing target hash and use the operating date as the desired service start date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.TWRYO_STIAM_TTU_TCHI_STIAM, jkkOpsvkeiTelIktAddCC.get(TWRYO_STIAM_TTU_TCHI_STIAM))` | // Call fee limit notification — call fee designated amount reach notification designated amount [-> TWRYO_STIAM_TTU_TCHI_STIAM="twryo_stiam_ttu_tchi_stiam"] |
| 2 | SET | `template.set(EKK0371D010CBSMsg.SVC_USE_STA_KIBO_YMD, inHash.get(UNYO_YMD))` | // Service use start desired date = operating date [-> UNYO_YMD="unyo_ymd"] |

**Block 11.2** — ELSE `(OP_SVC_CD != "B072" — Other option service) (L1276)`

> For all other option service types, nullify the call fee limit field and use the standard use-start date as the desired service start date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.setNull(EKK0371D010CBSMsg.TWRYO_STIAM_TTU_TCHI_STIAM)` | // Call fee limit notification designated amount = null [-> TWRYO_STIAM_TTU_TCHI_STIAM="twryo_stiam_ttu_tchi_stiam"] |
| 2 | SET | `template.set(EKK0371D010CBSMsg.SVC_USE_STA_KIBO_YMD, inHash.get(USE_START_YMD))` | // Service use start desired date = use start date [-> USE_START_YMD="use_start_ymd"] |

**Block 12** — EXEC `(null)` (L1280-1282)

> Set the display-oriented service provision start date (for UI purposes). This field is always set to USE_START_YMD regardless of the option service code branch, per requirement ANK-0571-00-00 (option service start date change対応) dated 2012/09/10.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0371D010CBSMsg.DSP_SVCTK_STAYMD, inHash.get(USE_START_YMD))` | // Display service provision start date [-> ANK-0571-00-00 2012/09/10] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `op_svc_cd` | Field | Option service code — identifies the type of option service being registered. Value "B072" specifically denotes the Call Fee Limit Notification (通話料上限通知) service. |
| `pcrs_cd` | Field | Price code — pricing tier identifier for the option service. |
| `pplan_cd` | Field | Price plan code — detailed pricing plan within a price code. |
| `oya_kei_skbt_cd` | Field | Parent contract identification code — links this service line item to its parent contract. |
| `svc_kei_no` | Field | Service contract number — the unique identifier for a service contract. Explicitly set to null for telephone option service contracts per requirement IT1-2012-0002376. |
| `svc_kei_ucwk_no` | Field | Service contract detail work number — internal tracking ID for service contract detail work items. |
| `seiky_kei_no` | Field | Billing contract number — identifies the billing contract associated with this registration. |
| `ido_div` | Field | Move separation — indicates the type of movement/change (e.g., addition, deletion, modification). |
| `twryo_stiam_ttu_tchi_stiam` | Field | Call fee limit notification designated amount — the monetary threshold for call fee usage notifications (通話料指定額到達通知指定金額). Only set when option service code is B072. |
| `unyo_ymd` | Field | Operating date — the system operational date used as the service start desired date for call fee limit notification option services. |
| `use_start_ymd` | Field | Use start date — the standard service activation date used for non-call-fee-limit option services and for display purposes. |
| `ex_upd_dtm` | Field | Exception/external update datetime — the previous update timestamp used for optimistic concurrency control and audit tracking. |
| `mksm_dtl_noNOW` | Field | Application details number — reference to the application/detail inquiry record (申請明細番号). |
| `dsp_svctk_staymd` | Field | Display service provision start date — the date shown on UI for when the service will be provided. Always set from USE_START_YMD per ANK-0571-00-00. |
| `upd_dtm_bf` | Field | Update datetime before — the timestamp before update for change tracking. |
| `sysid` | Field | System ID — identifies the originating system in a multi-system environment. |
| `func_code` | Field | Function code — used for access control and request routing. |
| EKK0371D010 | SC Code | Option Service Contract Registration for Telephone — the service component that processes telephone option service contract registration. |
| CAANMsg | Technical | Fujitsu's message/serialization framework object used for SIF (Service Interface Format) message construction. |
| SIF | Acronym | Service Interface Format — the standardized message format used for communication between service components. |
| SC | Acronym | Service Component — a business logic module that performs specific service operations. |
| CC | Acronym | Common Component — a reusable shared component class in the K-Opticom eo system architecture. |
| B072 | Code Value | Option service code for Call Fee Limit Notification (通話料上限通知) — allows customers to receive alerts when call charges reach a designated amount. |
| IT1-2012-0002376 | Requirement ID | Requirement that telephone option service contracts should not set service contract numbers (サービス契約番号が設定されない). |
| ANK-0571-00-00 | Requirement ID | Requirement for option service start date change対応 — mandates setting the display-oriented service provision start date. |
| TEMPLETEID | Field | Template ID — the SIF message type identifier. For this method, always "EKK0371D010". |
