# Business Logic — JFUTelOptSvcMskmCmpCC.setOpSvcKeiMskmData() [177 LOC]

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

## 1. Role

### JFUTelOptSvcMskmCmpCC.setOpSvcKeiMskmData()

This method performs the **option service contract registration processing** (オプションサービス契約データ登録処理) for telephone-based option services within the K-Opticom eo customer backbone system. It is the central entry point for registering one or more option service contracts during the telephone option package submission and registration workflow. The method operates as a **routing/dispatch pattern**: it iterates over a list of option service detail records (`dataList`), filters for registration-only records (skipping cancellation records), and then dispatches to specific service-specific processing branches based on the service type and the current contract lifecycle status (service contract internal status). For 050 number port-in services (indicated by `op_sbop_svc_cd == "B029"`), it first inquires available 050 phone numbers via the EZM0121B040 service and registers the engaging target via EZM0111D010, before proceeding to the general contract registration. For all records, it registers the option service contract via EKK0371D011. Depending on the service contract internal status (`svcKeiUcwkStat`), it may additionally execute provisioning (status "020"), provisioning completion (status "030" or "100"), or service start processing (status "100" with enabled start option). Finally, it updates the SOD (Service Order Data) map with the newly created option service contract number and generation timestamp, enabling downstream SOD data consistency. This method is a shared utility called by multiple screen entry points and is a critical step in the order fulfillment pipeline for telephone option services.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setOpSvcKeiMskmData Start"])
    LOG_START["Log Start"]
    GET_DATA["Get inMap from param.getData(fixedText)"]
    INIT_GENE_ADD["Initialize geneAddDtm = null"]

    START --> LOG_START --> GET_DATA --> INIT_GENE_ADD

    LOOP["FOR each dtlMap in dataList"]
    INIT_GENE_ADD --> LOOP

    LOOP_CHECK["mskm_div != 1 OR svc_div != 1"]
    LOOP --> LOOP_CHECK

    SKIP["Continue to next iteration"]
    LOOP_CHECK -- "True: Skip non-registration" --> SKIP

    EZM_CHECK["op_sbop_svc_cd == B029"]
    SKIP -- "False: Check service type" --> EZM_CHECK

    EZM_INIT["JFUBPCommon.initData EZM0121B040"]
    EZM_IGNORE["JFUBPCommon.ignoreSearchError"]
    EZM_MAP["setInMapEZM0121B040"]
    EZM_EXEC["JFUBPCommon.executeSC EZM0121B040"]
    EZM_EXISTS["isExistsTemplateDetail EZM0121B040"]
    EZM_GET_TEL["Get 050 telno from template"]
    EZM_PUT_TEL["Put telno into dtlMap and inMap"]
    EZM_ERROR["setErrorField and throw SCCallException"]
    EZM_REG_INIT["JFUBPCommon.initData EZM0111D010"]
    EZM_REG_MAP["setInMapEZM0111D010"]
    EZM_REG_EXEC["JFUBPCommon.executeSC EZM0111D010"]

    EZM_CHECK -- "True: 050 Number Port-in" --> EZM_INIT
    EZM_INIT --> EZM_IGNORE --> EZM_MAP --> EZM_EXEC --> EZM_EXISTS
    EZM_EXISTS -- "True: Data exists" --> EZM_GET_TEL --> EZM_PUT_TEL
    EZM_EXISTS -- "False: No data" --> EZM_ERROR
    EZM_PUT_TEL --> EZM_REG_INIT --> EZM_REG_MAP --> EZM_REG_EXEC
    EZM_ERROR --> EKK_COMMON_INIT

    EKK_COMMON_INIT["JFUBPCommon.initData EKK0371D011"]
    EKK_COMMON_MAP["setInMapEKK0371D011"]
    EKK_COMMON_EXEC["JFUBPCommon.executeSC EKK0371D011"]
    EKK_COMMON_GET_UPD["Get lastUpdDtm from template"]
    EKK_COMMON_GET_GENE["Get geneAddDtm from template"]
    EKK_COMMON_PUT_OP["Put op_svc_kei_no into dtlMap"]

    EZM_REG_EXEC --> EKK_COMMON_INIT

    EKK_COMMON_INIT --> EKK_COMMON_MAP --> EKK_COMMON_EXEC
    EKK_COMMON_EXEC --> EKK_COMMON_GET_UPD --> EKK_COMMON_GET_GENE
    EKK_COMMON_GET_GENE --> EKK_COMMON_PUT_OP

    SVC_STAT_GET["Get svcKeiUcwkStat from inMap"]
    EKK_COMMON_PUT_OP --> SVC_STAT_GET

    PROVING_CHECK["svcKeiUcwkStat == 020"]
    SVC_STAT_GET --> PROVING_CHECK

    PROVING_INIT["JFUBPCommon.initData EKK0371C010"]
    PROVING_MAP["setInMapEKK0371C010"]
    PROVING_EXEC["JFUBPCommon.executeSC EKK0371C010"]
    PROVING_GET_UPD["Get lastUpdDtm"]
    PROVING_GET_GENE["Get geneAddDtm"]

    PROVING_CHECK -- "True: Provisioning" --> PROVING_INIT
    PROVING_INIT --> PROVING_MAP --> PROVING_EXEC
    PROVING_EXEC --> PROVING_GET_UPD --> PROVING_GET_GENE

    COMPLETE_CHECK["svcKeiUcwkStat == 030 OR svcKeiUcwkStat == 100"]
    PROVING_GET_GENE --> COMPLETE_CHECK

    COMPLETE_INIT["JFUBPCommon.initData EKK0371C030"]
    COMPLETE_MAP["setInMapEKK0371C030"]
    COMPLETE_EXEC["JFUBPCommon.executeSC EKK0371C030"]
    COMPLETE_GET_UPD["Get lastUpdDtm"]
    COMPLETE_GET_GENE["Get geneAddDtm"]

    COMPLETE_CHECK -- "True: Completed In Progress" --> COMPLETE_INIT
    COMPLETE_INIT --> COMPLETE_MAP --> COMPLETE_EXEC
    COMPLETE_EXEC --> COMPLETE_GET_UPD --> COMPLETE_GET_GENE

    IN_SERVICE_CHECK["svcKeiUcwkStat == 100"]
    COMPLETE_GET_GENE --> IN_SERVICE_CHECK

    ENABLE_CHECK["isEnabledStartOption"]
    IN_SERVICE_CHECK -- "True: In Service" --> ENABLE_CHECK

    START_INIT["JFUBPCommon.initData EKK0371C041"]
    START_MAP["setInMapEKK0371C041"]
    START_EXEC["JFUBPCommon.executeSC EKK0371C041"]
    START_GET_UPD["Get lastUpdDtm"]
    START_GET_GENE["Get tempAddDtm"]

    ENABLE_CHECK -- "True: Enable Start Option" --> START_INIT
    START_INIT --> START_MAP --> START_EXEC
    START_EXEC --> START_GET_UPD --> START_GET_GENE

    GENE_UPDATE["Update geneAddDtm if tempAddDtm exists"]
    START_GET_GENE --> GENE_UPDATE

    SOD_MAP_CREATE["Create updateSODopMap"]
    GENE_UPDATE --> SOD_MAP_CREATE

    SOD_MAP_SET1["Put chaf_opsvkei_no into updateSODopMap"]
    SOD_MAP_CREATE --> SOD_MAP_SET1

    SOD_MAP_SET2["Put chaf_opsvkei_gene_add_dtm into updateSODopMap"]
    SOD_MAP_SET1 --> SOD_MAP_SET2

    SOD_MAP_GET["getUpdateSODMap from inMap"]
    SOD_MAP_SET2 --> SOD_MAP_GET

    SOD_MAP_PUT["Put updateSODopMap keyed by op_svc_cd"]
    SOD_MAP_GET --> SOD_MAP_PUT

    LOOP_END["End iteration - loop back"]
    SOD_MAP_PUT --> LOOP_END
    LOOP_END --> LOOP_CHECK

    LOG_END["Log End"]
    END_NODE(["Return lastUpdDtm"])

    EKK_COMMON_EXEC --> SVC_STAT_GET
    COMPLETE_CHECK -- "False: Not completed in progress" --> IN_SERVICE_CHECK
    IN_SERVICE_CHECK -- "False: Not in service" --> SOD_MAP_CREATE
    ENABLE_CHECK -- "False: Disable Start Option" --> SOD_MAP_CREATE
    GENE_UPDATE --> SOD_MAP_CREATE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for executing service component calls. Maintains the transaction context across SC invocations. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter management object used to initialize, populate, and retrieve data for service IF calls. Contains the inbound map retrieved via `param.getData(fixedText)`. |
| 3 | `fixedText` | `String` | Service message key / prefix used to identify the data section within `param`. Acts as a namespace for retrieving and setting parameter data. Inherited from the calling method (typically a fixed string like `"telOpSvcMskmCmpMap"`). |
| 4 | `dataList` | `ArrayList<HashMap>` | List of option service contract detail records to process. Each HashMap represents one line item with fields including `mskm_div` (registration/cancellation flag), `svc_div` (service division), `op_sbop_svc_cd` (option/sub-option service code), `op_svc_cd` (option service code), and `svc_kei_ucwk_no` (service detail work number). Only records where both `mskm_div == "1"` and `svc_div == "1"` are processed (registration records). |
| 5 | `lastUpdDtm` | `String` | Last update datetime string. Passed in from the caller and updated after each SC execution with the latest timestamp from the response. Used for optimistic concurrency control in subsequent calls. Returned by the method. |

**Instance fields / external state read by this method:**
- `OP_SBOP_SVC_CD` — constant key for option/sub-option service code in maps
- `EKK0161_SVC_KEI_UCWK_STAT` — constant key for service contract internal status in the inbound map
- `IN_COLUMN_LIST_EZM0121B040`, `TEMPLATE_ID_EZM0121B040`, `TEMPLATE_ID_EZM0121B040_DETAIL`, `ERROR_COLUMN_EZM0121B040`, `TEMP_TEMPLATE_KEY_EZM0121B040` — template configuration for 050 phone number inquiry
- `IN_COLUMN_LIST_EZM0111D010`, `TEMPLATE_ID_EZM0111D010`, `TEMP_TEMPLATE_KEY_EZM0111D010` — template configuration for engaging target registration
- `IN_COL_LIST_EKK0371D011`, `TEMP_ID_EKK0371D011`, `TEMP_ID_DTL_EKK0371D011`, `ERR_COL_EKK0371D011`, `TEMP_TEMP_KEY_EKK0371D011` — template configuration for option service contract registration
- `IN_COL_LIST_EKK0371C010`, `TEMP_ID_EKK0371C010`, `ERR_COL_EKK0371C010`, `TEMP_TEMP_KEY_EKK0371C010` — template for provisioning
- `IN_COL_LIST_EKK0371C030`, `TEMP_ID_EKK0371C030`, `ERR_COL_EKK0371C030`, `TEMP_TEMP_KEY_EKK0371C030` — template for provisioning completion
- `IN_COL_LIST_EKK0371C041`, `TEMP_ID_EKK0371C041`, `ERR_COL_EKK0371C041`, `TEMP_TEMP_KEY_EKK0371C041` — template for service start

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JFUBPCommon.initData` | - | - | Initializes request data structure for SC call (clears and resets template map) |
| - | `JFUBPCommon.ignoreSearchError` | - | - | Configures the parameter to ignore search errors during SC execution |
| - | `setInMapEZM0121B040` | - | - | Populates inbound map for 050 phone number inquiry SC |
| C | `JFUBPCommon.executeSC` | EZM0121B040 | EZM0121B040 (050 phone number usable list inquiry) | Executes 050 phone number usable list inquiry SC to find available port-in number |
| - | `JFUBPCommon.isExistsTemplateDetail` | - | - | Checks if template detail data exists in the response |
| R | `JFUBPCommon.getMaxTempTempleteKey` | - | - | Retrieves the maximum template key from the response map for data extraction |
| R | `JFUBPCommon.getTemplateListValue` | - | - | Extracts the 050 telno value from the inquiry response |
| - | `setErrorField` | - | - | Sets error field on parameter for 050 phone number error display |
| - | `JFUBPCommon.initData` | - | - | Initializes request data structure for EZM0111D010 SC call |
| - | `setInMapEZM0111D010` | - | - | Populates inbound map for engaging target registration SC |
| C | `JFUBPCommon.executeSC` | EZM0111D010 | EZM0111D010 (engaging target registration) | Registers engaging target for 050 number port-in service |
| - | `JFUBPCommon.initData` | - | - | Initializes request data structure for EKK0371D011 SC call |
| - | `setInMapEKK0371D011` | - | - | Populates inbound map for option service contract registration |
| C | `JFUBPCommon.executeSC` | EKK0371D011 | KK_T_OPSVKEI (option service contract table) | Registers option service contract <telephone> — creates new contract record |
| R | `JFUBPCommon.getTemplateValue` | - | - | Extracts lastUpdDtm, geneAddDtm, and op_svc_kei_no from EKK0371D011 response |
| R | `JFUBPCommon.getMaxTempTempleteKey` | - | - | Retrieves template key for extracting response data |
| - | `JFUBPCommon.initData` | - | - | Initializes request data structure for provisioning SC |
| - | `setInMapEKK0371C010` | - | - | Populates inbound map for provisioning (shouei) |
| U | `JFUBPCommon.executeSC` | EKK0371C010 | KK_T_OPSVKEI (option service contract table) | Executes option service contract <telephone> provisioning — updates contract to provisioning status |
| R | `JFUBPCommon.getTemplateValue` | - | - | Extracts lastUpdDtm and geneAddDtm from provisioning response |
| - | `JFUBPCommon.initData` | - | - | Initializes request data structure for provisioning completion SC |
| - | `setInMapEKK0371C030` | - | - | Populates inbound map for provisioning completion |
| U | `JFUBPCommon.executeSC` | EKK0371C030 | KK_T_OPSVKEI (option service contract table) | Executes option service contract <telephone> provisioning completion — marks contract as completed/in-progress |
| R | `JFUBPCommon.getTemplateValue` | - | - | Extracts lastUpdDtm and geneAddDtm from provisioning completion response |
| - | `JFUBPCommon.initData` | - | - | Initializes request data structure for service start SC |
| - | `setInMapEKK0371C041` | - | - | Populates inbound map for service start |
| U | `JFUBPCommon.executeSC` | EKK0371C041 | KK_T_OPSVKEI (option service contract table) | Executes option service contract <telephone> start — activates the service |
| R | `JFUBPCommon.getTemplateValue` | - | - | Extracts lastUpdDtm and geneAddDtm from service start response |
| R | `getUpdateSODMap` | - | - | Retrieves and builds the SOD (Service Order Data) update map |
| - | `outDebugLog` | - | - | Writes debug log entries for method start/end |

## 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: `outDebugLog` [-], `getUpdateSODMap` [R], `isNull` [-], `isNull` [-], `isNull` [-], `isNull` [-], `isNull` [-], `getTemplateValue` [R], `getTemplateValue` [R], `getTemplateValue` [R], `getTemplateValue` [R], `getTemplateValue` [R], `getMaxTempTempleteKey` [R], `getMaxTempTempleteKey` [R], `getMaxTempTempleteKey` [R], `getMaxTempTempleteKey` [R], `getMaxTempTempleteKey` [R], `getTemplateValue` [R], `getTemplateValue` [R], `getTemplateValue` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC: JFUTelOptSvcMskmCmpCC.setSaveData | `setSaveData(handle, param, fixedText)` -> `setOpSvcKeiMskmData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` | `executeSC EZM0121B040 [C]`, `executeSC EZM0111D010 [C]`, `executeSC EKK0371D011 [C] KK_T_OPSVKEI`, `executeSC EKK0371C010 [U] KK_T_OPSVKEI`, `executeSC EKK0371C030 [U] KK_T_OPSVKEI`, `executeSC EKK0371C041 [U] KK_T_OPSVKEI` |
| 2 | CC: JFUSetOptPackMskmCC.setSaveData | `setSaveData(handle, param, fixedText)` -> `setOpSvcKeiMskmData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` | `executeSC EZM0121B040 [C]`, `executeSC EZM0111D010 [C]`, `executeSC EKK0371D011 [C] KK_T_OPSVKEI`, `executeSC EKK0371C010 [U] KK_T_OPSVKEI`, `executeSC EKK0371C030 [U] KK_T_OPSVKEI`, `executeSC EKK0371C041 [U] KK_T_OPSVKEI` |

**Caller Details:**
- **JFUTelOptSvcMskmCmpCC.setSaveData()** (line ~1031): The primary entry point within this same class. Called as part of the full telephone option package registration flow, after commitment detail registration (`setMskmDtlData`) and before contract cancellation processing (`setOpSvcKeiDeleData`).
- **JFUSetOptPackMskmCC.setSaveData()** (line ~564): A sibling component's save method that delegates to this method for option service contract registration during the option package submission flow.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET/INIT] Initialize processing state (L1291)

> Method entry: debug log, retrieve inbound map, initialize generation timestamp.

| # | Type | Code |
|---|------|------|
| 1 | LOG | `outDebugLog("----- setOpSvcKeiMskmData Start  -----")` |
| 2 | SET | `inMap = (HashMap) param.getData(fixedText)` // Retrieve inbound map from request parameter |
| 3 | SET | `geneAddDtm = null` // Initialize generation registration datetime |

**Block 2** — [FOR] Iterate over dataList (L1299)

> Loop through each option service detail record to process registration data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dtlMap` // Each HashMap in dataList containing service detail fields |

**Block 3** — [IF] Filter: registration check (L1305)

> Skip records that are not registration type. Only process when `mskm_div == "1"` (registration) AND `svc_div == "1"` (service).

| # | Type | Code |
|---|------|------|
| 1 | IF | `! "1".equals(dtlMap.get("mskm_div"))` OR `! "1".equals(dtlMap.get("svc_div"))` |

**Block 3.1** — [ELSE-IF: continue] Skip non-registration (L1307)

> When the record is not a registration type, skip to the next iteration.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip to next iteration |

**Block 4** — [IF] Branch: 050 Number Port-in (L1311)

> When the option/sub-option service code equals **B029**, handle 050 number port-in processing path.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JFUStrConst.CD00136_B029.equals(dtlMap.get(OP_SBOP_SVC_CD))` |
| 2 | | `[-> CD00136_B029 = "B029" (050 Number Port-in service code)]` |

**Block 4.1** — [SUB] 050 Phone Number Inquiry (L1315)

> Execute the 050 phone number usable list inquiry SC to find an available port-in number.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JFUBPCommon.initData(param, fixedText, IN_COLUMN_LIST_EZM0121B040)` // Initialize request data |
| 2 | CALL | `JFUBPCommon.ignoreSearchError(param, fixedText)` // Set ignore search error flag |
| 3 | CALL | `setInMapEZM0121B040(param, fixedText)` // Populate inbound map for inquiry |
| 4 | CALL | `JFUBPCommon.executeSC(handle, param, fixedText, TEMPLATE_ID_EZM0121B040, TEMPLATE_ID_EZM0121B040_DETAIL, IN_COLUMN_LIST_EZM0121B040, ERROR_COLUMN_EZM0121B040)` // Execute SC |

**Block 4.2** — [IF] Check: data exists in inquiry result (L1319)

> After the 050 inquiry SC, check whether a phone number was returned.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JFUBPCommon.isExistsTemplateDetail(inMap, JFUBPCommon.getMaxTempTempleteKey(inMap, TEMP_TEMPLATE_KEY_EZM0121B040), TEMPLATE_ID_EZM0121B040_DETAIL)` |

**Block 4.2.1** — [THEN] Extract 050 telephone number (L1321)

> Get the 050 number from the inquiry response and store it in both the detail map and the inbound map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `telno050 = JFUBPCommon.getTemplateListValue(inMap, JFUBPCommon.getMaxTempTempleteKey(inMap, TEMP_TEMPLATE_KEY_EZM0121B040), TEMPLATE_ID_EZM0121B040_DETAIL, EZM0121B040CBSMsg1List.TELNO, 0)` // Extract 050 number |
| 2 | SET | `dtlMap.put(EZM0121B040CBSMsg1List.TELNO, telno050)` // Store in detail map |
| 3 | SET | `inMap.put(OUT_050_TELNO, telno050)` // Store in outbound map as n_050_telno |

**Block 4.2.2** — [ELSE] 050 number not found (L1328)

> If no 050 number was returned, set error and throw an exception.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setErrorField(param, "n_050_op_telno_err")` // Set error display field |
| 2 | EXEC | `throw new SCCallException("050電話番号が当たり出し不可", String.valueOf(0), JPCModelConstant.RELATION_ERR)` // [-> "050 telephone number assignment unavailable"] |

**Block 4.3** — [SUB] Engaging Target Registration (L1333)

> After successfully obtaining the 050 number, register the engaging target.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JFUBPCommon.initData(param, fixedText, IN_COLUMN_LIST_EZM0111D010)` // Initialize request data |
| 2 | CALL | `setInMapEZM0111D010(param, fixedText, (String)inMap.get(OUT_050_TELNO))` // Populate with 050 telno |
| 3 | CALL | `JFUBPCommon.executeSC(handle, param, fixedText, TEMPLATE_ID_EZM0111D010, TEMPLATE_ID_EZM0111D010_DETAIL, IN_COLUMN_LIST_EZM0111D010, ERROR_COLUMN_EZM0111D010)` // Execute SC |

**Block 5** — [SUB] Option Service Contract Registration (L1339)

> For ALL records (including non-B029), execute the option service contract registration SC EKK0371D011. This is the core registration step.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JFUBPCommon.initData(param, fixedText, IN_COL_LIST_EKK0371D011)` // Initialize request data |
| 2 | CALL | `setInMapEKK0371D011(param, fixedText, dtlMap, lastUpdDtm)` // Populate contract registration data |
| 3 | CALL | `JFUBPCommon.executeSC(handle, param, fixedText, TEMP_ID_EKK0371D011, TEMP_ID_DTL_EKK0371D011, IN_COL_LIST_EKK0371D011, ERR_COL_EKK0371D011)` // Execute registration SC |
| 4 | SET | `lastUpdDtm = JFUBPCommon.getTemplateValue(..., EKK0371D011CBSMsg.UPD_DTM)` // Extract updated datetime |
| 5 | SET | `geneAddDtm = JFUBPCommon.getTemplateValue(..., EKK0371D011CBSMsg.KK0351_GENE_ADD_DTM)` // Extract generation registration datetime |
| 6 | SET | `dtlMap.put("op_svc_kei_no", JFUBPCommon.getTemplateValue(..., EKK0371D011CBSMsg.OP_SVC_KEI_NO))` // Set option service contract number in detail map |

**Block 6** — [SET] Get service contract internal status (L1351)

> Retrieve the current lifecycle status of the service contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiUcwkStat = (String) inMap.get(EKK0161_SVC_KEI_UCWK_STAT)` // Get service contract internal status |

**Block 7** — [IF] Branch: Provisioning (status == "020") (L1354)

> When the service contract internal status is **020** (provisioning/照架), execute the provisioning SC. This status only applies to contracts that need physical line provisioning.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JFUStrConst.CD00037_020.equals(svcKeiUcwkStat)` |
| 2 | | `[-> CD00037_020 = "020" (Provisioning status)]` |

**Block 7.1** — [SUB] Provisioning SC Execution (L1358)

> Execute EKK0371C010 to set the contract to provisioning state.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JFUBPCommon.initData(param, fixedText, IN_COL_LIST_EKK0371C010)` // Initialize request data |
| 2 | CALL | `setInMapEKK0371C010(param, fixedText, dtlMap, lastUpdDtm)` // Populate provisioning data |
| 3 | CALL | `JFUBPCommon.executeSC(handle, param, fixedText, TEMP_ID_EKK0371C010, TEMP_ID_DTL_EKK0371C010, IN_COL_LIST_EKK0371C010, ERR_COL_EKK0371C010)` // Execute provisioning SC |
| 4 | SET | `lastUpdDtm = JFUBPCommon.getTemplateValue(..., EKK0371C010CBSMsg.UPD_DTM)` // Extract updated datetime |
| 5 | SET | `geneAddDtm = JFUBPCommon.getTemplateValue(..., EKK0371C010CBSMsg.KK0351_GENE_ADD_DTM)` // Extract generation registration datetime |

**Block 8** — [IF] Branch: Provisioning Completed / In Progress (status == "030" OR "100") (L1367)

> When the service contract internal status is **030** (completed/終了済み) or **100** (in progress/提供中), execute the provisioning completion SC.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JFUStrConst.CD00037_030.equals(svcKeiUcwkStat) || JFUStrConst.CD00037_100.equals(svcKeiUcwkStat)` |
| 2 | | `[-> CD00037_030 = "030" (Completed)]` |
| 3 | | `[-> CD00037_100 = "100" (In Progress)]` |

**Block 8.1** — [SUB] Provisioning Completion SC Execution (L1371)

> Execute EKK0371C030 to confirm the provisioning is complete.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JFUBPCommon.initData(param, fixedText, IN_COL_LIST_EKK0371C030)` // Initialize request data |
| 2 | CALL | `setInMapEKK0371C030(param, fixedText, dtlMap, lastUpdDtm)` // Populate completion data |
| 3 | CALL | `JFUBPCommon.executeSC(handle, param, fixedText, TEMP_ID_EKK0371C030, TEMP_ID_DTL_EKK0371C030, IN_COL_LIST_EKK0371C030, ERR_COL_EKK0371C030)` // Execute provisioning completion SC |
| 4 | SET | `lastUpdDtm = JFUBPCommon.getTemplateValue(..., EKK0371C030CBSMsg.UPD_DTM)` // Extract updated datetime |
| 5 | SET | `geneAddDtm = JFUBPCommon.getTemplateValue(..., EKK0371C030CBSMsg.KK0351_GENE_ADD_DTM)` // Extract generation registration datetime |

**Block 9** — [IF] Branch: In Service with Start Option (status == "100") (L1382)

> When the service contract internal status is **100** (in progress/提供中), check whether the start option is enabled and execute service start if applicable.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JFUStrConst.CD00037_100.equals(svcKeiUcwkStat)` |
| 2 | | `[-> CD00037_100 = "100" (In Progress / Service Active)]` |

**Block 9.1** — [IF] Check: start option enabled (L1384)

> Verify whether the start option feature is enabled for this service before executing the service start SC.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isEnabledStartOption(handle, param, fixedText, (String)dtlMap.get(OP_SVC_CD))` // Check if start option is enabled |

**Block 9.1.1** — [SUB] Service Start SC Execution (L1388)

> Execute EKK0371C041 to activate the service for customers in "in progress" status.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JFUBPCommon.initData(param, fixedText, IN_COL_LIST_EKK0371C041)` // Initialize request data |
| 2 | CALL | `setInMapEKK0371C041(param, fixedText, dtlMap, lastUpdDtm)` // Populate service start data |
| 3 | CALL | `JFUBPCommon.executeSC(handle, param, fixedText, TEMP_ID_EKK0371C041, TEMP_ID_DTL_EKK0371C041, IN_COL_LIST_EKK0371C041, ERR_COL_EKK0371C041)` // Execute service start SC |
| 4 | SET | `lastUpdDtm = JFUBPCommon.getTemplateValue(..., EKK0371C041CBSMsg.UPD_DTM)` // Extract updated datetime |
| 5 | SET | `tempAddDtm = JFUBPCommon.getTemplateValue(..., EKK0371C041CBSMsg.KK0351_GENE_ADD_DTM)` // Extract generation registration datetime from service start |
| 6 | IF | `!JFUBPCommon.isNull(tempAddDtm)` |

**Block 9.1.1.1** — [THEN] Update geneAddDtm (L1395)

> If the service start SC returned a new generation timestamp, update geneAddDtm.

| # | Type | Code |
|---|------|------|
| 1 | SET | `geneAddDtm = tempAddDtm` // Override with service start generation timestamp |

**Block 10** — [SET] Build SOD Update Map (L1399)

> After all service processing, construct the SOD (Service Order Data) update map with the newly created option service contract information.

| # | Type | Code |
|---|------|------|
| 1 | SET | `updateSODopMap = new HashMap()` // Create new update SOD option map |
| 2 | SET | `updateSODopMap.put("chaf_opsvkei_no", (String)dtlMap.get("op_svc_kei_no"))` // Set option service contract number |
| 3 | SET | `updateSODopMap.put("chaf_opsvkei_gene_add_dtm", geneAddDtm)` // Set generation registration datetime |

**Block 11** — [SET] Update SOD Map (L1403)

> Merge the option service update map into the main SOD map, keyed by the option service code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `updateSODMap = getUpdateSODMap(inMap)` // Retrieve/build main SOD map from inMap |
| 2 | SET | `updateSODMap.put(dtlMap.get(OP_SVC_CD), updateSODopMap)` // Key by option service code |

**Block 12** — [RETURN] Return lastUpdDtm (L1409)

> Log end and return the last update datetime to the caller.

| # | Type | Code |
|---|------|------|
| 1 | LOG | `outDebugLog("----- setOpSvcKeiMskmData End  -----")` |
| 2 | RETURN | `return lastUpdDtm` // Return updated datetime |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mskm_div` | Field | Registration/cancellation division — distinguishes registration ("1") from cancellation ("2") records in the option service list |
| `svc_div` | Field | Service division — identifies the service category; "1" indicates a standard option service record |
| `op_sbop_svc_cd` | Field | Option/Sub-option service code — classifies whether the record is a 050 number port-in service ("B029") or a regular option service |
| `op_svc_cd` | Field | Option service code — unique identifier for the type of option service (e.g., FTTH, Mail, ENUM) |
| `op_svc_kei_no` | Field | Option service contract number — the generated contract ID returned by EKK0371D011 after registration |
| `svc_kei_ucwk_no` | Field | Service detail work number — internal tracking ID for service contract line items, used as a reference key |
| `svcKeiUcwkStat` | Field | Service contract internal status — lifecycle state of the service contract |
| CD00037_020 | Constant | Status "020" — Provisioning (照架) — physical line provisioning is being prepared |
| CD00037_030 | Constant | Status "030" — Completed (終了済み) — provisioning is complete, service is ready |
| CD00037_100 | Constant | Status "100" — In Progress (提供中) — service is actively being provided to the customer |
| CD00136_B029 | Constant | Service code "B029" — 050 Number Port-in service type (ナンバーポートイン) |
| EZM0121B040 | SC | 050 Phone Number Usable List Inquiry SC — inquires available 050 telephone numbers for port-in |
| EZM0111D010 | SC | Engaging Target Registration SC — registers the target for 050 number port-in engaging |
| EKK0371D011 | SC | Option Service Contract <Telephone> Registration SC — creates the option service contract record |
| EKK0371C010 | SC | Option Service Contract <Telephone> Provisioning SC — sets contract to provisioning state |
| EKK0371C030 | SC | Option Service Contract <Telephone> Provisioning Completion SC — marks provisioning as complete |
| EKK0371C041 | SC | Option Service Contract <Telephone> Start SC — activates the service for in-progress contracts |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity that tracks all service orders and their lifecycle states |
| KK_T_OPSVKEI | DB Table | Option Service Contract table — stores option service contract records for telephone services |
| geneAddDtm | Field | Generation registration datetime — timestamp when the contract record was first created/generated |
| lastUpdDtm | Field | Last update datetime — timestamp of the most recent modification, used for optimistic locking |
| chaf_opsvkei_no | Field | Changed option service contract number — updated contract number in the SOD map after processing |
| chaf_opsvkei_gene_add_dtm | Field | Changed option service contract generation registration datetime — updated generation timestamp in SOD map |
| 照架 (shouei) | Japanese term | Provisioning — the process of preparing physical lines and equipment for a new telecom service |
| 提供中 (teikyou-chuu) | Japanese term | In Progress — service status indicating the service is actively being provided |
| 終了済み (shuuryou-zumi) | Japanese term | Completed — provisioning is complete, awaiting service activation |
| オプションサービス | Japanese term | Option Service — additional services (FTTH, Mail, ENUM, etc.) that customers can add to their base telecom plan |
| 050ナンバーポートイン | Japanese term | 050 Number Port-in — a service allowing customers to port their 050 telephone number to the K-Opticom network |
| 照架完了 (shouei-kanryou) | Japanese term | Provisioning Completion — the state where physical provisioning is finalized |
| 開始 (kaishi) | Japanese term | Start — the activation of an option service for a customer |
