# Business Logic — JKKEmailInfoAddCfmCC.mappingEKK0361D010SCInMsg() [75 LOC]

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

## 1. Role

### JKKEmailInfoAddCfmCC.mappingEKK0361D010SCInMsg()

This method populates a CAANMsg template (`EKK0361D010`) with the contract conditions and configuration data required to register an optional service contract for Internet Service Provider (ISP) service. It is a **data assembly (builder) method** — it receives raw input data in a `HashMap` and writes structured key-value pairs into a `CAANMsg` template object, which will subsequently be used by a Service Component (SC) to persist or validate the optional ISP service contract registration. The method handles multiple data sources: direct input hash parameters, a nested email information add-confirm list (`JKKEmailInfoAddCfmCCList`), and private helper methods (`getMlad_account`, `getStrymd`). It conditionally sets the application detail number (`MSKM_DTL_NO`) depending on the `FUNC_CODE` — when the function code is not `"2"`, it pulls the detail number from a separate acknowledgment detail template (`EKK0021D010`); when the function code equals `"2"`, it skips this field. The method serves as a shared data transformer used by the caller `callEKK0361D010SC()` within the same class, enabling email information add confirmation workflows at the K-Opticom customer base system.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["mappingEKK0361D010SCInMsg"])
    START --> S1["S1: fillCAANMSGNullMapping(template, EKK0361D010 contents)"]
    S1 --> S2["S2: Set TEMPLATE_ID = EKK0361D010"]
    S2 --> S3["S3: Set FUNC_CODE from inHash"]
    S3 --> S4["S4: Extract jKKEmailInfoAddCfmCCList from inHash"]
    S4 --> S5["S5: Get element at wK_INDEX from list"]
    S5 --> S6["S6: Extract mlBoxCapa"]
    S6 --> S7["S7: Set OP_SVC_CD from inHash"]
    S7 --> S8["S8: Set SVC_KEI_NO from inHash"]
    S8 --> S9["S9: Set PCRSCD = B01"]
    S9 --> S10["S10: Set PCRPLANCD = PB0101"]
    S10 --> S11["S11: Set OYA_KEISKBT_CD = 01"]
    S11 --> S12["S12: Set SYSID from inHash"]
    S12 --> S13["S13: Set IDODIV from inHash"]
    S13 --> S14["S14: Set MLAD_ACCOUNT from getMlad_account"]
    S14 --> S15["S15: Set CAPA = mlBoxCapa"]
    S15 --> S16["S16: Set SEIKY_KEINO from inHash"]
    S16 --> S17["S17: Set SVC_USE_STA_KIBO_YMD from getStrymd"]
    S17 --> COND{FUNC_CODE = 2?}
    COND -->|No| N1["N: Set MSKM_DTL_NO from EKK0021D010 template"]
    COND -->|Yes| Y1["Y: Skip MSKM_DTL_NO"]
    N1 --> S18["S18: Set UPD_DTM_BF from inHash"]
    Y1 --> S18
    S18 --> END_RETURN(["Return"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `template` | `CAANMsg` | The message template object (`EKK0361D010CBSMsg`) that will receive all mapped field values for the optional ISP service contract registration. This is the output target — after the method executes, the template carries the complete set of conditions for the downstream SC processing. |
| 2 | `inHash` | `HashMap<String, Object>` | Input data carrier holding service contract parameters. Contains: `func_code` (function type discriminator), `op_svc_cd` (optional service code), `svc_kei_no` (service contract number), `sysid` (system ID), `ido_div` (transfer/division type), `seiky_kei_no` (billing contract number), `ex_svc_upd_dtm` (previous service update timestamp), and `JKKEmailInfoAddCfmCCList` (the email info list containing `ml_box_capa`). |
| 3 | `resultHash` | `HashMap<String, Object>` | Application-specific parameters map. Used as a source for the acknowledgment detail number (`MSKM_DTL_NO`) keyed by the template ID `EKK0021D010` — pulled only when `FUNC_CODE` is not `"2"`. |

**Instance fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `wK_INDEX` | `int` | Working index into the email info add-confirm list (`JKKEmailInfoAddCfmCCList`). Defaults to `0`. Determines which list element to extract `mlBoxCapa` from. |
| `jKKEmailInfoAddCfmCC` (private) | `HashMap<String, Object>` | Cached element from the email info list. Read by `getStrymd()` and `getMlad_account()` to retrieve `use_staymd_year`, `use_staymd_mon`, `use_staymd_day`, and `mlad_account` values. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKEmailInfoAddCfmCC.fillCAANMSGNullMapping` | - | - | Calls `fillCAANMSGNullMapping` in `JKKEmailInfoAddCfmCC` to initialize all fields of the EKK0361D010CBSMsg template with null/default values before population. |
| R | `JKKEmailInfoAddCfmCC.getMlad_account` | - | - | Calls `getMlad_account()` private helper method to retrieve the current email address from `jKKEmailInfoAddCfmCC` (via `MLAD_ACCOUNT` field). Used to set `KIBO_ML_ACCOUNT_1` in the template. |
| R | `JKKEmailInfoAddCfmCC.getStrymd` | - | - | Calls `getStrymd()` private helper method to assemble the service start date (year+month+day) from `USE_STAYMD_YEAR`, `USE_STAYMD_MON`, `USE_STAYMD_DAY` fields. Used to set `SVC_USE_STA_KIBO_YMD` in the template. |
| R | `EKK0021D010CBSMsg.getContents` | EKK0021D010 | - | Static call to `EKK0021D010CBSMsg().getContents()` to retrieve the field schema for null mapping. Returns an Object[][] describing all valid field names and types of the acknowledgment detail registration message. |
| R | `EKK0361D010CBSMsg.getContents` | EKK0361D010 | EKK0361D010 | Static call to `EKK0361D010CBSMsg().getContents()` to retrieve the field schema for null mapping. Returns an Object[][] describing all valid field names and types of the optional ISP service contract registration message. |

**Analysis:** This method is a pure data mapper — it performs no direct database or service component calls. It transforms input hash data into a typed message template. The only external reads are from the input maps and the private helper methods. The SC invocation (which performs actual CRUD against the database) is delegated to the caller `callEKK0361D010SC()`.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| M | `fillCAANMSGNullMapping(CAANMsg msg, Object[][] contents)` | - | - | Internal method — initializes all template fields to null. |
| R | `getMlad_account()` | - | - | Private method — reads current email address from instance field. |
| R | `getStrymd()` | - | - | Private method — assembles service start date from instance field components. |

## 5. Dependency Trace

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

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC:JKKEmailInfoAddCfmCC.callEKK0361D010SC | `callEKK0361D010SC` -> `mappingEKK0361D010SCInMsg(template, inHash, resultHash)` | `fillCAANMSGNullMapping [-]`, `getMlad_account [R]`, `getStrymd [R]`, `EKK0361D010CBSMsg.getContents [R]`, `EKK0021D010CBSMsg.getContents [R]` |

**Instructions:**

The method is called by `callEKK0361D010SC()` within the same class `JKKEmailInfoAddCfmCC`. The call chain flows from a screen or CBS entry point into `callEKK0361D010SC()`, which constructs the template and input parameters, then delegates to `mappingEKK0361D010SCInMsg()` to populate the template. After `mappingEKK0361D010SCInMsg()` returns, `callEKK0361D010SC()` likely invokes the EKK0361D010 Service Component (SC) to persist the optional ISP service contract registration, but that actual SC call is outside the scope of this method.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (Null Mapping) (L1736)

> Initialize all fields of the EKK0361D010CBSMsg template with null/default values using the `fillCAANMSGNullMapping` method. This ensures the template is fully initialized before field-level population begins.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `fillCAANMSGNullMapping(template, new EKK0361D010CBSMsg().getContents())` // Initialize all template fields with null values [-> EKK0361D010CBSMsg schema] |

**Block 2** — [SET] (Template ID) (L1739)

> Set the SIF (System Interface Format) template identifier to `"EKK0361D010"`, identifying this message as an optional ISP service contract registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.TEMPLATEID, "EKK0361D010")` [-> TEMPLATE_ID_EKK0361D010="EKK0361D010"] (SIF template ID for optional ISP service contract registration) |

**Block 3** — [SET] (Function Code) (L1742)

> Copy the function code from the input hash. This code determines conditional branches downstream (notably the `MSKM_DTL_NO` assignment at Block 13).

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

**Block 4** — [SET, GET] (Extract Email Info List and mlBoxCapa) (L1745–L1748)

> Extract the `JKKEmailInfoAddCfmCCList` from the input hash, retrieve the element at the current working index (`wK_INDEX`), and extract the `mlBoxCapa` (email box capacity) value. This value will be used to set the capacity field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `jKKEmailInfoAddCfmCCList = (ArrayList) inHash.get(JKKEMAILINFOADDCFMCCLIST)` [-> JKKEMAILINFOADDCFMCCLIST="JKKEmailInfoAddCfmCCList"] (Email info add-confirm list) |
| 2 | SET | `jKKEmailInfoAddCfmCC = jKKEmailInfoAddCfmCCList.get(wK_INDEX)` [-> wK_INDEX=0 (instance field, working index)] |
| 3 | SET | `mlBoxCapa = (String) jKKEmailInfoAddCfmCC.get(ML_BOX_CAPA)` [-> ML_BOX_CAPA="ml_box_capa"] (Email box capacity from the current list element) |

**Block 5** — [SET] (Optional Service Code) (L1751–L1753)

> Set the optional service code from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.OP_SVC_CD, inHash.get(OP_SVC_CD))` [-> OP_SVC_CD="op_svc_cd"] |

**Block 6** — [SET] (Service Contract Number) (L1756–L1758)

> Set the service contract number (line item number) from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.SVC_KEI_NO, inHash.get(SVC_KEI_NO))` [-> SVC_KEI_NO="svc_kei_no"] |

**Block 7** — [SET] (Price Code) (L1761)

> Set the price code to `"B01"`, which identifies this as an email-related service billing line. This is a hardcoded constant.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.PCRS_CD, "B01")` [-> PCRS_CD_EMAIL="B01" (Price Code: Email)] |

**Block 8** — [SET] (Price Plan Code) (L1764)

> Set the price plan code to `"PB0101"`, identifying the specific email billing plan. This is a hardcoded constant.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.PPLAN_CD, "PB0101")` [-> PCRS_PLAN_CD_EMAIL="PB0101" (Price Plan Code: Email)] |

**Block 9** — [SET] (Parent Contract Identifier) (L1767–L1770)

> Set the parent contract identifier code to `"01"`, which is fixed. This represents the master subscription contract relationship for the optional ISP service.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.OYA_KEI_SKBT_CD, "01")` // Fixed value "03" fixed (Japanese comment: 03固定) — Parent contract identifier code, fixed at "01" |

**Block 10** — [SET] (System ID) (L1773–L1774)

> Set the system ID from the input hash.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.SYSID, inHash.get(SYSID))` [-> SYSID="sysid"] |

**Block 11** — [SET] (Transfer Division) (L1777–L1778)

> Set the transfer/division code from the input hash, indicating the type of service transfer or change being performed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.IDO_DIV, inHash.get(IDO_DIV))` [-> IDO_DIV="ido_div"] |

**Block 12** — [SET] (Expected Email Account) (L1781–L1783)

> Set the expected email account (desired email address) by calling the `getMlad_account()` private helper method, which reads the current email address from the instance field `jKKEmailInfoAddCfmCC`. The original inline `inHash.get(MLAD_ACCOUNT)` has been commented out (ST2-2012-0000457 change), replaced by the helper method call.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.KIBO_ML_ACCOUNT_1, getMlad_account())` // Email address account [-> getMlad_account() reads MLAD_ACCOUNT from jKKEmailInfoAddCfmCC instance field] |

**Block 13** — [SET] (Capacity) (L1786–L1787)

> Set the email box capacity from the previously extracted `mlBoxCapa` variable.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.CAPA, mlBoxCapa)` (Email box capacity value extracted from the email info list element) |

**Block 14** — [SET] (Billing Contract Number) (L1790–L1791)

> Set the billing contract number from the nested constant key `KKSV0002_KKSV0002OP_KKSV000201CC.SEIKY_KEI_NO`. This was added during an I/F refactoring (2011-09-26).

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.SEIKY_KEI_NO, inHash.get(KKSV0002_KKSV0002OP_KKSV000201CC.SEIKY_KEI_NO))` [-> KKSV000201CC.SEIKY_KEI_NO] (Billing contract number, I/F refactored) |

**Block 15** — [SET] (Service Usage Start Expected Date/Time) (L1794)

> Set the service usage start expected date/time (year-month-day) by calling the `getStrymd()` private helper method, which assembles the year, month, and day components from the instance field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.SVC_USE_STA_KIBO_YMD, getStrymd())` // Service usage start expected date [-> getStrymd() assembles USE_STAYMD_YEAR + USE_STAYMD_MON + USE_STAYMD_DAY from jKKEmailInfoAddCfmCC instance field] |

**Block 16** — [IF] (Conditional MSKM_DTL_NO Assignment) (FUNC_CODE = "2" check) (L1798)

> ST2-2012-0000457 modification (2012/03/27). Conditionally set the application detail number (`MSKM_DTL_NO`). When the function code is NOT `"2"`, the method retrieves the detail number from the `EKK0021D010` acknowledgment detail template stored in `resultHash`. When the function code equals `"2"`, this field is skipped (the acknowledgment detail is not available or not needed).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0021d010Msg = (HashMap) resultHash.get(TEMPLATE_ID_EKK0021D010)` [-> TEMPLATE_ID_EKK0021D010="EKK0021D010" (Application Detail Registration template)] |
| 2 | SET | `mskm_dtl_no = ekk0021d010Msg.get(EKK0021D010CBSMsg.MSKM_DTL_NO)` [-> MSKM_DTL_NO="mskm_dtl_no"] |
| 3 | SET | `template.set(EKK0361D010CBSMsg.MSKM_DTL_NO, mskm_dtl_no)` (Application detail number — conditionally set) |

**Block 16.1** — [ELSE] (FUNC_CODE = "2") (L1798)

> When `FUNC_CODE` equals `"2"`, the block is skipped. The acknowledgment detail number (`MSKM_DTL_NO`) is not populated, as this function code path represents a different workflow that does not reference the EKK0021D010 detail template.

| # | Type | Code |
|---|------|------|
| 1 | (skip) | No operations — the MSKM_DTL_NO field is not set for FUNC_CODE = "2" |

**Block 17** — [SET] (Previous Update Date/Time) (L1803–L1804)

> Set the previous service update date/time (year-month-day hour-minute-second). The source key `EX_SVC_UPD_DTM` is defined as `"ex_svc_upd_dtm"` in the class constants. This represents the timestamp from before the current service update.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0361D010CBSMsg.UPD_DTM_BF, inHash.get(EX_SVC_UPD_DTM))` [-> EX_SVC_UPD_DTM="ex_svc_upd_dtm"] |

**Block 18** — [RETURN] (L1807)

> Method completes and returns void. The template now contains all populated fields for the EKK0361D010 optional ISP service contract registration message.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // void return — caller receives populated template |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mskm_dtl_no` | Field | Application detail number — internal tracking number for acknowledgment detail records (EKK0021D010) |
| `opc_svc_cd` | Field | Optional service code — identifies the type of optional service attached to a main service contract |
| `svc_kei_no` | Field | Service contract line number — unique identifier for a service contract line item |
| `ido_div` | Field | Transfer/division — indicates the type of service transfer or change being processed |
| `mlad_account` | Field | Mail address account — the email address associated with the customer |
| `ml_box_capa` | Field | Mail box capacity — the storage capacity of the customer's email box (e.g., in MB or GB) |
| `seiky_kei_no` | Field | Billing contract number — the contract number used for billing and invoicing |
| `use_staymd_year` | Field | Usage start date (year) — requested service start year component |
| `use_staymd_mon` | Field | Usage start date (month) — requested service start month component |
| `use_staymd_day` | Field | Usage start date (day) — requested service start day component |
| `ex_svc_upd_dtm` | Field | Previous service update date/time — timestamp of the last service configuration update |
| `op_svc_cd` | Field | Optional service code — code identifying the optional service type |
| `pcrs_cd` | Field | Price code — billing classification code for the service line item |
| `pplan_cd` | Field | Price plan code — specific billing plan identifier |
| `oya_kei_skbt_cd` | Field | Parent contract subscriber-type code — identifies the relationship to a master subscription contract (fixed at "01") |
| `kibo_ml_account_1` | Field | Expected/Preferred email account (1st priority) — the customer's desired email address |
| `capa` | Field | Capacity — email box storage capacity for the service |
| `updt_dtm_bf` | Field | Update date/time before — timestamp prior to the current service update |
| `func_code` | Field | Function code — operational discriminator that determines which workflow path to follow |
| `wK_INDEX` | Field | Working key index — internal index into the email info add-confirm list (defaults to 0) |
| CAANMsg | Type | Fujitsu's application message template — a key-value message container used across Service Components |
| EKK0361D010 | SC Code | Optional Service Contract <ISP> Registration — Service Component for registering optional ISP service contracts |
| EKK0021D010 | SC Code | Application Detail Registration — Service Component for registering acknowledgment detail records |
| B01 | Constant | Price code value — identifies Email as the billing service type |
| PB0101 | Constant | Price plan code value — identifies the specific Email billing plan |
| "01" (oya_kei_skbt_cd) | Constant | Parent contract identifier — fixed value indicating the optional service is tied to a main contract |
| "2" (func_code) | Constant | Function code value — when present, indicates a workflow that does not require MSKM_DTL_NO population |
| EKK0361D010CBSMsg | Type | Message model class for EKK0361D010 SC — defines all field names and types for the optional ISP service contract registration |
| EKK0021D010CBSMsg | Type | Message model class for EKK0021D010 SC — defines all field names and types for the application detail registration |
| fillCAANMSGNullMapping | Method | Internal CC method that initializes all fields of a CAANMsg template to null based on a given CBSMsg's content schema |
| getMlad_account | Method | Private helper that reads the current email address from the instance-level `jKKEmailInfoAddCfmCC` map |
| getStrymd | Method | Private helper that assembles the service start date by concatenating year + month + day strings from the instance-level map |
| `JKKEMAILINFOADDCFMCCLIST` | Constant | Hash key `"JKKEmailInfoAddCfmCCList"` — the ArrayList of email info add-confirm data passed in from the caller |
| JKKEmailInfoAddCfmCC | Class | Email Information Add-Confirm CC Class — common component class handling email information addition confirmation logic for the K-Opticom customer base system |
| I/F | Abbreviation | Interface — refers to system interface/API boundaries; "I/F化" means refactoring to expose as an interface |
| SIF | Abbreviation | System Interface Format — the template identification scheme used to route messages to the correct SC |
| CC | Abbreviation | Common Component — a reusable software component layer in the K-Opticom architecture |
| SC | Abbreviation | Service Component — a service layer module that performs business operations against the database |
| ST2 | Abbreviation | Fujitsu development team/branch code (富士通) — used as a ticket prefix in change log entries |
