# (DD11) Business Logic — JFUSetVariTsushinKikiMskmCC.setInMapKkOpSvcKeiToroku() [36 LOC]

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

## 1. Role

### JFUSetVariTsushinKikiMskmCC.setInMapKkOpSvcKeiToroku()

This method performs the **upper mapping item setup for Equipment Option Service Contract Registration** (機器オプションサービス契約登録 — *kiki opsiyon saabisu keiyaku toroku*). It is the dedicated data-mapping method responsible for preparing the request payload that will be sent to the EKK2811D010CBS service component for registering a new Equipment Option Service (KkOpSvc) contract line.

The method operates as a **mapping/accumulator pattern** — it does not contain any conditional branches or decision logic. Instead, it takes 12 incoming business parameters (service codes, pricing codes, contract numbers, dates, identifiers) and populates a HashMap with them using well-defined CBS message keys from `EKK2811D010CBSMsg`. This map is then consumed by the calling `executeSC()` method, which dispatches the payload to the backend service.

Within the larger system, this method plays a supporting role in the **Equipment Option Service Contract Registration** flow, which is invoked from `setKkOpSvcKeiToroku()`. The registration process covers two sub-scenarios: (1) Router-based registration (for router functionality) and (2) VA (Value-Added) device registration (for phone function VA devices). The method handles both by accepting the appropriate service code (`kkopSvcCd`), pricing plan codes, and contract identifiers as parameters. Its role is purely data preparation — it does not perform business validation or branching logic; those decisions are made by the caller based on the router type, own-token router kind, and VA configuration.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setInMapKkOpSvcKeiToroku(params)"])
    STEP1["setFuncCode: Set function code FUNC_CD_1 = 1 (Check & Register)"]
    STEP2["Get inMap: param.getData(fixedText) -> HashMap"]
    STEP3["inMap.put(KKOP_SVC_CD, kkopSvcCd)"]
    STEP4["inMap.put(PCRS_CD, pcrsCd)"]
    STEP5["inMap.put(PPLAN_CD, pplanCd)"]
    STEP6["inMap.put(KKTK_SVC_KEI_NO, kktkSvcKeiNo)"]
    STEP7["inMap.put(SYSID, sysId)"]
    STEP8["inMap.put(MSKM_DTL_NO, mskmDtlNo)"]
    STEP9["inMap.put(RSV_APLY_YMD, JCCBPCommon.getOpeDate(null))"]
    STEP10["inMap.put(RSV_APLY_CD, CD00343_2 = 2)"]
    STEP11["inMap.put(IDO_DIV, idoDiv)"]
    STEP12["inMap.put(KIKI_RNTAI_KEI_CHGECHU_FLG, kiki_rntai_kei_chgechu_flg)"]
    STEP13["inMap.put(SEIKY_KEI_NO, seikyKeiNo)"]
    STEP14["inMap.put(UPD_DTM_BF, updDtmBf)"]
    END1["Return / Next"]

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> STEP9
    STEP9 --> STEP10
    STEP10 --> STEP11
    STEP11 --> STEP12
    STEP12 --> STEP13
    STEP13 --> STEP14
    STEP14 --> END1
```

This method follows a **straight-through processing pattern** — it has no conditional branches, no loops, and no decision points. The processing is a sequential 14-step pipeline:

1. **Set function code** — Configures the operation mode to "Check & Register" (FUNC_CD_1 = "1")
2. **Retrieve working map** — Gets the HashMap from the request parameter object using the service message key
3–14. **Populate 12 mapping keys** — Systematically places each business parameter into the map using `EKK2811D010CBSMsg` constant keys as the map keys

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying the working data map. It holds the `inMap` HashMap (retrieved via `getData(fixedText)`) and provides `setData()` for writing response data back to the caller. |
| 2 | `fixedText` | `String` | Service message key / identifier used as the key to retrieve and store the working HashMap within the request parameter object. This is the same key passed to `param.getData(fixedText)` and `param.setData(fixedText, inMap)`. |
| 3 | `kkopSvcCd` | `String` | Equipment Option Service Code — classifies the type of option service being registered. Values include `KK2801_KKOP_SVC_CD_G01` (Router type) and `KK2801_KKOP_SVC_CD_G02` (VA type). Determines whether the registration is for a router or a VA device. |
| 4 | `pcrsCd` | `String` | Pricing Code — the pricing plan code for the Equipment Option Service. For routers: `CD00134_G01` (Wired) or `CD00134_G02` (Wireless). For VA devices: `CD00134_G03` (Phone adapter #1) or `CD00134_G04` (Phone adapter #2). |
| 5 | `pplanCd` | `String` | Pricing Plan Code — the specific plan within the pricing code. E.g., `CD00565_PG0101` (Wired plan), `CD00565_PG0201` (Wireless plan), `CD00565_PG0301` (Phone adapter #1 plan), `CD00565_PG0401` (Phone adapter #2 plan). |
| 6 | `kktkSvcKeiNo` | `String` | Equipment Provider Service Contract Number — the unique identifier for the service contract line under the equipment provider (Kktk) service. This is the parent contract number to which the option service will be linked. |
| 7 | `sysId` | `String` | System ID — identifies the system context for the registration, typically the application or subsystem identifier. Retrieved from `inParamMap.get(IN_PARAM_SYSID)` by the caller. |
| 8 | `mskmDtlNo` | `String` | Application Detail Number — the detail record number of the application/shumoku. Links this option service registration to the specific application line item. |
| 9 | `idoDiv` | `String` | Migration Division — indicates whether this is a new registration, transfer, or modification operation. Passed through to the CBS payload for audit and workflow routing. |
| 10 | `seikyKeiNo` | `String` | Billing Contract Number — the billing contract identifier. Separated into net (`seikyKeiNoNet`) and phone (`seikyKeiNoTel`) in the caller based on whether the registration is for router or VA functionality. |
| 11 | `kiki_rntai_kei_chgechu_flg` | `String` | Equipment Linked Contract Change-in-Progress Flag — indicates whether the equipment-linked contract change is currently in progress. Values: `KK2811_KIKI_RNTAI_KEI_CHGECHU_FLG_0` (not in progress) for router, `KK2811_KIKI_RNTAI_KEI_CHGECHU_FLG_1` (in progress) for VA. |
| 12 | `updDtmBf` | `String` | Update Date-Time Before — the timestamp of the last update prior to this operation. Used for optimistic concurrency control and audit trail. Retrieved from the database or previous processing state by the caller. |

**External state / constants referenced:**
| Constant | Value | Business Meaning |
|----------|-------|------------------|
| `JPCModelConstant.FUNC_CD_1` | `"1"` | Function code for "Check & Register" (チェック＆登録) — sets the operation mode |
| `EKK2811D010CBSMsg.KKOP_SVC_CD` | `"kkop_svc_cd"` | Equipment Option Service Code map key |
| `EKK2811D010CBSMsg.PCRS_CD` | `"pcrs_cd"` | Pricing Code map key |
| `EKK2811D010CBSMsg.PPLAN_CD` | `"pplan_cd"` | Pricing Plan Code map key |
| `EKK2811D010CBSMsg.KKTK_SVC_KEI_NO` | `"kktk_svc_kei_no"` | Equipment Provider Service Contract Number map key |
| `EKK2811D010CBSMsg.SYSID` | `"sysid"` | System ID map key |
| `EKK2811D010CBSMsg.MSKM_DTL_NO` | `"mskm_dtl_no"` | Application Detail Number map key |
| `EKK2811D010CBSMsg.RSV_APLY_YMD` | `"rsv_aply_ymd"` | Reservation Application Date map key |
| `EKK2811D010CBSMsg.RSV_APLY_CD` | `"rsv_aply_cd"` | Reservation Application Code map key |
| `EKK2811D010CBSMsg.IDO_DIV` | `"ido_div"` | Migration Division map key |
| `EKK2811D010CBSMsg.KIKI_RNTAI_KEI_CHGECHU_FLG` | `"kiki_rntai_kei_chgechu_flg"` | Equipment Linked Contract Change-in-Progress Flag map key |
| `EKK2811D010CBSMsg.SEIKY_KEI_NO` | `"seiky_kei_no"` | Billing Contract Number map key |
| `EKK2811D010CBSMsg.UPD_DTM_BF` | `"upd_dtm_bf"` | Update Date-Time Before map key |
| `JFUStrConst.CD00343_2` | `"2"` | Reservation application code value |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JFUBaseCC.setFuncCode` | - | - | Sets function code to "1" (Check & Register) via param data. This is a local helper call, not a database operation. |
| - | `JFUBaseUtil.setFuncCode` | - | - | Sets function code in parameter data via utility delegation. |
| - | `JFUBPCommon.setFuncCode` | - | - | Sets function code in parameter data via BP common delegation. |
| R | `JCCBPCommon.getOpeDate` | - | - | Retrieves the current operation date (運用日付) from the system date, used for the reservation application date field (RSV_APLY_YMD). Returns a date string in YYYYMMDD format. |

### Method call classification:

This method performs **zero CRUD operations** on its own. It is a pure data mapping/accumulation method. All data persistence is delegated to the caller (`setKkOpSvcKeiToroku`), which invokes `executeSC(handle, param, fixedText, ...)` to dispatch the populated map to the backend. The backend CBS component `EKK2811D010CBS` is identified from the message class name `EKK2811D010CBSMsg` used throughout this method.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C (delegated) | `EKK2811D010CBS` | EKK2811D010CBS | KK_T_KKOP_SVC_KEI (Equipment Option Service Contract table) | Registration of a new Equipment Option Service contract line — CREATE operation. The populated map serves as the input payload. |

**Note:** The actual Create operation is NOT performed within this method. This method only prepares the data payload. The caller `setKkOpSvcKeiToroku()` calls `executeSC()` which dispatches the payload to `EKK2811D010CBS` for actual database insertion.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `setKkOpSvcKeiToroku` (private CBS method) | `KKSV0004CBS.kikiOpeSvcKeiTorokuHandle` -> `setKkOpSvcKeiToroku` -> `setInMapKkOpSvcKeiToroku` | `executeSC [C] KK_T_KKOP_SVC_KEI` (EKK2811D010CBS) |

**Direct caller analysis:**
- The only direct caller is `setKkOpSvcKeiToroku(SessionHandle, IRequestParameterReadWrite, String, String, String, String, String, String, String, String, HashMap)`, a private method in the same class `JFUSetVariTsushinKikiMskmCC`.
- `setKkOpSvcKeiToroku` handles the Equipment Option Service Contract Registration processing (機器オプションサービス契約登録処理), orchestrating two sub-registrations: (1) Router registration and (2) VA device registration.

**Caller context — `setKkOpSvcKeiToroku()`:**
The caller performs these steps before each invocation:
1. Reads IN parameters from the request map (SYSID, IDO_DIV, service contract internal detail number, own-token router kind, return equipment number, router function name).
2. Determines pricing code based on whether the router function name matches `ROUTER_KINO_YUSEN` (has router function) — sets wired (`CD00134_G01`) or wireless (`CD00134_G02`) pricing.
3. For non-multi-function routers (or null): calls `setInMapKkOpSvcKeiToroku` with `KK2801_KKOP_SVC_CD_G01` for router registration, then calls `executeSC` to dispatch.
4. For VA devices with phone adapter functionality: calls `setInMapKkOpSvcKeiToroku` with `KK2801_KKOP_SVC_CD_G02` for VA registration using phone-specific pricing codes (`CD00134_G03`/`CD00134_G04`).

**Terminal operations from this method:**
- `setFuncCode` [-] — Local function code setting
- `getOpeDate` [R] — Reads current operation date from system (JCCBPCommon)

## 6. Per-Branch Detail Blocks

This method contains **no conditional branches** (no if/else, no switch/case, no loops). The processing is a linear, deterministic sequence of 14 operations.

**Block 1** — [EXEC/SET SEQUENCE] (L2828)

> This block encompasses the entire method body — a sequential pipeline of function code setup, map retrieval, and 12 map population operations.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `setFuncCode(param, fixedText, JPCModelConstant.FUNC_CD_1)` | Set function code to "1" (チェック＆登録 / Check & Register) [-> FUNC_CD_1="1" (JPCModelConstant.java:29)] |
| 2 | EXEC | `HashMap inMap = (HashMap)param.getData(fixedText)` | Retrieve the working HashMap from the request parameter using the service message key as lookup |
| 3 | SET | `inMap.put(EKK2811D010CBSMsg.KKOP_SVC_CD, kkopSvcCd)` | Store Equipment Option Service Code (機器オプションサービスコード) |
| 4 | SET | `inMap.put(EKK2811D010CBSMsg.PCRS_CD, pcrsCd)` | Store Pricing Code (料金コードコード) |
| 5 | SET | `inMap.put(EKK2811D010CBSMsg.PPLAN_CD, pplanCd)` | Store Pricing Plan Code (料金プランコード) |
| 6 | SET | `inMap.put(EKK2811D010CBSMsg.KKTK_SVC_KEI_NO, kktkSvcKeiNo)` | Store Equipment Provider Service Contract Number (機器提供サービス契約番号) |
| 7 | SET | `inMap.put(EKK2811D010CBSMsg.SYSID, sysId)` | Store System ID |
| 8 | SET | `inMap.put(EKK2811D010CBSMsg.MSKM_DTL_NO, mskmDtlNo)` | Store Application Detail Number (申込明細番号) |
| 9 | SET | `inMap.put(EKK2811D010CBSMsg.RSV_APLY_YMD, JCCBPCommon.getOpeDate(null))` | Store Reservation Application Date (予約適用年月日) — fetched from system operation date |
| 10 | SET | `inMap.put(EKK2811D010CBSMsg.RSV_APLY_CD, JFUStrConst.CD00343_2)` | Store Reservation Application Code (予約適用コード) = "2" [-> CD00343_2 (JFUStrConst)] |
| 11 | SET | `inMap.put(EKK2811D010CBSMsg.IDO_DIV, idoDiv)` | Store Migration Division (異動区分) |
| 12 | SET | `inMap.put(EKK2811D010CBSMsg.KIKI_RNTAI_KEI_CHGECHU_FLG, kiki_rntai_kei_chgechu_flg)` | Store Equipment Linked Contract Change-in-Progress Flag (機器連帯契約変更中フラグ) |
| 13 | SET | `inMap.put(EKK2811D010CBSMsg.SEIKY_KEI_NO, seikyKeiNo)` | Store Billing Contract Number (請求契約番号) |
| 14 | SET | `inMap.put(EKK2811D010CBSMsg.UPD_DTM_BF, updDtmBf)` | Store Update Date-Time Before (更新年月日時分秒＜更新前>) |

**No further blocks** — the method returns void with no conditional logic.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kkopSvcCd` | Field | Equipment Option Service Code — classifies the type of equipment option service being registered (G01 = Router, G02 = VA device) |
| `pcrsCd` | Field | Pricing Code (料金コード) — high-level pricing category: G01=Wired router, G02=Wireless router, G03=Phone adapter #1, G04=Phone adapter #2 |
| `pplanCd` | Field | Pricing Plan Code (料金プランコード) — specific plan within a pricing category: PG0101, PG0201, PG0301, PG0401 |
| `kktkSvcKeiNo` | Field | Equipment Provider Service Contract Number (機器提供サービス契約番号) — the parent service contract line identifier |
| `mskmDtlNo` | Field | Application Detail Number (申込明細番号) — detail record ID linking this registration to the customer application |
| `idoDiv` | Field | Migration Division (異動区分) — operation type code: new registration, transfer, modification, etc. |
| `seikyKeiNo` | Field | Billing Contract Number (請求契約番号) — the billing contract ID for invoicing |
| `kiki_rntai_kei_chgechu_flg` | Field | Equipment Linked Contract Change-in-Progress Flag (機器連帯契約変更中フラグ) — indicates if contract change is in progress (0=not in progress, 1=in progress) |
| `updDtmBf` | Field | Update Date-Time Before (更新年月日時分秒＜更新前>) — previous update timestamp for optimistic concurrency control |
| `fixedText` | Field | Service message identifier — used as the key to store/retrieve working data maps within the request parameter object |
| `inMap` | Field | Working HashMap — the in-memory data structure holding all mapped request parameters for the CBS service call |
| FUNC_CD_1 | Constant | Function Code "1" — チェック＆登録 (Check & Register) mode |
| RSV_APLY_YMD | Field | Reservation Application Date (予約適用年月日) — the date when the reservation/pricing application takes effect |
| RSV_APLY_CD | Field | Reservation Application Code (予約適用コード) — code "2" indicating the reservation application type |
| EKK2811D010CBS | CBS | Equipment Option Service Contract Registration CBS — the backend service component handling CREATE/UPDATE of option service contracts |
| KKOP_SVC_CD | Field | KK Option Service Code map key — key name in the CBS message payload |
| PCRS_CD | Field | Pricing Code map key — key name in the CBS message payload |
| PPLAN_CD | Field | Pricing Plan Code map key — key name in the CBS message payload |
| KKTK_SVC_KEI_NO | Field | KK TK Service Contract Number map key — key name in the CBS message payload |
| SYSID | Field | System ID map key — key name in the CBS message payload |
| MSKM_DTL_NO | Field | Application Detail Number map key — key name in the CBS message payload |
| IDO_DIV | Field | Migration Division map key — key name in the CBS message payload |
| KIKI_RNTAI_KEI_CHGECHU_FLG | Field | Equipment Linked Contract Change-in-Progress Flag map key — key name in the CBS message payload |
| SEIKY_KEI_NO | Field | Billing Contract Number map key — key name in the CBS message payload |
| UPD_DTM_BF | Field | Update Date-Time Before map key — key name in the CBS message payload |
| KK2801_KKOP_SVC_CD_G01 | Constant | Equipment Option Service Code "G01" — Router type service |
| KK2801_KKOP_SVC_CD_G02 | Constant | Equipment Option Service Code "G02" — VA (Value-Added device) type service |
| ROUTER_KINO_YUSEN | Constant | Router function available (ルーター機能有無) — flag indicating whether the customer has a router function |
| OWN_TKN_RT_KIND_0 | Constant | Own token router kind "0" — non-multi-function router classification |
| KK2811_KIKI_RNTAI_KEI_CHGECHU_FLG_0 | Constant | Equipment linked contract change-in-progress flag "0" — not in progress (used for router) |
| KK2811_KIKI_RNTAI_KEI_CHGECHU_FLG_1 | Constant | Equipment linked contract change-in-progress flag "1" — in progress (used for VA device) |
| CD00134_G01 | Constant | Pricing code "G01" — Wired router service |
| CD00134_G02 | Constant | Pricing code "G02" — Wireless router service |
| CD00134_G03 | Constant | Pricing code "G03" — Phone adapter #1 service |
| CD00134_G04 | Constant | Pricing code "G04" — Phone adapter #2 service |
| CD00565_PG0101 | Constant | Pricing plan "PG0101" — Wired router plan |
| CD00565_PG0201 | Constant | Pricing plan "PG0201" — Wireless router plan |
| CD00565_PG0301 | Constant | Pricing plan "PG0301" — Phone adapter #1 plan |
| CD00565_PG0401 | Constant | Pricing plan "PG0401" — Phone adapter #2 plan |
| CD00343_2 | Constant | Reservation application code "2" |
| KkOpSvc | Business term | Equipment Option Service (機器オプションサービス) — optional service add-on for customer equipment (router, VA devices) |
| VA | Business term | Value-Added device — a phone adapter device that provides telephony functionality over IP/fiber |
| CHGECHU | Acronym | 変更中 (Henkou-chu) — "in progress" (of a contract change operation) |
| Kiki | Business term | 機器 (Kiki) — "Equipment" or "Device" — refers to customer-provided or ISP-provided networking equipment |
| Seikyaku | Business term | 契約者 (Seikyaku) — "Contract holder" / "Customer" |
| Shumoku | Business term | 申込 (Shumoku) — "Application" — customer application/registration request |
| Siki | Business term | 機器 (Kiki) — "Equipment" |
| OpeDate | Business term | 運用日付 (Unyoubiatsu) — System operation date, typically today's date used for date-sensitive business operations |
