# Business Logic — JFUAddSvcKeiTelCC.editRetEKK0191D010() [276 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JFUAddSvcKeiTelCC` |
| Layer | CC / Common Component (Controller-Component layer, part of the Fujitsu Futurity bp-custom common package) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JFUAddSvcKeiTelCC.editRetEKK0191D010()

This method performs **downstream (result-side) mapping** for the service contract line-item registration of **eo Light Phone** (eo光電話), a fiber-optic telephone service offered by K-Opticom. Specifically, it receives a `CAANMsg` template populated by a Service Component (SC) call — which executed the actual database insert for the `EKK0191D010` screen — and maps every field from that template into the application's working data structures (child maps, work data maps, and auto-application maps).

The method handles **three distinct business responsibilities**: (1) **Template-to-data mapping**, where each of the 11+ fields from the `EKK0191D010CBSMsg` template is copied into `childMap` (the row-level result for the current service line item), with null-safe handling that defaults to empty strings when the template field is absent. (2) **Auto-application data enrichment** for discount services (割引サービス自動適用対応), added in v1.00.00, where the method builds a `svcKeiListMap` representing the target service contract's characteristics — service type code `03` (telephone), status `010` (accepted/受付済), pricing code, and plan code — and embeds it into the discount auto-application map. (3) **Error info consolidation**, delegating to `editErrInfoEKK0191D010()` to process any template status codes and combining them with control-map error lists before returning.

This is a **shared mapping utility** called within the `addTelTrk()` method during the eo Light Phone registration flow. It implements a **routing/dispatch pattern** for null values (checking `isNull` on each template field and branching between empty-string defaults and actual template values), and a **builder pattern** for the service contract list map that feeds downstream discount-application logic.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> RETRIEVE_TEMPLATES["Retrieve templates from msgList<br/>JCMConstants.TEMPLATE_LIST_KEY"]
    RETRIEVE_TEMPLATES --> RETRIEVE_RETURN_CODE["Retrieve returnCode from msgList<br/>JCMConstants.RET_CD_INT_KEY"]
    RETRIEVE_RETURN_CODE --> GET_WORK_MAP["Get workMap from param<br/>param.getMappingWorkArea()"]
    GET_WORK_MAP --> CHECK_WORK_MAP_NULL{"workMap == null?"}
    CHECK_WORK_MAP_NULL -->|true| INIT_WORK_MAP["Initialize workMap = new HashMap()"]
    CHECK_WORK_MAP_NULL -->|false| GET_WORK_DATA
    INIT_WORK_MAP --> SET_WORK_MAP["param.setMappingWorkArea(workMap)"]
    SET_WORK_MAP --> GET_WORK_DATA["Get workDataMap<br/>workMap.get(CC_WORK_AREA_NAME)"]

    GET_WORK_DATA --> CHECK_WORK_DATA_NULL{"workDataMap == null?"}
    CHECK_WORK_DATA_NULL -->|true| INIT_WORK_DATA["Initialize workDataMap = new HashMap()"]
    CHECK_WORK_DATA_NULL -->|false| GET_DATA_MAP
    INIT_WORK_DATA --> SET_WORK_DATA["workMap.put(CC_WORK_AREA_NAME, workDataMap)"]
    SET_WORK_DATA --> GET_DATA_MAP["Get dataMap from param<br/>param.getData(fixedText)"]

    GET_DATA_MAP --> CHECK_DATA_MAP_NULL{"dataMap == null?"}
    CHECK_DATA_MAP_NULL -->|true| INIT_DATA_MAP["Initialize dataMap = new HashMap()"]
    CHECK_DATA_MAP_NULL -->|false| INIT_DATA_LIST
    INIT_DATA_MAP --> SET_DATA_MAP["param.setData(fixedText, dataMap)"]
    SET_DATA_MAP --> INIT_DATA_LIST["Get dataList from dataMap<br/>dataMap.get(EKK0191D010List)"]

    INIT_DATA_LIST --> CHECK_DATA_LIST_NULL{"dataList == null?"}
    CHECK_DATA_LIST_NULL -->|true| INIT_DATA_LIST_OBJ["Initialize dataList = new ArrayList()"]
    CHECK_DATA_LIST_NULL -->|false| GET_CHILD_MAP
    INIT_DATA_LIST_OBJ --> SET_DATA_LIST["dataMap.put(EKK0191D010List, dataList)"]
    SET_DATA_LIST --> GET_CHILD_MAP["Get childMap from dataList[index]"]

    GET_CHILD_MAP --> CHECK_CHILD_MAP_NULL{"childMap == null?"}
    CHECK_CHILD_MAP_NULL -->|true| INIT_CHILD_MAP["Initialize childMap = new HashMap()"]
    CHECK_CHILD_MAP_NULL -->|false| EXTRACT_EXTRACTION_DATA
    INIT_CHILD_MAP --> ADD_CHILD_MAP["dataList.add(index, childMap)"]
    ADD_CHILD_MAP --> EXTRACT_EXTRACTION_DATA["Extract extra fields<br/>sysId, mskmNo, telMap, work areas, wriSvcAutoAplyMap"]

    EXTRACT_EXTRACTION_DATA --> FIELD_MAPPING["Field Mapping Loop<br/>Map template fields to childMap/dataMap"]

    FIELD_MAPPING --> MAP_SVC_KEI_UCWK_NO{"template.isNull(SVC_KEI_UCWK_NO)?"}
    MAP_SVC_KEI_UCWK_NO -->|true| SET_EMPTY_SVC_NO["childMap put svc_kei_ucwk_no = empty<br/>svcKeiListMap put svc_kei_ucwk_no = empty"]
    MAP_SVC_KEI_UCWK_NO -->|false| SET_SVC_NO["childMap put svc_kei_ucwk_no from template<br/>workDataMap put svc_kei_ucwk_no_index from template<br/>svcKeiListMap put svc_kei_ucwk_no from template"]

    SET_EMPTY_SVC_NO --> MAP_KK0161_DTM{"template.isNull(KK0161_GENE_ADD_DTM)?"}
    SET_SVC_NO --> MAP_KK0161_DTM
    MAP_KK0161_DTM -->|true| SET_EMPTY_KK0161["childMap put kk0161_gene_add_dtm = empty"]
    MAP_KK0161_DTM -->|false| SET_KK0161["childMap put kk0161_gene_add_dtm from template<br/>workDataMap put kk0161_gene_add_dtm_index from template"]

    SET_EMPTY_KK0161 --> MAP_SVC_STAT{"template.isNull(SVC_KEI_UCWK_STAT)?"}
    SET_KK0161 --> MAP_SVC_STAT
    MAP_SVC_STAT -->|true| SET_EMPTY_STAT["childMap put svc_kei_ucwk_stat = empty"]
    MAP_SVC_STAT -->|false| SET_STAT["dataMap put svc_kei_ucwk_stat from template"]

    SET_EMPTY_STAT --> MAP_RSV_YMD{"template.isNull(RSV_APLY_YMD)?"}
    SET_STAT --> MAP_RSV_YMD
    MAP_RSV_YMD -->|true| SET_EMPTY_YMD["childMap put rsv_aply_ymd = empty"]
    MAP_RSV_YMD -->|false| SET_YMD["childMap put rsv_aply_ymd from template"]

    SET_EMPTY_YMD --> MAP_RSV_CD{"template.isNull(RSV_APLY_CD)?"}
    SET_YMD --> MAP_RSV_CD
    MAP_RSV_CD -->|true| SET_EMPTY_CD["childMap put rsv_aply_cd = empty"]
    MAP_RSV_CD -->|false| SET_CD["childMap put rsv_aply_cd from template"]

    SET_EMPTY_CD --> MAP_GENE_DTM{"template.isNull(KK0191_GENE_ADD_DTM)?"}
    SET_CD --> MAP_GENE_DTM
    MAP_GENE_DTM -->|true| SET_EMPTY_GENE_DTM["childMap put kk0191_gene_add_dtm = empty"]
    MAP_GENE_DTM -->|false| SET_GENE_DTM["childMap put kk0191_gene_add_dtm from template"]

    SET_EMPTY_GENE_DTM --> MAP_ADD_DTM{"template.isNull(ADD_DTM)?"}
    SET_GENE_DTM --> MAP_ADD_DTM
    MAP_ADD_DTM -->|true| SET_EMPTY_ADD_DTM["childMap put add_dtm = empty"]
    MAP_ADD_DTM -->|false| SET_ADD_DTM["childMap put add_dtm from template"]

    SET_EMPTY_ADD_DTM --> MAP_ADD_OPEACNT{"template.isNull(ADD_OPEACNT)?"}
    SET_ADD_DTM --> MAP_ADD_OPEACNT
    MAP_ADD_OPEACNT -->|true| SET_EMPTY_ADD_OPEACNT["childMap put add_opeacnt = empty"]
    MAP_ADD_OPEACNT -->|false| SET_ADD_OPEACNT["childMap put add_opeacnt from template"]

    SET_EMPTY_ADD_OPEACNT --> MAP_UPD_DTM{"template.isNull(UPD_DTM)?"}
    SET_ADD_OPEACNT --> MAP_UPD_DTM
    MAP_UPD_DTM -->|true| SET_EMPTY_UPD_DTM["childMap put upd_dtm = empty"]
    MAP_UPD_DTM -->|false| SET_UPD_DTM["childMap put upd_dtm from template"]

    SET_EMPTY_UPD_DTM --> MAP_UPD_OPEACNT{"template.isNull(UPD_OPEACNT)?"}
    SET_UPD_DTM --> MAP_UPD_OPEACNT
    MAP_UPD_OPEACNT -->|true| SET_EMPTY_UPD_OPEACNT["childMap put upd_opeacnt = empty"]
    MAP_UPD_OPEACNT -->|false| SET_UPD_OPEACNT["childMap put upd_opeacnt from template"]

    SET_EMPTY_UPD_OPEACNT --> MAP_MK_FLG{"template.isNull(MK_FLG)?"}
    SET_UPD_OPEACNT --> MAP_MK_FLG
    MAP_MK_FLG -->|true| SET_EMPTY_MK_FLG["childMap put mk_flg = empty"]
    MAP_MK_FLG -->|false| SET_MK_FLG["childMap put mk_flg from template"]

    SET_EMPTY_MK_FLG --> AUTO_APPLICATION_START["Discount Service Auto-Application<br/>Extract svcKeiGrpListMap from svcKeiGrpList"]
    SET_MK_FLG --> AUTO_APPLICATION_START

    AUTO_APPLICATION_START --> CHECK_SVC_KEY{"svcKeiGrpListMap contains SVC_KEI_LIST?"}
    CHECK_SVC_KEY -->|true| GET_SVC_LIST["svcKeiList = svcKeiGrpListMap.get(SVC_KEI_LIST)"]
    CHECK_SVC_KEY -->|false| SET_SYSID
    GET_SVC_LIST --> SET_SYSID["Set sysId from wriSvcAutoAplyMap or addKeishaServiceCCWorkMap"]

    SET_SYSID --> CHECK_MSKM{"wriSvcAutoAplyMap contains mskm_no?"}
    CHECK_MSKM -->|true| GET_MSKM["mskmNo = wriSvcAutoAplyMap.get(mskm_no)"]
    CHECK_MSKM -->|false| SET_FIXED_SVC_MAP
    GET_MSKM --> CHECK_MSKM_EMPTY{"mskmNo is empty?"}
    CHECK_MSKM_EMPTY -->|true| SET_MSKM["wriSvcAutoAplyMap.put(mskm_no, addMskmSCWork.get(mskm_no))"]
    CHECK_MSKM_EMPTY -->|false| SET_FIXED_SVC_MAP
    SET_MSKM --> SET_FIXED_SVC_MAP["Populate svcKeiListMap with<br/>tg_kei_skbt_cd=03, svc_kei_ucwk_stat=010, pcrs_cd, pplan_cd"]

    SET_FIXED_SVC_MAP --> ADD_SVC_LIST["svcKeiList.add(svcKeiListMap)"]
    ADD_SVC_LIST --> CHECK_GRP_EMPTY{"svcKeiGrpListMap NOT contains SVC_KEI_LIST?"}
    CHECK_GRP_EMPTY -->|true| ADD_TO_GRP["svcKeiGrpListMap.put(SVC_KEI_LIST, svcKeiList)"]
    CHECK_GRP_EMPTY -->|false| EDIT_ERR
    ADD_TO_GRP --> EDIT_ERR["Call editErrInfoEKK0191D010(param, template, returnCode, fixedText, index)"]

    EDIT_ERR --> GET_ERR_LIST["Get errList from param.getControlMapData(ERROR_INFO)"]
    GET_ERR_LIST --> CHECK_ERR_LIST_NULL{"errList == null?"}
    CHECK_ERR_LIST_NULL -->|true| INIT_ERR_LIST["Initialize errList = new ArrayList()"]
    CHECK_ERR_LIST_NULL -->|false| SET_ERROR_INFO
    INIT_ERR_LIST --> SET_ERROR_INFO["param.setControlMapData(ERROR_INFO, TemplateErrorUtil.getErrorInfo(msgList, errList))"]

    SET_ERROR_INFO --> RETURN_PARAM["Return param"]
    RETURN_PARAM --> END(["End"])
```

**Key constants resolved in flowchart:**

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `CC_WORK_AREA_NAME` | `"JFUAddSvcKeiTelCCWork"` | Work area name key for storing service contract line-item temporary data |
| `CC_WORK_AREA_NAME_KEISHA` | `"JFUAddKeishaServiceCCWork"` | Customer information work area key |
| `CC_WORK_AREA_NAME_MSKM` | `"JFUAddMskmSCWork"` | Subscription information (申請番号) work area key |
| `CC_WRI_SVC_AUTO_APLY_MAP` | `"JKKWrisvcAutoAplyCCMap"` | Map key for discount service auto-application configuration |
| `SVC_KEI_GRP_LIST` | `"svc_kei_grp_list"` | Key for service contract group list within the auto-application map |
| `SVC_KEI_LIST` | `"svc_kei_list"` | Key for service contract list within a group map |
| `tg_kei_skbt_cd` | `"03"` | Target contract subtype code — telephone service |
| `svc_kei_ucwk_stat` | `"010"` | Service contract line-item status — "Accepted" (受付済) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `msgList` | `Map<?, ?>` | The response message map returned from the Service Component (SC) call for `EKK0191D010`. Contains the template list (`JCMConstants.TEMPLATE_LIST_KEY`) with `CAANMsg` objects holding the SC result data, and the return code (`JCMConstants.RET_CD_INT_KEY`) indicating success/failure status. |
| 2 | `param` | `IRequestParameterReadWrite` | The request/response parameter object used throughout the screen processing pipeline. Used to retrieve and store working areas (`getMappingWorkArea`), data maps (`getData`/`setData`), and control map data (`getControlMapData`/`setControlMapData`). This is the central data carrier passed through the entire registration flow. |
| 3 | `fixedText` | `String` | The screen/data key identifier, used as the key to retrieve or create the data map within `param`. In the caller context (`addTelTrk`), this is always `"EKK0191D010"`, which identifies the service contract line-item <eo Light Phone> registration data. |
| 4 | `index` | `int` | The index within the `EKK0191D010List` ArrayList, used to access the specific service line item being processed. In `addTelTrk`, this iterates over all registered telephone line items (0 to telCnt-1). |

**Instance fields / external state read:**

| Field | Type | Description |
|-------|------|-------------|
| `CC_WORK_AREA_NAME` | `String` (private static final) | Key `"JFUAddSvcKeiTelCCWork"` — work area map name for temporary service data |
| `CC_WORK_AREA_NAME_KEISHA` | `String` (private static final) | Key `"JFUAddKeishaServiceCCWork"` — customer info work area |
| `CC_WORK_AREA_NAME_MSKM` | `String` (private static final) | Key `"JFUAddMskmSCWork"` — subscription info work area |
| `CC_WRI_SVC_AUTO_APLY_MAP` | `String` (private static final) | Key `"JKKWrisvcAutoAplyCCMap"` — discount service auto-application map key |
| `SVC_KEI_GRP_LIST` | `String` (private static final) | Key `"svc_kei_grp_list"` — service contract group list key |
| `SVC_KEI_LIST` | `String` (private static final) | Key `"svc_kei_list"` — service contract list key |
| `SCControlMapKeys.ERROR_INFO` | — | Control map key for error information list |
| `SCControlMapKeys.RETURN_CODE` | — | Control map key for return code |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JACBatCommon.isNull` | - | - | Utility null-check on template fields |
| - | `JACbatRknBusinessUtil.isNull` | - | - | Utility null-check on template fields |
| - | `JCHbatSeikyKaknoBusinessUtil.isNull` | - | - | Utility null-check on template fields |
| R | `JBSbatACECBuyIfTrkm.getErrorInfo` | JBSbatACECBuyIfTrkm | - | Retrieves error info (read) |
| - | `JBSbatACInsentetivePrcInfoSaksei.isNull` | - | - | Utility null-check on template fields |
| R | `JBSbatACKojiChrgInfoTrkm.getErrorInfo` | JBSbatACKojiChrgInfoTrkm | - | Retrieves error info (read) |
| - | `JBSbatAKCHSeikyYsoInfMake.isNull` | - | - | Utility null-check on template fields |
| - | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | - | - | Sets data in work area |
| - | `JBSbatAKKshkmRsltInfoTukiaws.setData` | - | - | Sets data in work area |
| - | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | - | - | Sets data in work area |
| - | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | - | - | Sets data in work area |
| R | `JBSbatDKNyukaFinAdd.getData` | JBSbatDKNyukaFinAdd | - | Reads financial data from work area |
| R | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Reads case file ranking data |
| R | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Reads move navigation data |
| - | `JBSbatKKGetCTITelno.setData` | JBSbatKKGetCTITelno | - | Sets C-TI telephone number data |
| R | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Reads advertisement set data |
| U | `JFUAddSvcKeiTelCC.editErrInfoEKK0191D010` | - | - | Updates error information mapping for service contract line-item registration (telephone) |
| R | `JFUeoTelOpTransferCC.getData` | JFUeoTelOpTransferCC | - | Reads EO telephone operation transfer data |
| R | `JFUTransferCC.getData` | JFUTransferCC | - | Reads transfer data |
| R | `JFUTransferListToListCC.getData` | JFUTransferListToListCC | - | Reads transfer list-to-list data |
| R | `JESC0101B010TPMA.getString` | JESC0101B010TPMA | - | Reads TPMA data (service component) |
| R | `JESC0101B020TPMA.getString` | JESC0101B020TPMA | JESC0101B020TPMA | Reads TPMA data (service component) |
| R | `KKW12701SFLogic.getData` | KKW12701SFLogic | - | Reads service flow logic data |
| R | `ApiBpInterface.getErrorInfo` | ApiBpInterface | - | Retrieves API error information (read) |
| - | `CAANMsg.isNull(field)` | EKK0191D010CBSMsg | - | Null-checks each template field (SVC_KEI_UCWK_NO, KK0161_GENE_ADD_DTM, etc.) |
| - | `CAANMsg.getString(field)` | EKK0191D010CBSMsg | - | Reads each field value from template for downstream mapping |
| R | `TemplateErrorUtil.getErrorInfo(msgList, errList)` | - | - | Reads and aggregates error info from the message list and error list |
| - | `param.getMappingWorkArea()` / `setMappingWorkArea()` | - | - | Retrieves/sets the work area map on the parameter object |
| - | `param.getData(fixedText)` / `setData(fixedText, dataMap)` | - | - | Retrieves/sets the business data map identified by the screen key |
| - | `param.getControlMapData(key)` / `setControlMapData(key, value)` | - | - | Retrieves/sets control map data (error info, return codes) |
| - | `template.getInt(EKK0191D010CBSMsg.STATUS)` | EKK0191D010CBSMsg | - | Reads template status code for error processing |
| - | `JCMAPLConstMgr.getString("RETURN_MESSAGE_" + status)` | - | - | Resolves return message string from constants manager |

### Business Classification

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JFUAddSvcKeiTelCC.editErrInfoEKK0191D010` | EKK0191D010 | - | Updates error information mapping for service contract line-item <eo Light Phone> registration — processes template status, adjusts for non-zero return codes, and aggregates error info |
| R | `CAANMsg.isNull()` / `CAANMsg.getString()` | EKK0191D010CBSMsg | EKK0191D010 template | Reads all 11+ fields from the SC response template (svc_kei_ucwk_no, kk0161_gene_add_dtm, svc_kei_ucwk_stat, rsv_aply_ymd, rsv_aply_cd, kk0191_gene_add_dtm, add_dtm, add_opeacnt, upd_dtm, upd_opeacnt, mk_flg) |
| R | `TemplateErrorUtil.getErrorInfo()` | - | - | Reads and aggregates error information from the SC response template list and local error list |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `isNull` [-], `getData` [R], `getData` [R], `getErrorInfo` [R], `getErrorInfo` [R], `getErrorInfo` [R], `editErrInfoEKK0191D010` [U], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `isNull` [-], `isNull` [-], `isNull` [-], `isNull` [-], `isNull` [-], `getString` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen: FUSV0152 / FUSV0161 / FUSV0356 | `FUSVxxxxOperation` -> `JFUAddSvcKeiTelCC.addTelTrk()` -> `editRetEKK0191D010()` | `editErrInfoEKK0191D010 [U] EKK0191D010 template` |
| 2 | Screen: JKKAddSvcKeiTelCC (different class) | `JKKAddSvcKeiTelCC.editRetEKK0191D010()` (sibling method in different class) | Same terminal operations |
| 3 | Screen: JKKUpdSvcKeiTelCC (different class) | `JKKUpdSvcKeiTelCC.editRetEKK0191D010()` (sibling method in different class) | Same terminal operations |
| 4 | Screen: JKKAdchgAddSvcKeiTelCC (different class) | `JKKAdchgAddSvcKeiTelCC.editRetEKK0191D010()` (sibling method in different class) | Same terminal operations |

**Note:** The direct caller in `JFUAddSvcKeiTelCC` is the `addTelTrk()` method, which is invoked by multiple screen operations (`FUSV0152`, `FUSV0161`, `FUSV0356`) during the eo Light Phone registration flow. The method iterates over all telephone line items and calls `editRetEKK0191D010` once per item.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Template and return code retrieval (L2999-L3003)

Retrieves the `CAANMsg` template array and return code from the SC response message map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = (CAANMsg[])msgList.get(JCMConstants.TEMPLATE_LIST_KEY)` // Retrieve template array |
| 2 | SET | `template = templates[0]` // First template is the active one |
| 3 | SET | `templateArray = null` // Unused placeholder |
| 4 | SET | `returnCode = msgList.get(JCMConstants.RET_CD_INT_KEY)` // Retrieve return code |

**Block 2** — [IF] Work map initialization (L3005-L3015)

Ensures the work area map exists on the parameter object, initializing it if null.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workMap = param.getMappingWorkArea()` // Retrieve work area map |
| 2 | IF | `workMap == null?` (L3008) |
| 2.1 | SET | `workMap = new HashMap()` // [true] Initialize |
| 2.2 | EXEC | `param.setMappingWorkArea(workMap)` // [true] Set on param |
| 3 | [else] | Proceed with existing workMap |

**Block 3** — [IF] Work data map initialization (L3017-L3026)

Retrieves or initializes the per-component work data map using `CC_WORK_AREA_NAME = "JFUAddSvcKeiTelCCWork"`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workDataMap = (HashMap)workMap.get(CC_WORK_AREA_NAME)` // ["JFUAddSvcKeiTelCCWork"] |
| 2 | IF | `workDataMap == null?` (L3020) |
| 2.1 | SET | `workDataMap = new HashMap()` // [true] Initialize |
| 2.2 | SET | `workMap.put(CC_WORK_AREA_NAME, workDataMap)` // [true] Store in workMap |
| 3 | [else] | Proceed with existing workDataMap |

**Block 4** — [SET] Data map initialization (L3029-L3038)

Retrieves or creates the business data map using the `fixedText` key (e.g., `"EKK0191D010"`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `dataMap = (HashMap)param.getData(fixedText)` // Get data by fixedText key |
| 2 | IF | `dataMap == null?` (L3032) |
| 2.1 | SET | `dataMap = new HashMap()` // [true] Initialize |
| 2.2 | SET | `param.setData(fixedText, dataMap)` // [true] Store on param |

**Block 5** — [SET] v1.00.00 List initialization (L3040-L3052)

Initializes the `EKK0191D010List` ArrayList and the specific child map for the given index.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dataList = (ArrayList)dataMap.get("EKK0191D010List")` // Hardcoded list key |
| 2 | IF | `dataList == null?` (L3043) |
| 2.1 | SET | `dataList = new ArrayList()` // [true] Initialize |
| 2.2 | SET | `dataMap.put("EKK0191D010List", dataList)` // [true] Store in dataMap |
| 3 | SET | `childMap = (HashMap)dataList.get(index)` // Get child at index |
| 4 | IF | `childMap == null?` (L3049) |
| 4.1 | SET | `childMap = new HashMap()` // [true] Initialize |
| 4.2 | SET | `dataList.add(index, childMap)` // [true] Insert at index |

**Block 6** — [SET] Extra data extraction (L3055-L3075)

Extracts supporting data needed for the discount auto-application feature (added v1.00.00, 2012/4/24).

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysId = ""` // Initialize |
| 2 | SET | `mskmNo = ""` // Initialize |
| 3 | SET | `telMap = (HashMap)param.getData("EKK0111D010")` // Service contract <eo Light Phone> info |
| 4 | SET | `addKeishaServiceCCWorkMap = (HashMap)workMap.get(CC_WORK_AREA_NAME_KEISHA)` // ["JFUAddKeishaServiceCCWork"] |
| 5 | SET | `addMskmSCWork = (HashMap)workMap.get(CC_WORK_AREA_NAME_MSKM)` // ["JFUAddMskmSCWork"] |
| 6 | SET | `wriSvcAutoAplyMap = (HashMap)param.getData(CC_WRI_SVC_AUTO_APLY_MAP)` // ["JKKWrisvcAutoAplyCCMap"] |
| 7 | SET | `svcKeiGrpListMap = new HashMap()` // Service contract group list map |
| 8 | SET | `svcKeiGrpList = (ArrayList)wriSvcAutoAplyMap.get(SVC_KEI_GRP_LIST)` // ["svc_kei_grp_list"] |
| 9 | SET | `svcKeiListMap = new HashMap()` // Service contract list map |
| 10 | SET | `svcKeiList = new ArrayList()` // Service contract list |

**Block 7** — [FIELD MAPPING] Template field-to-data mapping (L3080-L3200)

This block maps 11 template fields from the SC response to the local data structures. Each field follows the same pattern: check `isNull`, then either set an empty string or copy the template value. The `svc_kei_ucwk_no` and `kk0161_gene_add_dtm` fields additionally write to `workDataMap` with an index suffix and to `svcKeiListMap` for auto-application. The `svc_kei_ucwk_stat` field writes to `dataMap` instead of `childMap`.

**Block 7.1** — [IF] `svc_kei_ucwk_no` mapping (L3080-L3096)

Service contract line-item number. This is the only field that writes to three destinations (childMap, workDataMap, svcKeiListMap).

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.SVC_KEI_UCWK_NO)?` (L3080) |
| 1.1 | SET | `childMap.put("svc_kei_ucwk_no", new String())` // [true] Empty string |
| 1.2 | SET | `svcKeiListMap.put("svc_kei_ucwk_no", "")` // [true] Also set empty in auto-app map |
| 1.3 | SET | `childMap.put("svc_kei_ucwk_no", template.getString(EKK0191D010CBSMsg.SVC_KEI_UCWK_NO))` // [false] From template |
| 1.4 | SET | `workDataMap.put("svc_kei_ucwk_no_" + index, template.getString(EKK0191D010CBSMsg.SVC_KEI_UCWK_NO))` // [false] Indexed |
| 1.5 | SET | `svcKeiListMap.put("svc_kei_ucwk_no", template.getString(EKK0191D010CBSMsg.SVC_KEI_UCWK_NO))` // [false] From template |

**Block 7.2** — [IF] `kk0161_gene_add_dtm` mapping (L3098-L3110)

Generation registration date/time (service contract). Writes to childMap and workDataMap (indexed).

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.KK0161_GENE_ADD_DTM)?` (L3098) |
| 1.1 | SET | `childMap.put("kk0161_gene_add_dtm", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("kk0161_gene_add_dtm", template.getString(EKK0191D010CBSMsg.KK0161_GENE_ADD_DTM))` // [false] From template |
| 1.3 | SET | `workDataMap.put("kk0161_gene_add_dtm" + index, ...)` // [false] Indexed |

**Block 7.3** — [IF] `svc_kei_ucwk_stat` mapping (L3112-L3121)

Service contract line-item status. Writes to `dataMap` (not `childMap`).

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.SVC_KEI_UCWK_STAT)?` (L3112) |
| 1.1 | SET | `childMap.put("svc_kei_ucwk_stat", new String())` // [true] Empty string |
| 1.2 | SET | `dataMap.put("svc_kei_ucwk_stat", template.getString(EKK0191D010CBSMsg.SVC_KEI_UCWK_STAT))` // [false] To dataMap |

**Block 7.4** — [IF] `rsv_aply_ymd` mapping (L3123-L3132)

Reservation application date (YYYYMMDD).

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.RSV_APLY_YMD)?` (L3123) |
| 1.1 | SET | `childMap.put("rsv_aply_ymd", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("rsv_aply_ymd", template.getString(EKK0191D010CBSMsg.RSV_APLY_YMD))` // [false] From template |

**Block 7.5** — [IF] `rsv_aply_cd` mapping (L3134-L3143)

Reservation application code.

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.RSV_APLY_CD)?` (L3134) |
| 1.1 | SET | `childMap.put("rsv_aply_cd", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("rsv_aply_cd", template.getString(EKK0191D010CBSMsg.RSV_APLY_CD))` // [false] From template |

**Block 7.6** — [IF] `kk0191_gene_add_dtm` mapping (L3145-L3156)

Generation registration date/time (service contract <eo Light Phone>).

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.KK0191_GENE_ADD_DTM)?` (L3145) |
| 1.1 | SET | `childMap.put("kk0191_gene_add_dtm", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("kk0191_gene_add_dtm", template.getString(EKK0191D010CBSMsg.KK0191_GENE_ADD_DTM))` // [false] From template |

**Block 7.7** — [IF] `add_dtm` mapping (L3158-L3167)

Registration date/time.

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.ADD_DTM)?` (L3158) |
| 1.1 | SET | `childMap.put("add_dtm", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("add_dtm", template.getString(EKK0191D010CBSMsg.ADD_DTM))` // [false] From template |

**Block 7.8** — [IF] `add_opeacnt` mapping (L3169-L3178)

Registration operator account.

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.ADD_OPEACNT)?` (L3169) |
| 1.1 | SET | `childMap.put("add_opeacnt", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("add_opeacnt", template.getString(EKK0191D010CBSMsg.ADD_OPEACNT))` // [false] From template |

**Block 7.9** — [IF] `upd_dtm` mapping (L3180-L3189)

Update date/time.

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.UPD_DTM)?` (L3180) |
| 1.1 | SET | `childMap.put("upd_dtm", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("upd_dtm", template.getString(EKK0191D010CBSMsg.UPD_DTM))` // [false] From template |

**Block 7.10** — [IF] `upd_opeacnt` mapping (L3191-L3200)

Update operator account.

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.UPD_OPEACNT)?` (L3191) |
| 1.1 | SET | `childMap.put("upd_opeacnt", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("upd_opeacnt", template.getString(EKK0191D010CBSMsg.UPD_OPEACNT))` // [false] From template |

**Block 7.11** — [IF] `mk_flg` mapping (L3202-L3211)

Invalid flag (無効フラグ).

| # | Type | Code |
|---|------|------|
| 1 | IF | `template.isNull(EKK0191D010CBSMsg.MK_FLG)?` (L3202) |
| 1.1 | SET | `childMap.put("mk_flg", new String())` // [true] Empty string |
| 1.2 | SET | `childMap.put("mk_flg", template.getString(EKK0191D010CBSMsg.MK_FLG))` // [false] From template |

**Block 8** — [SET] Discount service auto-application — group list extraction (L3214-L3220)

Extracts the service contract group list map from the auto-application map, and retrieves the service list if present.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiGrpListMap = (HashMap)svcKeiGrpList.get(0)` // Get first group from list |
| 2 | IF | `svcKeiGrpListMap.containsKey(SVC_KEI_LIST)?` (L3218) |
| 2.1 | SET | `svcKeiList = (ArrayList)svcKeiGrpListMap.get(SVC_KEI_LIST)` // [true] Retrieve existing list |

**Block 9** — [IF] sysId fallback logic (L3222-L3230)

Sets sysId from the auto-application map, falling back to the customer information work map if empty.

| # | Type | Code |
|---|------|------|
| 1 | IF | `wriSvcAutoAplyMap.containsKey("sysid")?` (L3224) |
| 1.1 | SET | `sysId = (String)wriSvcAutoAplyMap.get("sysid")` // [true] Get sysId |
| 2 | IF | `"".equals(sysId)?` (L3227) |
| 2.1 | SET | `wriSvcAutoAplyMap.put("sysid", (String)addKeishaServiceCCWorkMap.get("sysid"))` // [true] Fallback to customer work |

**Block 10** — [IF] mskmNo fallback logic (L3232-L3240)

Sets mskmNo (subscription number / 申請番号) from the auto-application map, falling back to the subscription work map if empty.

| # | Type | Code |
|---|------|------|
| 1 | IF | `wriSvcAutoAplyMap.containsKey("mskm_no")?` (L3234) |
| 1.1 | SET | `mskmNo = (String)wriSvcAutoAplyMap.get("mskm_no")` // [true] Get mskmNo |
| 2 | IF | `"".equals(mskmNo)?` (L3237) |
| 2.1 | SET | `wriSvcAutoAplyMap.put("mskm_no", (String)addMskmSCWork.get("mskm_no"))` // [true] Fallback to subscription work |

**Block 11** — [SET] svcKeiListMap population (L3242-L3257)

Populates the service contract list map with fixed values and dynamic pricing/plan data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiListMap.put("tg_kei_skbt_cd", "03")` // Target contract subtype = telephone |
| 2 | SET | `svcKeiListMap.put("svc_kei_ucwk_stat", "010")` // Service contract line-item status = "Accepted" (受付済) |
| 3 | SET | `svcKeiListMap.put("pcrs_cd", telMap.get("pcrs_cd"))` // Pricing code from telMap |
| 4 | SET | `svcKeiListMap.put("pplan_cd", telMap.get("pplan_cd"))` // Pricing plan code from telMap |
| 5 | SET | `svcKeiList.add(svcKeiListMap)` // Add populated map to service list |

**Block 12** — [IF] Group list update (L3259-L3264)

If the group list map does not yet contain a service list, adds the newly built list.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!svcKeiGrpListMap.containsKey(SVC_KEI_LIST)?` (L3259) |
| 1.1 | SET | `svcKeiGrpListMap.put(SVC_KEI_LIST, svcKeiList)` // [true] Add svcKeiList to group |

**Block 13** — [CALL] Error info processing (L3266)

Delegates to `editErrInfoEKK0191D010` for error status mapping and aggregation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `editErrInfoEKK0191D010(param, template, (Integer)returnCode, fixedText, index)` // Update error info |

**Block 14** — [IF] Error list retrieval and update (L3268-L3278)

Retrieves the existing error list, initializes if null, then sets consolidated error info via `TemplateErrorUtil.getErrorInfo()`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `errList = (ArrayList<Object>)param.getControlMapData(SCControlMapKeys.ERROR_INFO)` // Get error list |
| 2 | IF | `errList == null?` (L3271) |
| 2.1 | SET | `errList = new ArrayList<Object>()` // [true] Initialize |
| 3 | EXEC | `param.setControlMapData(SCControlMapKeys.ERROR_INFO, TemplateErrorUtil.getErrorInfo(msgList, errList))` // Set consolidated error info |

**Block 15** — [RETURN] Return param (L3272)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` // Return the updated parameter object |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_ucwk_no` | Field | Service contract line-item number — internal tracking ID for a specific service contract line item within a subscription |
| `kk0161_gene_add_dtm` | Field | Generation registration date/time (service contract) — timestamp when the service contract line item was registered in the generation system |
| `kk0191_gene_add_dtm` | Field | Generation registration date/time (service contract <eo Light Phone>) — timestamp for the eo Light Phone specific registration |
| `svc_kei_ucwk_stat` | Field | Service contract line-item status — current processing status of the line item (e.g., "010" = Accepted/受付済) |
| `rsv_aply_ymd` | Field | Reservation application date — the date (YYYYMMDD) when the reservation service was applied |
| `rsv_aply_cd` | Field | Reservation application code — code identifying the type of reservation application |
| `add_dtm` | Field | Registration date/time — timestamp of when this record was created |
| `add_opeacnt` | Field | Registration operator account — the operator who created this record |
| `upd_dtm` | Field | Update date/time — timestamp of the last modification |
| `upd_opeacnt` | Field | Update operator account — the operator who last modified this record |
| `mk_flg` | Field | Invalid flag (無効フラグ) — flag indicating whether the record is marked as invalid/cancelled |
| `EKK0191D010` | Screen/Data key | Service contract line-item <eo Light Phone> registration screen/data identifier |
| `EKK0111D010` | Screen/Data key | Service contract <eo Light Phone> registration screen/data identifier |
| `tg_kei_skbt_cd` | Field | Target contract subtype code — "03" identifies telephone services |
| `pcrs_cd` | Field | Pricing code — determines the pricing tier for the service |
| `pplan_cd` | Field | Pricing plan code — identifies the specific pricing plan |
| `sysid` | Field | System ID — identifies the system context for discount auto-application |
| `mskm_no` | Field | Subscription number (申請番号) — the subscription/application number for the customer |
| eo Light Phone (eo光電話) | Business term | Fiber-optic telephone service offered by K-Opticom, combining internet and telephone services |
| SC (Service Component) | Acronym | Backend service component that executes database operations (insert/select/update/delete) |
| CAANMsg | Technical | Fujitsu internal message class — a key-value container holding template fields and their values |
| CBs (CBS) | Acronym | Component-Based System — the message definition class (e.g., EKK0191D010CBSMsg) that defines all field keys |
| Downstream mapping (下りマッピング) | Business term | The process of converting SC response data back into the application's working data structures for the screen layer |
| Upstream mapping (上りマッピング) | Business term | The opposite process — converting application data into SC request format (handled by `editIn*` methods) |
| Discount service auto-application (割引サービス自動適用対応) | Business feature | System feature added in v1.00.00 that automatically applies discount services to telephone contracts based on customer eligibility |
| CC (Common Component) | Pattern | Shared reusable component in the Fujitsu Futurity framework that encapsulates business logic |
| Template error status (テンプレートステータス) | Field | Status code from the SC response template, used for error message lookup via `JCMAPLConstMgr` |
| `RETURN_MESSAGE_NNNN` | Constant | Error message key format — maps status codes (e.g., "0", "9000") to human-readable messages |
| 受付済 (uketzumi) | Business term | "Accepted" — the initial status of a service contract line item after successful SC registration |
