# Business Logic — JKKKojiChgPlaceNoCC.htelNoInfoChgeOdrCtrl() [92 LOC]

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

## 1. Role

### JKKKojiChgPlaceNoCC.htelNoInfoChgeOdrCtrl()

This method implements the **home address bulk update order control processing** (住所一括更新オーダ制御処理). It orchestrates the creation of a service contract line item for an emergency notification/change scenario when a telephone number is being updated as part of a home address change operation. The method acts as a **dispatch/routing gate** — it first checks whether a Z1 (primary) order has already been issued for the given service contract line. If the Z1 order has NOT yet been sent, the method proceeds to generate a cascading set of three service component calls (EKK1081C011, EKK1081D010, and EKK1551D010) that collectively register the order information conditions, the order details themselves, and the order creation work data under the emergency change service type. If the Z1 order HAS already been sent, the method skips all processing and returns the unchanged `param`, because the Z1 path already handles the necessary updates (Z1未処理の場合はZ1に乗り替えるので変更不要 / "For unprocessed Z1, delegation to the Z1 path means no change is needed"). This method is called by `execSvckeiEmgUpd()` within the same class, which is invoked by the KKSV0150 business process screen, making this method a shared business component used during emergency service contract updates tied to home address changes.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["htelNoInfoChgeOdrCtrl"])
    EXTRACT_KEY["Extract svc_kei_no from svcKeiMsg"]
    EXTRACT_UCWK["Extract svc_kei_ucwk_no from svcUcwkMsg"]
    CHECK_Z1["findZ1OrderHasBeenSent"]
    Z1_BRANCH{"Z1 order
already sent?"}
    EKK1081C_IN["Build ekk1081c011IN: TEMPLATE_ID_EKK1081C011, FUNC_CODE=1"]
    EKK1081C_CALL["callSC: EKK1081C011 - Order Info Condition Registration"]
    EKK1081D_IN["Build ekk1081d010IN: TEMPLATE_ID_EKK1081D010, FUNC_CODE=1"]
    EKK1081D_CALL["callSC: EKK1081D010 - Order Info Registration"]
    EKK1551D_IN["Build ekk1551d010IN: TEMPLATE_ID_EKK1551D010, FUNC_CODE=1, ODR_NAIYO_CD=251"]
    EKK1551D_CALL["callSC: EKK1551D010 - Order Info Creation Work Registration"]
    RETURN["Return param"]
    END_NODE(["End"])

    START --> EXTRACT_KEY
    EXTRACT_KEY --> EXTRACT_UCWK
    EXTRACT_UCWK --> CHECK_Z1
    CHECK_Z1 --> Z1_BRANCH
    Z1_BRANCH -->|true| EKK1081C_IN
    Z1_BRANCH -->|false| RETURN
    EKK1081C_IN --> EKK1081C_CALL
    EKK1081C_CALL --> EKK1081D_IN
    EKK1081D_IN --> EKK1081D_CALL
    EKK1081D_CALL --> EKK1551D_IN
    EKK1551D_IN --> EKK1551D_CALL
    EKK1551D_CALL --> RETURN
    RETURN --> END_NODE
```

**CRITICAL — Constant Resolution:**

| Constant Name | Resolved Value | Business Meaning |
|--------------|---------------|-----------------|
| `TEMPLATE_ID_EKK1081C011` | `"EKK1081C011"` | Template ID for Order Information Condition Registration (EKK1081C011) |
| `FUNC_CODE` (hardcoded) | `"1"` | Function code — fixed at 1 for this processing path |
| `ORDER_SBT_CD_RMG` | `"4"` | Order subtype code — Emergency Notification (緊急通報) |
| `SVC_ORDER_CD_EMG` | `"24"` | Service order code — Emergency Notification (緊急通報) |
| `YOKYU_SBT_CD_CHG` | `"04"` | Request subtype code — Change (変更) |
| `ODR_HAKKO_JOKEN_CD_SOKJI_HAKKO` | `"01"` | Order issuance condition code — Provisional Issuance (素地発行) |
| `TEMPLATE_ID_EKK1081D010` | `"EKK1081D010"` | Template ID for Order Information Registration (EKK1081D010) |
| `TEMPLATE_ID_EKK1551D010` | `"EKK1551D010"` | Template ID for Order Info Creation Work Registration (EKK1551D010) |
| `ODR_NAIYO_CD_251` | `"251"` | Order content code — Home Address Change (住所変更) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle carrying the session context (e.g., database connection, user identity, transaction scope) for all service component invocations within this business operation. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service component call invoker — the intermediary used to dispatch SC (Service Component) requests to backend CBS (Core Business System) services. |
| 3 | `param` | `IRequestParameterReadWrite` | Parameter object containing the model group and control map; used to pass business data and system-level control metadata throughout the processing chain. |
| 4 | `fixedText` | `String` | User-defined arbitrary text string, typically used as a fixed descriptor or identifier attached to the order for traceability. |
| 5 | `svcKeiMsg` | `CAANMsg` | Service contract message object containing the service key number (`SVC_KEI_NO`) and the generation/addition timestamp (`GENE_ADD_DTM`) for the service contract line item. |
| 6 | `svcUcwkMsg` | `CAANMsg` | Service detail work message object containing the service detail work number (`SVC_KEI_UCWK_NO`) — the internal tracking ID for service contract line items. |
| 7 | `svc_kei_ucwk_gadtm` | `String` | Service detail work generation/addition timestamp — the timestamp when this service detail work record was created or last modified. |

**External state / instance fields used:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `TEMPLATE_ID_EKK1081C011` | `String` (private static final) | Constant template ID for the EKK1081C011 CBS service, hardcoded as `"EKK1081C011"`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `findZ1OrderHasBeenSent` | JKKKojiChgPlaceNoCC | - | Checks whether a Z1 (primary) order has already been sent for this service contract line item. Used as a gating condition. |
| C | `callSC` | EKK1081C011 | (Order Info Condition Registration) | Calls EKK1081C011 CBS with FUNC_CODE="1". Registers order information conditions and returns a `SAME_TRN_NO` (same transaction number) for correlation. |
| C | `callSC` | EKK1081D010 | (Order Information Registration) | Calls EKK1081D010 CBS with FUNC_CODE="1". Registers order details including order subtype (EMG="4"), service order code (EMG="24"), request subtype (CHG="04"), order issuance condition (SOKJI_HAKKO="01"), and links via `SAME_TRN_NO` from EKK1081C011. Returns `ODR_HAKKO_JOKEN_NO`. |
| C | `callSC` | EKK1551D010 | (Order Info Creation Work Registration) | Calls EKK1551D010 CBS with FUNC_CODE="1". Creates the order work record linked to the order issuance condition number from EKK1081D010, with order content code 251 (Home Address Change), and populates timestamps from the service contract and work messages. |

### Summary by SC Code:

| SC Code | Entity / DB | CRUD | Description |
|---------|-------------|------|-------------|
| EKK1081C011 | Order Information Condition Registration table (KK_T_ODR_HAKKO_JOKEN related) | C | Registers order info conditions for emergency notification. Fixed function code "1". Returns the SAME_TRN_NO for cross-SO linking. |
| EKK1081D010 | Order Information Registration table (KK_T_ODR_HAKKO_JOKEN) | C | Registers the actual order record with emergency notification subtype, emergency service order code, change request type, and provisional issuance condition. |
| EKK1551D010 | Order Info Creation Work table (KK_T_ODR_SOKUYAKU) | C | Creates the order work data record referencing the order issuance condition, with order content code 251 (home address change). |

**How to classify:**
- All three service component calls (EKK1081C011, EKK1081D010, EKK1551D010) perform **C (Create)** operations as they register/order new data into the system.
- `findZ1OrderHasBeenSent` performs an **R (Read)** check to gate whether the subsequent create operations should execute.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0150 | `KKSV0150OPOperation` -> `JKKKojiChgPlaceNoCC.execSvckeiEmgUpd()` -> `JKKKojiChgPlaceNoCC.htelNoInfoChgeOdrCtrl()` | `EKK1081C011 [C]`, `EKK1081D010 [C]`, `EKK1551D010 [C]` |

**Call Chain Detail:**
- The KKSV0150 screen operation calls `execSvckeiEmgUpd()` on `JKKKojiChgPlaceNoCC`, which iterates over service contract records and invokes `htelNoInfoChgeOdrCtrl()` for each one to handle emergency service contract line updates.
- This method is called with the full `scCall` context, enabling it to dispatch to three distinct CBS services in sequence.

## 6. Per-Branch Detail Blocks

**Block 1** — [EXTRACT] `(Extract business keys from messages)` (L2839-L2840)

> Extract the service contract number and service detail work number from the two message objects.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svc_kei_no = svcKeiMsg.getString(EKK0081A010CBSMsg1List.SVC_KEI_NO)` // Service contract number from service contract message |
| 2 | SET | `svc_kei_ucwk_no = svcUcwkMsg.getString(EKK0161A010CBSMsg1List.SVC_KEI_UCWK_NO)` // Service detail work number from work message |

**Block 2** — [CHECK] `(Z1 order existence check)` (L2841)

> Gate check: determine whether a Z1 (primary) order has already been sent for this service contract line. If true, the Z1 path handles the update and no further processing is needed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `isZ1Ordered = findZ1OrderHasBeenSent(param, scCall, handle, fixedText, svc_kei_no, svc_kei_ucwk_no)` // Z1 order existence gate flag |

**Block 3** — [IF] `(Z1 order already sent — emergency notification / change processing)` (L2843) `[Z1未処理の場合はZ1に乗り替えるので変更不要]`

> When the Z1 order has already been sent, skip all processing for this method. The Z1 pathway handles the necessary updates separately.

| # | Type | Code |
|---|------|------|
| 1 | SET | `// Z1未処理の場合はZ1に乗り替えるので変更不要` // "For unprocessed Z1, delegation to the Z1 path means no change is needed" |

**Block 4** — [ELSE-BRANCH: Z1 not sent — proceed with emergency order creation] `(L2846-L2917)`

> When Z1 order has NOT been sent, proceed with the emergency notification/change order creation workflow. Three CBS services are called in sequence.

### Block 4.1 — [SET] `(Build EKK1081C011 input — Emergency Notification / Change)` (L2849-L2854)

> Prepare the input data map for the order information condition registration CBS service (EKK1081C011). This is the first step in the three-part order creation sequence.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk1081c011IN = { {TEMPLATEID, TEMPLATE_ID_EKK1081C011}, {FUNC_CODE, "1"} }` // TEMPLATE_ID_EKK1081C011 = "EKK1081C011", FUNC_CODE="1" (fixed) |

### Block 4.2 — [CALL] `(EKK1081C011 — Order Info Condition Registration)` (L2856-L2857)

> Call the EKK1081C011 CBS service. Returns the same transaction number (`SAME_TRN_NO`) needed for cross-service correlation in subsequent calls.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `EKK1081C011msg = callSC(handle, scCall, param, fixedText, ekk1081c011IN)` // Returns CAANMsg with SAME_TRN_NO |

### Block 4.3 — [SET] `(Build EKK1081D010 input — Order Information Registration)` (L2860-L2881)

> Prepare the comprehensive input data map for the order information registration CBS service (EKK1081D010). Populates order subtype (RMG/EMG="4"), service order code (EMG="24"), request subtype (CHG="04"), order issuance condition (SOKJI_HAKKO="01"), and links to EKK1081C011 via `SAME_TRN_NO`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk1081d010IN = { ... }` // Order info registration data map |
| 2 | SET | `{TEMPLATEID, TEMPLATE_ID_EKK1081D010}` // Template ID for EKK1081D010 CBS |
| 3 | SET | `{FUNC_CODE, "1"}` // Fixed function code |
| 4 | SET | `{SVC_KEI_NO, svc_kei_no}` // Service contract number (from Block 1) |
| 5 | SET | `{SVC_KEI_UCWK_NO, setNull()}` // Set to null (handled via Z1) |
| 6 | SET | `{KKTK_SVC_KEI_NO, setNull()}` // Secondary service contract number — null |
| 7 | SET | `{OP_SVC_KEI_NO, setNull()}` // Operator service contract number — null |
| 8 | SET | `{SBOP_SVC_KEI_NO, setNull()}` // Sub-operator service contract number — null |
| 9 | SET | `{SEIOPSVC_KEI_NO, setNull()}` // SEIO operator service contract number — null |
| 10 | SET | `{ORDER_SBT_CD, JKKHakkoSODConstCC.ORDER_SBT_CD_RMG}` `[-> "4"]` // Order subtype code: Emergency Notification (緊急通報) |
| 11 | SET | `{SVC_ORDER_CD, JKKHakkoSODConstCC.SVC_ORDER_CD_EMG}` `[-> "24"]` // Service order code: Emergency Notification |
| 12 | SET | `{YOKYU_SBT_CD, JKKHakkoSODConstCC.YOKYU_SBT_CD_CHG}` `[-> "04"]` // Request subtype code: Change (変更) |
| 13 | SET | `{ODR_HAKKO_JOKEN_CD, JKKHakkoSODConstCC.ODR_HAKKO_JOKEN_CD_SOKJI_HAKKO}` `[-> "01"]` // Order issuance condition: Provisional Issuance (素地発行) |
| 14 | SET | `{SAME_TRN_NO, EKK1081C011msg.getString(EKK1081C011CBSMsg.SAME_TRN_NO)}` // Same transaction number from EKK1081C011 response for cross-service correlation |
| 15 | SET | `{TAKNKIKI_MODEL_CD, setNull()}` // Equipment model code — null |
| 16 | SET | `{KIKI_SEIZO_NO, setNull()}` // Equipment manufacturing number — null |
| 17 | SET | `{MLAD, setNull()}` // MLAD — null |
| 18 | SET | `{SPOT_LOGIN_SYSID, setNull()}` // Spot login system ID — null |
| 19 | SET | `{SEND_REQ_FIN_DTM, setNull()}` // Send request completion timestamp — null |
| 20 | SET | `{SVC_KEI_KAISEN_UCWK_NO, setNull()}` // Service contract improvement work number — null |

### Block 4.4 — [CALL] `(EKK1081D010 — Order Information Registration)` (L2883-L2884)

> Execute the order information registration CBS service. Returns a message containing `ODR_HAKKO_JOKEN_NO` used by the next step.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `EKK1081D010msg = callSC(handle, scCall, param, fixedText, ekk1081d010IN)` // Returns CAANMsg with ODR_HAKKO_JOKEN_NO |

### Block 4.5 — [SET] `(Build EKK1551D010 input — Order Info Creation Work Registration)` (L2887-L2915)

> Prepare the input data map for the order info creation work registration CBS service (EKK1551D010). Links to the order issuance condition via `ODR_HAKKO_JOKEN_NO`, sets order content code 251 (Home Address Change), and populates service timestamps.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk1551d010IN = { ... }` // Order creation work data map |
| 2 | SET | `{TEMPLATEID, TEMPLATE_ID_EKK1551D010}` // Template ID for EKK1551D010 CBS |
| 3 | SET | `{FUNC_CODE, "1"}` // Fixed function code |
| 4 | SET | `{ODR_HAKKO_JOKEN_NO, EKK1081D010msg.getString(EKK1081D010CBSMsg.ODR_HAKKO_JOKEN_NO)}` // Order issuance condition number from EKK1081D010 |
| 5 | SET | `{ODR_NAIYO_CD, JKKHakkoSODConstCC.ODR_NAIYO_CD_251}` `[-> "251"]` // Order content code: Home Address Change (住所変更) |
| 6 | SET | `{SVC_KEI_NO, svc_kei_no}` // Service contract number |
| 7 | SET | `{SVKEI_GADTM, svcKeiMsg.getString(EKK0081A010CBSMsg1List.GENE_ADD_DTM)}` // Service contract generation/addition timestamp |
| 8 | SET | `{SVC_KEI_UCWK_NO, svcUcwkMsg.getString(EKK0161A010CBSMsg1List.SVC_KEI_UCWK_NO)}` // Service detail work number |
| 9 | SET | `{SVKEIUW_GADTM, svc_kei_ucwk_gadtm}` // Service detail work generation/addition timestamp (parameter) |
| 10-N | SET | Multiple null fields (KKTK_SVC_KEI_NO, KKTSVKEI_GADTM, OP_SVC_KEI_NO, OPSVKEI_GADTM, SBOP_SVC_KEI_NO, SBOPSVKEI_GADTM, SEIOPSVC_KEI_NO, SEIOPSVKEI_GADTM, HUKA_INF_KEI_NO, HUKA_INF_KEI_GADTM, CHBF_SVKEI_GADTM, CHBF_SVKEIUW_GADTM, CHBF_KKTSVKEI_GADTM, CHBF_OPSVKEI_GADTM, CHBF_SBOPSVKEI_GADTM, CHBF_SEIOPSVKEI_GADTM, KKOP_SVC_KEI_NO_1, KKOSVKEI_GADTM_1, CHBF_KKOSVKEI_GADTM_1, KKOP_SVC_KEI_NO_2, KKOSVKEI_GADTM_2, CHBF_KKOSVKEI_GADTM_2) // All set to null — not applicable for this emergency order type |

### Block 4.6 — [CALL] `(EKK1551D010 — Order Info Creation Work Registration)` (L2917-L2918)

> Execute the order creation work registration CBS service. No return value is captured.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callSC(handle, scCall, param, fixedText, ekk1551d010IN)` // No return — fire and forget |

**Block 5** — [RETURN] `(Return param)` (L2920)

> Return the parameter object (potentially modified by the called service components) to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` // Return parameter object for downstream processing |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the unique identifier for a service contract line item. |
| `svc_kei_ucwk_no` | Field | Service detail work number — internal tracking ID for service contract line item detail work records. |
| `svc_kei_ucwk_gadtm` | Field | Service detail work generation/addition timestamp — when this service work record was created or last modified. |
| `SVC_KEI_NO` | Field | Service contract number — database/message field for the service contract key. |
| `SVC_KEI_UCWK_NO` | Field | Service detail work number — database/message field for the work tracking ID. |
| `GENE_ADD_DTM` | Field | Generation/addition timestamp — when the service contract was created. |
| `ODR_NAIYO_CD` | Field | Order content code — classifies the type of order (e.g., 251 = Home Address Change). |
| `ORDER_SBT_CD` | Field | Order subtype code — distinguishes order types (e.g., "4" = Emergency Notification). |
| `SVC_ORDER_CD` | Field | Service order code — the service order classification (e.g., "24" = Emergency Notification). |
| `YOKYU_SBT_CD` | Field | Request subtype code — the type of request (e.g., "04" = Change). |
| `ODR_HAKKO_JOKEN_CD` | Field | Order issuance condition code — the condition under which the order is issued (e.g., "01" = Provisional Issuance). |
| `SAME_TRN_NO` | Field | Same transaction number — correlation key linking multiple service component calls within a single business transaction. |
| `ODR_HAKKO_JOKEN_NO` | Field | Order issuance condition number — the key identifying a specific order issuance condition record. |
| Z1 | Business term | Primary (Z1) order — the initial/main order processing path in the order issuance workflow. |
| SC | Acronym | Service Component — the middleware component used to invoke CBS (Core Business System) services. |
| CBS | Acronym | Core Business System — the backend business processing engine (e.g., EKK1081C011, EKK1081D010, EKK1551D010). |
| SOD | Acronym | Service Order Data — the order fulfillment data entity in the telecom domain. |
| EMG | Acronym | Emergency — used in codes for emergency notification scenarios (緊急通報). |
| RMG | Acronym | (Abbreviation in `ORDER_SBT_CD_RMG`) — Order subtype code value "4" designates Emergency Notification (緊急通報). |
| CHG | Acronym | Change — used in `YOKYU_SBT_CD_CHG` = "04", the request subtype code for modifications. |
| SOKJI_HAKKO | Business term | 素地発行 (Provisional Issuance) — order issuance condition "01" for orders that need to be issued provisionally. |
| FUNC_CODE | Field | Function code — a fixed value ("1") used to specify the processing mode within CBS services. |
| TEMPLATEID | Field | Template ID — identifies which CBS service template to invoke. |
| EKK1081C011 | Service | Order Information Condition Registration CBS — registers order info conditions and returns the same transaction number for cross-service linking. |
| EKK1081D010 | Service | Order Information Registration CBS — registers the actual order record with all relevant classification codes. |
| EKK1551D010 | Service | Order Info Creation Work Registration CBS — creates the order work data record. |
| Emergency Notification | Business term | 緊急通報 — a telecom service type (code "24" for SVC_ORDER_CD, code "4" for ORDER_SBT_CD) where service changes are urgently processed. |
| Home Address Change | Business term | 住所変更 — order content code 251 (ODR_NAIYO_CD_251), the classification for orders related to customer address changes. |
