# Business Logic — JKKTvSvcKeiCourceChgCC.addMkjAddfKeiRvStarCh() [62 LOC]

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

## 1. Role

### JKKTvSvcKeiCourceChgCC.addMkjAddfKeiRvStarCh()

This method registers a **contract reservation that cannot be confirmed at application time** (申込時登録不可契約予約) for a service course change operation. Specifically, it handles the Star Channel (BS digital/BS) option service reservation workflow — when a customer is changing their service course but the Star Channel option contract cannot be confirmed directly at application time, a deferred reservation record is created instead.

The method implements a **two-step service component (SC) invocation pattern**: first querying the current order detail (EKK0021A010) to retrieve metadata such as the detail number and last update timestamp, then submitting a contract reservation record (EKK2931D010) with all necessary parameters including service type codes, pricing codes, and timing configuration. It acts as a **delegation component** that prepares and dispatches data to the underlying CBS layer, with no conditional branching — it follows a linear sequential flow.

The method is designed as a **shared utility** called from the course change processing (`courceChange`) and is invoked whenever a Star Channel option service reservation must be created during a service contract modification. It ensures the reservation carries the correct pricing plan, service codes, and manual reflection flag so the downstream system can process the deferred reservation at the appropriate time.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["addMkjAddfKeiRvStarCh"])

    START --> INIT["Initialize: condMap, mapper, scCall"]
    INIT --> STEP1["Step 1: EKK0021A010 - Order Detail Inquiry"]
    STEP1 --> SET_COND["setEKK0021A010 - Set inquiry conditions from workMap"]
    SET_COND --> RUN1["scCall.run - Execute SC"]
    RUN1 --> GET1["getEKK0021A010 - Retrieve order detail results"]
    GET1 --> CHK1["scResultCheck - Check SC result"]
    CHK1 --> INIT2["Initialize kk2931_d010_map with reservation parameters"]
    INIT2 --> BUILD_PARAMS["Build params: MKJ_ADDF_KEI_RV_SBT_CD=01, MSKM_DTL_NO, SETE_TG_KEI_SKBT_CD=01, SETE_TG_KEI_NO, OP_SVC_CD=B109, PCRS_CD=BB5, PPLAN_CD=PBB501, RSV_KEI_CNT=1, MKJ_ADDF_KEI_RVHNE_WAY_CD=1, MKJ_ADDF_KEI_RVHNE_TMG_CD=02, UPD_DTM_BF"]
    BUILD_PARAMS --> STEP2["Step 2: EKK2931D010 - Contract Reservation Registration"]
    STEP2 --> SET2["setEKK2931D010 - Set reservation data"]
    SET2 --> RUN2["scCall.run - Execute SC"]
    RUN2 --> GET2["getEKK2931D010 - Retrieve registration results"]
    GET2 --> CHK2["scResultCheck - Check SC result"]
    CHK2 --> END(["Return (void)"])

    INIT --> STEP1
    STEP1 --> SET_COND
    SET_COND --> RUN1
    RUN1 --> GET1
    GET1 --> CHK1
    CHK1 --> INIT2
    INIT2 --> BUILD_PARAMS
    BUILD_PARAMS --> STEP2
    STEP2 --> SET2
    SET2 --> RUN2
    RUN2 --> GET2
    GET2 --> CHK2
    CHK2 --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Request parameter interface carrying request/response data for the course change screen. Used by the mapper to serialize/deserialize data between the application layer and the SC layer. |
| 2 | `fixedText` | `String` | Fixed text identifier used to map to screen-specific configuration values (e.g., label text, display constants). Passed through to the mapper for data binding. |
| 3 | `handle` | `SessionHandle` | Session handle containing transaction and connection context (DB connection, SOAP handler context). Passed to `scCall.run()` to establish the CBS call context. |
| 4 | `workMap` | `Map` | Work area map (in-memory working data) carrying intermediate values across the course change processing. Contains `mskm_dtl_no` (order detail number) used as a query condition for the EKK0021A010 inquiry. |
| 5 | `curSvcKeiInfo` | `CAANMsg` | Current service contract message object containing the service contract number (`SVC_KEI_NO`) of the active service contract being modified. Used as the target contract identifier for the reservation. |

**External/instance fields read:** None directly. The method creates local objects including `JKKAdchgMapperCC` (singleton via `getInstance()`), and `ServiceComponentRequestInvoker` (new instance).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKAdchgMapperCC.setEKK0021A010` | EKK0021A010SC | (Order Detail Table) | Sets inquiry parameters for order detail search (EKK0021A010). Maps `mskm_dtl_no` from workMap as a search condition. |
| R | `ServiceComponentRequestInvoker.run` (1st call) | EKK0021A010SC | (Order Detail Table) | Executes the order detail inquiry SC call. Queries existing order detail records to retrieve the `LAST_UPD_DTM` value. |
| R | `JKKAdchgMapperCC.getEKK0021A010` | EKK0021A010SC | (Order Detail Table) | Extracts the inquiry result, including `LAST_UPD_DTM` for use in the reservation data. |
| - | `JKKAdchgMapperCC.scResultCheck` | - | - | Validates the SC call result; throws exception if result indicates failure or error. |
| C | `JKKAdchgMapperCC.setEKK2931D010` | EKK2931D010CBS | Contract Reservation Table | Sets registration parameters for the contract reservation that cannot be confirmed at application time. Populates all reservation fields including service type, pricing, and timing codes. |
| C | `ServiceComponentRequestInvoker.run` (2nd call) | EKK2931D010CBS | Contract Reservation Table | Executes the contract reservation registration SC call. Creates the deferred reservation record. |
| R | `JKKAdchgMapperCC.getEKK2931D010` | EKK2931D010CBS | Contract Reservation Table | Retrieves the registration result from the SC response. |
| - | `JKKAdchgMapperCC.scResultCheck` | - | - | Validates the registration SC call result; throws exception if result indicates failure. |

## 5. Dependency Trace

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `scResultCheck` [-], `getEKK2931D010` [R], `run` [-], `run` [-], `run` [-], `run` [-], `run` [-], `setEKK2931D010` [-], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `scResultCheck` [-], `getEKK0021A010` [R], `run` [-], `run` [-], `run` [-], `run` [-], `run` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: `courceChange` (JKKTvSvcKeiCourceChgCC) | `courceChange` -> `addMkjAddfKeiRvStarCh` | `scResultCheck` [-], `getEKK2931D010` [R], `run` [C] EKK2931D010CBS (Contract Reservation), `run` [R] EKK0021A010SC (Order Detail), `setEKK2931D010` [C], `getEKK0021A010` [R] |

## 6. Per-Branch Detail Blocks

**Block 1** — PROCESSING (Initialization) (L638)

> Initializes local variables and obtains singleton/cache instances for the mapper and SC request invoker.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `condMap = new HashMap<String, String>()` | Creates condition map for SC query conditions |
| 2 | SET | `reqMap` (uninitialized) | Declares request map for SC call |
| 3 | SET | `resMap` (uninitialized) | Declares response map for SC call |
| 4 | EXEC | `JKKAdchgMapperCC mapper = JKKAdchgMapperCC.getInstance()` | Gets mapper instance (住所変更登録コミコン mapping utility) — Location Change Registration Component Mapper |
| 5 | SET | `scCall = new ServiceComponentRequestInvoker()` | Creates new SC request invoker for CBS calls |

**Block 2** — PROCESSING (Step 1: EKK0021A010 — Order Detail Inquiry) (L645)

> Queries the existing order detail record to obtain metadata (detail number, last update timestamp). This is used as a precondition for the reservation registration.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `condMap.clear()` | Clears condition map for fresh use |
| 2 | SET | `condMap.put(JKKAdchgMapperCC.COND_KEY_MSKM_DTL_NO, (String)workMap.get("mskm_dtl_no"))` | Sets order detail number as search key from workMap |
| 3 | SET | `reqMap = mapper.setEKK0021A010(param, fixedText, condMap)` | Sets inquiry parameters for EKK0021A010 SC call |
| 4 | SET | `resMap = scCall.run(reqMap, handle)` | Executes the order detail inquiry SC call |
| 5 | SET | `kk0021_a010 = mapper.getEKK0021A010(param, fixedText, resMap)` | Retrieves order detail result into map |
| 6 | EXEC | `mapper.scResultCheck(param)` | Checks SC result — throws exception on error (申込明細照会結果チェック — Order Detail Inquiry Result Check) |

**Block 3** — PROCESSING (Step 2: EKK2931D010 — Contract Reservation Data Building) (L651)

> Builds the contract reservation data map with all required fields. This reservation represents a **Star Channel option service** that cannot be confirmed at application time.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `kk2931_d010_map = new HashMap<String, Object>()` | Creates reservation data map |
| 2 | SET | `kk2931_d010_map.put(MKJ_ADDF_KEI_RV_SBT_CD, "01")` | Contract reservation type code = "01" (デジタル・BS スターチャンネルセット / Digital BS Star Channel Set) [-> MKJ_ADDF_KEI_RV_SBT_CD_01="01"] |
| 3 | SET | `kk2931_d010_map.put(MSKM_DTL_NO, workMap.get("mskm_dtl_no"))` | Order detail number from workMap |
| 4 | SET | `kk2931_d010_map.put(SETE_TG_KEI_SKBT_CD, "01")` | Target contract identification code = "01" (サービス契約 / Service Contract) [-> SETE_TG_KEI_SKBT_CD_SVC_KEI="01"] |
| 5 | SET | `kk2931_d010_map.put(SETE_TG_KEI_NO, curSvcKeiInfo.getString(SVC_KEI_NO))` | Service contract number from current service info — 設定対象契約番号 (Target Contract Number) |
| 6 | SET | `kk2931_d010_map.put(OP_SVC_CD, "B109")` | Option service code = "B109" (オプションサービスコード スターチャンネル) [-> OP_SVC_CD_STACH="B109"] |
| 7 | SET | `kk2931_d010_map.put(PCRS_CD, "BB5")` | Fee code = "BB5" (料金コードサービスコード：スターチャンネル / Fee Code: Star Channel) [-> BB5_STACH="BB5"] |
| 8 | SET | `kk2931_d010_map.put(PPLAN_CD, "PBB501")` | Fee plan code = "PBB501" [-> PBB501="PBB501"] |
| 9 | SET | `kk2931_d010_map.put(RSV_KEI_CNT, "1")` | Reservation contract count = "1" (予約契約数 / Reservation Contract Count) |
| 10 | SET | `kk2931_d010_map.put(MKJ_ADDF_KEI_RVHNE_WAY_CD, "1")` | Reflection method = "1" (手動反映 / Manual Reflection) [-> MKJ_ADDF_KEI_RVHNE_WAY_CD_SYUDO="1"] |
| 11 | SET | `kk2931_d010_map.put(MKJ_ADDF_KEI_RVHNE_TMG_CD, "02")` | Timing code = "02" (設定対象契約サービス変更完了 / Target Contract Service Change Completion) [-> MKJ_ADDF_KEI_RVHNE_TMG_CD_CRS_CHG="02"] |
| 12 | SET | `kk2931_d010_map.put(UPD_DTM_BF, kk0021_a010.get(LAST_UPD_DTM))` | Pre-update timestamp from order detail inquiry result (更新年月日時分秒(更新前) / Update datetime before modification) |

**Block 4** — PROCESSING (EKK2931D010 — Contract Reservation Registration) (L681)

> Executes the contract reservation registration SC call, registering the deferred Star Channel reservation into the system.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `reqMap = mapper.setEKK2931D010(param, fixedText, kk2931_d010_map)` | Sets registration parameters for EKK2931D010 SC call (申込時登録不可契約予約登録 — Unregisterable Contract Reservation Registration) |
| 2 | SET | `resMap = scCall.run(reqMap, handle)` | Executes the contract reservation registration SC call |
| 3 | EXEC | `mapper.getEKK2931D010(param, fixedText, resMap)` | Retrieves registration result from SC response |
| 4 | EXEC | `mapper.scResultCheck(param)` | Checks SC result — throws exception on error |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `addMkjAddfKeiRvStarCh` | Method | Add unregistrable contract reservation Star Channel — registers a deferred Star Channel option contract reservation during service course change |
| `mskm_dtl_no` | Field | Order detail number — unique identifier for a specific line item within an order |
| `mkj_addf_kei_rv_sbt_cd` | Field | Contract reservation subtype code — classifies the type of unregistrable contract reservation ("01" = Digital BS Star Channel Set) |
| `sete_tg_kei_skbt_cd` | Field | Set target contract subtype code — identifies the target contract type ("01" = Service Contract) |
| `sete_tg_kei_no` | Field | Set target contract number — the service contract number being modified |
| `op_svc_cd` | Field | Option service code — identifies the optional service ("B109" = Star Channel BS Pass-through) |
| `pcrs_cd` | Field | Price code — fee schedule code ("BB5" = Star Channel pricing) |
| `pplan_cd` | Field | Price plan code — pricing plan identifier ("PBB501") |
| `rsv_kei_cnt` | Field | Reservation contract count — number of contracts in the reservation ("1") |
| `mkj_addf_kei_rvhne_way_cd` | Field | Unregistrable contract reservation reflection method code — how the deferred reservation is applied ("1" = Manual Reflection) |
| `mkj_addf_kei_rvhne_tmg_cd` | Field | Unregistrable contract reservation reflection timing code — when to process the deferred reservation ("02" = Target Contract Service Change Completion) |
| `upd_dtm_bf` | Field | Update datetime before — timestamp snapshot before modification, taken from the order detail inquiry |
| `last_upd_dtm` | Field | Last update datetime — the timestamp of the most recent modification to the order detail record |
| EKK0021A010 | SC Code | Order detail inquiry service component — retrieves existing order detail records |
| EKK2931D010 | SC Code | Unregistrable contract reservation registration service component — registers deferred contract reservations |
| Star Channel | Business term | Japanese premium satellite TV channel service — offered as an optional add-on to broadband TV subscriptions |
| スターチャンネル | Japanese term | Star Channel — the Japanese name for the premium satellite broadcasting service |
| 申込時登録不可 | Japanese term | Unregistrable at application time — contract items that cannot be confirmed at the time of application and require deferred/sequential processing |
| 契約予約 | Japanese term | Contract reservation — a pending reservation for a service contract that will be activated at a future timing |
| 住所変更 | Japanese term | Address change — the broader course change operation context during which this method operates |
| スターチャンネルセット | Japanese term | Star Channel Set — the digital/BS version of the Star Channel option package |
| 手動反映 | Japanese term | Manual reflection — the deferred reservation requires manual processing/approval rather than automatic application |
| サービス変更完了 | Japanese term | Service change completion — the timing event that triggers the deferred reservation processing |
| CBS | Acronym | CBS (Common Business System) — backend enterprise system providing business services |
| SC | Acronym | Service Component — a unit of business logic invoked via the service component framework |
| CAANMsg | Type | CAAN Message — a message/object carrying structured business data between layers |
| SessionHandle | Type | Session Handle — context object carrying transaction/session information for CBS calls |
| IRequestParameterReadWrite | Interface | Request Parameter Interface — interface for request/response data exchange in the screen framework |
| EOO HIKARI TV | Business term | E&O HIKARI TV — NTT's fiber optic TV service, the parent service to which Star Channel is an option |
| BS | Business term | Broadcast Satellite — satellite broadcasting tier for digital TV |
