# Business Logic — JFUAddSvcKeiTvCC.editRetEKK0181D010() [293 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.editRetEKK0181D010()

This method performs the **downstream mapping (result-to-parameter mapping)** for the Service Contract Breakdown <TV> Registration process in the K-Opticom "eo Light TV" (eo光テレビ) customer registration system. After the underlying Service Component (SC) `EKK0181D010CBS` executes the database insert for a service contract breakdown record, this method reads the SC's return message (`CAANMsg`) and maps each field — such as the service detail work number, generation timestamps, registration operator, contract status, reservation details, and penalty codes — into the application's working data structures (`childMap`, `svcKeiListMap`, `workDataMap`) so that the calling screen (`KKSV0004` via `addTvTrk`) can display confirmation data or proceed to subsequent operations.

It implements the **template-based data transformation** design pattern: using a `CAANMsg` template (built from the CBS message class `EKK0181D010CBSMsg`) as a field-definition schema, the method iterates over each field, checking nullability with `isNull()` and extracting values with `getString()`, writing them into structured maps. It also handles a secondary data flow for the discount service auto-application feature (added in v1.00.00 / 2012-04-24), where it constructs a `svcKeiListMap` with the target contract classification code (`03`), contract status (`010` = processing complete), pricing code, and pricing plan code — then injects this into the auto-application work area. Finally, it delegates to `editErrInfoEKK0181D010` to extract any error fields returned by the SC and aggregates them into the control map error list via `TemplateErrorUtil.getErrorInfo`.

This method serves as a **shared utility component** (common component) that participates in a multi-step registration pipeline. It is called by `JFUAddSvcKeiTvCC.addTvTrk()` in a loop — one invocation per STB device index — and sits between the SC execution (`scCall.run()`) and the screen's confirmation display.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editRetEKK0181D010 start"])
    START --> GET_PARAMS["Get templates, returnCode, workMap from param/msgList"]

    GET_PARAMS --> INIT_WORKMAP["Initialize workDataMap if null"]

    INIT_WORKMAP --> INIT_DATAMAP["Get/create dataMap from param.getData(fixedText)"]

    INIT_DATAMAP --> INIT_DATALIST["Get/create dataList from dataMap.get(EKK0181D010List)"]

    INIT_DATALIST --> INIT_CHILDMAP["Get/create childMap at index from dataList"]

    INIT_CHILDMAP --> LOAD_CONTEXT["Load TV map, work areas, auto-apply map"]

    LOAD_CONTEXT --> COND_SVCKEI["SVC_KEI_UCWK_NO is null?"]

    COND_SVCKEI -- Yes --> SET_SVC_EMPTY["childMap.put(svc_kei_ucwk_no, empty)"]
    COND_SVCKEI -- No --> SET_SVC_VALUE["childMap.put(svc_kei_ucwk_no, template value)"]

    SET_SVC_EMPTY --> COND_GENEADD["KK0161_GENE_ADD_DTM is null?"]
    SET_SVC_VALUE --> COND_GENEADD

    COND_GENEADD -- Yes --> SET_GENE_EMPTY["childMap.put(kk0161_gene_add_dtm, empty)"]
    COND_GENEADD -- No --> SET_GENE_VALUE["childMap.put(kk0161_gene_add_dtm, template value)"]

    SET_GENE_EMPTY --> COND_STAT["SVC_KEI_UCWK_STAT is null?"]
    SET_GENE_VALUE --> COND_STAT

    COND_STAT -- Yes --> SET_STAT_EMPTY["childMap.put(svc_kei_ucwk_stat, empty)"]
    COND_STAT -- No --> SET_STAT_VALUE["childMap.put(svc_kei_ucwk_stat, template value)"]

    SET_STAT_EMPTY --> COND_RSVYMD["RSV_APLY_YMD is null?"]
    SET_STAT_VALUE --> COND_RSVYMD

    COND_RSVYMD -- Yes --> SET_RSVYMD_EMPTY["childMap.put(rsv_aply_ymd, empty)"]
    COND_RSVYMD -- No --> SET_RSVYMD_VALUE["childMap.put(rsv_aply_ymd, template value)"]

    SET_RSVYMD_EMPTY --> COND_RSVCD["RSV_APLY_CD is null?"]
    SET_RSVYMD_VALUE --> COND_RSVCD

    COND_RSVCD -- Yes --> SET_RSVCD_EMPTY["childMap.put(rsv_aply_cd, empty)"]
    COND_RSVCD -- No --> SET_RSVCD_VALUE["childMap.put(rsv_aply_cd, template value)"]

    SET_RSVCD_EMPTY --> COND_PNLTY["PNLTY_HASSEI_CD is null?"]
    SET_RSVCD_VALUE --> COND_PNLTY

    COND_PNLTY -- Yes --> SET_PNLTY_EMPTY["childMap.put(pnlty_hassei_cd, empty)"]
    COND_PNLTY -- No --> SET_PNLTY_VALUE["childMap.put(pnlty_hassei_cd, template value)"]

    SET_PNLTY_EMPTY --> COND_IDO["IDO_DIV is null?"]
    SET_PNLTY_VALUE --> COND_IDO

    COND_IDO -- Yes --> SET_IDO_EMPTY["childMap.put(ido_div, empty)"]
    COND_IDO -- No --> SET_IDO_VALUE["childMap.put(ido_div, template value)"]

    SET_IDO_EMPTY --> COND_GENEADD2["KK0181_GENE_ADD_DTM is null?"]
    SET_IDO_VALUE --> COND_GENEADD2

    COND_GENEADD2 -- Yes --> SET_GENEADD2_EMPTY["childMap.put(gene_add_dtm, empty)"]
    COND_GENEADD2 -- No --> SET_GENEADD2_VALUE["childMap.put(gene_add_dtm, template value)"]

    SET_GENEADD2_EMPTY --> COND_ADDDTM["ADD_DTM is null?"]
    SET_GENEADD2_VALUE --> COND_ADDDTM

    COND_ADDDTM -- Yes --> SET_ADDDTM_EMPTY["childMap.put(add_dtm, empty)"]
    COND_ADDDTM -- No --> SET_ADDDTM_VALUE["childMap.put(add_dtm, template value)"]

    SET_ADDDTM_EMPTY --> COND_ADDOP["ADD_OPEACNT is null?"]
    SET_ADDDTM_VALUE --> COND_ADDOP

    COND_ADDOP -- Yes --> SET_ADDOP_EMPTY["childMap.put(add_opeacnt, empty)"]
    COND_ADDOP -- No --> SET_ADDOP_VALUE["childMap.put(add_opeacnt, template value)"]

    SET_ADDOP_EMPTY --> COND_UPDDTM["UPD_DTM is null?"]
    SET_ADDOP_VALUE --> COND_UPDDTM

    COND_UPDDTM -- Yes --> SET_UPDDTM_EMPTY["childMap.put(upd_dtm, empty)"]
    COND_UPDDTM -- No --> SET_UPDDTM_VALUE["childMap.put(upd_dtm, template value)"]

    SET_UPDDTM_EMPTY --> COND_UPDOP["UPD_OPEACNT is null?"]
    SET_UPDDTM_VALUE --> COND_UPDOP

    COND_UPDOP -- Yes --> SET_UPDOP_EMPTY["childMap.put(upd_opeacnt, empty)"]
    COND_UPDOP -- No --> SET_UPDOP_VALUE["childMap.put(upd_opeacnt, template value)"]

    SET_UPDOP_EMPTY --> COND_MKFLG["MK_FLG is null?"]
    SET_UPDOP_VALUE --> COND_MKFLG

    COND_MKFLG -- Yes --> SET_MKFLG_EMPTY["childMap.put(mk_flg, empty)"]
    COND_MKFLG -- No --> SET_MKFLG_VALUE["childMap.put(mk_flg, template value)"]

    SET_MKFLG_EMPTY --> LOAD_SVCGRP["Load svcKeiGrpList from auto-apply map"]

    LOAD_SVCGRP --> GET_SVCGRP_MAP["svcKeiGrpListMap = svcKeiGrpList.get(0)"]

    GET_SVCGRP_MAP --> CHECK_SVC_LIST["svcKeiGrpListMap.containsKey(SVC_KEI_LIST)?"]

    CHECK_SVC_LIST -- Yes --> EXTRACT_SVC_LIST["svcKeiList = svcKeiGrpListMap.get(SVC_KEI_LIST)"]
    CHECK_SVC_LIST -- No --> KEEP_EMPTY_LIST["svcKeiList remains new ArrayList"]

    EXTRACT_SVC_LIST --> INIT_SYSID["sysId = ''"]
    KEEP_EMPTY_LIST --> INIT_SYSID

    INIT_SYSID --> CHECK_SYSID["wriSvcAutoAplyMap.containsKey(sysid)?"]

    CHECK_SYSID -- Yes --> SET_SYSID["sysId = wriSvcAutoAplyMap.get(sysid)"]
    CHECK_SYSID -- No --> SET_SYSID_EMPTY["sysId remains ''"]

    SET_SYSID --> CHECK_SYSID_EMPTY["sysId equals ''?"]
    SET_SYSID_EMPTY --> CHECK_SYSID_EMPTY

    CHECK_SYSID_EMPTY -- Yes --> COPY_SYSID["wriSvcAutoAplyMap.put(sysid, addKeishaServiceCCWorkMap.get(sysid))"]
    CHECK_SYSID_EMPTY -- No --> CHECK_MSKM["Check mskm_no"]

    COPY_SYSID --> CHECK_MSKM

    CHECK_MSKM -- Yes --> SET_MSKM["mskmNo = wriSvcAutoAplyMap.get(mskm_no)"]
    CHECK_MSKM -- No --> SET_MSKM_EMPTY["mskmNo remains ''"]

    SET_MSKM --> CHECK_MSKM_EMPTY["mskmNo equals ''?"]
    SET_MSKM_EMPTY --> CHECK_MSKM_EMPTY

    CHECK_MSKM_EMPTY -- Yes --> COPY_MSKM["wriSvcAutoAplyMap.put(mskm_no, addMskmSCWork.get(mskm_no))"]
    CHECK_MSKM_EMPTY -- No --> BUILD_SVC_MAP

    COPY_MSKM --> BUILD_SVC_MAP

    BUILD_SVC_MAP --> SET_TG_SKBT["svcKeiListMap.put(tg_kei_skbt_cd, 03)"]

    SET_TG_SKBT --> SET_SVC_STAT["svcKeiListMap.put(svc_kei_ucwk_stat, 010)"]

    SET_SVC_STAT --> SET_PCRS["svcKeiListMap.put(pcrs_cd, tvMap.get(pcrs_cd))"]

    SET_PCRS --> SET_PPLAN["svcKeiListMap.put(pplan_cd, tvMap.get(pplan_cd))"]

    SET_PPLAN --> ADD_TO_LIST["svcKeiList.add(svcKeiListMap)"]

    ADD_TO_LIST --> CHECK_GRP_HAS_LIST["svcKeiGrpListMap.containsKey(SVC_KEI_LIST)?"]

    CHECK_GRP_HAS_LIST -- No --> ADD_LIST_TO_GRP["svcKeiGrpListMap.put(SVC_KEI_LIST, svcKeiList)"]
    CHECK_GRP_HAS_LIST -- Yes --> SKIP_ADD

    ADD_LIST_TO_GRP --> CALL_ERRINFO
    SKIP_ADD --> CALL_ERRINFO

    CALL_ERRINFO["editErrInfoEKK0181D010(param, template, returnCode, fixedText, index)"] --> GET_ERRLIST["Get control map error list"]

    GET_ERRLIST --> SET_ERRINFO["param.setControlMapData(ERROR_INFO, TemplateErrorUtil.getErrorInfo(...))"]

    SET_ERRINFO --> RETURN_PARAM["Return param"]
    RETURN_PARAM --> END_NODE(["Return / Next"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `msgList` | `Map<?, ?>` | The SC return message map containing the CAANMsg template array (`TEMPLATE_LIST_KEY`) and the integer return code (`RET_CD_INT_KEY`). This carries the raw result from the `EKK0181D010CBS` Service Component — the database insert result for a single service contract breakdown record. |
| 2 | `param` | `IRequestParameterReadWrite` | The request/response parameter object that holds all working data maps, control map data, and mapping work areas. It is the central data bus through which the method reads context (TV map, work areas, auto-apply map) and writes mapped results (childMap, error info). Modified in-place and returned. |
| 3 | `fixedText` | `String` | The template identifier key (value: `"EKK0181D010"`) used to retrieve the data map from `param.getData()`. It identifies which registration flow's data area to populate — specifically the Service Contract Breakdown <TV> Registration. |
| 4 | `index` | `int` | The STB (Set-Top Box) device index within a multi-device registration. The method uses this to select the correct child entry in `dataList` (which holds per-device breakdown data), and also to key per-device entries in `workDataMap` (e.g., `"svc_kei_ucwk_no_" + index`). |

**Instance fields / external state read:**

| Field | Source Class | Business Description |
|-------|-------------|---------------------|
| `CC_WORK_AREA_NAME` | `JFUAddSvcKeiTvCC` (private static) | Work area map name `"JFUAddSvcKeiTvCCWork"` — stores per-item breakdown data keyed by index. |
| `CC_WORK_AREA_NAME_KEISHA` | `JFUAddSvcKeiTvCC` (private static) | Contractor work area name `"JFUAddKeishaServiceCCWork"` — holds system ID for discount auto-application. |
| `CC_WORK_AREA_NAME_MSKM` | `JFUAddSvcKeiTvCC` (private static) | Order detail work area name `"JFUAddMskmSCWork"` — holds order number for discount auto-application. |
| `CC_WRI_SVC_AUTO_APLY_MAP` | `JFUAddSvcKeiTvCC` (private static) | Discount service auto-application map name `"JKKWrisvcAutoAplyCCMap"`. |
| `SVC_KEI_GRP_LIST` | `JFUAddSvcKeiTvCC` (private static) | Key `"svc_kei_grp_list"` for service contract group list within the auto-apply map. |
| `SVC_KEI_LIST` | `JFUAddSvcKeiTvCC` (private static) | Key `"svc_kei_list"` for service contract list within the group map. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JACBatCommon.isNull` | EKK0181D010CBS | - | Calls `isNull` in `JACBatCommon` for null-checking utility |
| R | `JACbatRknBusinessUtil.isNull` | EKK0181D010CBS | - | Calls `isNull` in `JACbatRknBusinessUtil` for null-checking utility |
| R | `JCHbatSeikyKaknoBusinessUtil.isNull` | EKK0181D010CBS | - | Calls `isNull` in `JCHbatSeikyKaknoBusinessUtil` for null-checking utility |
| R | `JBSbatACECBuyIfTrkm.getErrorInfo` | - | - | Calls `getErrorInfo` in `JBSbatACECBuyIfTrkm` (read via pre-computed graph) |
| R | `JBSbatACInsentetivePrcInfoSaksei.isNull` | - | - | Calls `isNull` in `JBSbatACInsentetivePrcInfoSaksei` |
| R | `JBSbatACKojiChrgInfoTrkm.getErrorInfo` | - | - | Calls `getErrorInfo` in `JBSbatACKojiChrgInfoTrkm` |
| R | `JBSbatAKCHSeikyYsoInfMake.isNull` | - | - | Calls `isNull` in `JBSbatAKCHSeikyYsoInfMake` |
| R | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | - | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiawsday` |
| R | `JBSbatAKKshkmRsltInfoTukiaws.setData` | - | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiaws` |
| R | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | - | - | Calls `setData` in `JBSbatAKKshkmRsltInfoTukiawsRealSkh` |
| R | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | - | - | Calls `setData` in `JBSbatAKKshkmRsltInfTkCvsNCnsl` |
| R | `JBSbatDKNyukaFinAdd.getData` | - | - | Calls `getData` in `JBSbatDKNyukaFinAdd` |
| R | `JBSbatFUCaseFileRnkData.getString` | - | - | Calls `getString` in `JBSbatFUCaseFileRnkData` |
| R | `JBSbatFUMoveNaviData.getString` | - | - | Calls `getString` in `JBSbatFUMoveNaviData` |
| R | `JBSbatKKGetCTITelno.setData` | - | - | Calls `setData` in `JBSbatKKGetCTITelno` |
| R | `JBSbatZMAdDataSet.getString` | - | - | Calls `getString` in `JBSbatZMAdDataSet` |
| U | `JFUAddSvcKeiTvCC.editErrInfoEKK0181D010` | EKK0181D010CBS | - | Calls `editErrInfoEKK0181D010` to extract and set error fields from SC result |
| R | `JFUeoTelOpTransferCC.getData` | - | - | Calls `getData` in `JFUeoTelOpTransferCC` |
| R | `JFUTransferCC.getData` | - | - | Calls `getData` in `JFUTransferCC` |
| R | `JFUTransferListToListCC.getData` | - | - | Calls `getData` in `JFUTransferListToListCC` |
| R | `JESC0101B010TPMA.getString` | - | - | Calls `getString` in `JESC0101B010TPMA` |
| R | `JESC0101B020TPMA.getString` | - | - | Calls `getString` in `JESC0101B020TPMA` |
| R | `KKW12701SFLogic.getData` | - | - | Calls `getData` in `KKW12701SFLogic` |
| R | `ApiBpInterface.getErrorInfo` | - | - | Calls `getErrorInfo` in `ApiBpInterface` (read via pre-computed graph) |
| - | `TemplateErrorUtil.getErrorInfo` | EKK0181D010CBS | - | Static utility call to format error info list from msgList and errList |
| - | `param.getData(fixedText)` | EKK0181D010CBS | - | Reads the data map for template `EKK0181D010` from param |
| - | `param.setData(fixedText, dataMap)` | EKK0181D010CBS | - | Writes/updates the data map for template `EKK0181D010` |
| - | `param.getMappingWorkArea()` | EKK0181D010CBS | - | Reads the working area mapping from param |
| - | `param.setMappingWorkArea(workMap)` | EKK0181D010CBS | - | Writes the working area mapping |
| - | `param.setControlMapData(ERROR_INFO, ...)` | EKK0181D010CBS | - | Sets the aggregated error info list into the control map |
| - | `param.getControlMapData(ERROR_INFO)` | EKK0181D010CBS | - | Retrieves the control map error info list |

**CRUD classification explanation:**
- This method is primarily a **mapping/transformation** method — it does not directly invoke DB-level CRUD operations. Instead, it reads from the SC return message (`CAANMsg`) and writes mapped values into in-memory data structures.
- The underlying SC `EKK0181D010CBS` was already called by the caller (`addTvTrk`) via `ServiceComponentRequestInvoker` and performs the actual **Create** (INSERT) against the `KK_T_SVC_KEI_IS` table. This method handles the **Read** (R) of the return data.
- `editErrInfoEKK0181D010` is classified as **Update** (U) because it populates error info fields into the working map.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Caller: JFUAddSvcKeiTvCC.addTvTrk | `addTvTrk(handle, param, fixedText)` → `editInEKK0181D010(param, TEMPLATE_ID_TV_UTC, i)` → `scCall.run(...)` → `editRetEKK0181D010(result, param, TEMPLATE_ID_TV_UTC, i)` | `editErrInfoEKK0181D010 [U]`, `getErrorInfo [R]`, `getString [R]`, `isNull [-]`, `setControlMapData [U]`, `getErrorInfo [R] (TemplateErrorUtil)` |

**Notes:**
- `addTvTrk()` is the sole direct caller. It is called from screen `KKSV0004` (eo Light TV Registration) during the device registration flow.
- The method executes in a loop (one iteration per STB device), called after each `scCall.run()` for the `EKK0181D010CBS` SC.
- Terminal operations reachable from this method include: `editErrInfoEKK0181D010` (which further reads error fields from the SC template via `template.getString()`), `TemplateErrorUtil.getErrorInfo()` (which reads from the msgList), and various null-checking utilities used internally.

## 6. Per-Branch Detail Blocks

**Block 1** — INITIALIZATION (L2573)

> Sets up the foundational data structures: retrieves templates and return code from msgList, then initializes the work area map and data map.

| # | Type | Code |
|---|------|------|
| 1 | GET | `templates = (CAANMsg[])msgList.get(JCMConstants.TEMPLATE_LIST_KEY)` // Retrieve CAANMsg template array from msgList |
| 2 | GET | `template = templates[0]` // Take the first template (EKK0181D010CBS return) |
| 3 | GET | `returnCode = msgList.get(JCMConstants.RET_CD_INT_KEY)` // Retrieve integer return code from SC |
| 4 | CALL | `workMap = param.getMappingWorkArea()` // Get the work area mapping |
| 5 | IF | `workMap == null` → create new HashMap and set [L2583] |
| 6 | GET | `workDataMap = (HashMap)workMap.get(CC_WORK_AREA_NAME)` // CC_WORK_AREA_NAME = "JFUAddSvcKeiTvCCWork" [L2591] |
| 7 | IF | `workDataMap == null` → create new HashMap, put into workMap [L2592-2594] |

**Block 2** — DATA MAP SETUP (L2599-2612)

> Retrieves or creates the data map for this template, then gets/creates the dataList and childMap at the given index.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `dataMap = (HashMap)param.getData(fixedText)` // fixedText = "EKK0181D010" |
| 2 | IF | `dataMap == null` → create new HashMap, set via `param.setData(fixedText, dataMap)` [L2601-2603] |
| 3 | GET | `dataList = (ArrayList)dataMap.get("EKK0181D010List")` |
| 4 | IF | `dataList == null` → create new ArrayList, put into dataMap [L2607-2609] |
| 5 | GET | `childMap = (HashMap)dataList.get(index)` // Get child map at device index |
| 6 | IF | `childMap == null` → create new HashMap, add to dataList at index [L2610-2612] |

**Block 3** — LOAD CONTEXT FOR AUTO-APPLICATION (L2617-2635)

> Loads additional context: the TV map (`EKK0101D010`), contractor work area, order detail work area, and the discount service auto-application map. Also initializes empty list structures for building the service contract list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysId = ""` // Initialize system ID for discount auto-application |
| 2 | SET | `mskmNo = ""` // Initialize order number for discount auto-application |
| 3 | CALL | `tvMap = (HashMap)param.getData("EKK0101D010")` // Load TV service contract data |
| 4 | CALL | `addKeishaServiceCCWorkMap = (HashMap)workMap.get(CC_WORK_AREA_NAME_KEISHA)` // CC_WORK_AREA_NAME_KEISHA = "JFUAddKeishaServiceCCWork" |
| 5 | CALL | `addMskmSCWork = (HashMap)workMap.get(CC_WORK_AREA_NAME_MSKM)` // CC_WORK_AREA_NAME_MSKM = "JFUAddMskmSCWork" |
| 6 | CALL | `wriSvcAutoAplyMap = (HashMap)param.getData(CC_WRI_SVC_AUTO_APLY_MAP)` // CC_WRI_SVC_AUTO_APLY_MAP = "JKKWrisvcAutoAplyCCMap" |
| 7 | SET | `svcKeiGrpListMap = new HashMap()` // Initialize service contract group list map |
| 8 | SET | `svcKeiGrpList = new HashMap()` // Service contract group list |
| 9 | GET | `svcKeiGrpList = (ArrayList)wriSvcAutoAplyMap.get(SVC_KEI_GRP_LIST)` // SVC_KEI_GRP_LIST = "svc_kei_grp_list" |
| 10 | SET | `svcKeiListMap = new HashMap()` // Initialize service contract list map |
| 11 | SET | `svcKeiList = new ArrayList()` // Initialize service contract list |

**Block 4** — MAP SERVICE CONTRACT BREAKDOWN FIELDS (L2639-2758)

> Iterates over each field of the SC return message, checking nullability and writing values into childMap. This is the primary data mapping section. Each field follows the same pattern: `isNull()` check → write empty string or template value.

**Block 4.1** — svc_kei_ucwk_no (Service Detail Work Number) (L2640-2655)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.SVC_KEI_UCWK_NO)` [L2640] |
| 2 | SET | `childMap.put("svc_kei_ucwk_no", "")` // Empty string if null |
| 3 | SET | `svcKeiListMap.put("svc_kei_ucwk_no", "")` // Also for auto-application map [L2643] |
| 4 | ELSE | |
| 5 | SET | `childMap.put("svc_kei_ucwk_no", template.getString(EKK0181D010CBSMsg.SVC_KEI_UCWK_NO))` |
| 6 | SET | `workDataMap.put("svc_kei_ucwk_no_" + index, template value)` // Per-device key [L2647] |
| 7 | SET | `svcKeiListMap.put("svc_kei_ucwk_no", template value)` // For auto-application [L2651] |

**Block 4.2** — kk0161_gene_add_dtm (Generation Registration Datetime) (L2657-2668)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.KK0161_GENE_ADD_DTM)` [L2657] |
| 2 | SET | `childMap.put("kk0161_gene_add_dtm", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("kk0161_gene_add_dtm", template.getString(EKK0181D010CBSMsg.KK0161_GENE_ADD_DTM))` |
| 5 | SET | `workDataMap.put("kk0161_gene_add_dtm" + index, template value)` [L2663] |

**Block 4.3** — svc_kei_ucwk_stat (Service Contract Breakdown Status) (L2670-2677)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.SVC_KEI_UCWK_STAT)` [L2670] |
| 2 | SET | `childMap.put("svc_kei_ucwk_stat", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("svc_kei_ucwk_stat", template.getString(EKK0181D010CBSMsg.SVC_KEI_UCWK_STAT))` |

**Block 4.4** — rsv_aply_ymd (Reservation Application Date) (L2680-2687)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.RSV_APLY_YMD)` [L2680] |
| 2 | SET | `childMap.put("rsv_aply_ymd", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("rsv_aply_ymd", template.getString(EKK0181D010CBSMsg.RSV_APLY_YMD))` |

**Block 4.5** — rsv_aply_cd (Reservation Application Code) (L2690-2697)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.RSV_APLY_CD)` [L2690] |
| 2 | SET | `childMap.put("rsv_aply_cd", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("rsv_aply_cd", template.getString(EKK0181D010CBSMsg.RSV_APLY_CD))` |

**Block 4.6** — pnlty_hassei_cd (Penalty Generation Code) (L2700-2707)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.PNLTY_HASSEI_CD)` [L2700] |
| 2 | SET | `childMap.put("pnlty_hassei_cd", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("pnlty_hassei_cd", template.getString(EKK0181D010CBSMsg.PNLTY_HASSEI_CD))` |

**Block 4.7** — ido_div (Difference Classification / Change Type) (L2710-2717)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.IDO_DIV)` [L2710] |
| 2 | SET | `childMap.put("ido_div", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("ido_div", template.getString(EKK0181D010CBSMsg.IDO_DIV))` |

**Block 4.8** — gene_add_dtm (Generation Registration Datetime for eo Light TV) (L2720-2727)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.KK0181_GENE_ADD_DTM)` [L2720] |
| 2 | SET | `childMap.put("gene_add_dtm", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("gene_add_dtm", template.getString(EKK0181D010CBSMsg.KK0181_GENE_ADD_DTM))` |

**Block 4.9** — add_dtm (Registration Datetime) (L2730-2737)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.ADD_DTM)` [L2730] |
| 2 | SET | `childMap.put("add_dtm", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("add_dtm", template.getString(EKK0181D010CBSMsg.ADD_DTM))` |

**Block 4.10** — add_opeacnt (Registration Operator Account) (L2740-2747)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.ADD_OPEACNT)` [L2740] |
| 2 | SET | `childMap.put("add_opeacnt", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("add_opeacnt", template.getString(EKK0181D010CBSMsg.ADD_OPEACNT))` |

**Block 4.11** — upd_dtm (Update Datetime) (L2750-2757)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.UPD_DTM)` [L2750] |
| 2 | SET | `childMap.put("upd_dtm", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("upd_dtm", template.getString(EKK0181D010CBSMsg.UPD_DTM))` |

**Block 4.12** — upd_opeacnt (Update Operator Account) (L2760-2767)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.UPD_OPEACNT)` [L2760] |
| 2 | SET | `childMap.put("upd_opeacnt", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("upd_opeacnt", template.getString(EKK0181D010CBSMsg.UPD_OPEACNT))` |

**Block 4.13** — mk_flg (Invalid Flag) (L2770-2777)

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0181D010CBSMsg.MK_FLG)` [L2770] |
| 2 | SET | `childMap.put("mk_flg", "")` |
| 3 | ELSE | |
| 4 | SET | `childMap.put("mk_flg", template.getString(EKK0181D010CBSMsg.MK_FLG))` |

**Block 5** — DISCOUNT SERVICE AUTO-APPLICATION MAP BUILDING (L2782-2830)

> Constructs a service contract list map (`svcKeiListMap`) for the discount service auto-application feature. Sets the target contract classification code, contract status, pricing code, and pricing plan code. Then injects the list into the group map.

| # | Type | Code |
|---|------|------|
| 1 | GET | `svcKeiGrpListMap = (HashMap)svcKeiGrpList.get(0)` // Get first group from list |
| 2 | IF | `svcKeiGrpListMap.containsKey(SVC_KEI_LIST)` → extract existing list [L2787-2789] |
| 3 | IF | `wriSvcAutoAplyMap.containsKey("sysid")` → set sysId [L2792-2794] |
| 4 | IF | `sysId.equals("")` → copy sysId from addKeishaServiceCCWorkMap [L2795-2796] |
| 5 | IF | `wriSvcAutoAplyMap.containsKey("mskm_no")` → set mskmNo [L2799-2801] |
| 6 | IF | `mskmNo.equals("")` → copy mskmNo from addMskmSCWork [L2802-2803] |
| 7 | SET | `svcKeiListMap.put("tg_kei_skbt_cd", "03")` // Target contract: TV subscription |
| 8 | SET | `svcKeiListMap.put("svc_kei_ucwk_stat", "010")` // Status: 010 = Processing Complete (受付済) |
| 9 | SET | `svcKeiListMap.put("pcrs_cd", tvMap.get("pcrs_cd"))` // Pricing code from TV map |
| 10 | SET | `svcKeiListMap.put("pplan_cd", tvMap.get("pplan_cd"))` // Pricing plan code from TV map |
| 11 | SET | `svcKeiList.add(svcKeiListMap)` // Add map to list |
| 12 | IF | `!svcKeiGrpListMap.containsKey(SVC_KEI_LIST)` → put svcKeiList into group map [L2821-2823] |

**Block 6** — ERROR INFO HANDLING (L2828-2847)

> Calls the error info mapping method, retrieves the existing error list from the control map, and sets the final error info using `TemplateErrorUtil.getErrorInfo()`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `editErrInfoEKK0181D010(param, template, (Integer)returnCode, fixedText, index)` // Extract error fields |
| 2 | CALL | `errList = (ArrayList<Object>)param.getControlMapData(SCControlMapKeys.ERROR_INFO)` |
| 3 | IF | `errList == null` → create new ArrayList |
| 4 | SET | `param.setControlMapData(SCControlMapKeys.ERROR_INFO, TemplateErrorUtil.getErrorInfo(msgList, errList))` |
| 5 | RETURN | `return param` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_ucwk_no` | Field | Service detail work number — internal tracking ID for a service contract line item (the breakdown record) |
| `svc_kei_ucwk_stat` | Field | Service contract breakdown status — `010` means "processing complete" (受付済), i.e., the SC insert was successful |
| `svc_kei_ucwk_no_` + index | Field | Per-device service detail work number stored in workDataMap, keyed by STB device index |
| `kk0161_gene_add_dtm` | Field | Generation registration datetime (for the KK series) — timestamp when this record was generated in the system |
| `gene_add_dtm` | Field | Generation registration datetime for eo Light TV (eo光TV) — the system-generated registration timestamp |
| `add_dtm` | Field | Registration datetime — timestamp of the record creation |
| `add_opeacnt` | Field | Registration operator account — the user ID of the operator who registered the record |
| `upd_dtm` | Field | Update datetime — timestamp of the last modification |
| `upd_opeacnt` | Field | Update operator account — the user ID of the operator who last modified the record |
| `mk_flg` | Field | Invalid flag (無効フラグ) — indicates whether this contract breakdown record is marked as invalid/nullified |
| `rsv_aply_ymd` | Field | Reservation application date — the date when service reservation was applied |
| `rsv_aply_cd` | Field | Reservation application code — code classifying the type of reservation application |
| `pnlty_hassei_cd` | Field | Penalty generation code — code indicating whether a penalty applies (e.g., early termination fee) |
| `ido_div` | Field | Difference classification (異動区分) — classifies the type of contract change (new, modify, cancel, transfer) |
| `tg_kei_skbt_cd` | Field | Target service sub-type code — `03` designates TV subscription (eo Light TV) as the target contract type |
| `pcrs_cd` | Field | Pricing code (料金コースコード) — identifies the pricing tier/course for the service |
| `pplan_cd` | Field | Pricing plan code (料金プランコード) — identifies the pricing plan within the course |
| `kk0161_gene_add_dtm` | Field | Generation registration datetime from the KK0161 process — system timestamp for generation |
| `KK0181_GENE_ADD_DTM` | Field | Generation registration datetime specific to KK0181 (eo Light TV) — per-device generation timestamp |
| `EKK0181D010` | Template ID | Service Contract Breakdown <TV> Registration template — identifies this registration flow |
| `EKK0181D010List` | Map Key | Per-template list key holding the array of per-device breakdown maps |
| `TEMPLATE_ID_TV` | Constant | Template ID `"EKK0101D010"` — the parent TV service contract registration |
| `TEMPLATE_ID_TV_UTC` | Constant | Template ID `"EKK0181D010"` — the service contract breakdown <TV> registration |
| `TEMPLATE_ID_KK` | Constant | Template ID `"EKK0341D010Tv"` — the equipment-provided service contract registration |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity (used in SC names) |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband service (contextual to eo Light ecosystem) |
| STB | Acronym | Set-Top Box — the TV set-top box device registered in the eo Light TV service |
| eo Light TV | Business term | eo光テレビ — K-Opticom's IPTV/cable television service brand |
| B-CAS | Acronym | Broadcast Content Protection for Digital Terrestrial Broadcasting — smart card used in Japanese digital TV for content protection and subscription management |
| SC | Acronym | Service Component — a service-layer module (typically ending in `CBS` or `SC`) that performs a specific business operation, often involving DB CRUD |
| CBS | Acronym | Common Business Service — a message-based service component interface in the Futurity framework |
| CAANMsg | Technical class | Fujitsu's message wrapper class used for SC input/output — provides `isNull()`, `getString()`, `getInt()` methods |
| IRequestParameterReadWrite | Technical interface | The request/response parameter bus in the Futurity framework — carries all working data between CCs, SCs, and screens |
| workMap | Technical | The mapping work area (`getMappingWorkArea()`) — a shared HashMap used by multiple common components for cross-component data sharing |
| auto-apply map | Technical | Discount service auto-application map (`JKKWrisvcAutoAplyCCMap`) — used to pass system ID and order number to discount auto-application logic |
| TMCK_ERR_STATUS | Constant | Error threshold value `1000` — return codes >= this indicate a single-item error, triggering a `CCException` throw in the caller |
| `CC_ERROR_STRING` | Constant | Error string `"サービスコンポーネントエラー"` (Service Component Error) — thrown as message when return code >= TMCK_ERR_STATUS |
| K-Opticom | Business term | The telecommunications company operating the eo Light service ecosystem |
| `addTvTrk` | Method | The TV registration entry point method in `JFUAddSvcKeiTvCC` — orchestrates the full registration flow including TV contract, breakdown, and equipment registration |
