# Business Logic — JKKAdchgTelInfoChgCC.idoRsv() [95 LOC]

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

## 1. Role

### JKKAdchgTelInfoChgCC.idoRsv()

The `idoRsv()` method manages pending reservations (deferred contract changes) for phone service cost plans during address change registration. In the K-Opticom residential information change system, certain service plan modifications cannot take effect immediately and must be registered as pending reservations that are applied later. Specifically, this method handles **price plan number changes** — when a customer transitions between plan A32 and plan A31 (or vice versa), it first cancels any prior pending reservation via `idoRsvCncl()`, then builds and executes a new **Service Contract Price Plan Change** request (SC Code: EKK0081C110). The method uses a routing/dispatch design pattern, branching on the service change division code to early-return for "Add" operations (which do not create pending reservations), early-returning when required price plan data is missing, and proceeding with the change workflow only when a genuine plan number transition is detected. It is a shared component called by `telInfoChg()` within the KKSV0725 address change screen flow, serving as the final step in the phone number information change process.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> GET_PARAM["Get request parameters via getRequestParameter"]
    GET_PARAM --> GET_USE_SVC["Extract use_svc_chg_div"]
    GET_USE_SVC --> CD00849_3_CHECK{CD00849_ADD equals 3}

    CD00849_3_CHECK -->|"Add"| RETURN_EARLY_1["return"]
    CD00849_3_CHECK -->|"not Add"| NULL_CHECK{reg_pplan_cd or pplan_cd empty}

    NULL_CHECK -->|"Yes"| RETURN_EARLY_2["return"]
    NULL_CHECK -->|"No"| INIT_COMPONENTS["Initialize mapper, lclCmnLogic, scCall"]

    INIT_COMPONENTS --> PLAN_COMPARE{Price plan number changed}

    PLAN_COMPARE -->|"A32 to A31 or A31 to A32"| CHANGE_BRANCH["Handle number change branch"]

    PLAN_COMPARE -->|"No change"| END_NODE(["Return"])

    CHANGE_BRANCH --> IDO_RSV_CNCL["idoRsvCncl: Cancel prior pending reservation"]
    IDO_RSV_CNCL --> GET_EKK0081A010["lclCmnLogic.getEKK0081A010: Fetch service contract agreement"]
    GET_EKK0081A010 --> EXTRACT_TK_HOSHIKI["Extract tk_hoshiki_kei_no_bf"]
    EXTRACT_TK_HOSHIKI --> TK_COMPARE{tk_hoshiki_kei_no_bf different from tk_hoshiki_kei_no}

    TK_COMPARE -->|"Different"| SET_IS_CHG_TRUE["isChg = true"]
    TK_COMPARE -->|"Same"| SET_IS_CHG_FALSE["isChg = false"]

    SET_IS_CHG_TRUE --> IS_CHG_CHECK{isChg equals true}
    SET_IS_CHG_FALSE --> IS_CHG_CHECK

    IS_CHG_CHECK -->|"No"| END_NODE
    IS_CHG_CHECK -->|"Yes"| MAP_PUT_SECTION["Update kk0081_a010_map with parameters"]

    MAP_PUT_SECTION --> SET_EKK0081C110["mapper.setEKK0081C110: Build request"]
    SET_EKK0081C110 --> SC_CALL_RUN["scCall.run: Execute service component call"]
    SC_CALL_RUN --> GET_EKK0081C110_2["mapper.getEKK0081C110: Parse response"]
    GET_EKK0081C110_2 --> SC_RESULT_CHECK["mapper.scResultCheck: Verify result"]
    SC_RESULT_CHECK --> END_NODE
```

**CRITICAL — Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `CD00849_ADD` | `"3"` | Address change processing type: Add (new addition, not eligible for pending reservation) |
| `IDO_DIV_ADCHG_RGST` | `"00019"` | Migration division: Address change / Registration |
| `DEFAULT_RSV_APLY_YMD` | `"20991231"` | Reservation application date — set to far-future default (2099-12-31) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | `idoRsv()` is a private no-arg method. It retrieves its data from the session-bound request parameter map via `getRequestParameter()`, which is populated by the calling `telInfoChg()` method with phone service change context data. |

**Instance fields / external state read:**

| Source | Field | Business Description |
|--------|-------|---------------------|
| `getRequestParameter()` | `use_svc_chg_div` | Service change division code — indicates whether this is a keep, change, hold, add, or cancellation operation |
| `getRequestParameter()` | `svc_kei_no` | Service contract number — unique identifier for the customer's service contract line |
| `getRequestParameter()` | `tk_hoshiki_kei_no` | Provider format contract number — the phone number associated with the service contract (changes when plan number changes between A31/A32) |
| `getRequestParameter()` | `mskm_dtl_no` | Application detail number — internal tracking ID for the service contract detail line item (phone) |
| `getRequestParameter()` | `prc_grp_cd` | Price group code — e.g., eo Light Network Home Type, eo Light Network Mansion Type |
| `getRequestParameter()` | `pcrs_cd` | Price code — specific pricing tier within the price group |
| `getRequestParameter()` | `pplan_cd` | Price plan code — the new/current service price plan number (e.g., A31) |
| `getRequestParameter()` | `reg_pplan_cd` | Previous price plan code — the prior service price plan number (e.g., A32) |
| Session | `keepSesHandle` | Session handle — database connection / context for the current transaction |
| Session | `keepReqParam` | Request parameter read-write interface — carries request/response data through the processing chain |
| Session | `keepFixedText` | Fixed text bundle — localized error messages and display strings |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKAdchgMapperCC.getInstance` | JKKAdchgMapperCC | - | Singleton mapper instance for service contract change operations |
| R | `JKKAdchgCmnLogicCC` | JKKAdchgCmnLogicCC | - | Common logic component for service contract agreement queries |
| - | `JKKAdchgCmnLogicCC.getEKK0081A010` | EKK0081A010SC | KK_T_SVC_KEI (Service Contract) | Fetches service contract agreement data by service contract number to retrieve the provider format contract number (phone number) |
| R | `ServiceComponentRequestInvoker` | - | - | Creates SC request invoker for executing service component calls |
| R | `JKKIdoRsvCnclCC.getInstance` | JKKIdoRsvCnclCC | - | Used indirectly in idoRsvCncl — cancellation handling for pending reservations |
| - | `JKKIdoRsvCnclCC.cancelIdoRsvBySvcKeiNo` | - | KK_T_IDO_RSV (Pending Reservation) | Cancels prior pending reservation by service contract number (called within `idoRsvCncl` helper) |
| C | `JKKAdchgMapperCC.setEKK0081C110` | EKK0081C110SC | KK_T_SVC_KEI_PPLAN (Service Contract Price Plan) | Registers new service contract price plan change pending reservation |
| - | `ServiceComponentRequestInvoker.run` | EKK0081C110CBS | KK_T_SVC_KEI_PPLAN (Service Contract Price Plan) | Executes the price plan change service component business logic |
| R | `JKKAdchgMapperCC.getEKK0081C110` | EKK0081C110SC | KK_T_SVC_KEI_PPLAN (Service Contract Price Plan) | Reads back the result of the price plan change operation |
| - | `JKKAdchgMapperCC.scResultCheck` | - | - | Validates the SC response and throws on error if status is not success |

**CRUD Summary:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `lclCmnLogic.getEKK0081A010` | EKK0081A010SC | KK_T_SVC_KEI | Read service contract agreement to extract prior provider format contract number (tk_hoshiki_kei_no_bf) |
| D | `idoRsvCncl` -> `cancelIdoRsvBySvcKeiNo` | - | KK_T_IDO_RSV | Delete prior pending reservation for the service contract number |
| C | `mapper.setEKK0081C110` -> `scCall.run` | EKK0081C110SC | KK_T_SVC_KEI_PPLAN | Create new service contract price plan change pending reservation |
| R | `mapper.getEKK0081C110` | EKK0081C110SC | KK_T_SVC_KEI_PPLAN | Read price plan change result for verification |
| - | `mapper.scResultCheck` | - | - | Result validation check |

## 5. Dependency Trace

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `scResultCheck` [-], `getEKK0081C110` [R], `run` [-], `run` [-], `getEKK0081A010` [R], `idoRsvCncl` [-], `getInstance` [R], `getInstance` [R], `getRequestParameter` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0725 | `KKSV0725OPOperation` -> target83 (`KKAdchgTelInfoChgCC.telInfoChg`) -> `idoRsv()` | `getEKK0081A010 [R] KK_T_SVC_KEI`, `cancelIdoRsvBySvcKeiNo [D] KK_T_IDO_RSV`, `setEKK0081C110 [C] KK_T_SVC_KEI_PPLAN` |

**Caller details:**

| # | Caller Class | Call Chain | Context |
|---|-------------|------------|---------|
| 1 | `KKSV0725OPOperation` (Screen KKSV0725) | `KKSV0725OPOperation.execute` -> `target83.run()` -> `JKKAdchgTelInfoChgCC.telInfoChg()` -> `idoRsv()` | KKSV0725 is the residential change (address change) registration screen. `telInfoChg()` processes phone number information changes as part of the address change flow. `idoRsv()` is called as the final step to update pending reservations after all other phone info processing (service contract detail clearing, modification, appending) is complete. |

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(useSvcChgDiv equals CD00849_ADD="3")` (L2725)

> When the service change division is "Add", no pending reservation should be registered. This is a guard clause that returns early for add-only operations.

| # | Type | Code |
|---|------|------|
| 1 | SET | `useSvcChgDiv = (String) param.get("use_svc_chg_div")` // Extract service change division from request params |
| 2 | IF | `JKKAdchgConstCC.CD00849_ADD.equals(useSvcChgDiv)` // CD00849_ADD = "3" (Add) [-> "3"] |
| 3 | RETURN | `return;` // No pending reservation for Add operations |

**Block 2** — [IF] `(reg_pplan_cd is empty OR pplan_cd is empty)` (L2735)

> Both the previous price plan code and the new price plan code must be present to proceed with a plan change. If either is null or blank, this is not a valid plan change scenario, so return early.

| # | Type | Code |
|---|------|------|
| 1 | IF | `StringUtils.isEmpty(reg_pplan_cd) || StringUtils.isEmpty(pplan_cd)` // Both must be non-empty |
| 2 | RETURN | `return;` // Guard clause — cannot process without price plan data |

**Block 3** — [PROCESS] Initialize components (L2740–L2744)

> Prepare the mapper, common logic, and SC request invoker for the service contract change workflow.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapper = JKKAdchgMapperCC.getInstance()` // Get singleton mapper instance |
| 2 | SET | `lclCmnLogic = new JKKAdchgCmnLogicCC(keepSesHandle.get())` // Common logic with session handle |
| 3 | SET | `scCall = new ServiceComponentRequestInvoker()` // SC request invoker for CBS calls |

**Block 4** — [IF] `(Price plan number changed)` (L2748–L2753)

> Detects plan number transitions between A32 and A31. A31/A32 are specific price plan codes in the K-Opticom system. When a customer changes between these two plans, the phone number (provider format contract number) also changes, requiring cancellation of any prior pending reservation and creation of a new one.

| # | Type | Code |
|---|------|------|
| 1 | IF | `(reg_pplan_cd.indexOf("A32") > -1 && pplan_cd.indexOf("A31") > -1)` // Previous plan was A32, new plan is A31 |
| 2 | IF | `(reg_pplan_cd.indexOf("A31") > -1 && pplan_cd.indexOf("A32") > -1)` // Previous plan was A31, new plan is A32 |

**Block 4.1** — [NESTED] Cancel prior pending reservation and build new one (L2750–L2795)

> Within the price plan change branch: first cancel any existing pending reservation, then fetch the service contract agreement, compare the provider format contract number, and if it differs, execute a new service contract price plan change.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `idoRsvCncl(svcKeiNo, mskm_dtl_no)` // Cancel prior pending reservation (L2750) |
| 2 | CALL | `lclCmnLogic.getEKK0081A010(keepReqParam.get(), mapper, keepFixedText.get(), scCall, svcKeiNo, JKKAdchgConstCC.DEFAULT_RSV_APLY_YMD)` // Fetch service contract agreement (L2753) |
| 3 | SET | `kk0081_a010_map = lclCmnLogic.getEKK0081A010(...)` // Result map with prior provider format contract number |
| 4 | SET | `tk_hoshiki_kei_no_bf = (String) kk0081_a010_map.get(EKK0081A010CBSMsg1List.TK_HOSHIKI_KEI_NO)` // Extract prior phone number (L2754) |

**Block 4.1.1** — [IF] `(tk_hoshiki_kei_no_bf != tk_hoshiki_kei_no)` (L2758)

> The provider format contract number (phone number) differs between prior and current state. Since a phone number cost change means there is a change in the prior and posterior, `isChg` is set to true.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!tk_hoshiki_kei_no_bf.equals(tk_hoshiki_kei_no)` // Prior phone number differs from current |
| 2 | SET | `isChg = true` // Phone cost change exists — prior and posterior differ |
| 3 | ELSE | `isChg = false` // No difference detected |

**Block 4.1.2** — [IF] `(isChg == true)` (L2768)

> Only proceed with price plan change registration if a genuine change is detected.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isChg` // True when prior and current phone numbers differ |
| 2 | SET | `kk0081_a010_map.put(EKK0081A010CBSMsg1List.MSKM_DTL_NO, mskm_dtl_no)` // Replace detail number |
| 3 | SET | `kk0081_a010_map.put(EKK0081A010CBSMsg1List.IDO_DIV, JKKAdchgConstCC.IDO_DIV_ADCHG_RGST)` // Migration division: Address change/Registration [-> "00019"] |
| 4 | SET | `kk0081_a010_map.put(EKK0081A010CBSMsg1List.TK_HOSHIKI_KEI_NO, tk_hoshiki_kei_no)` // Replace provider format contract number |
| 5 | SET | `kk0081_a010_map.put(EKK0081A010CBSMsg1List.PRC_GRP_CD, prc_grp_cd)` // Price group code |
| 6 | SET | `kk0081_a010_map.put(EKK0081A010CBSMsg1List.PCRS_CD, pcrs_cd)` // Price code |
| 7 | SET | `kk0081_a010_map.put(EKK0081A010CBSMsg1List.PPLAN_CD, pplan_cd)` // New price plan code |
| 8 | SET | `kk0081_a010_map.put(EKK0081A010CBSMsg1List.RSV_APLY_YMD, JKKAdchgConstCC.DEFAULT_RSV_APLY_YMD)` // Reservation application date [-> "20991231"] |
| 9 | SET | `kk0081_a010_map.put(JKKAdchgMapperCC.UPD_DT_SVC_KEI_UPD_DTM_BEF, (String) kk0081_a010_map.get(EKK0081A010CBSMsg1List.LAST_UPD_DTM))` // Last update datetime backup |
| 10 | CALL | `reqMap = mapper.setEKK0081C110(keepReqParam.get(), keepFixedText.get(), kk0081_a010_map)` // Build SC request (L2786) |
| 11 | EXEC | `resMap = scCall.run(reqMap, keepSesHandle.get())` // Execute service component call (L2787) |
| 12 | CALL | `kk0081_c110_map = mapper.getEKK0081C110(keepReqParam.get(), keepFixedText.get(), resMap)` // Parse response (L2788) |
| 13 | EXEC | `mapper.scResultCheck(keepReqParam.get())` // Verify SC result (L2789) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsv` | Field | Pending reservation — a deferred contract change that takes effect at a future date rather than immediately |
| `ido_div` | Field | Migration division — classifies the type of contract change operation (e.g., address change registration, address change confirmation) |
| `IDO_DIV_ADCHG_RGST` | Constant | Migration division code "00019" — Address change / Registration |
| `IDO_DIV_ADCHG_FIX` | Constant | Migration division code "00020" — Address change / Confirmation |
| `use_svc_chg_div` | Field | Service change division — indicates whether the operation is a keep (0), change (1), hold (2), add (3), cancellation (4), or no-contract (5) |
| `CD00849_ADD` | Constant | Address change processing type code "3" — Add (new addition) |
| `svc_kei_no` | Field | Service contract number — unique identifier for a customer's service contract line |
| `svc_kei_ucwk_no` | Field | Service detail work number — internal tracking ID for service contract line items |
| `tk_hoshiki_kei_no` | Field | Provider format contract number — the actual phone number assigned to a service contract (changes during plan transitions) |
| `mskm_dtl_no` | Field | Application detail number — internal tracking ID for the service contract detail line item (phone) |
| `prc_grp_cd` | Field | Price group code — broad pricing category (e.g., eo Light Network Home Type, eo Light Network Mansion Type) |
| `pcrs_cd` | Field | Price code — specific pricing tier within a price group |
| `pplan_cd` | Field | Price plan code — the current/new service price plan number (e.g., A31) |
| `reg_pplan_cd` | Field | Previous price plan code — the prior service price plan number (e.g., A32) |
| A31 / A32 | Business term | Price plan codes — specific service tiers in the K-Opticom plan catalog. Transitioning between A31 and A32 triggers a phone number change. |
| `DEFAULT_RSV_APLY_YMD` | Constant | Default reservation application date "20991231" — far-future sentinel date used when no specific effective date is set |
| `EKK0081A010` | SC Code | Service Contract Agreement inquiry — fetches the current state of a service contract including the provider format contract number |
| `EKK0081C110` | SC Code | Service Contract Price Plan Change — registers a new price plan change as a pending reservation |
| KK_T_SVC_KEI | DB Table | Service contract master table — stores primary service contract information |
| KK_T_SVC_KEI_PPLAN | DB Table | Service contract price plan table — stores price plan assignments for service contracts |
| KK_T_IDO_RSV | DB Table | Pending reservation table — stores deferred contract changes awaiting application |
| KKSV0725 | Screen | Residential change (address change) registration screen — the customer-facing screen where customers update their registered address |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity used for service change records |
| SC | Acronym | Service Component — backend business logic module that performs CRUD operations on database entities |
| CBS | Acronym | Central Business System — the core billing and service management system |
| CC | Acronym | Common Component — reusable Java component class in the K-Opticom framework (extends AbstractCommonComponent) |
| ServiceComponentRequestInvoker | Class | Invoker for executing SC (Service Component) calls from within CC components |
