# Business Logic — JKKHakkoSODCC.htelNoKaihkOdrCtrl() [530 LOC]

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

## 1. Role

### JKKHakkoSODCC.htelNoKaihkOdrCtrl()

This method implements the **Light Telephone Number Restoration Order Control** processing. In Japanese, the Javadoc reads `光電話番号回復オーダ制御処理` — it is the central coordinator for generating all Service Order Data (SOD) required when a light telephone (hikari telephone / IP-PBX style phone service over fiber) number is restored after suspension or disconnection. The method is invoked during the broader order issuance flow (`hakkoSOD`) and is responsible for a comprehensive multi-phase SOD issuance orchestration.

The method handles **three main service categories**: (1) **OLS (Optical Loop System) setup with phone number addition** for the restored device information; (2) **SIP (Session Initiation Protocol) registration** and associated features (number porting, temporary suspension, ENUM setup); (3) **Option services** including call forwarding (`OP_SVC_CD_TENSO` = "B024"), number portability (`OP_SVC_CD_N050` = "B029"), and caller ID notification (`OP_SVC_CD_DSP_ME` = "B022"). It also supports **multifunction router (Takino RT)** devices through a dedicated branch when `takino_flg == 4`.

The method implements a **conditional dispatch/routing design pattern**: it first checks whether the "4 orders" (Radius, OLS, SIP, ECS) have already been sent. If not, it handles option order control and returns early — the restoration will complete after the orders are issued by downstream processing. If all orders are already sent, it proceeds through a full SOD issuance pipeline covering device registration, SIP features, option services, and suspension handling.

Its **role in the larger system** is that of a shared order control component called from `hakkoSOD()`. It does not directly query databases — it delegates all SC/CBS calls and SOD creation to helper methods (`addSOD`, `addTakinoSOD`, `add050AddSod`, `addTokiSOD`, `pauseUkOdrCtrl`, etc.). The method acts as the business logic router that decides which SODs need to be issued based on the current state of the service contract, option services, and equipment.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["htelNoKaihkOdrCtrl start"])
    
    START --> EXTRACT["Extract SOD maps from sodMap"]
    EXTRACT --> DEEP1["shkkaMap for 3 maps: basic, svc_con, svc_detail"]
    DEEP1 --> EXTRACT2["Extract fields: sys_id, ido_div, svc_kei_no, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm"]
    EXTRACT2 --> GETSAME["getSame_trn_no - Get same transaction number"]
    GETSAME --> GETEKK0251["getEKK0251B001SC - Service contract line detail list"]
    GETEKK0251 --> SEARCHSVC["searchSvcKeiUcwk - Service contract detail agreement check"]
    SEARCHSVC --> CALLEKK035["callEKK0351B002SC - Option service contract list"]
    CALLEKK035 --> ISZ1["findZ1OrderHasBeenSentSvcKeiUcwk - Check if 4 orders are sent"]
    
    ISZ1 --> Z1CHECK{Z1 ordered?}
    
    Z1CHECK -- false --> OPTIONLOOP["Loop option service contracts"]
    OPTIONLOOP --> CHECKMSK["Check mskmDtlNo matches svcKeiUcwkMskmDtlNo"]
    CHECKMSK --> CHECKTENSO{op_svc_cd == OP_SVC_CD_TENSO B024?}
    
    CHECKTENSO -- true --> EDITOP["edit4OpSetOdrCtrl - Map option order data"]
    EDITOP --> OPSET["opSetOdrCtrl - Option order control"]
    OPSET --> OPTIONCONT
    CHECKTENSO -- false --> OPTIONCONT["Next loop iteration"]
    OPTIONCONT --> OPTIONRETURN["Return param - Early return"]
    
    Z1CHECK -- true --> CALLEKK019["callEKK0191A010SC - NTT service contract line detail"]
    CALLEKK019 --> EXTRACTVA["Extract vaTaknkikiModelCd, vaKikiChgNo"]
    EXTRACTVA --> CALLEKK034["callEKK0341B008SC - Equipment provision service contract list"]
    CALLEKK034 --> CHECKTAKINO{takino_flg check}
    
    CHECKTAKINO -- 0 --> EGCHECK["EG swap check via callEKK0341B008_02SC"]
    EGCHECK --> ISREGAL["isRegalVaKiki - Verify VA device"]
    ISREGAL --> SKIPREGAL{isRegalVaKiki true?}
    SKIPREGAL -- true --> SETFIELD["Set instance fields: kktk_svc_kei_no, gadtm, model_cd, kiki_seizo_no"]
    SKIPREGAL -- false --> OPTIONLOOP2["Continue loop - skip"]
    SETFIELD --> ADDOLS["addSOD - OLS setup + phone number add"]
    
    CHECKTAKINO -- 4 --> ADDTAKINO["addTakinoSOD - Multifunction router SOD"]
    
    ADDOLS --> ADDSIP1["addSOD - SIP registration"]
    ADDTAKINO --> ADDSIP1
    ADDSIP1 --> BMPUMCHECK{BMP_UM == BMP_UM_ARI?}
    
    BMPUMCHECK -- true --> ISBMP["isBmpOpenZumi - Porting completed?"]
    ISBMP --> BMPDONE{isBmpOpenZumi true?}
    BMPDONE -- true --> ADDBMP["addSOD - SIP + number port info"]
    BMPDONE -- false --> ADDTMP["addSOD - SIP temporary suspension"]
    
    BMPUMCHECK -- false --> ISTAJGS{isTajgsTelNo true?}
    ISTAJGS -- false --> ISMONAI{isMonaiBmp true?}
    ISMONAI -- true --> ENUMADD["addSOD - SIP + number port info"]
    ENUMADD --> ENUMADD2["addSOD - ENUM setup + register"]
    ISMONAI -- false --> NOPORT["No porting order"]
    ISTAJGS -- true --> NOPORT
    
    ADDBMP --> LOOPMSG
    ADDTMP --> LOOPMSG
    ENUMADD2 --> LOOPMSG
    NOPORT --> LOOPMSG
    
    LOOPMSG["Loop option contracts - extract telOpUm, htbTchUm"]
    LOOPMSG --> CHECKN050{op_svc_cd == OP_SVC_CD_N050 B029?}
    
    CHECKN050 -- true --> ADD050["add050AddSod - Number portability add"]
    CHECKN050 -- false --> TELCHECK["legalTelSod - Check valid tel op"]
    TELCHECK --> CHECKDSP{op_svc_cd == OP_SVC_CD_DSP_ME B022?}
    CHECKDSP -- true --> SETHTB["Set op_svc_kei_no, op_gadtm, htbTchUm"]
    CHECKDSP -- false --> TELCHECK2["Update telOpUm flag"]
    
    ADD050 --> TELUMCHECK{telOpUm true?}
    TELCHECK2 --> TELUMCHECK
    SETHTB --> TELUMCHECK
    
    TELUMCHECK -- true --> ADDSIP2["addSOD - SIP option bulk add"]
    TELUMCHECK -- false --> TOKISOD
    
    ADDSIP2 --> TOKISOD["addTokiSOD - Suspension order registration"]
    
    TOKISOD --> ADDURGENT["addSOD - Emergency notification register"]
    ADDURGENT --> STATCHECK{SVC_KEI_STAT == 210?}
    
    STATCHECK -- true --> PAUSEMAP["Build opSodMap with basic/con/detail info"]
    PAUSEMAP --> PAUSECTRL["pauseUkOdrCtrl - Suspension reception order control"]
    
    STATCHECK -- false --> RETURN
    PAUSECTRL --> RETURN["Return param"]
    
    OPTIONRETURN --> RETURN
    SKIPREGAL --> RETURN
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle carrying session manager context — used for all SC/CBS invocations and database operations. Acts as the transaction/session carrier throughout the processing pipeline. |
| 2 | `param` | `IRequestParameterReadWrite` | Parameter object containing model groups and control maps. Carries the request/response data structure used to pass business data between processing stages. Modified in-place by `addSOD`, `opSetOdrCtrl` calls, and returned at the end. |
| 3 | `fixedText` | `String` | User-defined arbitrary character string — passed through to `opSetOdrCtrl` for option order control mapping. Typically contains fixed text metadata for order identification. |
| 4 | `sodMap` | `HashMap<String, Object>` | Service Order Data (SOD) map containing nested maps for SOD basic info (`SOD_KIHON_INFO`), service contract info (`SVC_KEI_INFO`), and service contract detail info (`SVC_KEI_UCWK_INFO`). This is the primary data carrier that flows through the entire method. |

**Instance fields read/modified by the method:**

| Field | Operation | Description |
|-------|-----------|-------------|
| `same_trn_no` | Written | Same transaction number obtained from `getSame_trn_no` — used for order coordination |
| `svc_kei_ucwk_no` | Written | Changed service contract detail number (single-element array) |
| `svc_kei_ucwk_gadtm` | Written | Changed service contract detail generation registration datetime |
| `svc_kei_kaisen_ucwk_no` | Written | Service contract line detail number (from EKK0251B001SC) |
| `svc_kei_kaisen_ucwk_gadtm` | Written | Service contract line detail generation registration datetime |
| `kktk_svc_kei_no` | Written | Equipment provision service contract number |
| `kktk_svc_kei_gadtm` | Written | Equipment provision service contract generation registration datetime |
| `taknkiki_model_cd` | Written | Indoor device model code |
| `kiki_seizo_no` | Written | Device serial number |
| `op_svc_kei_no` | Written | Option service contract number (for dispatch message) |
| `op_gadtm` | Written | Generation registration datetime (for dispatch message) |
| `op_svc_kei_no_tikan` | Written | Option service contract number (reserved, commented out) |
| `op_gadtm_tikan` | Written | Generation registration datetime (reserved, commented out) |
| `svc_kei_stat` | Read | Service contract status — checked against `SVC_KEI_STAT_210` for suspension handling |
| `ido_div` | Read | Migration division — used in `addTokiSOD` for suspension order routing |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKHakkoSODCC.callEKK0191A010SC` | EKK0191A010SC | `t_m_svc_kei` (service contract master), `t_m_kktk_svc_kei` (equipment provision service contract master) | NTT service contract line detail one-view check — retrieves VA indoor device model code and device change number |
| R | `JKKHakkoSODCC.callEKK0341B008SC` | EKK0341B008SC | `t_m_kktk_svc_kei` (equipment provision service contract master), `t_m_kktk_svc` (equipment provision service master) | Equipment provision service contract one-view check — retrieves all equipment (VA, ONU, router, etc.) associated with the service contract |
| R | `JKKHakkoSODCC.callEKK0341B008_02SC` | EKK0341B008_02SC | `t_m_kktk_svc_kei` | Equipment provision service contract one-view check (EG swap variant) — used when EG swap consideration is needed during VA device acquisition |
| R | `JKKHakkoSODCC.callEKK0351B002SC` | EKK0351B002SC | `t_m_op_svc_kei` (option service contract master) | Option service contract one-view check (service contract number) — retrieves all option services (call forwarding, number portability, etc.) |
| R | `JKKHakkoSODCC.getEKK0251B001SC` | EKK0251B001SC | `t_m_svc_kei` | Service contract line detail one-view check (service contract number) — retrieves service line detail number and generation registration datetime |
| R | `JKKHakkoSODCC.findZ1OrderHasBeenSentSvcKeiUcwk` | - | - | Checks whether the 4 orders (Radius, OLS, SIP, ECS) have been sent for the service contract |
| R | `JKKHakkoSODCC.searchSvcKeiUcwk` | EKK0161A010SC | `t_m_svc_kei_ucwk` (service contract detail master) | Service contract detail agreement check — retrieves contract detail agreement info including mskm_dtl_no |
| R | `JKKHakkoSODCC.getSame_trn_no` | - | - | Obtains the same transaction number for order coordination |
| R | `JKKHakkoSODCC.shkkaMap` | - | - | Deep copy / shield map utility — creates independent copies of the SOD nested maps to prevent side effects |
| R | `JKKHakkoSODCC.isBmpOpenZumi` | - | `t_m_bmp_koji` (number porting work master) | Checks whether number porting work has been completed |
| R | `JKKHakkoSODCC.isMonaiBmp` | - | `t_m_bmp_koji` (number porting work master) | Checks whether number porting exists (porting request) |
| R | `JKKHakkoSODCC.isTajgsTelNo` | - | - | Checks whether the telephone number is from the telephone number acquisition business operator (self / in-network porting) |
| C | `JKKHakkoSODCC.addSOD` | - | `t_odr_hakko_sod` (order issuance SOD table) | Issues SOD for various scenarios: OLS setup + phone number add (208), SIP registration (218), SIP + number port info (225), SIP temporary suspension (223), ENUM setup + register (265), SIP option bulk add (219), emergency notification register (250) |
| C | `JKKHakkoSODCC.add050AddSod` | - | `t_odr_hakko_sod` | Issues SOD for number portability registration (ODR_NAIYO_CD_248) — specialized handler for B029 option service |
| C | `JKKHakkoSODCC.addTakinoSOD` | - | `t_odr_hakko_sod` | Issues SOD for multifunction router setup change - VA function phone number add (ODR_NAIYO_CD_408) |
| C | `JKKHakkoSODCC.addTokiSOD` | - | `t_odr_hakko_sod` | Issues SOD for suspension order registration — handles Toki (suspension) SOD based on migration division |
| U | `JKKHakkoSODCC.edit4OpSetOdrCtrl` | - | - | Maps option order control data — prepares SOD map for option service order control |
| U | `JKKHakkoSODCC.opSetOdrCtrl` | - | `t_odr_hakko_sod` | Option order control processing — registers option service order data |
| U | `JKKHakkoSODCC.pauseUkOdrCtrl` | - | `t_odr_hakko_sod` | Suspension reception order control processing — issues suspension order when service contract status is "suspension/in progress" (210) |
| - | `JKKHakkoSODCC.checkTakinoRT` | - | - | Checks whether the device is a multifunction router (Takino RT) — returns flag: 0 = normal, 4 = multifunction router |
| - | `JKKHakkoSODCC.isRegalVaKiki` | - | - | Verifies whether the equipment is a valid Regal VA device — returns false to skip SOD issuance if device info is inconsistent |
| - | `JKKStringUtil.isNullBlank` | - | - | Utility check for null or blank string values |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKHakkoSODCC.hakkoSOD` | `hakkoSOD()` → `htelNoKaihkOdrCtrl()` | `addSOD [C] t_odr_hakko_sod`, `addTokiSOD [C] t_odr_hakko_sod`, `add050AddSod [C] t_odr_hakko_sod`, `addTakinoSOD [C] t_odr_hakko_sod`, `pauseUkOdrCtrl [U] t_odr_hakko_sod`, `callEKK0341B008_02SC [R] t_m_kktk_svc_kei`, `callEKK0351B002SC [R] t_m_op_svc_kei`, `callEKK0191A010SC [R] t_m_svc_kei`, `callEKK0341B008SC [R] t_m_kktk_svc_kei`, `getEKK0251B001SC [R] t_m_svc_kei`, `searchSvcKeiUcwk [R] t_m_svc_kei_ucwk` |

**Call chain description:** The method is called directly from `hakkoSOD()`, which is the main order issuance orchestrator. `hakkoSOD()` determines the service type and dispatches to specific handlers (FTTH registration, light telephone restoration, etc.). `htelNoKaihkOdrCtrl()` is the dedicated handler for light telephone number restoration orders.

**Terminal operations summary:**
- **Create (C):** `addSOD` — multiple SOD entries issued for OLS setup, SIP registration, number porting, ENUM setup, emergency notification, SIP temporary suspension, SIP option bulk add
- **Create (C):** `add050AddSod` — number portability registration SOD
- **Create (C):** `addTakinoSOD` — multifunction router setup SOD
- **Create (C):** `addTokiSOD` — suspension order SOD
- **Update (U):** `opSetOdrCtrl` — option order control SOD data
- **Update (U):** `pauseUkOdrCtrl` — suspension reception order SOD data

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Extract and deep-copy SOD maps (L15335)

| # | Type | Code |
|---|------|------|
| 1 | SET | `statusCode = 0` // Service interval processing state flag |
| 2 | SET | `sod_kihon_info_Map = (HashMap)sodMap.get(SOD_KIHON_INFO)` // SOD basic info |
| 3 | SET | `svc_kei_info_Map = (HashMap)sodMap.get(SVC_KEI_INFO)` // Service contract info |
| 4 | SET | `svc_kei_ucwk_info_Map = (HashMap)sodMap.get(SVC_KEI_UCWK_INFO)` // Service contract detail info |
| 5 | EXEC | `sod_kihon_info_Map = shkkaMap(...)` // Deep copy SOD basic info |
| 6 | EXEC | `svc_kei_info_Map = shkkaMap(...)` // Deep copy service contract info |
| 7 | EXEC | `svc_kei_ucwk_info_Map = shkkaMap(...)` // Deep copy service contract detail info |

**Block 2** — [SET] Extract (1) light telephone restoration required parameters (L15344)

| # | Type | Code |
|---|------|------|
| 1 | SET | `sys_id = (String)sod_kihon_info_Map.get(INFO_SYSID)` // SYSID |
| 2 | SET | `ido_div = (String)sod_kihon_info_Map.get(INFO_IDO_DIV)` // Migration division |
| 3 | SET | `svc_kei_no = (String)svc_kei_info_Map.get(INFO_SVC_KEI_NO)` // Service contract number |
| 4 | SET | `svc_kei_ucwk_no = (String)svc_kei_ucwk_info_Map.get(INFO_SVC_KEI_UCWK_NO)` // Post-change service contract detail number |
| 5 | SET | `chaf_svc_kei_ucwk_gene_add_dtm = (String)svc_kei_ucwk_info_Map.get(INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM)` // Post-change service contract detail generation registration datetime |

**Block 3** — [EXEC] (3) Light telephone restoration processing (#1 only) (L15353)

| # | Type | Code |
|---|------|------|
| 1 | SET | `sameTrnNo = new String[1]` // Array to hold same transaction number |
| 2 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` // Obtain same transaction number |
| 3 | SET | `this.same_trn_no = sameTrnNo[0]` // Store in instance field |
| 4 | SET | `this.svc_kei_ucwk_no = new String[1]` // Initialize service contract detail number array |
| 5 | SET | `this.svc_kei_ucwk_no[0] = svc_kei_ucwk_no` // Set value |
| 6 | SET | `this.svc_kei_ucwk_gadtm = new String[1]` // Initialize generation datetime array |
| 7 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` // Set value |

**Block 4** — [CALL] EKK0251B001 Service contract line detail list (L15360)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `eKK0251B001Hash = getEKK0251B001SC(param, handle, svc_kei_no, FUNC_CODE_1)` // Service contract line detail one-view check |
| 2 | SET | `this.svc_kei_kaisen_ucwk_no = (String)eKK0251B001Hash.get(SVC_KEI_KAISEN_UCWK_NO)` // Service contract line detail number |
| 3 | SET | `this.svc_kei_kaisen_ucwk_gadtm = (String)eKK0251B001Hash.get(GENE_ADD_DTM)` // Service contract line detail generation registration datetime |

**Block 5** — [CALL] Z1 order issuance check (OM-2015-0003416) (L15368)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `eKK0161A010Hash = searchSvcKeiUcwk(handle, param, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm)` // Service contract detail agreement check |
| 2 | SET | `svcKeiUcwkMskmDtlNo = (String)eKK0161A010Hash.get(MSKM_DTL_NO)` // Service contract detail application detail number |

**Block 6** — [CALL] EKK0351B002 Option service contract list (L15375)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashOp = new HashMap()` // Input hash for option SC |
| 2 | SET | `resultHashOp = new HashMap()` // Result hash for option SC |
| 3 | SET | `inHashOp.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` // Service contract detail number |
| 4 | CALL | `statusCode = callEKK0351B002SC(param, handle, inHashOp, resultHashOp, FUNC_CODE_1)` // Option service contract one-view |
| 5 | IF | `statusCode != 0` → `throw CCException(SCCallException(...))` // Error handling |
| 6 | SET | `msgList = (CAANMsg[])resultHashOp.get(TEMPLATE_ID_EKK0351B002)` // Option service contract message list |

**Block 7** — [IF] (condition: Z1 order has NOT been sent) [ODR_NAIYO_CD_208="208" / ODR_NAIYO_CD_218="218" / ODR_NAIYO_CD_225="225" / ODR_NAIYO_CD_223="223" / ODR_NAIYO_CD_219="219"] (L15391)

> When the 4 orders (Radius, OLS, SIP, ECS) have NOT been sent yet, the method processes any simultaneous restoration option services and returns early. The comment says Z3 orders remain valid during the restoration period, so Z3 registration is unnecessary.

**Block 7.1** — [WHILE] Loop over option service contracts (L15395)

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0; i < msgList.length; i++` |
| 2 | SET | `eKK0351B002Hash = msgList[i].getMsgData()` // Option service data |
| 3 | SET | `opSvcCd = eKK0351B002Hash.get(OP_SVC_CD).toString()` // Option service code |
| 4 | SET | `opSvcKeiNo = eKK0351B002Hash.get(OP_SVC_KEI_NO).toString()` // Option service contract number |
| 5 | SET | `geneAddDtm = eKK0351B002Hash.get(GENE_ADD_DTM).toString()` // Generation registration datetime |
| 6 | SET | `mskmDtlNo = (String)eKK0351B002Hash.get(MSKM_DTL_NO)` // Application detail number |
| 7 | IF | `isNullBlank(mskmDtlNo) || !mskmDtlNo.equals(svcKeiUcwkMskmDtlNo)` → `continue` // Skip options not being simultaneously restored |

**Block 7.1.1** — [IF-ELSE] (condition: `opSvcCd == OP_SVC_CD_TENSO` = "B024", Call Forwarding) (L15405)

> If the option service is call forwarding, perform option order control processing — register SIP + call forwarding orders.

| # | Type | Code |
|---|------|------|
| 1 | IF | `OP_SVC_CD_TENSO.equals(opSvcCd)` — Call forwarding option service |
| 2 | CALL | `opSodMap = edit4OpSetOdrCtrl(ido_div, sys_id, svc_kei_no, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm, opSvcKeiNo, null, geneAddDtm)` // Map option order control data |
| 3 | CALL | `param = opSetOdrCtrl(handle, param, fixedText, opSodMap)` // Option order control processing |
| 4 | ELSE | Other option services → `continue` (not processed in this early-return path) |

**Block 7.2** — [RETURN] Early return (L15420)

> Since the 4 orders have not been sent, SOD registration is not needed at this time. Return the param as-is.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` |

**Block 8** — [CALL] EKK0191A010 NTT service contract line detail (L15427)

> This branch executes when all 4 orders (Z1) have been sent. Process OLS setup and phone number addition.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashUcwk = new HashMap()` // Input hash |
| 2 | SET | `resultHashUcwk = new HashMap()` // Result hash |
| 3 | SET | `inHashUcwk.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` // Service contract detail number |
| 4 | SET | `inHashUcwk.put(GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` // Generation registration datetime |
| 5 | CALL | `statusCode = callEKK0191A010SC(param, handle, inHashUcwk, resultHashUcwk, FUNC_CODE_1)` // NTT service contract line detail |
| 6 | IF | `statusCode != 0` → `throw CCException(...)` // Error handling |
| 7 | SET | `eKK0191A010Hash = (HashMap)resultHashUcwk.get(TEMPLATE_ID_EKK0191A010)` // Extract result |
| 8 | SET | `vaTaknkikiModelCd = (String)eKK0191A010Hash.get(VA_TAKNKIKI_MODEL_CD)` // VA indoor device model code |
| 9 | SET | `vaKikiChgNo = (String)eKK0191A010Hash.get(VA_KIKI_CHG_NO)` // VA device change number |

**Block 9** — [CALL] EKK0341B008 Equipment provision service contract list (L15447)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashKktk = new HashMap()` // Input hash for equipment |
| 2 | SET | `resultHashKktk = new HashMap()` // Result hash for equipment |
| 3 | SET | `inHashKktk.put(SVC_KEI_NO, svc_kei_no)` // Service contract number |
| 4 | CALL | `statusCode = callEKK0341B008SC(param, handle, inHashKktk, resultHashKktk, FUNC_CODE_1)` // Equipment provision SC list |
| 5 | IF | `statusCode != 0` → `throw CCException(...)` // Error handling |
| 6 | SET | `msgEKK0341B008SCList = (CAANMsg[])resultHashKktk.get(TEMPLATE_ID_EKK0341B022)` // Equipment message list |

**Block 10** — [IF] (condition: `takino_flg == 0`, normal device) / [ELSE IF] (condition: `takino_flg == 4`, multifunction router) (L15456)

> Checks whether the device is a multifunction router (Takino RT). Returns 0 for normal devices, 4 for multifunction routers.

**Block 10.1** — [IF] (condition: `takino_flg == 0`) Normal device (L15457)

**Block 10.1.1** — [IF] EG swap check (IT2-2016-0000035) (L15463)

> When EG swap consideration is needed during VA device acquisition, get replacement device records and replace the device list if the device change number matches and the migration division is "00067: EG swap".

| # | Type | Code |
|---|------|------|
| 1 | SET | `inHashKktk.put(SVC_KEI_NO, svc_kei_no)` // Service contract number |
| 2 | CALL | `statusCode = callEKK0341B008_02SC(param, handle, inHashKktk, resultHashKktk, FUNC_CODE_4)` // Equipment SC list (EG swap variant) |
| 3 | IF | `statusCode != 0` → `throw CCException(...)` // Error handling |
| 4 | SET | `msgEKK0341B022_02SCList = (CAANMsg[])resultHashKktk.get(TEMPLATE_ID_EKK0341B022)` // EG swap message list |
| 5 | IF | `msgEKK0341B022_02SCList != null && length > 0` |

**Block 10.1.1.1** — [FOR] Loop over EG swap results (L15470)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0341B022SCHash = msgEKK0341B022_02SCList[i].getMsgData()` |
| 2 | SET | `kktkSvcCd = (String)eKK0341B022SCHash.get(KKTK_SVC_CD)` // Equipment provision service code |
| 3 | SET | `kikiChgNo = (String)eKK0341B022SCHash.get(KIKI_CHG_NO)` // Device change number |
| 4 | SET | `idoDiv = (String)eKK0341B022SCHash.get(IDO_DIV)` // Migration division |
| 5 | IF | `KKTK_SVC_CD_HTEL_VA.equals(kktkSvcCd)` — VA equipment |

**Block 10.1.1.1.1** — [IF] (condition: VA device change number matches AND idoDiv == "00067: EG swap") (L15480)

| # | Type | Code |
|---|------|------|
| 1 | IF | `vaKikiChgNo.equals(kikiChgNo) && "00067".equals(idoDiv)` — Device change matches AND EG swap |
| 2 | SET | `msgEKK0341B008SCList = msgEKK0341B022_02SCList` // Replace device list with EG swap list |

**Block 10.1.2** — [FOR] Loop over equipment provision service contracts (L15491)

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0341B008SCHash = msgEKK0341B008SCList[i].getMsgData()` |
| 2 | SET | `kktkSvcKeiNo = (String)eKK0341B008SCHash.get(KKTK_SVC_KEI_NO)` // Equipment provision service contract number |
| 3 | SET | `kktkGeneAddDtm = (String)eKK0341B008SCHash.get(GENE_ADD_DTM)` // Generation registration datetime |
| 4 | SET | `kktkKikiSeizoNo = (String)eKK0341B008SCHash.get(KIKI_SEIZO_NO)` // Device serial number |
| 5 | SET | `vaTaknkikiModelCd = (String)eKK0341B008SCHash.get(TAKNKIKI_MODEL_CD)` // Indoor device model code |

**Block 10.1.2.1** — [IF] (condition: `!isRegalVaKiki(...)`) — Invalid/regal VA device check (L15528)

> If the device is not a valid Regal VA device (or device info is inconsistent), skip SOD issuance. Modified in ANK-3238 to accept handle/param parameters and return pre-change device info.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kokanBfKiki = new HashMap()` // Pre-change device info container |
| 2 | IF | `!isRegalVaKiki(handle, param, eKK0341B008SCHash, vaTaknkikiModelCd, null, ido_div, vaKikiChgNo, kokanBfKiki)` |
| 3 | EXEC | `continue` // Skip this equipment entry |

**Block 10.1.2.1.1** — [IF] (condition: repair exchange in progress — `kokanBfKiki` not empty) (L15538)

> During repair/exchange, use the pre-change device information.

| # | Type | Code |
|---|------|------|
| 1 | IF | `kokanBfKiki != null && !kokanBfKiki.isEmpty()` — Repair exchange detected |
| 2 | SET | `kktkSvcKeiNo = (String)kokanBfKiki.get(KKTK_SVC_KEI_NO)` // Pre-change equipment provision SC number |
| 3 | SET | `kktkGeneAddDtm = (String)kokanBfKiki.get(GENE_ADD_DTM)` // Pre-change generation datetime |
| 4 | SET | `kktkKikiSeizoNo = (String)kokanBfKiki.get(KIKI_SEIZO_NO)` // Pre-change device serial number |
| 5 | SET | `vaTaknkikiModelCd = (String)kokanBfKiki.get(TAKNKIKI_MODEL_CD)` // Pre-change device model code |

**Block 10.1.2.2** — [SET] Set instance fields for equipment data (L15550)

| # | Type | Code |
|---|------|------|
| 1 | SET | `this.kktk_svc_kei_no = new String[1]` |
| 2 | SET | `this.kktk_svc_kei_no[0] = kktkSvcKeiNo` // Equipment provision service contract number |
| 3 | SET | `this.kktk_svc_kei_gadtm = new String[1]` |
| 4 | SET | `this.kktk_svc_kei_gadtm[0] = kktkGeneAddDtm` // Equipment provision SC generation datetime |
| 5 | SET | `this.taknkiki_model_cd = new String[1]` |
| 6 | SET | `this.taknkiki_model_cd[0] = vaTaknkikiModelCd` // Indoor device model code |
| 7 | SET | `this.kiki_seizo_no = new String[1]` |
| 8 | SET | `this.kiki_seizo_no[0] = kktkKikiSeizoNo` // Device serial number |

**Block 10.1.2.3** — [EXEC] OLS setup + phone number addition (L15562)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_208)` // OLS setup + phone number add |
| 2 | EXEC | `break` // Exit equipment loop — OLS done for this device |

**Block 10.2** — [ELSE IF] (condition: `takino_flg == 4`) Multifunction router (L15568)

> When the device is a multifunction router (Takino RT), process it through the dedicated multifunction router SOD handler.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addTakinoSOD(handle, param, ODR_NAIYO_CD_408)` // Multifunction router setup change - VA function phone number add |

**Block 11** — [CALL] SIP registration (L15572)

> Always executed after OLS or Takino processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_218)` // SIP registration |

**Block 12** — [IF/ELSE IF/ELSE] BMP_UM check — Number porting flag (L15576)

> Checks whether number porting information is set. Branches: porting exists (BMP_UM == "1"), no porting from own operator + in-network porting, no porting at all.

**Block 12.1** — [IF] (condition: `BMP_UM == BMP_UM_ARI` = "1", porting exists) (L15576)

**Block 12.1.1** — [IF] (condition: `isBmpOpenZumi(...)` — porting work completed?) (L15609)

> OM-2016-0000010: Changed the number porting completion check logic.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isBmpOpenZumi(param, handle, svc_kei_no, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm)` — Porting completed |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_225)` // SIP + number port info add |
| 3 | ELSE | Porting not yet completed |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_223)` // SIP temporary suspension |

**Block 12.2** — [ELSE] No porting flag set — check operator type (L15633)

> v72.00.01 ANK-4494: For cases without porting flag, check if it's from the telephone number acquisition business operator and has in-network porting.

**Block 12.2.1** — [IF] (condition: `!isTajgsTelNo(...) && isMonaiBmp(...)`) — Self operator + porting request (L15638)

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isTajgsTelNo(handle, param, telno) && isMonaiBmp(handle, param, telno)` // Not from own operator AND porting exists |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_225)` // SIP + number port info add |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_265)` // ENUM setup + register |
| 4 | ELSE | No porting — no additional SOD |

**Block 13** — [FOR] Loop over option contracts (msgList) — second pass (L15649)

> After Z1 order check is complete and OLS/SIP/Takino SODs are registered, process option services again for additional SOD issuance. This is the original position where this loop was before OM-2015-0003416 refactoring.

| # | Type | Code |
|---|------|------|
| 1 | SET | `telOpUm = false` // Telephone option (non-050) existence flag |
| 2 | SET | `htbTchUm = false` // Caller ID notification option existence flag |
| 3 | SET | `i = 0; i < msgList.length; i++` |
| 4 | SET | `eKK0351B002Hash = msgList[i].getMsgData()` |
| 5 | SET | `op_svc_cd = eKK0351B002Hash.get(OP_SVC_CD).toString()` // Option service code |
| 6 | SET | `opSvcKeiNo = eKK0351B002Hash.get(OP_SVC_KEI_NO).toString()` // Option service contract number |
| 7 | SET | `geneAddDtm = eKK0351B002Hash.get(GENE_ADD_DTM).toString()` // Generation registration datetime |
| 8 | SET | `mskmDtlNo = (String)eKK0351B002Hash.get(MSKM_DTL_NO)` // Application detail number |

**Block 13.1** — [IF] (condition: `mskmDtlNo` matches) — Process only matching option contracts (L15668)

> OM-2016-0000019: Only process option services where mskmDtlNo matches the parent service contract detail. Number portability order registration is delegated to common processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isNullBlank(mskmDtlNo) || !mskmDtlNo.equals(svcKeiUcwkMskmDtlNo)` |
| 2 | EXEC | `continue` // Not the target option — skip |

**Block 13.1.1** — [IF] (condition: `op_svc_cd == OP_SVC_CD_N050` = "B029", Number Portability) (L15680)

> OM-2016-0000019: Number portability order registration is now delegated to common processing via `add050AddSod`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `OP_SVC_CD_N050.equals(op_svc_cd)` — Number portability option service |
| 2 | CALL | `param = add050AddSod(param, handle, svc_kei_no, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm, opSvcKeiNo, geneAddDtm)` // Number portability add |

**Block 13.1.2** — [ELSE] Non-050 option services (L15691)

**Block 13.1.2.1** — [EXEC] Update telOpUm flag (L15696)

> IT1-2012-0002564: Changed from direct `telOpUm = true` to calling `legalTelSod(op_svc_cd)` to check if the option service is a valid telephone option.

| # | Type | Code |
|---|------|------|
| 1 | SET | `telOpUm = (telOpUm ? telOpUm : legalTelSod(op_svc_cd))` // Check if valid tel op |

**Block 13.1.2.2** — [IF] (condition: `op_svc_cd == OP_SVC_CD_DSP_ME` = "B022", Dispatch Message) (L15701)

> IT1-2013-0000714: Caller ID notification option. Sets option service contract number and generation datetime.

| # | Type | Code |
|---|------|------|
| 1 | IF | `OP_SVC_CD_DSP_ME.equals(op_svc_cd)` — Caller ID notification option |
| 2 | SET | `this.op_svc_kei_no = eKK0351B002Hash.get(OP_SVC_KEI_NO).toString()` // Option service contract number |
| 3 | SET | `this.op_gadtm = eKK0351B002Hash.get(GENE_ADD_DTM).toString()` // Generation registration datetime |
| 4 | SET | `htbTchUm = true` // Mark caller ID option as present |

**Block 14** — [IF] (condition: `telOpUm == true`) — Telephone option exists (L15713)

> If there are telephone options (non-050), issue SIP option bulk add SOD.

| # | Type | Code |
|---|------|------|
| 1 | IF | `telOpUm` — Telephone option (non-050) exists |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_219)` // SIP option bulk add |

**Block 15** — [CALL] Toki (Suspension) SOD registration (L15731)

> IT1-2013-0000714: Suspension SOD registration using migration division.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addTokiSOD(handle, param, this.ido_div, null)` // Suspension order registration |

**Block 16** — [CALL] Emergency notification registration (L15736)

> Emergency notification (quick alarm) registration SOD — always issued.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_250)` // Emergency notification register |

**Block 17** — [IF] (condition: `SVC_KEI_STAT_210 == "210"`, Suspension/In Progress) (L15741)

> When the service contract status is "Suspension/In Progress", issue a suspension reception order through `pauseUkOdrCtrl`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `SVC_KEI_STAT_210.equals(this.svc_kei_stat)` — Service contract status is suspension |
| 2 | SET | `opSodMap = new HashMap()` // SOD map |
| 3 | SET | `opSodKihonInfoMap = new HashMap()` // SOD basic info |
| 4 | SET | `opSvcKeiInfoMap = new HashMap()` // Service contract info |
| 5 | SET | `opSvcKeiUcwkInfoMap = new HashMap()` // Service contract detail info |
| 6 | SET | `opSodKihonInfoMap.put(INFO_SYSID, sys_id)` // SYSID |
| 7 | SET | `opSodKihonInfoMap.put(INFO_IDO_DIV, ido_div)` // Migration division |
| 8 | SET | `opSvcKeiInfoMap.put(INFO_SVC_KEI_NO, svc_kei_no)` // Service contract number |
| 9 | SET | `opSvcKeiUcwkInfoMap.put(INFO_SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` // Service contract detail number |
| 10 | SET | `opSvcKeiUcwkInfoMap.put(INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` // Generation datetime |
| 11 | SET | `opSodMap.put(SOD_KIHON_INFO, opSodKihonInfoMap)` |
| 12 | SET | `opSodMap.put(SVC_KEI_INFO, opSvcKeiInfoMap)` |
| 13 | SET | `opSodMap.put(SVC_KEI_UCWK_INFO, opSvcKeiUcwkInfoMap)` |
| 14 | CALL | `pauseUkOdrCtrl(handle, param, opSodMap)` // Suspension reception order control |

**Block 18** — [RETURN] (L15764)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` // Return processed parameter object |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `htelNoKaihkOdrCtrl` | Method | Light Telephone Number Restoration Order Control — the main orchestration method for phone service restoration |
| SOD | Acronym | Service Order Data — the internal order issuance entity that triggers downstream service provisioning across multiple systems |
| OLS | Acronym | Optical Loop System — fiber optic loop equipment that connects the customer premises to the NTT network |
| SIP | Acronym | Session Initiation Protocol — VoIP protocol for establishing voice call sessions over IP networks |
| Radius | Acronym | Remote Authentication Dial-In User Service — authentication protocol for network access credentials |
| ECS | Acronym | Equipment Control System — system managing network equipment state |
| Z1 Order | Field | Refers to the collective 4 orders (Radius, OLS, SIP, ECS) that must be sent before device-specific SODs can be issued |
| Z3 Order | Field | Suspension-related orders that remain valid during the restoration period and do not need re-registration |
| `svc_kei_no` | Field | Service contract number — unique identifier for the service contract line (e.g., fiber service agreement) |
| `svc_kei_ucwk_no` | Field | Service contract detail number — internal tracking ID for service contract line items with change history |
| `svc_kei_ucwk_gadtm` | Field | Service contract detail generation registration datetime — timestamp of when the contract detail was generated/changed |
| `chaf_svc_kei_ucwk_gene_add_dtm` | Field | Post-change service contract detail generation registration datetime — the datetime field for changed contract details |
| `svc_kei_stat` | Field | Service contract status — indicates the state of the service (e.g., 210 = suspension/in progress) |
| `ido_div` | Field | Migration division — classification for service migration types used in suspension order routing |
| `sys_id` | Field | SYSID — system identifier for the service |
| `same_trn_no` | Field | Same transaction number — coordination number for related order processing |
| `skkkaMap` | Method | Deep copy / shield map utility — creates independent copies of nested SOD maps to prevent side effects between processing stages |
| `ODR_NAIYO_CD_208` | Constant | OLS setup + phone number addition order content code |
| `ODR_NAIYO_CD_408` | Constant | Multifunction router setup change — VA function phone number addition order content code |
| `ODR_NAIYO_CD_218` | Constant | SIP registration order content code |
| `ODR_NAIYO_CD_225` | Constant | SIP + number port information registration order content code |
| `ODR_NAIYO_CD_223` | Constant | SIP temporary suspension order content code |
| `ODR_NAIYO_CD_265` | Constant | ENUM setup + registration order content code |
| `ODR_NAIYO_CD_219` | Constant | SIP option bulk registration order content code |
| `ODR_NAIYO_CD_250` | Constant | Emergency notification registration order content code |
| `OP_SVC_CD_TENSO` | Constant | "B024" — Call forwarding option service code |
| `OP_SVC_CD_N050` | Constant | "B029" — Number portability option service code |
| `OP_SVC_CD_DSP_ME` | Constant | "B022" — Dispatch message (caller ID notification) option service code |
| `BMP_UM_ARI` | Constant | "1" — Number porting exists flag |
| `BMP_UM_NASI` | Constant | "0" — No number porting flag |
| `SVC_KEI_STAT_210` | Constant | "210" — Service contract status: Suspension/In Progress |
| `vaTaknkikiModelCd` | Field | VA indoor device model code — identifies the model of the Virtual Apartment indoor equipment |
| `vaKikiChgNo` | Field | VA device change number — tracks changes to the VA device |
| `kktkSvcCd` | Field | Equipment provision service code — identifies the type of equipment service (e.g., C004 = HTel VA, C012 = ONU) |
| `kktk_svc_kei_no` | Field | Equipment provision service contract number — links equipment to the service contract |
| `kiki_seizo_no` | Field | Device serial number — unique hardware identifier for the equipment |
| `taknkiki_model_cd` | Field | Indoor device model code — general model code for indoor NTT equipment |
| `takino_flg` | Variable | Multifunction router flag — 0 = normal device, 4 = multifunction router (Takino RT) |
| `telOpUm` | Variable | Telephone option existence flag — true if non-050 telephone option services exist |
| `htbTchUm` | Variable | Caller ID notification option existence flag — true if dispatch message option exists |
| `mskmDtlNo` | Field | Application detail number — matches parent service contract detail to identify the correct option service |
| `EG swap` | Business term | EG (Ethernet Gateway) swap — migration division "00067" indicating the EG device was replaced during the restoration |
| `isTajgsTelNo` | Method | Checks whether the telephone number is from the telephone number acquisition business operator (self / in-network porting) |
| `isMonaiBmp` | Method | Checks whether number porting request exists |
| `isBmpOpenZumi` | Method | Checks whether number porting work has been completed |
| `isRegalVaKiki` | Method | Verifies whether the equipment is a valid Regal VA device; returns false if device info is inconsistent |
| `legalTelSod` | Method | Checks whether the option service code is a valid telephone option service |
| `add050AddSod` | Method | Specialized SOD issuer for number portability (B029) — handles complex multi-parameter SOD creation |
| `addTakinoSOD` | Method | SOD issuer for multifunction router (Takino RT) devices — handles router-specific SOD creation |
| `addTokiSOD` | Method | Suspension order SOD issuer — creates SOD for suspension scenarios based on migration division |
| `pauseUkOdrCtrl` | Method | Suspension reception order control — issues suspension order when service contract status is suspension |
| `edit4OpSetOdrCtrl` | Method | Maps option order control data — prepares the SOD map for option service order control |
| `opSetOdrCtrl` | Method | Option order control processing — registers option service order data via SOD issuance |
| `kokanBfKiki` | Variable | Pre-change device information map — populated when equipment is in repair/exchange status |
| NTT | Acronym | Nippon Telegraph and Telephone — Japan's primary telecommunications carrier |
| FTTH | Acronym | Fiber To The Home — fiber-optic broadband connection to residential premises |
| VA | Acronym | Virtual Apartment — NTT's indoor equipment system for multi-dwelling units |
| ONU | Acronym | Optical Network Unit — fiber termination equipment |
| ENUM | Acronym | E.164 Number Mapping — DNS-based system mapping telephone numbers to SIP URIs for VoIP routing |
| `FUNC_CODE_1` | Constant | Function code 1 — standard processing mode for SC calls |
| `FUNC_CODE_4` | Constant | Function code 4 — specialized processing mode (used for EG swap variant equipment query) |
| CCException | Class | Common Component Exception — exception class thrown for service component call failures |
| SCCallException | Class | Service Component Call Exception — wraps status codes from SC/CBS calls |
| CAANMsg | Class | Common Application AN (Ancillary) Message — message wrapper for SC/CBS response data |
| `template_id` | Field | Template ID — identifies the response template used by SC/CBS methods |
