# Business Logic — JFUTelOptSvcMskmCmpCC.setSaveData() [263 LOC]

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

## 1. Role

### JFUTelOptSvcMskmCmpCC.setSaveData()

The `setSaveData` method is the central save operation for the **eo Telecom Option Pack Subscription/Cancellation** (eo光電話オプションパック申込登録) business domain. It serves as a Common Component (CC) that coordinates the entire lifecycle of registering or modifying phone option services for K-Opticom customers — a telecom service provider offering bundled internet and telephony packages (FTTH, ADSL, and related services).

The method implements a **dispatch/routing design pattern** that branches into two distinct processing modes based on the function code (`IN_FUNC_CD`) carried in the input data. **Check Mode** (`FUNC_CD_2 = "2"`) performs all relational and business rule validations without persisting any data — it is used by screens that need to verify whether the requested changes would succeed before committing (e.g., pre-submission validation screens). **Registration Mode** (all other function codes) performs the full subscription/cancellation workflow, writing all changes to downstream services and ultimately issuing a Service Order Data (SOD) document.

In both modes, the method first executes parameter-level and cross-reference integrity checks (unit parameters, relational constraints). Then, depending on the mode, it either performs comprehensive validation checks or proceeds to register option service contract subscriptions and cancellations (オプションサービス契約申込/解約), sub-option service contracts (サブオプションサービス契約), service order data mappings (SODデータマッピング), and progression registration (進捗登録). Finally, in Registration Mode, it triggers SOD issuance via the `hakkoSOD` service, which creates the external order fulfillment document sent to equipment vendors.

The method acts as a **shared utility called by many screens** — primarily the BPM workflow for the eo customer portal (FUSV0334). It receives pre-validated request parameters, processes them according to the business mode, and returns a response parameter map containing either success results, error information, or both.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setSaveData Start"])
    INIT["Initialize inMap bodyMap error info"]
    CHECK_UNIT["checkUnitParam"]
    RET5000_1["Set RETURN_CD 5000"]
    CHECK_KNRN["checkKnrnParam"]
    RET5000_2["Set RETURN_CD 5000"]
    EXTRACT["Extract lists and lastUpdDtm"]
    CONV_SVC["convOpSvcList"]
    CONV_PACK["convOpPackList"]
    CHECK_FUNC["FUNC_CD check"]
    CHECK_MODE["Check Mode FUNC_CD 2"]
    REL_CHECK_MAP["Build telMskmRelCheckMap"]
    AD_CHG["check adChgUm via getAdChgUmC"]
    AD_CHG_ERR["adChgUm = CD00002_1"]
    AD_CHG_FAIL["Set error 4006 RETURN 5000"]
    DATE_CHECK["Date less than 20210701"]
    VLAN_CHECK["checkVlanIdFix"]
    VLAN_FAIL["Set error 4005 RETURN 5000"]
    OP_CHECK_MAP["Build telOpMskmCheckMap"]
    MSKM_CHECK["execute JFUTelOpMskmCheckCC"]
    MSKM_KH["mskmKhFlg = CD00002_1"]
    MSKM_KH_FAIL["Set error 4007 RETURN 5000"]
    SVC_MSKM["checkOpSvcKeiMskmData"]
    SVC_DELE["checkOpSvcKeiDeleData"]
    SBOP_MSKM["checkSbopSvcKeiMskmData"]
    SBOP_DELE["checkSbopSvcKeiDeleData"]
    TEL_PACK["setTelSelOptPackMapping"]
    REG_MODE["Registration Mode"]
    MSKM_DTL["setMskmDtlData"]
    SET_SVC_M["setOpSvcKeiMskmData"]
    SET_SVC_D["setOpSvcKeiDeleData"]
    SET_SBOP_M["setSbopSvcKeiMskmData"]
    SET_SBOP_D["setSbopSvcKeiDeleData"]
    SOD_MAP["setSODMapping"]
    TEL_PACK_REG["setTelSelOptPackMapping"]
    RPG["setRpgData"]
    HAKKO_SOD["hakkoSOD"]
    OUT_OK_1["bodyMap.out_result OK"]
    OUT_OK_2["Set RETURN_CD 0000"]
    END_OK(["Return param"])
    SC_CATCH["Catch SCCallException"]
    ERROR_3001["upd_dtm_bf_err error 3001"]
    ERROR_4001["op_svc_kei_no_err error 4001"]
    ERROR_4002["op_svc_cd_err error 4002"]
    ERROR_4003["n_050_op_telno_err error 4003"]
    ERROR_4004["ido_rsv_dtl_cd_err error 4004"]
    ERROR_4008["rsv_aply_ymd_err error 4008"]
    ERROR_4009["op_pack_list_err error 4009"]
    ERROR_5001_SYS["Default error 5001"]
    RE_THROW_SC["Throw SCCallException"]
    CC_CATCH["Catch CCException"]
    ERROR_5001["error 5001"]
    RE_THROW_CC["Throw CCException"]
    LOG_END["End debug log"]

    START --> INIT --> CHECK_UNIT
    CHECK_UNIT -- fail --> RET5000_1 --> LOG_END
    CHECK_UNIT -- pass --> CHECK_KNRN
    CHECK_KNRN -- fail --> RET5000_2 --> LOG_END
    CHECK_KNRN -- pass --> EXTRACT --> CONV_SVC --> CONV_PACK --> CHECK_FUNC
    CHECK_FUNC -- FUNC_CD2 --> CHECK_MODE
    CHECK_FUNC -- else --> REG_MODE

    CHECK_MODE --> REL_CHECK_MAP --> AD_CHG --> AD_CHG_ERR
    AD_CHG_ERR -- true --> AD_CHG_FAIL --> LOG_END
    AD_CHG_ERR -- false --> DATE_CHECK
    DATE_CHECK -- true --> VLAN_CHECK --> VLAN_FAIL
    DATE_CHECK -- false --> OP_CHECK_MAP --> MSKM_CHECK --> MSKM_KH
    MSKM_KH -- true --> MSKM_KH_FAIL --> LOG_END
    MSKM_KH -- false --> SVC_MSKM --> SVC_DELE --> SBOP_MSKM --> SBOP_DELE --> TEL_PACK --> OUT_OK_1 --> END_OK

    REG_MODE --> MSKM_DTL --> SET_SVC_M --> SET_SVC_D --> SET_SBOP_M --> SET_SBOP_D --> SOD_MAP --> TEL_PACK_REG --> RPG --> HAKKO_SOD --> OUT_OK_2 --> END_OK

    SC_CATCH --> ERROR_3001 --> RE_THROW_SC
    SC_CATCH --> ERROR_4001 --> RE_THROW_SC
    SC_CATCH --> ERROR_4002 --> RE_THROW_SC
    SC_CATCH --> ERROR_4003 --> RE_THROW_SC
    SC_CATCH --> ERROR_4004 --> RE_THROW_SC
    SC_CATCH --> ERROR_4008 --> RE_THROW_SC
    SC_CATCH --> ERROR_4009 --> RE_THROW_SC
    SC_CATCH --> ERROR_5001_SYS --> RE_THROW_SC
    CC_CATCH --> ERROR_5001 --> RE_THROW_CC
    RE_THROW_SC --> LOG_END
    RE_THROW_CC --> LOG_END
    LOG_END --> END_OK
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for the BPM workflow — provides transaction context, DB connection, and system information (DB code, system ID) required by all downstream service component calls |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter container — carries all input data for the operation (option pack list, option service list, function code, customer info, etc.) and receives output data including error information, result codes, and processed business data. Returned as-is to the caller after processing |
| 3 | `fixedText` | `String` | Service message key used for localization and error message retrieval. It serves as a key to look up business messages (e.g., `"telMskmRelCheckMap"`, `"hakkoSODMap"`) and API error message identifiers in message bundles |

**Instance Fields / External State Read:**

| Source | Description |
|--------|-------------|
| `param.getData(fixedText)` | Retrieves the input HashMap from the parameter map under the key specified by `fixedText`. This is the primary business data payload |
| `JCCBPCommon.getOpeDate` | Reads the current operation date from the system — used for the VLAN cut-off date comparison (20210701) |
| `JFUBaseNetChgRelCheckCC.getAdChgUmC` | Reads address change status information to determine if the customer is in the midst of a relocation, which affects validation rules |

## 4. CRUD Operations / Called Services

Analyze all method calls within this method and classify each as a CRUD operation.

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCCBPCommon.getOpeDate` | EKK0001B010SC | - | Reads the current operation date |
| R | `JFUBaseNetChgRelCheckCC.getAdChgUmC` | EKK0351C240CBS | - | Reads address change status to check if customer is relocating |
| R | `JFUBPCommon.nvl` | - | - | Null-value helper for string defaults |
| R | `JFUHakkosiNaviRelAddCC.getOpeDate` | EKK0351C250CBS | - | Reads operation date for moving navigation related check |
| R | `JFUeoTelOpTransferCC.getData` | EKK0401C170CBS | - | Reads telecom option transfer data for check mode |
| R | `JFUEoTvCngAddStbCC.getOpeDate` | EKK0431C041CBS | - | Reads operation date for TV change add STB check |
| R | `JFUHikkosiNaviRelAddCC.getOpeDate` | EKK0431D011CBS | - | Reads operation date for moving navigation related add check |
| - | `JFURelationalCheckCC.checkVlanIdFix` | EKK0371C030CBS | - | Validates VLAN ID assignment for FTTH services |
| - | `JFUSetVariTsushinKikiMskmCC.hakkoSOD` | EKK0401C180CBS | - | Submits service order data for various communication equipment |
| - | `JFUTelOptSvcMskmCmpCC.checkKnrnParam` | - | - | Validates cross-reference parameter consistency |
| - | `JFUTelOptSvcMskmCmpCC.checkOpSvcKeiDeleData` | - | - | Validates option service contract cancellation data |
| - | `JFUTelOptSvcMskmCmpCC.checkOpSvcKeiMskmData` | - | - | Validates option service contract subscription data |
| - | `JFUTelOptSvcMskmCmpCC.checkSbopSvcKeiDeleData` | - | - | Validates sub-option service contract cancellation data |
| - | `JFUTelOptSvcMskmCmpCC.checkSbopSvcKeiMskmData` | - | - | Validates sub-option service contract subscription data |
| - | `JFUTelOptSvcMskmCmpCC.checkUnitParam` | - | - | Validates individual parameter unit constraints |
| - | `JFUTelOptSvcMskmCmpCC.convOpPackList` | - | - | Converts option pack list data for processing |
| - | `JFUTelOptSvcMskmCmpCC.convOpSvcList` | - | - | Converts option service list data for processing |
| - | `JFUTelOpMskmCheckCC.execute` | EKK0371C041CBS | - | Executes option subscription eligibility check |
| - | `JFUHakkoSODCC.hakkoSOD` | EKK1091D011CBS | KK_T_SOD, KK_T_SOD_DTL | Issues (creates) Service Order Data document |
| - | `setMskmDtlData` | - | - | Registers subscription detail data |
| - | `setOpSvcKeiMskmData` | EKK0341B002CBS | KK_T_OPSVKEI_ISP | Registers option service contract subscription |
| - | `setOpSvcKeiDeleData` | EKK0341A010CBS | KK_T_OPSVKEI_ISP | Registers option service contract cancellation |
| - | `setSbopSvcKeiMskmData` | EKK0341C010CBS | KK_T_SBOPSVKEI_ISP | Registers sub-option service contract subscription |
| - | `setSbopSvcKeiDeleData` | EKK0341A010CBS | KK_T_SBOPSVKEI_ISP | Registers sub-option service contract cancellation |
| - | `setSODMapping` | EKK1091D011CBS | KK_T_SOD, KK_T_SOD_DTL | Maps service order data for equipment vendor orders |
| - | `setTelSelOptPackMapping` | EKK0351B003CBS | - | Maps telecom selectable option pack data for output |
| - | `setRpgData` | - | - | Creates progression registration data for tracking |

**How to classify:**
- **C** (Create): Methods with names like `set*Data`, `hakkoSOD`, `setSODMapping`, `setRpgData` — register, create, or submit data
- **R** (Read): Methods with names like `getOpeDate`, `getData`, `getAdChgUmC` — query/read data from the system
- **U** (Update): Many `set*Data` methods also perform updates on existing records (contract status changes)
- **D** (Delete): `setOpSvcKeiDeleData`, `setSbopSvcKeiDeleData` — cancel/delete service contracts
- **-** (Delegate): Methods that are CC-to-CC calls or internal processing — the actual CRUD is performed by the downstream CBS they invoke

## 5. Dependency Trace

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:FUSV0334 (eo Telecom Option Subscription/Cancellation) | `FUSV0334Flow.run()` -> `FUSV0334OPOperation.run()` -> `CCRequestBroker.run()` -> `JFUTelOptSvcMskmCmpCC.setSaveData` | `hakkoSOD [C] KK_T_SOD`, `setOpSvcKeiMskmData [C/U] KK_T_OPSVKEI_ISP`, `setOpSvcKeiDeleData [D] KK_T_OPSVKEI_ISP`, `setSbopSvcKeiMskmData [C/U] KK_T_SBOPSVKEI_ISP`, `setSbopSvcKeiDeleData [D] KK_T_SBOPSVKEI_ISP`, `setSODMapping [C] KK_T_SOD, KK_T_SOD_DTL` |

**Call Chain Detail for FUSV0334:**
- Entry point: `FUSV0334Flow` (EJB Stateful Session Bean, BPM workflow for eo telecom option subscription/cancellation screen)
- Operation: `FUSV0334OPOperation.run()` — orchestrates the business process and delegates to the CC
- CC Request Broker: `CCRequestBroker` routes to `JFUTelOptSvcMskmCmpCC.setSaveData` via class name, method name, and CC code `"FUSV033401CC"`
- Terminal endpoints: SOD issuance, option service contract CRUD, sub-option service contract CRUD, progression registration

## 6. Per-Branch Detail Blocks

### Block 1 — INITIALIZATION (L892)

> Initialize request data structures: retrieve the input HashMap from the parameter map, create the output body map, set default values for result, available phone number, and error info list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap = (HashMap)param.getData(fixedText)` — retrieve input data payload [-> fixedText is the key] |
| 2 | SET | `bodyMap = new HashMap<String, Object>()` — create output body map |
| 3 | SET | `inMap.put(BODY_INFO, bodyMap)` — attach bodyMap to input under BODY_INFO key |
| 4 | SET | `bodyMap.put(OUT_RESULT, RESULT_NG)` — set default result to NG (not good / failure) [-> RESULT_NG] |
| 5 | SET | `bodyMap.put(OUT_050_TELNO, JFUStrConst.EMPTY)` — set default available phone number to empty [-> JFUStrConst.EMPTY] |
| 6 | SET | `inMap.put(ERROR_INFO, new ArrayList<Map<String, String>>())` — create empty error info list |

### Block 2 — [IF] Unit Parameter Check (L916)

> Validate individual parameter unit constraints. If validation fails, set return code to 5000 (application error) and return immediately.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `checkUnitParam(inMap)` — validate parameter unit constraints |
| 2 | IF | `if (!checkUnitParam(inMap))` [-> parameter validation failed] (L916) |
| 2.1 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` — set error return code [-> RETURN_CD_5000] |
| 2.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, null)` — clear message |
| 2.3 | RETURN | `return param` — early exit with error |

### Block 3 — [IF] Cross-Reference Parameter Check (L924)

> Validate cross-reference (relational) parameter consistency. If validation fails, same error handling as Block 2.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `checkKnrnParam(inMap)` — validate relational parameter consistency |
| 2 | IF | `if (!checkKnrnParam(inMap))` [-> relational check failed] (L924) |
| 2.1 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 2.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, null)` |
| 2.3 | RETURN | `return param` — early exit with error |

### Block 4 — [TRY] Main Processing Body (L932)

> Core processing begins. Extract business data from the input map and begin mode-specific processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `lastUpdDtm = (String)inMap.get(IN_LAST_UPD_DTM)` — extract last update datetime [-> IN_LAST_UPD_DTM] |
| 2 | SET | `optPackList = (ArrayList)inMap.get(IN_OPT_PACK_LIST)` — extract option pack list [-> IN_OPT_PACK_LIST] |
| 3 | SET | `opSvcMskmList = (ArrayList)inMap.get(IN_OP_SVC_MSKM_LIST)` — extract option service subscription/cancellation list [-> IN_OP_SVC_MSKM_LIST] |
| 4 | CALL | `convOpSvcList(handle, param, fixedText, opSvcMskmList, optPackList)` — convert option service list data |
| 5 | CALL | `convOpPackList(handle, param, fixedText, optPackList)` — convert option pack list data |

### Block 5 — [IF] Check Mode Branch (L938)

> When `FUNC_CD = "2"`, this branch performs all validations without committing any data. Used by screens that need pre-submission verification.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JPCModelConstant.FUNC_CD_2.equals(inMap.get(IN_FUNC_CD))` [-> FUNC_CD_2 = "2" (Check Mode)] (L938) |

#### Block 5.1 — [Inside Check Mode] Build Relationship Check Map (L940)

> Prepare data for relational checks including service number, improvement work number, and phone number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `relCheckMap = new HashMap()` — create new relationship check map |
| 2 | SET | `relCheckMap.put(IN_PARAM_KEY_SVC_KEI_NO, inMap.get(IN_SVC_KEI_NO))` — service number [-> IN_SVC_KEI_NO] |
| 3 | SET | `relCheckMap.put(IN_PARAM_KEY_SVC_KEI_KAISEN_UCWK_NO, inMap.get(IN_SVC_KEI_KAISEN_UCWK_NO))` — service improvement work number |
| 4 | SET | `relCheckMap.put(IN_PARAM_KEY_TELNO, inMap.get(IN_TELNO))` — phone number [-> IN_TELNO] |
| 5 | EXEC | `param.setData("telMskmRelCheckMap", relCheckMap)` — store in param |

#### Block 5.2 — [Inside Check Mode] Address Change Check (L946)

> Check if the customer is currently in the process of relocating (住所変更中). If so, this is an error because option subscriptions cannot proceed during relocation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `adChgUm = new JFUTelOptSvcMskmRelCheckCC().getAdChgUmC(handle, param, "telMskmRelCheckMap")` — get address change status [-> "telMskmRelCheckMap"] |
| 2 | IF | `JFUStrConst.CD00002_1.equals(adChgUm)` [-> CD00002_1 = "1" (address change in progress)] (L947) |
| 2.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4006, JFUStrConst.EMPTY))` — add error info [-> RES_KEY_ERROR_CODE_4006 = "4006"] |
| 2.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 2.3 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, RETURN_MESSAGE_API_ERROR)` — set error message |
| 2.4 | RETURN | `return param` — early exit with error 4006 |

#### Block 5.3 — [Inside Check Mode] VLAN ID Fix Check (L957)

> For operations before July 1, 2021, perform VLAN ID confirmation check. This is a legacy date check — post-2021-07-01 operations skip this check.

| # | Type | Code |
|---|------|------|
| 1 | IF | `Integer.parseInt("20210701") > Integer.parseInt(JFUBPCommon.getOpeDate(null))` [-> date < 20210701] (L957) |
| 1.1 | SET | `checkVlanIdFix = new JFUTelOptSvcMskmRelCheckCC().checkVlanIdFix(handle, param, "telMskmRelCheckMap")` — perform VLAN ID check [-> "telMskmRelCheckMap"] |
| 1.2 | IF | `!JFUStrConst.CD00002_1.equals(checkVlanIdFix)` [-> VLAN check failed] (L958) |
| 1.2.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4005, JFUStrConst.EMPTY))` — add error info [-> RES_KEY_ERROR_CODE_4005 = "4005"] |
| 1.2.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 1.2.3 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, RETURN_MESSAGE_API_ERROR)` |
| 1.2.4 | RETURN | `return param` — early exit with error 4005 |

#### Block 5.4 — [Inside Check Mode] Option Subscription Eligibility Check (L972)

> Build the option check map with system ID, service number, improvement work number, and service work number. Then execute the option subscription check CC.

| # | Type | Code |
|---|------|------|
| 1 | SET | `opCheckMap = new HashMap()` |
| 2 | SET | `opCheckMap.put("sysid", inMap.get(IN_SYSID))` — system ID [-> IN_SYSID] |
| 3 | SET | `opCheckMap.put("svc_kei_no", inMap.get(IN_SVC_KEI_NO))` — service number |
| 4 | SET | `opCheckMap.put("svc_kei_kaisen_ucwk_no", inMap.get(IN_SVC_KEI_KAISEN_UCWK_NO))` — improvement work number |
| 5 | SET | `opCheckMap.put("svc_kei_ucwk_no", inMap.get(IN_SVC_KEI_UCWK_NO))` — service work number [-> IN_SVC_KEI_UCWK_NO] |
| 6 | EXEC | `param.setData("telOpMskmCheckMap", opCheckMap)` — store in param |
| 7 | CALL | `new JFUTelOpMskmCheckCC().execute(handle, param, "telOpMskmCheckMap")` — execute option subscription check |
| 8 | SET | `retMap = (HashMap)param.getData("telOpMskmCheckMap")` — retrieve check results |
| 9 | IF | `JFUStrConst.CD00002_1.equals(retMap.get("mskmKhFlg"))` [-> CD00002_1 = "1" (check flag set, cannot subscribe)] (L979) |
| 9.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4007, JFUStrConst.EMPTY))` — add error info [-> RES_KEY_ERROR_CODE_4007 = "4007"] |
| 9.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 9.3 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, RETURN_MESSAGE_API_ERROR)` |
| 9.4 | RETURN | `return param` — early exit with error 4007 |

#### Block 5.5 — [Inside Check Mode] Service Contract Validation (L985-L996)

> Sequentially validate option service subscription data, option service cancellation data, sub-option service subscription data, and sub-option service cancellation data. Each validation updates the `lastUpdDtm`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `lastUpdDtm = checkOpSvcKeiMskmData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` — validate option service subscription [-> L985] |
| 2 | SET | `lastUpdDtm = checkOpSvcKeiDeleData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` — validate option service cancellation [-> L989] |
| 3 | SET | `lastUpdDtm = checkSbopSvcKeiMskmData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` — validate sub-option service subscription [-> L993] |
| 4 | SET | `lastUpdDtm = checkSbopSvcKeiDeleData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` — validate sub-option service cancellation [-> L997] |
| 5 | CALL | `setTelSelOptPackMapping(handle, param, fixedText, optPackList, lastUpdDtm)` — map telecom selectable option pack data [-> L1001] |
| 6 | SET | `bodyMap.put(OUT_RESULT, RESULT_OK)` — set result to OK [-> RESULT_OK] |
| 7 | RETURN | `return param` — return with success |

### Block 6 — [ELSE] Registration Mode Processing (L1006)

> Full registration processing: register subscription details, service contracts, sub-option contracts, SOD mapping, progression data, and finally issue SOD. This mode persists all changes.

#### Block 6.1 — [Inside Registration] Register Subscription Details (L1011)

> Register subscription detail data (申込詳細登録処理) — creates the initial registration records for the option subscription request.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setMskmDtlData(handle, param, fixedText)` — register subscription detail data [-> L1011] |

#### Block 6.2 — [Inside Registration] Register Service Contracts (L1014-L1021)

> Register option service subscriptions, cancellations, sub-option subscriptions, and cancellations in sequence. Each returns updated lastUpdDtm.

| # | Type | Code |
|---|------|------|
| 1 | SET | `lastUpdDtm = setOpSvcKeiMskmData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` — register option service contract subscription [-> L1014] |
| 2 | SET | `lastUpdDtm = setOpSvcKeiDeleData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` — register option service contract cancellation [-> L1018] |
| 3 | SET | `lastUpdDtm = setSbopSvcKeiMskmData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` — register sub-option service contract subscription [-> L1021] |
| 4 | SET | `lastUpdDtm = setSbopSvcKeiDeleData(handle, param, fixedText, opSvcMskmList, lastUpdDtm)` — register sub-option service contract cancellation [-> L1025] |

#### Block 6.3 — [Inside Registration] SOD Data Mapping (L1029)

> Create SOD (Service Order Data) mapping data. Only runs for machine (old modem, multifunction router), option, and sub-option subscription/cancellation count records.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setSODMapping(handle, param, fixedText, opSvcMskmList)` — map SOD data [-> L1029] |

#### Block 6.4 — [Inside Registration] Telecom Option Pack Mapping (L1032)

> Map telecom selectable option pack data for output processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setTelSelOptPackMapping(handle, param, fixedText, optPackList, lastUpdDtm)` — map option pack data [-> L1032] |

#### Block 6.5 — [Inside Registration] Progression Registration (L1037-L1042)

> Create progression registration data using progress state 5112. This allows distinguishing between registration and cancellation by checking a single progression item. Format: "eo Telecom Pack 3 [registration/cancellation] start/end date: YYYY/MM/DD". For option pack exchanges between packs, two lines (registration + cancellation) are output.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setRpgData(handle, param, fixedText, optPackList, opSvcMskmList)` — create progression registration [-> L1042] |

#### Block 6.6 — [Inside Registration] SOD Issuance (L1045-L1047)

> Issue the Service Order Data (SOD) by invoking the SOD creation service. This creates the external order fulfillment document sent to equipment vendors for FTTH and related service installations.

| # | Type | Code |
|---|------|------|
| 1 | SET | `hakkoSODCC = new JFUHakkoSODCC()` — create SOD issuance CC instance [-> L1045] |
| 2 | CALL | `hakkoSODCC.hakkoSOD(handle, param, "hakkoSODMap")` — issue SOD [-> "hakkoSODMap"] |

#### Block 6.7 — [Inside Registration] Finalize Registration Mode (L1050-L1053)

> Set the result to OK, populate the available phone number field, and set the return code to success.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bodyMap.put(OUT_RESULT, RESULT_OK)` — set result to OK [-> RESULT_OK] |
| 2 | SET | `bodyMap.put(OUT_050_TELNO, JFUBPCommon.nvl(..., JFUStrConst.EMPTY))` — set available phone number with null safety |
| 3 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_0000)` — set success code [-> RETURN_CD_0000] |
| 4 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, null)` — clear error message |

### Block 7 — [CATCH SCCallException] Service Call Error Handling (L1057-L1104)

> When a downstream Service Component (SC) call raises an exception, catch it and map the specific error field to an appropriate business error code. Each error field corresponds to a distinct business rule violation in the telecom option subscription workflow.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isErrorField(param, "upd_dtm_bf_err")` — last update datetime mismatch (排他エラー / pessimistic lock error) [-> L1059] |
| 1.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_3001, "排他エラー"))` — exclusive lock error [-> RES_KEY_ERROR_CODE_3001 = "3001"] |
| 1.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 1.3 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, RETURN_MESSAGE_API_ERROR)` |
| 2 | ELSE-IF | `isErrorField(param, "op_svc_kei_no_err")` — not in a valid contractable state (実行可能な契約状態ではない) [-> L1067] |
| 2.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4001, ...))` [-> 4001] |
| 2.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 3 | ELSE-IF | `isErrorField(param, "op_svc_cd_err")` — already in process with same content (同一内容で既に契約変更手続き中) [-> L1075] |
| 3.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4002, ...))` [-> 4002] |
| 3.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 4 | ELSE-IF | `isErrorField(param, "n_050_op_telno_err")` — 050 number issuance impossible (050番号割り出し不可) [-> L1083] |
| 4.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4003, ...))` [-> 4003] |
| 4.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 5 | ELSE-IF | `isErrorField(param, "ido_rsv_dtl_cd_err")` — option migration reservation exists (オプションの異動予約あり) [-> L1091] |
| 5.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4004, ...))` [-> 4004] |
| 5.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 6 | ELSE-IF | `isErrorField(param, "rsv_aply_ymd_err")` — 050 number application restriction (050ナンバープレスの申請制限あり) [-> L1099] |
| 6.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4008, ...))` [-> 4008] |
| 6.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 7 | ELSE-IF | `isErrorField(param, "op_pack_list_err")` — option pack allocation error (パック割区分設定エラー) [-> L1106] |
| 7.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_4009, ...))` [-> 4009] |
| 7.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 8 | ELSE | default — system error (システムエラー) [-> L1111] |
| 8.1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_5001, ...))` [-> 5001] |
| 8.2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 9 | EXEC | `throw scCallEx` — re-throw the original exception |

### Block 8 — [CATCH CCException] Common Component Error Handling (L1115-L1120)

> When a Common Component (CC) level exception occurs, set error code 5001 (system error) and re-throw.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(ERROR_INFO, getApiErrInfList(RES_KEY_ERROR_CODE_5001, JFUStrConst.EMPTY))` — system error [-> 5001] |
| 2 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, RETURN_CD_5000)` |
| 3 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, RETURN_MESSAGE_API_ERROR)` |
| 4 | EXEC | `throw ccEx` — re-throw the original exception |

### Block 9 — COMPLETION (L1123-L1124)

> Log the end of processing and return the result parameter.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outDebugLog("----- setSaveData End -----")` — end debug log |
| 2 | RETURN | `return param` — return the populated parameter |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `inMap` | Field | Input HashMap — the business data payload extracted from the request parameter, containing all input fields for option subscription/cancellation |
| `bodyMap` | Field | Output body HashMap — nested map within inMap that holds output results including return code, available phone number, and final status |
| `optPackList` | Field | Option pack list (オプションパックリスト) — ArrayList of option pack entries to be processed (e.g., eo Telecom Pack 3, Pack 7) |
| `opSvcMskmList` | Field | Option service subscription/cancellation list (オプションサービス契約申込解約リスト) — ArrayList of option service entries for registration or cancellation |
| `lastUpdDtm` | Field | Last update date/time (最終更新年月日時分秒) — tracks the most recent update timestamp across sequential service contract operations |
| `svc_kei_no` | Field | Service detail number (サービス詳細番号) — internal identifier for a specific service contract line item |
| `svc_kei_ucwk_no` | Field | Service detail work number (サービス詳細作業番号) — tracking number for service detail work operations |
| `svc_kei_kaisen_ucwk_no` | Field | Service detail improvement work number (サービス詳細改良作業番号) — tracking number for service improvement operations |
| `FUNC_CD_2` | Constant | Function code "2" — represents Check Mode (確認モード), where only validation is performed without persisting data |
| `RESULT_OK` | Constant | Result code for success (処理結果: 成功) — indicates the operation completed successfully |
| `RESULT_NG` | Constant | Result code for failure (処理結果: 失敗) — default value indicating the operation did not succeed |
| `RETURN_CD_0000` | Constant | Return code 0000 (返却コード: 正常終了) — indicates successful completion |
| `RETURN_CD_5000` | Constant | Return code 5000 (返却コード: 業務エラー) — indicates an application/business error occurred |
| `CD00002_1` | Constant | Discriminator value "1" — used in multiple contexts (address change in progress, check flag set, VLAN check passed) |
| RES_KEY_ERROR_CODE_4005 | Constant | API error code 4005 — VLAN ID fix error (VLAN確定済チェックエラー) |
| RES_KEY_ERROR_CODE_4006 | Constant | API error code 4006 — address change in progress error (住所変更中エラー) |
| RES_KEY_ERROR_CODE_4007 | Constant | API error code 4007 — option subscription eligibility check failure (電話オプション申込可否チェックエラー) |
| RES_KEY_ERROR_CODE_4001 | Constant | API error code 4001 — not in a valid contractable state (実行可能な契約状態ではない) |
| RES_KEY_ERROR_CODE_4002 | Constant | API error code 4002 — contract change already in progress (同一内容で既に契約変更手続き中) |
| RES_KEY_ERROR_CODE_4003 | Constant | API error code 4003 — 050 number issuance impossible (050番号割り出し不可) |
| RES_KEY_ERROR_CODE_4004 | Constant | API error code 4004 — option migration reservation exists (オプションの異動予約あり) |
| RES_KEY_ERROR_CODE_4008 | Constant | API error code 4008 — 050 number application restriction (050ナンバープレスの申請制限あり) |
| RES_KEY_ERROR_CODE_4009 | Constant | API error code 4009 — option pack allocation setting error (パック割区分設定エラー) |
| RES_KEY_ERROR_CODE_5001 | Constant | API error code 5001 — system error (システムエラー) |
| RES_KEY_ERROR_CODE_3001 | Constant | API error code 3001 — exclusive lock error (排他エラー) |
| SOD | Acronym | Service Order Data (サービスオーダーデータ) — external order fulfillment document created for equipment vendors |
| SOD Issuance | Business term | hakkoSOD (SOD発行処理) — process that creates and submits the SOD document to trigger equipment delivery/installation |
| FTTH | Business term | Fiber To The Home (フレッツ光) — fiber-optic broadband internet service offered by NTT |
| Option Service | Business term | オプションサービス — optional telephony/internet add-on services that customers can subscribe to alongside their base service |
| Option Pack | Business term | オプションパック — bundled packages of multiple option services sold together |
| Sub-Option Service | Business term | サブオプションサービス — secondary/additional option services layered on top of the primary option service |
| Check Mode | Business term | チェックモード (FUNC_CD_2 = "2") — processing mode that validates all business rules without committing data to the database |
| Registration Mode | Business term | 登録モード — processing mode that performs full data registration, including service contract changes and SOD issuance |
| telMskmRelCheckMap | Field | Relationship check map key (住所変更中チェック用) — contains service number, improvement work number, and phone number for relational checks |
| telOpMskmCheckMap | Field | Option subscription check map key — contains system ID, service numbers for eligibility validation |
| Progression Registration | Business term | 進捗登録 — registration of workflow progress tracking data using state code 5112 to distinguish between subscription and cancellation |
| 050 Number | Business term | 050番号 — a telephone number prefix (050-XXXX-XXXX) used for internet-based voice services (VoIP) in Japan |
| adChgUm | Field | Address change status (住所変更状態) — indicates whether the customer is in the process of relocating their address |
| mskmKhFlg | Field | Subscription check flag (申込可否フラグ) — flag indicating whether the customer is eligible to subscribe to the requested option service |
| upd_dtm_bf_err | Field | Update datetime before error key — indicates a pessimistic lock conflict where the record was modified by another user since it was read |
| op_svc_kei_no_err | Field | Option service detail number error key — indicates the customer is not in a valid contractable state |
| op_svc_cd_err | Field | Option service code error key — indicates a contract change with the same content is already in progress |
| op_pack_list_err | Field | Option pack list error key — indicates an error in option pack allocation settings |
| FUSV0334 | Business term | eo Telecom Option Subscription/Cancellation screen — the BPM workflow screen for customers to subscribe to or cancel telecom option services |
| CC | Acronym | Common Component — a shared reusable business logic component in the Fujitsu BPM framework |
| CBS | Acronym | Common Business Service — a service component that handles specific business operations (often wrapping DB operations) |
| SC | Acronym | Service Component — a lower-level business component invoked by CBS or CC for specific data operations |
| KK_T_OPSVKEI_ISP | Entity | Option service detail ISP table — stores option service contract subscription and cancellation records |
| KK_T_SBOPSVKEI_ISP | Entity | Sub-option service detail ISP table — stores sub-option service contract subscription and cancellation records |
| KK_T_SOD | Entity | Service Order Data master table — stores SOD (order fulfillment) documents |
| KK_T_SOD_DTL | Entity | Service Order Data detail table — stores line item details within SOD documents |
| JFUStrConst.EMPTY | Constant | Empty string constant — used as default values for string fields |
| JFUStrConst.CD00002_1 | Constant | Discriminator "1" — value indicating a specific condition state across multiple validation checks |
| BODY_INFO | Constant | Body information map key — key under which bodyMap is stored in inMap |
| OUT_RESULT | Constant | Output result key — key for the processing result field in bodyMap |
| OUT_050_TELNO | Constant | Output 050 phone number key — key for the available phone number in bodyMap |
| ERROR_INFO | Constant | Error information key — key for the error info list in inMap |
| IN_FUNC_CD | Constant | Input function code key — key for the function code that determines Check vs Registration mode |
| IN_LAST_UPD_DTM | Constant | Input last update datetime key — key for the last update timestamp in the input map |
| IN_OPT_PACK_LIST | Constant | Input option pack list key — key for the option pack entries |
| IN_OP_SVC_MSKM_LIST | Constant | Input option service subscription list key — key for the option service entries |
| IN_SYSID | Constant | Input system ID key — key for the system identifier |
| IN_TELNO | Constant | Input telephone number key — key for the customer's phone number |
| IN_SVC_KEI_NO | Constant | Input service number key — key for the service detail number |
| IN_SVC_KEI_UCWK_NO | Constant | Input service work number key — key for the service work number |
| IN_SVC_KEI_KAISEN_UCWK_NO | Constant | Input service improvement work number key — key for the service improvement work number |
