# Business Logic — JKKPopPwdShkkaRnkAddCC.mappingEKK1091D010InMsg() [90 LOC]

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

## 1. Role

### JKKPopPwdShkkaRnkAddCC.mappingEKK1091D010InMsg()

This method constructs and populates an `EKK1091D010` CBS (Community Broadcasting System) inbound message template for **POP Password Initialization** — the process of provisioning a fresh POP (Post Office Protocol) password for a customer's internet service contract. It serves as a **data-mapping bridge** between the higher-level POP initial registration flow and the underlying CBS layer that communicates with Fujitsu's backend service systems.

The method follows a **builder pattern** — it receives a pre-allocated `CAANMsg` template and fills in all required fields according to the business context of a POP password initialization request. It pulls the **application detail number** from a previously retrieved `EKK0011D020` (Application Content Acceptance Registration) result hash, which represents the confirmation of the customer's order details. The method sets the **modification division code** to `00052` (POP password initialization type), the **progress status** to `5301` (customer password initialization), and constructs a placeholder **modification reason list** with a default code of `56` (empty/no reason, as the original Japanese comment states "本来はいらない" — "not really needed").

As a **shared utility** within the `JKKPopPwdShkkaRnkAddCC` component, this method is called by `callEKK1091D010SC()` to prepare the inbound CBS message before invoking the `EKK1091D010` service component. Its role is purely transformational: it reads from input hashes and parameters, and writes structured message fields into the template.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["mappingEKK1091D010InMsg"])
    STEP1["fillCAANMSGNullMapping"]
    STEP2["Set TEMPLATE_ID_EKK1091D010 = EKK1091D010"]
    STEP3["Set FUNC_CODE = 1"]
    STEP4["Extract eKK0011D020Hash from resultHash"]
    STEP5["Extract CAANMsg array from eKK0011D020Hash"]
    STEP6["Get first element CAANMsg[0]"]
    STEP7["Get msgData HashMap from CAANMsg"]
    STEP8["Set SVC_KEI_NO"]
    STEP9["Set MSKM_DTL_NO from msgData"]
    STEP10["Set IDO_DIV = 00052"]
    STEP11["Set IDO_DTM"]
    STEP12["Set PRG_STAT = 5301"]
    STEP13["Create idoRsnTemp CAANMsg"]
    STEP14["setSvcIFMapping(IDO_RSN_CD) = 56"]
    STEP15["setSvcIFMapping(IDO_RSN_MEMO) = null"]
    STEP16["Create CAANMsg array with 1 element"]
    STEP17["Set EKK1091D010CBSMSG1LIST"]
    STEP18["Set OP_SVC_KEI_NO"]
    END(["Return void"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> STEP9
    STEP9 --> STEP10
    STEP10 --> STEP11
    STEP11 --> STEP12
    STEP12 --> STEP13
    STEP13 --> STEP14
    STEP14 --> STEP15
    STEP15 --> STEP16
    STEP16 --> STEP17
    STEP17 --> STEP18
    STEP18 --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `template` | `CAANMsg` | The EKK1091D010 CBS inbound message template to populate. This is the primary output carrier — all business data for the POP password initialization request is written into this object. It is passed by reference and modified in-place. |
| 2 | `inHash` | `HashMap<String, Object>` | Input condition hash containing filter/search criteria passed into this method. Not actively used in this implementation — may be a remnant from a prior design or reserved for future extension. |
| 3 | `svcKeiNo` | `String` | Service contract number — the unique identifier for the customer's internet service contract line. This links the POP password initialization to a specific contracted service. |
| 4 | `resultHash` | `HashMap<String, Object>` | A result map carrying data retrieved by prior CBS calls in the same flow. Specifically, it contains the `EKK0011D020` (Application Content Acceptance Registration) result, from which the application detail number (`MSKM_DTL_NO`) is extracted. |
| 5 | `opSvcKeiNo` | `String` | Optional service contract number — the contract number for the optional/add-on service associated with the primary service. Set on the template for CBS correlation. |
| 6 | `idoDtm` | `String` | Modification date-time — a timestamp indicating when the modification (POP password initialization) was performed. Previously generated via `JCCBPCommon.getOpeDateTimeStamp(null)` but changed to accept an explicit parameter (per 2012-04-11 replacement). |

### External State / Instance Fields Read

| Field | Type | Business Description |
|-------|------|---------------------|
| `oPE_DATE` | `String` | Operation date string (instance-level, set per request). Declared as an instance field due to IT1-2013-0000291 modification to support per-request date tracking. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKPopPwdShkkaRnkAddCC.fillCAANMSGNullMapping` | JKKPopPwdShkkaRnkAddCC | - | Populates the template with null-mapped default values from the `EKK1091D010CBSMsg` contents. |
| - | `JKKPopPwdShkkaRnkAddCC.setSvcIFMapping` | JKKPopPwdShkkaRnkAddCC | - | Sets service interface mapping fields (`IDO_RSN_CD`, `IDO_RSN_MEMO`) on the `idoRsnTemp` CAANMsg. Called twice for different sub-fields. |

**CRUD Classification:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| M | `JKKPopPwdShkkaRnkAddCC.fillCAANMSGNullMapping` | JKKPopPwdShkkaRnkAddCC | CAANMsg template (in-memory) | Fills null-safe default mappings into the template using the contents of an empty `EKK1091D010CBSMsg`. |
| M | `JKKPopPwdShkkaRnkAddCC.setSvcIFMapping` | JKKPopPwdShkkaRnkAddCC | CAANMsg idoRsnTemp (in-memory) | Maps service interface fields — sets `IDO_RSN_CD` (modification reason code) to `"56"` and `IDO_RSN_MEMO` (modification reason memo) to `null`. |

**Notes on data operations:**
- This method does **not perform any direct database access** (no R/U/D against entities). It exclusively **manipulates in-memory `CAANMsg` objects**.
- The `EKK0011D020` data it reads from `resultHash` was retrieved by a **prior** CBS call in the calling chain (`callEKK1091D010SC`), not by this method directly.
- The method is a **pure transformer** — it does not call any SC or CBS classes itself.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKPopPwdShkkaRnkAddCC.callEKK1091D010SC()` | `callEKK1091D010SC()` → `mappingEKK1091D010InMsg()` | `setSvcIFMapping` [-], `setSvcIFMapping` [-], `fillCAANMSGNullMapping` [-] |

**Caller Details:**

| # | Caller Class | Caller Method | Kind |
|---|-------------|---------------|------|
| 1 | `JKKPopPwdShkkaRnkAddCC` | `callEKK1091D010SC()` | CC/Common Component |

**Terminal operations reachable from this method:** `setSvcIFMapping` (2 calls, in-memory), `fillCAANMSGNullMapping` (1 call, in-memory). No terminal SC/CBS or database operations originate directly from this method.

## 6. Per-Branch Detail Blocks

This method contains **no conditional branches** (no if/else, switch, or loops). All processing executes linearly. Each step is documented below.

### Block 1 — EXEC — Null mapping initialization (L1104)

> Populates the template with null-safe default values before further field assignment. This ensures all message fields have safe defaults, preventing null-pointer issues in downstream CBS processing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `fillCAANMSGNullMapping(template, new EKK1091D010CBSMsg().getContents())` // Fill template with null defaults [-> EKK1091D010CBSMsg contents] |

### Block 2 — SET — Set template ID (L1107)

> Assigns the CBS service identifier to the template, marking this as an EKK1091D010-type inbound message.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.TEMPLATEID, TEMPLATE_ID_EKK1091D010)` // [-> TEMPLATE_ID_EKK1091D010="EKK1091D010" (JKKAdInfChgConstCC.java:574)] |

### Block 3 — SET — Set function code (L1110)

> Sets the function code to `"1"`, indicating this is an initial/standard function invocation within the CBS workflow.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.FUNC_CODE, "1")` // Function code = "1" |

### Block 4 — EXEC — Extract application detail info from resultHash (L1116-L1123)

> Retrieves the `EKK0011D020` (Application Content Acceptance Registration) result from the `resultHash` map, extracts the message array, takes the first element, and obtains its data HashMap. This application detail number is then used to link the POP password initialization to the confirmed order.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0011D020Hash = (HashMap<String, Object>) resultHash.get(TEMPLATE_ID_EKK0011D020)` // Extract result [-> TEMPLATE_ID_EKK0011D020="EKK0011D020" (JKKAdInfChgConstCC.java:547)] |
| 2 | SET | `eKK0011D020CBSMSG1LIST = (CAANMsg[]) eKK0011D020Hash.get(EKK0011D020CBSMsg.EKK0011D020CBSMSG1LIST)` // Get message array |
| 3 | SET | `eKK0011D020CBSMSG = eKK0011D020CBSMSG1LIST[0]` // Get first element |
| 4 | SET | `retHash = eKK0011D020CBSMSG.getMsgData()` // Get msgData HashMap |

### Block 5 — SET — Set service contract number (L1126-L1128)

> Sets the service contract number (`svcKeiNo`) parameter directly onto the template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.SVC_KEI_NO, svcKeiNo)` // [-> SVC_KEI_NO="svc_kei_no" (JKKPopPwdShkkaRnkAddCC.java:93)] |

### Block 6 — SET — Set application detail number (L1132-L1134)

> Extracts the application detail number (`MSKM_DTL_NO`) from the `EKK0011D020` result data and sets it on the template. This links the POP password initialization request to the specific line item of the confirmed application.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.MSKM_DTL_NO, retHash.get(EKK0011D020CBSMsg1List.MSKM_DTL_NO))` // [-> MSKM_STB_CD_00026="00026" (JKKPopPwdShkkaRnkAddCC.java:99)] |

### Block 7 — SET — Set modification division code (L1137-L1139)

> Sets the modification division code to `00052`, which identifies this request as a **POP password initialization** operation. This code is a classifying constant that tells the CBS system what type of service modification is being requested.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.IDO_DIV, IDO_DIV_00052)` // [-> IDO_DIV_00052="00052" (JKKPopPwdShkkaRnkAddCC.java:129)] |

### Block 8 — SET — Set modification date-time (L1143)

> Sets the modification timestamp from the `idoDtm` parameter. Per the 2012-04-11 code comment (差し替え = replacement), this was changed from auto-generating via `JCCBPCommon.getOpeDateTimeStamp(null)` to accepting an explicit parameter, ensuring the timestamp is controlled by the caller.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.IDO_DTM, idoDtm)` // [2012-04-11 差し替え: no longer auto-generates, uses parameter] |

### Block 9 — SET — Set progress status (L1146-L1148)

> Sets the progress status to `5301`, which corresponds to **Customer Password Initialization** in the system's progress status classification. This tells the CBS system which workflow state this operation belongs to.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.PRG_STAT, PRG_STAT_5301)` // [-> PRG_STAT_5301="5301" (JKKSvcConst.java:1305)] |

### Block 10 — EXEC — Create modification reason placeholder (L1156-L1163)

> Constructs a single-element array containing a `CAANMsg` for modification reasons. Sets the modification reason code (`IDO_RSN_CD`) to `"56"` and the memo field to `null`. The Japanese comment notes that the reason code "本来はいらない" (is not really needed), meaning this is a placeholder with default values — the actual reason is not captured for POP password initialization.

| # | Type | Code |
|---|------|------|
| 1 | SET | `idoRsnTemp = new CAANMsg(EKK1091D010CBSMsg1List.class.getName())` // Create new CAANMsg for reason list element |
| 2 | EXEC | `setSvcIFMapping("56", EKK1091D010CBSMsg1List.IDO_RSN_CD, idoRsnTemp)` // Set reason code = "56" |
| 3 | EXEC | `setSvcIFMapping(null, EKK1091D010CBSMsg1List.IDO_RSN_MEMO, idoRsnTemp)` // Set reason memo = null |
| 4 | SET | `list = new CAANMsg[1]` // Create array of size 1 |
| 5 | SET | `list[0] = idoRsnTemp` // Assign the single element |

### Block 11 — SET — Set modification reason list on template (L1166)

> Assigns the constructed modification reason array to the `EKK1091D010CBSMSG1LIST` field of the main template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.EKK1091D010CBSMSG1LIST, list)` // Set the reason list |

### Block 12 — SET — Set optional service contract number (L1170)

> Sets the optional service contract number (`opSvcKeiNo`) on the template. Added on 2012-04-11 (追加 = addition) to include the optional service context in the CBS message.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK1091D010CBSMsg.OP_SVC_KEI_NO, opSvcKeiNo)` // [2012-04-11 追加: added optional service contract number] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `EKK1091D010` | Template ID | CBS inbound message template for POP Password Initialization — the service interface between the application layer and Fujitsu's backend CBS for provisioning POP passwords. |
| `EKK0011D020` | Template ID | Application Content Acceptance Registration — a prior CBS call whose result contains the confirmed order details (including the application detail number). |
| `TEMPLATEID` | Field | CBS template identifier field — identifies which CBS message type is being constructed. |
| `FUNC_CODE` | Field | Function code — indicates the type of function being invoked within the CBS message. Value `"1"` represents standard/initial function. |
| `SVC_KEI_NO` | Field | Service contract number — the unique identifier for a customer's contracted internet service line item. |
| `MSKM_DTL_NO` | Field | Application detail number — the line-item identifier within the confirmed application content (EKK0011D020 result), linking this POP password request to a specific order detail. |
| `IDO_DIV` | Field | Modification division code — classifies the type of service modification. Value `"00052"` = POP password initialization. |
| `IDO_DTM` | Field | Modification date-time — timestamp of when the modification was performed. |
| `PRG_STAT` | Field | Progress status — indicates the workflow state. Value `"5301"` = Customer Password Initialization (お客様パスワード初期化). |
| `IDO_RSN_CD` | Field | Modification reason code — reason for the service modification. Value `"56"` = default/no reason (placeholder). |
| `IDO_RSN_MEMO` | Field | Modification reason memo — free-text explanation for the modification reason. Set to `null` for POP password initialization. |
| `OP_SVC_KEI_NO` | Field | Optional service contract number — the contract number for an add-on/optional service associated with the primary service contract. |
| `EKK1091D010CBSMSG1LIST` | Field | Modification reason list — an array of CAANMsg objects representing modification reason entries. |
| POP Password Initialization | Business process | Provisioning a fresh POP (Post Office Protocol) password for a customer's internet service, allowing them to access email via POP3. |
| CBS | Acronym | Community Broadcasting System — Fujitsu's backend service system for telecom service provisioning and management. |
| CAANMsg | Technical class | Fujitsu's standard message object used for CBS communication — a key-value message carrier with typed field access. |
| `resultHash` | Parameter | A HashMap carrying results from prior CBS calls within the same service flow. Used to pass data between method steps in the registration chain. |
| `eKK0011D020CBSMSG1LIST` | Field | Message list field within the EKK0011D020 result — contains the array of CAANMsg objects with application detail data. |
| ST1-2012-0000012 | Change ticket | Fujitsu internal change ticket for modifying request parameters linked from POP password initialization. |
| EKK | Prefix | Fujitsu/eo system coding prefix for customer-related service processing modules (K-Opticom system). |
| `idoRsnTemp` | Variable | Temporary CAANMsg object constructed to hold modification reason data for the EKK1091D010 template. |
