# Business Logic — JFUAddSvcKeiTvCC.editInEKK0181D010() [292 LOC]

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

## 1. Role

### JFUAddSvcKeiTvCC.editInEKK0181D010()

This method performs the **upper-level mapping** (上りマッピング) for the **Service Detail Registration <eo光TV>** (サービス契約内訳＜TV＞登録) business scenario (EKK0181D010). It takes the screen input data for a single service detail line item — identified by `fixedText` (template ID) and `index` (row number within a list of STB devices) — and transforms it into a structured `CAANMsg` template that will be forwarded to the downstream Service Component (SC) layer for persistence.

The method handles **all service detail line items** for eo光TV service contract registration, including: service contract number, order detail number, pricing code, pricing plan code, delivery scheme contract number, payment method continuation flag, web operation addition impossibility flag, business liaison remarks, service start date, reservation application start date, trial period dates, full registration dates, penalty occurrence codes, migration classification, removal work dates, adult flag, billing contract number, and pricing item code.

It implements a **delegation routing pattern**: for each field, if the value is absent in the immediate input map (`inMap`), it falls back to retrieving the value from a work area map (`getWorkMapValue`), or sets it as null. This two-tier sourcing ensures that field values are resolved from either the current screen row or a shared work-area context. The method does **not** invoke any SC or CBS methods directly — it is a pure mapping/transform layer.

The method is called by **two callers within the same class**: `addTvTrk()` (TV registration entry point for eo光TV) and `getInvokeCBS()` (batch-style CBS preparation). Both callers iterate over a list of STB device rows, calling this method once per row to build a `CAANMsg` array for batch SC invocation.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInEKK0181D010"])
    CREATE_TEMPLATE["Create CAANMsg Template"]

    SET_TEMPLATE_ID["Set TEMPLATE_ID"]
    SET_FUNC_CODE_DEF["Set FUNC_CODE default value"]
    SET_OPERATOR_ID["Get OPERATOR_ID from controlMap"]
    SET_OPE_DATE["Set OPERATE_DATE from controlMap"]
    SET_OPE_TIME["Set OPERATE_DATETIME from controlMap"]

    GET_MAPPING_AREA["Get mappingWorkArea"]
    GET_DATA["Get data by fixedText"]
    EXTRACT_INDEX["Extract list row by index"]

    OVERRIDE_FUNC_CODE["Override FUNC_CODE from inMap"]

    CHECK_SVC_KEI_NO["Check svc_kei_no"]
    GET_SVC_KEI_WORK["getWorkMapValue for svc_kei_no"]
    SET_SVC_KEI_NULL["template.setNull SVC_KEI_NO"]
    SET_SVC_KEI_MAP["template.set SVC_KEI_NO from workMap"]
    SET_SVC_KEI_INMAP["template.set SVC_KEI_NO from inMap"]

    CHECK_MSKM_DTL_NO["Check mskm_dtl_no"]
    GET_MSKM_WORK["getWorkMapValue for mskm_dtl_no"]
    SET_MSKM_NULL["template.setNull MSKM_DTL_NO"]
    SET_MSKM_WORK["template.set MSKM_DTL_NO from workMap"]
    SET_MSKM_INMAP["template.set MSKM_DTL_NO from inMap"]

    CHECK_PCRS_CD["Check pcrs_cd"]
    SET_PCRS_NULL["template.setNull PCRS_CD"]
    SET_PCRS_MAP["template.set PCRS_CD from inMap"]

    CHECK_PPLAN_CD["Check pplan_cd"]
    SET_PPLAN_NULL["template.setNull PPLAN_CD"]
    SET_PPLAN_MAP["template.set PPLAN_CD from inMap"]

    CHECK_OTHER_FIELDS["Map remaining fields"]

    CHECK_UPD_DTM["Check upd_dtm_bf"]
    GET_UPD_DTM["Get upd_dtm from EKK0101D010 data"]
    SET_UPD_DTM_NULL["template.setNull UPD_DTM_BF"]
    SET_UPD_DTM_MAP["template.set UPD_DTM_BF from data"]

    RETURN_TEMPLATE["Return template"]

    START --> CREATE_TEMPLATE
    CREATE_TEMPLATE --> SET_TEMPLATE_ID
    SET_TEMPLATE_ID --> SET_FUNC_CODE_DEF
    SET_FUNC_CODE_DEF --> SET_OPERATOR_ID
    SET_OPERATOR_ID --> SET_OPE_DATE
    SET_OPE_DATE --> SET_OPE_TIME
    SET_OPE_TIME --> GET_MAPPING_AREA
    GET_MAPPING_AREA --> GET_DATA
    GET_DATA --> EXTRACT_INDEX
    EXTRACT_INDEX --> OVERRIDE_FUNC_CODE

    OVERRIDE_FUNC_CODE --> CHECK_SVC_KEI_NO
    CHECK_SVC_KEI_NO --> GET_SVC_KEI_WORK
    GET_SVC_KEI_WORK --> SET_SVC_KEI_NULL
    GET_SVC_KEI_WORK --> SET_SVC_KEI_MAP
    CHECK_SVC_KEI_NO --> SET_SVC_KEI_INMAP

    SET_SVC_KEI_NULL --> CHECK_MSKM_DTL_NO
    SET_SVC_KEI_MAP --> CHECK_MSKM_DTL_NO
    SET_SVC_KEI_INMAP --> CHECK_MSKM_DTL_NO

    CHECK_MSKM_DTL_NO --> GET_MSKM_WORK
    GET_MSKM_WORK --> SET_MSKM_NULL
    GET_MSKM_WORK --> SET_MSKM_WORK
    CHECK_MSKM_DTL_NO --> SET_MSKM_INMAP

    SET_MSKM_NULL --> CHECK_PCRS_CD
    SET_MSKM_WORK --> CHECK_PCRS_CD
    SET_MSKM_INMAP --> CHECK_PCRS_CD

    CHECK_PCRS_CD --> SET_PCRS_NULL
    CHECK_PCRS_CD --> SET_PCRS_MAP
    SET_PCRS_NULL --> CHECK_PPLAN_CD
    SET_PCRS_MAP --> CHECK_PPLAN_CD

    CHECK_PPLAN_CD --> SET_PPLAN_NULL
    CHECK_PPLAN_CD --> SET_PPLAN_MAP
    SET_PPLAN_NULL --> CHECK_OTHER_FIELDS
    SET_PPLAN_MAP --> CHECK_OTHER_FIELDS

    CHECK_OTHER_FIELDS --> CHECK_UPD_DTM
    CHECK_UPD_DTM --> SET_UPD_DTM_NULL
    CHECK_UPD_DTM --> SET_UPD_DTM_MAP
    SET_UPD_DTM_NULL --> RETURN_TEMPLATE
    SET_UPD_DTM_MAP --> RETURN_TEMPLATE
```

**Processing Summary:**

1. **Template Initialization**: Creates a `CAANMsg` template of type `EKK0181D010CBSMsg`, sets the template ID, a hardcoded default `FUNC_CODE = "1"`, and operator/audit metadata (operator ID, operate date, operate date/time) from the control map.

2. **Work Area Extraction**: Retrieves the mapping work area from `param.getMappingWorkArea()` and fetches the raw input data using `param.getData(fixedText)`. Then extracts the specific row by unwrapping: `(ArrayList)inMap.get("EKK0181D010List")` → `.get(index)` → cast to `HashMap<String, Object>`.

3. **Function Code Override**: The default `FUNC_CODE = "1"` set in step 1 is overwritten with the value from `inMap.get(JCMConstants.FUNC_CODE_KEY)`, reflecting the actual business function context.

4. **Field-by-Field Mapping** (lines 845–1078): For each of 20+ service detail fields, the method checks if the value is present in `inMap` (null or empty string triggers fallback). For `svc_kei_no` and `mskm_dtl_no`, a fallback to `getWorkMapValue()` is used — these fields may not exist in the row-level map but can be resolved from a shared work area. Other fields simply go to `template.setNull()` on fallback. This sequential mapping covers all fields defined in `EKK0181D010CBSMsg`.

5. **Audit Timestamp**: Reads the pre-update timestamp (`upd_dtm_bf`) from the parent EKK0101D010 data map for optimistic concurrency or audit tracking purposes (added in v1.01.00, 2012/05/07 for service interoperability support).

6. **Return**: Returns the fully populated `CAANMsg` template for downstream SC processing.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying all screen input data, control map metadata (operator ID, operation date/time), and mapping work area context. It is the primary data carrier between the screen layer and the business logic layer. |
| 2 | `fixedText` | `String` | The template ID / service message identifier used to retrieve input data from the parameter object. In practice this is `"EKK0181D010"` (the template ID for Service Detail Registration <TV>). Used as the key for `param.getData()` and `param.getMappingWorkArea()`. |
| 3 | `index` | `int` | The row index within the list of STB devices for the service detail. The method extracts `(ArrayList)inMap.get("EKK0181D010List").get(index)` to isolate a single STB device's service detail line item. Each STB device has its own set of service detail fields. |

**Instance fields / external state read:**

| Field | Description |
|-------|-------------|
| `CC_WORK_AREA_NAME` | Constant `"JFUAddSvcKeiTvCCWork"` — the work area map name for shared service detail data (used by `getWorkMapValue`). |
| `CC_WORK_AREA_NAME_MSKM` | Constant `"JFUAddMskmSCWork"` — the work area map name for order detail number data (used by `getWorkMapValue` for `mskm_dtl_no`). |
| `CC_WORK_AREA_NAME_SKK` | Constant `"JFUAddSkkSCWork"` — the work area map name for billing contract number data. |
| `TEMPLATE_ID_TV_UTC` | Constant `"EKK0181D010"` — the template ID for service detail <TV> registration. |
| `EKK0101D010CBSMsg` | Referenced for `UPD_DTM` key to read the pre-update timestamp from parent data. |

## 4. CRUD Operations / Called Services

This method performs **pure data mapping** — it does **not** directly invoke any Service Component (SC), CBS, or database layer. All operations are within the local parameter/template object.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `param.getControlMapData(...)` | - | - | Reads operator ID, operate date, operate time from control map metadata |
| - | `param.getMappingWorkArea()` | - | - | Reads the shared work area map for fallback field resolution |
| - | `param.getData(fixedText)` | - | - | Retrieves raw input data HashMap by template ID key |
| - | `getWorkMapValue(...)` (local helper) | - | - | Reads a value from the work area map by key (local method) |
| - | `template.set(...)` | - | - | Sets fields on the CAANMsg output template |
| - | `template.setNull(...)` | - | - | Marks fields as null on the output template |

**Called methods breakdown:**

| Method Called | Description |
|---------------|-------------|
| `template.set(key, value)` | Sets a field value on the `CAANMsg` template (used ~30+ times) |
| `template.setNull(key)` | Sets a field as null on the template (used when input is missing) |
| `param.getControlMapData(key)` | Reads control metadata (operator, date, time) from the parameter |
| `param.getMappingWorkArea()` | Returns the work area Map for fallback data resolution |
| `param.getData(fixedText)` | Gets the HashMap of input data keyed by template ID |
| `getWorkMapValue(param, key, fixText)` | Local helper method that resolves a value from the work area Map |

**Note:** This method is a **pure transformation/mapping layer**. All actual database CRUD operations (Create/Read/Update/Delete) are performed by the downstream SC layer that receives the `CAANMsg` template. The CBS layer `EKK0181D010` (as identified by the CBS message class name) handles the actual persistence to the `KK_T_SVC_KEI_UC` (service detail contract) table and related entities.

## 5. Dependency Trace

### Caller Analysis

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS:JFUAddSvcKeiTvCC.addTvTrk | `addTvTrk()` → iterates over STB list → `editInEKK0181D010(param, "EKK0181D010", i)` | SC: EKK0181D010 [C/U] KK_T_SVC_KEI_UC (Service Detail) |
| 2 | CBS:JFUAddSvcKeiTvCC.getInvokeCBS | `getInvokeCBS()` → builds CAANMsg array → `editInEKK0181D010(param, "EKK0181D010", i)` | SC: EKK0181D010 [C/U] KK_T_SVC_KEI_UC (Service Detail) |

**Full call chain for `addTvTrk()`:**

1. Entry: `addTvTrk(SessionHandle, IRequestParameterReadWrite, String)` — TV registration entry point for eo光TV
2. Checks if TEMPLATE_ID_TV (EKK0101D010) data exists — early return if null
3. Calls `editInEKK0101D010()` for the parent service contract registration
4. Invokes SC via `ServiceComponentRequestInvoker.run()`
5. Calls `editRetEKK0101D010()` for response mapping
6. Iterates over `EKK0181D010List` from input data, calling `editInEKK0181D010(param, "EKK0181D010", i)` for each STB device row
7. Each row is then passed to `scCall.run()` for SC processing
8. `editRetEKK0181D010()` maps SC response back to parameter

**Full call chain for `getInvokeCBS()`:**

1. Entry: `getInvokeCBS(SessionHandle, IRequestParameterReadWrite, String)` — batch-style CBS preparation
2. Checks if TEMPLATE_ID_TV data exists — returns null if not
3. Calls `editInEKK0101D010()` for the parent service contract
4. Iterates over `EKK0181D010List`, calling `editInEKK0181D010(param, "EKK0181D010", i)` for each row
5. Also handles device registration via `editInEKK0341D010()` for STB equipment
6. Packages all CAANMsg templates into an array via `setSCInputCommonData()`

**Terminal operations from this method:**

- `template.set(...)` — 30+ field assignments (no CRUD, pure in-memory mapping)
- `template.setNull(...)` — null assignments for missing fields
- `param.getControlMapData(...)` — reads control metadata (3 calls)
- `param.getMappingWorkArea()` — reads work area (1 call)
- `param.getData(...)` — reads input data (2 calls)
- `getWorkMapValue(...)` — local fallback resolver (3 calls)

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Template Initialization (L805)

> Creates and initializes the CAANMsg output template with header metadata.

| # | Type | Code |
|---|------|------|
| 1 | SET | `CAANMsg template = new CAANMsg(EKK0181D010CBSMsg.class.getName())` // Create CBS message template |
| 2 | SET | `CAANMsg[] templateArray = null` // Unused array variable |
| 3 | SET | `HashMap inMap = null` // Input map placeholder |
| 4 | SET | `ArrayList inList = null` // Unused list variable |
| 5 | SET | `template.set(EKK0181D010CBSMsg.TEMPLATEID, fixedText)` // [TEMPLATE_ID_TV_UTC = "EKK0181D010"] Set template ID |
| 6 | SET | `template.set(EKK0181D010CBSMsg.FUNC_CODE, "1")` // [Default FUNC_CODE = "1"] Set default function code |
| 7 | SET | `Object operatorId = param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` // Get operator ID from control map |
| 8 | SET | `template.set(JCMConstants.OPERATOR_ID_KEY, operatorId)` // Set operator ID on template |
| 9 | SET | `Object operateDate = param.getControlMapData(SCControlMapKeys.OPE_DATE)` // Get operation date from control map |
| 10 | SET | `template.set(JCMConstants.OPERATE_DATE_KEY, operateDate)` // Set operation date on template |
| 11 | SET | `Object operateDateTime = param.getControlMapData(SCControlMapKeys.OPE_TIME)` // Get operation time from control map |
| 12 | SET | `template.set(JCMConstants.OPERATE_DATETIME_KEY, operateDateTime)` // Set operation datetime on template |

**Block 2** — [SET] Work Area and Data Extraction (L822–L833)

> Retrieves the shared work area and extracts the specific row from the input list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Map workMap = (Map)param.getMappingWorkArea()` // Get work area map (keyed by CC_WORK_AREA_NAME = "JFUAddSvcKeiTvCCWork") |
| 2 | SET | `inMap = (HashMap)param.getData(fixedText)` // Get raw input data by template ID |
| 3 | SET | `inMap = (HashMap)((ArrayList)inMap.get("EKK0181D010List")).get(index)` // [v1.00.00 Added] Extract row by index from the STB device list |

**Block 3** — [SET] Function Code Override (L835)

> The default FUNC_CODE "1" is overwritten with the actual function code from the input data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EKK0181D010CBSMsg.FUNC_CODE, inMap.get(JCMConstants.FUNC_CODE_KEY))` // Override FUNC_CODE from inMap |

**Block 4** — [IF-ELSE] Service Contract Number (svc_kei_no) (L838–L856)

> Maps the service contract number. Falls back to work area if not present in the row data. This field uses a unique two-tier fallback: first checks inMap, then falls back to getWorkMapValue with CC_WORK_AREA_NAME.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("svc_kei_no") == null \| "".equals(inMap.get("svc_kei_no"))` // svc_kei_no missing in row data |
| 1.1 | IF | `svc_kei_no == null` // Work area fallback also returns null |
| 1.1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.SVC_KEI_NO)` // Set null on template |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.SVC_KEI_NO, svc_kei_no)` // Set from work area |
| 2 | ELSE | // svc_kei_no present in inMap |
| 2.1 | EXEC | `template.set(EKK0181D010CBSMsg.SVC_KEI_NO, (String)inMap.get("svc_kei_no"))` // Set from inMap |

**Block 5** — [IF-ELSE] Order Detail Number (mskm_dtl_no) (L859–L883)

> Maps the order detail number. Falls back to getWorkMapValue with CC_WORK_AREA_NAME_MSKM ("JFUAddMskmSCWork") using key `ekk0101_mskm_dtl_no`. This is the order detail number from the parent EKK0101 registration.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("mskm_dtl_no") == null \| "".equals(inMap.get("mskm_dtl_no"))` // mskm_dtl_no missing |
| 1.1 | SET | `String mskm_dtl_no = getWorkMapValue(param, "ekk0101_mskm_dtl_no", CC_WORK_AREA_NAME_MSKM)` // [CC_WORK_AREA_NAME_MSKM = "JFUAddMskmSCWork"] |
| 1.2 | IF | `mskm_dtl_no == null` |
| 1.2.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.MSKM_DTL_NO)` // Set null |
| 1.3 | ELSE | |
| 1.3.1 | EXEC | `template.set(EKK0181D010CBSMsg.MSKM_DTL_NO, mskm_dtl_no)` // Set from work area |
| 2 | ELSE | // mskm_dtl_no present in inMap |
| 2.1 | EXEC | `template.set(EKK0181D010CBSMsg.MSKM_DTL_NO, (String)inMap.get("mskm_dtl_no"))` // Set from inMap |

**Block 6** — [IF-ELSE] Pricing Code (pcrs_cd) (L888–L900)

> Maps the pricing code. No work area fallback — directly sets null if missing from inMap. Note: the outer condition checks for an empty string key `""` and `"EKK0181D010Msg1List"` — these appear to be legacy conditions from the v1.00.00 addition, likely no longer triggered.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("") == null \| "".equals(inMap.get("EKK0181D010Msg1List"))` // Outer check (legacy v1.00.00 condition) |
| 1.1 | IF | `inMap == null \|\| inMap.get("pcrs_cd") == null \| "".equals(inMap.get("pcrs_cd"))` // pcrs_cd missing |
| 1.1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.PCRS_CD)` // Set null |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.PCRS_CD, (String)inMap.get("pcrs_cd"))` // Set from inMap |

**Block 7** — [IF-ELSE] Pricing Plan Code (pplan_cd) (L903–L913)

> Maps the pricing plan code. Same null-check pattern — sets null on fallback.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("pplan_cd") == null \| "".equals(inMap.get("pplan_cd"))` // pplan_cd missing |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.PPLAN_CD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.PPLAN_CD, (String)inMap.get("pplan_cd"))` |

**Block 8** — [IF-ELSE] Delivery Scheme Contract Number (tk_hoshiki_kei_no) (L916–L926)

> Maps the delivery scheme (delivery method) contract number.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("tk_hoshiki_kei_no") == null \| "".equals(inMap.get("tk_hoshiki_kei_no"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.TK_HOSHIKI_KEI_NO)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.TK_HOSHIKI_KEI_NO, (String)inMap.get("tk_hoshiki_kei_no"))` |

**Block 9** — [IF-ELSE] Payment Method Continuation Flag (payway_keizoku_flg) (L929–L939)

> Maps whether the payment method continues from a previous contract.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("payway_keizoku_flg") == null \| "".equals(inMap.get("payway_keizoku_flg"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.PAYWAY_KEIZOKU_FLG)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.PAYWAY_KEIZOKU_FLG, (String)inMap.get("payway_keizoku_flg"))` |

**Block 10** — [IF-ELSE] Web Operation Addition Impossibility Flag (web_op_add_fail_flg) (L942–L952)

> Maps whether web-based service addition is impossible for this line item.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("web_op_add_fail_flg") == null \| "".equals(inMap.get("web_op_add_fail_flg"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.WEB_OP_ADD_FAIL_FLG)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.WEB_OP_ADD_FAIL_FLG, (String)inMap.get("web_op_add_fail_flg"))` |

**Block 11** — [IF-ELSE] Business Liaison Remarks (work_rrk_biko) (L955–L965)

> Maps business liaison remarks / additional comments for the service detail.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("work_rrk_biko") == null \| "".equals(inMap.get("work_rrk_biko"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.WORK_RRK_BIKO)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.WORK_RRK_BIKO, (String)inMap.get("work_rrk_biko"))` |

**Block 12** — [IF-ELSE] Service Start Preference Date (svc_use_sta_kibo_ymd) (L968–L978)

> Maps the desired service start date (year/month/day).

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("svc_use_sta_kibo_ymd") == null \| "".equals(inMap.get("svc_use_sta_kibo_ymd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.SVC_USE_STA_KIBO_YMD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.SVC_USE_STA_KIBO_YMD, (String)inMap.get("svc_use_sta_kibo_ymd"))` |

**Block 13** — [IF-ELSE] Reservation Application Start Preference Date (rsv_tsta_kibo_ymd) (L981–L991)

> Maps the desired reservation application start date.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("rsv_tsta_kibo_ymd") == null \| "".equals(inMap.get("rsv_tsta_kibo_ymd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.RSV_TSTA_KIBO_YMD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.RSV_TSTA_KIBO_YMD, (String)inMap.get("rsv_tsta_kibo_ymd"))` |

**Block 14** — [IF-ELSE] Trial Addition Date (ftrial_kanyu_ymd) (L994–L1004)

> Maps the trial service start date (year/month/day).

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("ftrial_kanyu_ymd") == null \| "".equals(inMap.get("ftrial_kanyu_ymd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.FTRIAL_KANYU_YMD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.FTRIAL_KANYU_YMD, (String)inMap.get("ftrial_kanyu_ymd"))` |

**Block 15** — [IF-ELSE] Trial Period End Date (ftrial_prd_endymd) (L1007–L1017)

> Maps the trial service period end date.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("ftrial_prd_endymd") == null \| "".equals(inMap.get("ftrial_prd_endymd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.FTRIAL_PRD_ENDYMD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.FTRIAL_PRD_ENDYMD, (String)inMap.get("ftrial_prd_endymd"))` |

**Block 16** — [IF-ELSE] Full Registration Date (honkanyu_ymd) (L1020–L1030)

> Maps the full (permanent) service registration date.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("honkanyu_ymd") == null \| "".equals(inMap.get("honkanyu_ymd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.HONKANYU_YMD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.HONKANYU_YMD, (String)inMap.get("honkanyu_ymd"))` |

**Block 17** — [IF-ELSE] Full Registration Migration Deadline (honkanyu_iko_kigen_ymd) (L1033–L1043)

> Maps the deadline for migration from trial to full registration.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("honkanyu_iko_kigen_ymd") == null \| "".equals(inMap.get("honkanyu_iko_kigen_ymd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.HONKANYU_IKO_KIGEN_YMD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.HONKANYU_IKO_KIGEN_YMD, (String)inMap.get("honkanyu_iko_kigen_ymd"))` |

**Block 18** — [IF-ELSE] Penalty Occurrence Code (pnlty_hassei_cd) (L1046–L1056)

> Maps the contract penalty occurrence code.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("pnlty_hassei_cd") == null \| "".equals(inMap.get("pnlty_hassei_cd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.PNLTY_HASSEI_CD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.PNLTY_HASSEI_CD, (String)inMap.get("pnlty_hassei_cd"))` |

**Block 19** — [IF-ELSE] Migration Classification (ido_div) (L1059–L1069)

> Maps the migration type classification (e.g., new subscription, transfer, etc.).

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("ido_div") == null \| "".equals(inMap.get("ido_div"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.IDO_DIV)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.IDO_DIV, (String)inMap.get("ido_div"))` |

**Block 20** — [IF-ELSE] Removal Work Preference Date (tekkyo_koji_kibo_ymd) (L1072–L1082)

> Maps the desired removal/disconnect work date.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("tekkyo_koji_kibo_ymd") == null \| "".equals(inMap.get("tekkyo_koji_kibo_ymd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.TEKKYO_KOJI_KIBO_YMD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.TEKKYO_KOJI_KIBO_YMD, (String)inMap.get("tekkyo_koji_kibo_ymd"))` |

**Block 21** — [IF-ELSE] Adult Flag (adult_flg) (L1085–L1095)

> Maps whether this is an adult-contracted service.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("adult_flg") == null \| "".equals(inMap.get("adult_flg"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.ADULT_FLG)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.ADULT_FLG, (String)inMap.get("adult_flg"))` |

**Block 22** — [IF-ELSE] Billing Contract Number (seiky_kei_no) (L1100–L1122)

> Maps the billing contract number. Like svc_kei_no, uses a unique two-tier fallback: first checks inMap, then falls back to getWorkMapValue with CC_WORK_AREA_NAME_SKK ("JFUAddSkkSCWork").

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("seiky_kei_no") == null \| "".equals(inMap.get("seiky_kei_no"))` |
| 1.1 | SET | `String seiky_kei_no = getWorkMapValue(param, "seiky_kei_no", CC_WORK_AREA_NAME_SKK)` // [CC_WORK_AREA_NAME_SKK = "JFUAddSkkSCWork"] |
| 1.2 | IF | `seiky_kei_no == null` |
| 1.2.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.SEIKY_KEI_NO)` |
| 1.3 | ELSE | |
| 1.3.1 | EXEC | `template.set(EKK0181D010CBSMsg.SEIKY_KEI_NO, seiky_kei_no)` |
| 2 | ELSE | |
| 2.1 | EXEC | `template.set(EKK0181D010CBSMsg.SEIKY_KEI_NO, (String)inMap.get("seiky_kei_no"))` |

**Block 23** — [IF-ELSE] Pricing Item Code (prc_kmk_cd) (L1127–L1137)

> Maps the pricing item code.

| # | Type | Code |
|---|------|------|
| 1 | IF | `inMap == null \|\| inMap.get("prc_kmk_cd") == null \| "".equals(inMap.get("prc_kmk_cd"))` |
| 1.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.PRC_KMK_CD)` |
| 1.2 | ELSE | |
| 1.2.1 | EXEC | `template.set(EKK0181D010CBSMsg.PRC_KMK_CD, (String)inMap.get("prc_kmk_cd"))` |

**Block 24** — [IF-ELSE] Update Timestamp (Pre-Update) (upd_dtm_bf) (L1140–L1153)

> [v1.01.00 Added] Maps the pre-update timestamp for optimistic concurrency control. Read from the parent EKK0101D010 data map, not from the current inMap. This supports service interoperability (サービスインターフェース取込対応) as noted in the 2012/05/07 comment by h.iwamoto.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String upd_dtm_bf = (String)((HashMap)(param.getData("EKK0101D010"))).get(EKK0101D010CBSMsg.UPD_DTM)` // Read pre-update timestamp from parent EKK0101D010 data |
| 2 | IF | `upd_dtm_bf == null` |
| 2.1 | EXEC | `template.setNull(EKK0181D010CBSMsg.UPD_DTM_BF)` |
| 3 | ELSE | |
| 3.1 | EXEC | `template.set(EKK0181D010CBSMsg.UPD_DTM_BF, upd_dtm_bf)` |

**Block 25** — [RETURN] Final Return (L1156)

> Returns the fully constructed CAANMsg template.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return template` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the unique identifier for a service contract line item |
| `svc_kei_ucwk_no` | Field | Service detail contract number — internal tracking ID for a service contract detail record |
| `svc_kei_ucwk_stat` | Field | Service detail contract status — current processing state of the detail record |
| `mskm_dtl_no` | Field | Order detail number — links to the parent order detail from the original application |
| `ekk0101_mskm_dtl_no` | Field | EKK0101 order detail number — the order detail number from the parent service contract registration (EKK0101D010) |
| `pcrs_cd` | Field | Pricing code — identifies the pricing structure (e.g., monthly fee tier) for this service line |
| `pplan_cd` | Field | Pricing plan code — identifies the specific pricing plan option |
| `tk_hoshiki_kei_no` | Field | Delivery scheme contract number — the contract number for the delivery/installation method |
| `payway_keizoku_flg` | Field | Payment method continuation flag — indicates whether to continue the previous contract's payment method |
| `web_op_add_fail_flg` | Field | Web operation addition impossibility flag — indicates whether web-based service addition is blocked |
| `work_rrk_biko` | Field | Business liaison remarks — free-text operational notes for the service detail |
| `svc_use_sta_kibo_ymd` | Field | Service start preference date (YM/D) — the customer's desired service start date |
| `rsv_tsta_kibo_ymd` | Field | Reservation application start preference date — desired date for reservation application to begin |
| `ftrial_kanyu_ymd` | Field | Trial addition date (YM/D) — the start date of the trial service period |
| `ftrial_prd_endymd` | Field | Trial period end date (YM/D) — the end date of the trial service period |
| `honkanyu_ymd` | Field | Full registration date (YM/D) — the date of permanent (non-trial) service activation |
| `honkanyu_iko_kigen_ymd` | Field | Full registration migration deadline (YM/D) — deadline to migrate from trial to full registration |
| `pnlty_hassei_cd` | Field | Penalty occurrence code — identifies contract penalty conditions |
| `ido_div` | Field | Migration classification — the type of migration (new, transfer from another provider, etc.) |
| `tekkyo_koji_kibo_ymd` | Field | Removal work preference date (YM/D) — the customer's desired service disconnection date |
| `adult_flg` | Field | Adult flag — indicates whether this is an adult-contracted service (age verification required) |
| `seiky_kei_no` | Field | Billing contract number — the contract number associated with the billing account |
| `prc_kmk_cd` | Field | Pricing item code — identifies a specific pricing item within the pricing structure |
| `upd_dtm_bf` | Field | Update datetime (pre-update) — the timestamp before the current update, used for optimistic concurrency control |
| `kk0161_gene_add_dtm` | Field | Generation registration datetime (service detail) — system-generated timestamp for the detail record |
| `kk0181_gene_add_dtm` | Field | Generation registration datetime (service detail <eo光TV>) — system timestamp for eo光TV detail records |
| `kakins_no` | Field | Billing priority number — determines billing charge order |
| `kakins_tstaymd` | Field | Billing priority application start date |
| `kakins_tendymd` | Field | Billing priority application end date |
| `mk_flg` | Field | Invalid flag — indicates whether the record is invalidated |
| `EKK0181D010` | Screen/Scenario ID | Service Detail Registration <eo光TV> — the business scenario for registering service contract detail lines for eo光TV |
| `EKK0101D010` | Screen/Scenario ID | Service Contract Registration <TV> — the parent scenario for TV service contract registration |
| `TEMPLATE_ID_TV` | Constant | `"EKK0101D010"` — template ID for service contract <TV> registration mapping |
| `TEMPLATE_ID_TV_UTC` | Constant | `"EKK0181D010"` — template ID for service detail <TV> registration mapping |
| `TEMPLATE_ID_KK` | Constant | `"EKK0341D010Tv"` — template ID for equipment-provided service contract registration mapping |
| `CC_WORK_AREA_NAME` | Constant | `"JFUAddSvcKeiTvCCWork"` — work area map name for service detail data |
| `CC_WORK_AREA_NAME_MSKM` | Constant | `"JFUAddMskmSCWork"` — work area map name for order detail number data |
| `CC_WORK_AREA_NAME_SKK` | Constant | `"JFUAddSkkSCWork"` — work area map name for billing contract data |
| eo光 (eo光) | Business term | eo Hikari — K-Opticom's fiber-optic internet/TV broadband service brand |
| eo光TV | Business term | eo Hikari TV — K-Opticom's fiber-optic television service bundled with internet |
| STB | Acronym | Set-Top Box — the hardware device for receiving and decoding TV signals |
| CAANMsg | Technical | Custom message wrapper class for structured data transfer between layers |
| SC | Acronym | Service Component — the mid-tier business logic component that handles database operations |
| CBS | Acronym | Call-Based Service — the backend service layer invoked by SCs for data persistence |
| FUNC_CODE | Field | Function code — identifies the business function context (e.g., new registration = "1") |
| UPD_DTM | Field | Update datetime — system timestamp tracking when a record was last modified |
| BCAS | Acronym | Broadcast Content Access System — Japanese conditional access system for satellite/cable TV |
| B-CAS不要 | Business term | B-CAS unnecessary — STB devices that do not require B-CAS card registration (e.g., HDD capacity code variants) |
| KK_T_SVC_KEI_UC | DB Table | Service detail contract table — stores service contract detail line items (inferred from scenario naming) |
| `JFUAddSvcKeiTvCC` | Class | eo光TV registration component — the common component class handling all mapping for eo光TV service registration |
| `getWorkMapValue` | Method | Work area value resolver — helper method that retrieves values from the shared work area map with null/empty-string normalization |
| `setSCInputCommonData` | Method | Sets common SC input data — populates shared fields (operator, date, sysid) on the SC input parameter map |
| `ServiceComponentRequestInvoker` | Class | SC invocation orchestrator — the framework class that invokes Service Components with prepared parameters |
