# Business Logic — JKKHakkoSODCC.htelItntokiOdrCtrl() [486 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.htelItntokiOdrCtrl()

This method implements the **Light/Phone Transfer Toki Order Control** process (`光電話移転トーキオーダ制御処理`). It is the central dispatch method responsible for evaluating the current state of a light/phone (光電話) service contract at the time of a transfer/ports operation and determining which Service Order Data (SOD) order entries to create.

The method handles multiple service state scenarios — **transfer-to-destination token activation** (the porting destination becomes operational), **transfer-from-original-termination token activation** (the original provider's termination begins), **suspension token activation**, and **suspension termination/end-of-pause** — by querying service contract inner details status and DSL pause token data, then branching into one of several business paths. Each path triggers specific SOD registrations (e.g., SIP token registration, suspension registration, ENUM setup, temporary stop) via the `addSOD` method with different `ODR_NAIYO_CD` order content codes.

The method implements a **routing/dispatch pattern**: it reads the service state and token codes from pre-queried data, applies date-based gating (the operation date must match the token start/end date), and then dispatches to a cascade of `addSOD` calls. It also handles the special case of **residence change during porting** (where the customer's address changed mid-transfer), querying residence change info and work case status to determine whether termination and re-registration orders should fire after a move-related work is completed.

For number portability scenarios, the method checks whether the phone number is from the same provider (`isTajgsTelNo`) or an exclusive number (`isMonaiBmp`) and conditionally creates ENUM setup/deletion orders (`ODR_NAIYO_CD_265` / `ODR_NAIYO_CD_266`) when the number is not from the same provider and is an exclusive number.

## 2. Processing Pattern (Detailed Business Logic)

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

    SUB1["(1) Extract SOD basic/service info from sodMap"]
    SUB2["(3) Light/Phone Transfer Token Processing"]

    SUB1 --> SVC_KEI_UCWK_NO["Get svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm"]
    SVC_KEI_UCWK_NO --> EKK0161_A["callEKK0161A010SC - Service contract inner details status"]

    EKK0161_A --> EKK0191_A["callEKK0191A010SC - DSL pause token data"]

    EKK0191_A --> EXTRACT_FIELDS["Extract: svcKeiUcwkStat, itntokiAddCd, itntokiStaYmd, itntokiEndYmd, itensOpafTokiAddCd, itensOpafTokiStaYmd, itensOpafTokiEndYmd, bmpUm"]

    EXTRACT_FIELDS --> TRANSFER_CHECK{"Transfer registration
porting-start?
(itensOpafTokiStaYmd != blank AND
opeDate==it AND itensOpafTokiEndYmd==blank)"}

    TRANSFER_CHECK -->|YES| TRANSFER_DEST_STATUS{"Destination status =
'Service in progress'
(100)?"}
    TRANSFER_CHECK -->|NO| DSL_TOKEN_START{"Current contract
status check"}

    TRANSFER_DEST_STATUS -->|YES| TRANSFER_DEST_ADD_CD{"Porting registration
token (259)?"}
    TRANSFER_DEST_ADD_CD -->|YES| SIP_REGISTER_259["addSOD - ODR_NAIYO_CD_259:
SIP/Token register
(porting registration)"]
    SIP_REGISTER_259 --> BMP_UM_CHECK1{"BMP (number) present?"}
    BMP_UM_CHECK1 -->|No| NO_BMP_CONDITION{"Tel provider=self
AND exclusive number?"}
    BMP_UM_CHECK1 -->|Yes| DSL_TOKEN_START
    NO_BMP_CONDITION -->|YES| ENUM_REGISTER_265["addSOD - ODR_NAIYO_CD_265:
ENUM setup/register"]
    NO_BMP_CONDITION -->|No| DSL_TOKEN_START
    ENUM_REGISTER_265 --> DSL_TOKEN_START

    DSL_TOKEN_START --> DSL_START_CHECK{"itntokiStaYmd != blank AND
opeDate==it AND
itntokiEndYmd==blank?"}

    DSL_START_CHECK -->|YES| DSL_STAT_910{"Service status =
'Terminated' (910)?"}
    DSL_STAT_910 -->|NO| SVC_KEI_STAT_210_CHECK{"Service status =
'Suspended' (210)?"}
    DSL_STAT_910 -->|YES| DSL_ADD_CD_CHECK{"Porting original-termination
token (220)?"}

    DSL_ADD_CD_CHECK -->|YES| SIP_TERMINATION_START["addSOD - ODR_NAIYO_CD_220:
SIP/Token register
(porting original-termination start)"]
    SIP_TERMINATION_START --> BMP_UM_CHECK2{"BMP (number) present?"}
    BMP_UM_CHECK2 -->|No| NO_BMP_CONDITION2{"Tel provider=self
AND exclusive number?"}
    BMP_UM_CHECK2 -->|Yes| SVC_KEI_STAT_210_CHECK
    NO_BMP_CONDITION2 -->|YES| ENUM_REGISTER_265_2["addSOD - ODR_NAIYO_CD_265:
ENUM setup/register"]
    NO_BMP_CONDITION2 -->|No| SVC_KEI_STAT_210_CHECK
    ENUM_REGISTER_265_2 --> SVC_KEI_STAT_210_CHECK

    SVC_KEI_STAT_210_CHECK -->|YES| SVC_KEI_STAT_210_DSL{"Token type = pause (262)?"}
    SVC_KEI_STAT_210_CHECK -->|NO| SVC_STAT_100_ADCHG{"Service status =
'Service in progress' (100)?"}
    SVC_KEI_STAT_210_DSL -->|YES| SIP_PAUSE_REGISTER["addSOD - ODR_NAIYO_CD_229:
SIP/termination"]
    SIP_PAUSE_REGISTER --> PAUSE_DEL_230["addSOD - ODR_NAIYO_CD_230:
SIP/deletion"]
    PAUSE_DEL_230 --> PAUSE_TOKEN_262["addSOD - ODR_NAIYO_CD_262:
SIP/token register
(suspension start)"]
    PAUSE_TOKEN_262 --> SVC_STAT_PAUSE_CHECK

    SVC_STAT_PAUSE_CHECK{"Service status =
'Suspended' (210)?"} -->|YES| SVC_STAT_PAUSE_DSL{"Token = pause (262)?"}
    SVC_STAT_PAUSE_CHECK -->|NO| SVC_STAT_100_ADCHG2{"Service status =
'Service in progress' (100)?"}
    SVC_STAT_PAUSE_DSL -->|YES| GET_SAME_TRN["getSame_trn_no
- Find same transaction number"]
    GET_SAME_TRN --> PAUSE_TERM_263["addSOD - ODR_NAIYO_CD_263:
SIP/token (suspension)
termination"]
    PAUSE_TERM_263 --> PAUSE_TERM_264["addSOD - ODR_NAIYO_CD_264:
SIP/token (suspension)
deletion"]
    PAUSE_TERM_264 --> PHONE_RESTART_218["addSOD - ODR_NAIYO_CD_218:
SIP/register (phone restart request)"]
    PHONE_RESTART_218 --> OPTION_REGISTER_219["addSOD - ODR_NAIYO_CD_219:
Options bulk register (050 excl.)"]
    OPTION_REGISTER_219 --> TELNO_JUDGE{"isTelnoSODJudge -
Phone state check?"}
    TELNO_JUDGE -->|true| BMP_REG_225["addSOD - ODR_NAIYO_CD_225:
Phone info register"]
    TELNO_JUDGE -->|false| PAUSE_JDG["pauseJdg -
Suspension judgment"]
    BMP_REG_225 --> PAUSE_JDG
    PAUSE_JDG --> PAUSE_JDG_CD1{"Pause code = 1
(pause in progress)?"}
    PAUSE_JDG_CD1 -->|YES| TEMP_STOP_223["addSOD - ODR_NAIYO_CD_223:
SIP/temporary stop"]
    PAUSE_JDG_CD1 -->|No| ADCHG_CHECK
    TEMP_STOP_223 --> ADCHG_CHECK

    ADCHG_CHECK{"Service status =
'Service in progress' (100)?"} -->|YES| GET_ADCHG["getAdChgInfo -
Residence change info"]
    GET_ADCHG --> ADCHG_STAT_REG{"Adchg status =
registered?"}
    ADCHG_STAT_REG -->|YES| GET_KOJIAK["getKojiakState -
Work case status"]
    GET_KOJIAK --> KOJIAK_STAT200{"Kojiak status =
work completed (200)?"}
    KOJIAK_STAT200 -->|YES| RESIDENCE_TERM["addSOD - ODR_NAIYO_CD_229:
SIP/termination"]
    RESIDENCE_TERM --> RESIDENCE_DEL_230["addSOD - ODR_NAIYO_CD_230:
SIP/deletion"]
    RESIDENCE_DEL_230 --> RES_BMP_CHECK{"BMP (number) present?"}
    RES_BMP_CHECK -->|No| NO_BMP_RES{"Tel provider=self
AND exclusive number?"}
    RES_BMP_CHECK -->|Yes| RESIDENCE_START_220
    NO_BMP_RES -->|YES| ENUM_DEL_266["addSOD - ODR_NAIYO_CD_266:
ENUM setup/deletion"]
    NO_BMP_RES -->|No| RESIDENCE_START_220
    ENUM_DEL_266 --> RESIDENCE_START_220
    RESIDENCE_START_220["addSOD - ODR_NAIYO_CD_220:
SIP/token register
(porting start)"]
    RESIDENCE_START_220 --> RES_BMP_CHECK2{"BMP (number) present?"}
    RES_BMP_CHECK2 -->|No| NO_BMP_RES2{"Tel provider=self
AND exclusive number?"}
    RES_BMP_CHECK2 -->|Yes| TRANSFER_END_CHECK
    NO_BMP_RES2 -->|YES| ENUM_REG_265_RES["addSOD - ODR_NAIYO_CD_265:
ENUM setup/register"]
    NO_BMP_RES2 -->|No| TRANSFER_END_CHECK
    ENUM_REG_265_RES --> TRANSFER_END_CHECK

    TRANSFER_END_CHECK{"Transfer end date
match?"} -->|YES| TRANSFER_END_STAT{"Status =
'Terminated' (910)?"}
    TRANSFER_END_CHECK -->|NO| DSL_END_CHECK{"itntokiEndYmd not blank
AND opeDate equals it?"}
    TRANSFER_END_STAT -->|YES| TRANSFER_END_ADD_CD{"Porting dest registration
token?"}
    TRANSFER_END_ADD_CD -->|YES| GET_SAME_TRN_END["getSame_trn_no"]
    GET_SAME_TRN_END --> TERM_UNREG_260["addSOD - ODR_NAIYO_CD_260:
SIP/token (porting dest reg)
unregistration"]
    TERM_UNREG_260 --> TERM_DELETE_261["addSOD - ODR_NAIYO_CD_261:
SIP/token (porting dest reg)
deletion"]
    TERM_DELETE_261 --> TERM_BMP_CHECK{"BMP (number) present?"}
    TERM_BMP_CHECK -->|No| NO_BMP_TERM{"Tel provider=self
AND exclusive number?"}
    TERM_BMP_CHECK -->|Yes| DSL_END_CHECK
    NO_BMP_TERM -->|YES| ENUM_DEL_266_END["addSOD - ODR_NAIYO_CD_266:
ENUM setup/deletion"]
    NO_BMP_TERM -->|No| DSL_END_CHECK
    ENUM_DEL_266_END --> DSL_END_CHECK

    DSL_END_CHECK -->|YES| DSL_END_STAT210{"Status =
'Suspended' (210)?"}
    DSL_END_STAT210 -->|YES| DSL_END_PAUSE{"Token = pause (262)?"}
    DSL_END_PAUSE -->|YES| GET_SAME_TRN_END2["getSame_trn_no"]
    GET_SAME_TRN_END2 --> PAUSE_TERM_263_END["addSOD - ODR_NAIYO_CD_263:
SIP/token (suspension)
termination"]
    PAUSE_TERM_263_END --> PAUSE_TERM_264_END["addSOD - ODR_NAIYO_CD_264:
SIP/token (suspension)
deletion"]
    PAUSE_TERM_264_END --> PHONE_RESTART_218_END["addSOD - ODR_NAIYO_CD_218:
SIP/register (phone restart request)"]
    PHONE_RESTART_218_END --> OPTION_REGISTER_219_END["addSOD - ODR_NAIYO_CD_219:
Options bulk register (050 excl.)"]
    OPTION_REGISTER_219_END --> PAUSE_JDG_END["pauseJdg"]
    PAUSE_JDG_END --> PAUSE_JDG_CD1_END{"Pause code = 1?"}
    PAUSE_JDG_CD1_END -->|YES| TEMP_STOP_223_END["addSOD - ODR_NAIYO_CD_223:
SIP/temporary stop"]
    PAUSE_JDG_CD1_END -->|No| ELSE_BRANCH
    TEMP_STOP_223_END --> ELSE_BRANCH

    ELSE_BRANCH{"Default / other
service status?"} -->|YES| ELSE_DSL{"Token = porting
original-termination (220)?"}
    ELSE_DSL -->|YES| GET_SAME_TRN_3["getSame_trn_no"]
    GET_SAME_TRN_3 --> ELSE_TERM_221["addSOD - ODR_NAIYO_CD_221:
SIP/token (porting orig-termination)
termination"]
    ELSE_TERM_221 --> ELSE_DEL_222["addSOD - ODR_NAIYO_CD_222:
SIP/token (porting orig-termination)
deletion"]
    ELSE_DEL_222 --> ELSE_BMP_CHECK{"BMP (number) present?"}
    ELSE_BMP_CHECK -->|No| NO_BMP_ELSE{"Tel provider=self
AND exclusive number?"}
    ELSE_BMP_CHECK -->|Yes| END_NODE
    NO_BMP_ELSE -->|YES| ENUM_DEL_266_ELSE["addSOD - ODR_NAIYO_CD_266:
ENUM setup/deletion"]
    NO_BMP_ELSE -->|No| END_NODE
    ENUM_DEL_266_ELSE --> END_NODE

    ELSE_DSL -->|NO| END_NODE
    TRANSFER_END_STAT -->|NO| DSL_END_CHECK
    TRANSFER_END_CHECK -->|NO| DSL_END_CHECK
    TRANSFER_END_ADD_CD -->|NO| DSL_END_CHECK
    ADSHG_CHECK -->|NO| DSL_END_CHECK
    SVC_STAT_100_ADCHG2 -->|NO| DSL_END_CHECK
    SVC_STAT_PAUSE_DSL -->|NO| ELSE_BRANCH

    END_NODE(["Return param"])
    DSL_END_CHECK -->|NO| END_NODE
    DSL_START_CHECK -->|NO| TRANSFER_END_CHECK

    linkStyle default interpolate basis
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle carrying the database session and transaction context. Used for all service component calls and SOD registration. Represents the current database connection/transaction scope. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object containing the model group and control map. It carries input parameters from the calling screen and accumulates SOD order entries via `addSOD` calls. Modified in-place through method chaining (return value reassigned). |
| 3 | `fixedText` | `String` | User-specified arbitrary text string. Passed through to the method but not actively used in the control logic — a pass-through parameter for additional context from the calling screen. |
| 4 | `sodMap` | `HashMap<String, Object>` | SOD (Service Order Data) map containing sub-maps for SOD basic info (`SOD_KIHON_INFO`), service contract info (`SVC_KEI_INFO`), and service contract inner details info (`SVC_KEI_UCWK_INFO`). Extracted and cleaned via `shkkaMap()` to resolve null-safe key lookups. |

**Instance fields read/written by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `this.svc_kei_ucwk_no` | `String[1]` | Service contract inner details number — set to the extracted `svc_kei_ucwk_no` for downstream use by called methods. |
| `this.svc_kei_ucwk_gadtm` | `String[1]` | Post-change service contract inner details generation registration date-time — set from `chaf_svc_kei_ucwk_gene_add_dtm`. |
| `this.same_trn_no` | `String` | Same transaction number — set when `getSame_trn_no` is called to enable transaction grouping across related SOD entries. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKHakkoSODCC.callEKK0161A010SC` | EKK0161A010SC | Service contract inner details | Query service contract inner details status — called twice (first for current contract, second for porting destination contract after transfer). |
| R | `JKKHakkoSODCC.callEKK0191A010SC` | EKK0191A010SC | DSL pause token data | Query DSL pause/termination token data including start/end dates, add codes, and BMP (number portability) status. |
| R | `JKKHakkoSODCC.getAdChgInfo` | EKK2091A010SC / EKK2101B002SC | Residence change info (adchg tables) | Retrieve residence change information including address change status, address change number, and pre/post change identification numbers when a customer moved during porting. |
| R | `JKKHakkoSODCC.getKojiakState` | (work case CBS) | Work case status table | Query work case status to determine if residence-change-related construction work is completed (status 200). |
| R | `JKKHakkoSODCC.getSame_trn_no` | (transaction CBS) | Transaction number table | Find the same transaction number to group related SOD orders under a single transaction for processing. Called in multiple suspension/termination scenarios. |
| C | `JKKHakkoSODCC.addSOD` | JKKHakkoSODCC | SOD order data | Create SOD (Service Order Data) order entries with various `ODR_NAIYO_CD` codes. This is the primary write operation — the method issues 2 to 6+ `addSOD` calls depending on the path taken. |
| - | `JKKHakkoSODCC.isTajgsTelNo` | - | - | Check if the phone number belongs to the same (own) telecom provider. Returns true for own provider numbers. |
| - | `JKKHakkoSODCC.isMonaiBmp` | - | - | Check if the phone number is an exclusive/unique number eligible for number portability BMP processing. |
| - | `JKKHakkoSODCC.isTelnoSODJudge` | - | - | Determine if a phone info registration SOD should be created based on phone number state. |
| - | `JKKHakkoSODCC.isBlankDate` | - | - | Utility to check if a date string is blank/null/empty. |
| - | `JKKHakkoSODCC.shkkaMap` | - | - | Utility to resolve null-safe map key lookups (returns empty map for null input). |
| - | `JKKHakkoSODCC.pauseJdg` | - | - | Suspension judgment — determines current pause/suspension state of the service line, returns a pause judgment code. |

### `addSOD` Order Content Code Reference

| ODR_NAIYO_CD | Business Meaning |
|--------------|------------------|
| `218` | SIP/register (phone restart request) |
| `219` | Options bulk register (excluding 050) |
| `220` | SIP/Token register (porting original-termination start) |
| `221` | SIP/Token (porting original-termination) termination |
| `222` | SIP/Token (porting original-termination) deletion |
| `223` | SIP/temporary stop |
| `225` | Phone info register |
| `229` | SIP/termination |
| `230` | SIP/deletion |
| `259` | SIP/Token register (porting registration) |
| `260` | SIP/Token (porting destination registration) unregistration |
| `261` | SIP/Token (porting destination registration) deletion |
| `262` | SIP/token register (suspension start) |
| `263` | SIP/token (suspension) termination |
| `264` | SIP/token (suspension) deletion |
| `265` | ENUM setup/register |
| `266` | ENUM setup/deletion |

## 5. Dependency Trace

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKHakkoSODCC.hakkoSOD()` | `hakkoSOD()` → `htelItntokiOdrCtrl()` | `addSOD [C] SOD order data`, `callEKK0161A010SC [R] Service contract inner details`, `callEKK0191A010SC [R] DSL pause token data`, `getAdChgInfo [R] Residence change info`, `getKojiakState [R] Work case status`, `getSame_trn_no [R] Transaction number`, `pauseJdg [-] Suspension judgment`, `isTajgsTelNo [-]`, `isMonaiBmp [-]`, `isTelnoSODJudge [-]` |

This method is called exclusively from `JKKHakkoSODCC.hakkoSOD()`, which is the main order issuance dispatch method. The `hakkoSOD` method determines which specialized controller method to invoke (light/phone transfer, light/phone number info change, etc.) based on the order context and dispatches to `htelItntokiOdrCtrl` when the scenario is a light/phone transfer at token time.

## 6. Per-Branch Detail Blocks

### Block 1 — INIT [L15871]

Initialize service state tracking and extract SOD data from the map.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | SET | `sod_kihon_info_Map = shkkaMap(sodMap.get(SOD_KIHON_INFO))` | Extract and clean SOD basic info map |
| 2 | SET | `svc_kei_info_Map = shkkaMap(sodMap.get(SVC_KEI_INFO))` | Extract and clean service contract info map |
| 3 | SET | `svc_kei_ucwk_info_Map = shkkaMap(sodMap.get(SVC_KEI_UCWK_INFO))` | Extract and clean service contract inner details map |
| 4 | EXEC | `svc_kei_ucwk_no = svc_kei_info_Map.get(INFO_SVC_KEI_NO)` | Get service contract number |
| 5 | SET | `svc_kei_ucwk_no = svc_kei_ucwk_info_Map.get(INFO_SVC_KEI_UCWK_NO)` | Get post-change service contract inner details number |
| 6 | SET | `chaf_svc_kei_ucwk_gene_add_dtm = svc_kei_ucwk_info_Map.get(INFO_CHAF_SVC_KEI_UCWK_GENE_ADD_DTM)` | Get post-change generation registration datetime |
| 7 | SET | `opeDate = JCCBPCommon.getOpeDate(null)` | Get the operation date (system date) |

### Block 2 — EKK0161A010SC CALL [L15895-L15913]

Query the service contract inner details status.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | SET | `inHashUcwk.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` | Set input: service contract inner details number |
| 2 | SET | `inHashUcwk.put(GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` | Set input: generation registration datetime |
| 3 | CALL | `statusCode = callEKK0161A010SC(param, handle, inHashUcwk, resultHashUcwk, FUNC_CODE_1)` | Call service component to query service contract inner details status |
| 4 | IF | `statusCode != 0` | On error, throw CCException with SCCallException |
| 5 | SET | `eKK0161A010Hash = resultHashUcwk.get(TEMPLATE_ID_EKK0161A010)` | Extract response hash |
| 6 | SET | `svcKeiUcwkStat = eKK0161A010Hash.get(SVC_KEI_UCWK_STAT)` | Extract service contract inner details status code |

### Block 3 — EKK0191A010SC CALL [L15916-L15937]

Query DSL pause token data.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | SET | `inHashUcwkTel.put(SVC_KEI_UCWK_NO, svc_kei_ucwk_no)` | Set input: service contract inner details number |
| 2 | SET | `inHashUcwkTel.put(GENE_ADD_DTM, chaf_svc_kei_ucwk_gene_add_dtm)` | Set input: generation registration datetime |
| 3 | CALL | `statusCode = callEKK0191A010SC(param, handle, inHashUcwkTel, resultHashUcwkTel, FUNC_CODE_1)` | Call service component to query DSL pause token data |
| 4 | IF | `statusCode != 0` | On error, throw CCException |
| 5 | SET | `eKK0191A010Hash = resultHashUcwkTel.get(TEMPLATE_ID_EKK0191A010)` | Extract response hash |
| 6 | SET | `itntokiAddCd = eKK0191A010Hash.get(DSL_PAUSE_TOKI_ADD_CD)` | Extract pause/termination token add code |
| 7 | SET | `itntokiStaYmd = eKK0191A010Hash.get(DSL_PAUSE_TOKI_STA_YMD)` | Extract pause/termination token start date |
| 8 | SET | `bmpUm = eKK0191A010Hash.get(BMP_UM)` | Extract BMP (number portability) presence flag |
| 9 | SET | `this.svc_kei_ucwk_no[0] = svc_kei_ucwk_no` | Set instance field |
| 10 | SET | `this.svc_kei_ucwk_gadtm[0] = chaf_svc_kei_ucwk_gene_add_dtm` | Set instance field |

### Block 4 — TRANSFER REGISTRATION PORTING-START CHECK [L15948]

Check if the transfer destination porting-start token is active (i.e., the porting destination has started and the end date is still blank).

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | SET | `itensOpafTokiAddCd = eKK0191A010Hash.get(ITENS_OPAF_TOKI_ADD_CD)` | Extract transfer destination token add code |
| 2 | SET | `itensOpafTokiStaYmd = eKK0191A010Hash.get(ITENS_OPAF_TOKI_STA_YMD)` | Extract transfer destination token start date |
| 3 | SET | `itensOpafTokiEndYmd = eKK0191A010Hash.get(ITENS_OPAF_TOKI_END_YMD)` | Extract transfer destination token end date |
| 4 | IF | `itensOpafTokiStaYmd != blank AND opeDate == it AND itensOpafTokiEndYmd == blank` | Transfer destination porting-start token is active today |

#### Block 4.1 — DESTINATION SERVICE STATUS CHECK [L15958-L15973]

When the transfer destination porting-start token is active, query the destination contract status and check if it's "service in progress" and the original contract is "terminated".

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | SET | `itnsOpafTokiTssSvkuwno = eKK0191A010Hash.get(ITNS_OPAF_TOKI_TSS_SVKUWNO)` | Get destination service contract inner details number |
| 2 | SET | `tssInHashUcwk.put(SVC_KEI_UCWK_NO, itnsOpafTokiTssSvkuwno)` | Set input for destination query |
| 3 | SET | `tssInHashUcwk.put(OPE_DATE, JCCBPCommon.getOpeDate(null))` | Set operation date |
| 4 | CALL | `statusCode = callEKK0161A010SC(..., FUNC_CODE_2)` | Query destination contract status |
| 5 | SET | `tssSvcKeiUcwkStat = tssEKK0161A010Hash.get(SVC_KEI_UCWK_STAT)` | Get destination service status |
| 6 | IF | `svcKeiUcwkStat == SVC_KEI_STAT_910 (Terminated) AND tssSvcKeiUcwkStat == SVC_KEI_STAT_100 (Service in progress)` | Both: original terminated, destination active |

##### Block 4.1.1 — PORTING REGISTRATION TOKEN CHECK [L15977-L15983]

Check if the token add code indicates "registration due to porting destination registration" and issue the appropriate SOD orders.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `itensOpafTokiAddCd == ITNTOKI_ADD_CD_ADD (porting registration)` | Token type matches porting registration |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_259)` | Register SIP/Token for porting registration |

##### Block 4.1.2 — ENUM REGISTRATION FOR NO-BMP CASES [L15989-L16001]

When BMP is not present, check if ENUM setup is needed (own provider, exclusive number).

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `bmpUm != BMP_UM_ARI (BMP not present)` | Number portability not active |
| 2 | IF | `!isTajgsTelNo(...) AND isMonaiBmp(...)` | Own provider AND exclusive number |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_265)` | Register ENUM setup |

### Block 5 — CURRENT CONTRACT STATUS CHECK (PORTING START) [L16008]

Check if the current contract's transfer token start date matches the operation date (i.e., the token is starting today).

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | SET | `itntokiEndYmd = eKK0191A010Hash.get(DSL_PAUSE_TOKI_END_YMD)` | Extract pause/termination token end date |
| 2 | IF | `itntokiStaYmd != blank AND opeDate == it AND itntokiEndYmd == blank` | Current token started today, no end date yet |

#### Block 5.1 — SERVICE STATUS = TERMINATED CHECK [L16019-L16024]

Check if the service contract status is "Terminated" (910).

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `svcKeiUcwkStat == SVC_KEI_STAT_910 (Terminated)` | Service contract is terminated |

##### Block 5.1.1 — PORTING ORIGINAL-TERMINATION TOKEN [L16028-L16035]

When the token code indicates "token due to porting original-termination", issue SIP termination orders.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `itntokiAddCd == ITNTOKI_ADD_CD_DSL (porting original-termination)` | Token matches porting original-termination |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_220)` | Register SIP/Token for porting original-termination start |

##### Block 5.1.2 — ENUM REGISTRATION FOR NO-BMP [L16041-L16053]

Same ENUM logic as Block 4.1.2: register ENUM for own-provider exclusive numbers when BMP is not present.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `bmpUm != BMP_UM_ARI` | BMP not active |
| 2 | IF | `!isTajgsTelNo(...) AND isMonaiBmp(...)` | Own provider AND exclusive number |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_265)` | Register ENUM setup |

#### Block 5.2 — SERVICE STATUS = SUSPENDED CHECK [L16059-L16060]

Check if the service contract status is "Suspended" (210).

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `svcKeiUcwkStat == SVC_KEI_STAT_210 (Suspended)` | Service is suspended |

##### Block 5.2.1 — SUSPENSION TOKEN CHECK [L16064-L16068]

When the token is a "token due to suspension", issue termination/deletion and re-registration orders.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `itntokiAddCd == ITNTOKI_ADD_CD_PAUSE (suspension)` | Token matches suspension |
| 2 | SET | `sameTrnNo = new String[1]` | Allocate same transaction number holder |
| 3 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` | Find same transaction number for grouping |
| 4 | SET | `this.same_trn_no = sameTrnNo[0]` | Store in instance field |
| 5 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_229)` | Register SIP/termination |
| 6 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_230)` | Register SIP/deletion |
| 7 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_262)` | Register SIP/token (suspension start) |

##### Block 5.2.2 — PHONE STATE CHECK AND OPTION REGISTRATION [L16073-L16086]

After registration, check phone state and register options.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | CALL | `isTelnoSODJudge(handle, param, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm, null, TELNO_JUDGE_001)` | Check phone number state for SOD decision |
| 2 | IF | `isTelnoSODJudge returns true` | Phone state requires registration |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_225)` | Register phone info |
| 4 | SET | `pause_jdg_cd = new String[1]` | Allocate pause judgment code holder |
| 5 | CALL | `param = pauseJdg(param, handle, null, svc_kei_no, pause_jdg_cd)` | Determine suspension state |
| 6 | IF | `pause_jdg_cd[0] == PAUSE_JDG_CD_1 (pause in progress)` | Currently in pause |
| 7 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_223)` | Register SIP/temporary stop |

#### Block 5.3 — SERVICE STATUS = IN PROGRESS (RESIDENCE CHANGE) CHECK [L16090-L16149]

ANP-2648-00-00 addition (2015-12-17): When the service status is "Service in progress" and the porting original-termination token is active, check if the customer moved during the transfer (residence change scenario).

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `svcKeiUcwkStat == SVC_KEI_STAT_100 (Service in progress)` | Service is in progress |
| 2 | IF | `itntokiAddCd == ITNTOKI_ADD_CD_DSL (porting original-termination)` | Token matches porting original-termination |
| 3 | CALL | `adchgInfo = getAdChgInfo(param, handle, svc_kei_ucwk_no)` | Get residence change info |
| 4 | SET | `adchgStat = adchgInfo.get(ADCHG_STAT)` | Get address change status |
| 5 | IF | `adchgStat == ADCHG_STAT_REG (registered)` | Residence change is registered/in-progress |
| 6 | SET | `adchgNo = adchgInfo.get(ADCHG_NO)` | Get address change number |
| 7 | CALL | `kojiakStat = getKojiakState(param, handle, adchgNo, svc_kei_no)` | Get work case status |
| 8 | SET | `chbfSkbtNo = adchgInfo.get(CHBF_SKBT_NO)` | Get pre-change identification number |
| 9 | SET | `chafSkbtNo = adchgInfo.get(CHAF_SKBT_NO)` | Get post-change identification number |
| 10 | IF | `kojiakStat == KOJIAK_STAT_200 (work completed) AND svc_kei_ucwk_no == chbfSkbtNo AND chafSkbtNo is not blank` | Work completed, original contract number matches pre-change number, post-change number exists |

##### Block 5.3.1 — RESIDENCE CHANGE TERMINATION ORDERS [L16120-L16125]

When construction work is complete and the move is confirmed, issue termination and deletion orders.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_229)` | SIP/termination |
| 2 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_230)` | SIP/deletion |

##### Block 5.3.2 — ENUM DELETION FOR NO-BMP CASES [L16131-L16143]

When BMP is not present and it's an own-provider exclusive number, delete ENUM setup.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `bmpUm != BMP_UM_ARI` | BMP not active |
| 2 | IF | `!isTajgsTelNo(...) AND isMonaiBmp(...)` | Own provider AND exclusive number |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_266)` | Delete ENUM setup |

##### Block 5.3.3 — RESIDENCE CHANGE START TOKEN ORDERS [L16152-L16160]

After termination, issue the porting start token registration.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_220)` | SIP/token register (porting start) |

##### Block 5.3.4 — ENUM REGISTRATION FOR NO-BMP [L16166-L16178]

Register ENUM for the post-change contract when BMP is not present.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `bmpUm != BMP_UM_ARI` | BMP not active |
| 2 | IF | `!isTajgsTelNo(...) AND isMonaiBmp(...)` | Own provider AND exclusive number |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_265)` | Register ENUM setup |

### Block 6 — TRANSFER END DATE CHECK (PORTING DESTINATION) [L16185]

Check if the transfer destination porting token end date matches the operation date.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `itensOpafTokiStaYmd != blank AND itensOpafTokiEndYmd != blank AND opeDate == itensOpafTokiEndYmd` | Transfer end date matches operation date |

#### Block 6.1 — TRANSFER DESTINATION TERMINATED STATUS [L16192-L16203]

When the original service status is "Terminated" (910) and the token is for porting destination registration, issue unregistration orders.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `svcKeiUcwkStat == SVC_KEI_STAT_910 (Terminated)` | Original contract is terminated |
| 2 | IF | `itensOpafTokiAddCd == ITNTOKI_ADD_CD_ADD (porting registration)` | Token matches porting registration |
| 3 | SET | `sameTrnNo = new String[1]` | Allocate holder |
| 4 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` | Get same transaction number |
| 5 | SET | `this.same_trn_no = sameTrnNo[0]` | Store in instance |
| 6 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_260)` | Unregister SIP/Token (porting dest registration) |
| 7 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_261)` | Delete SIP/Token (porting dest registration) |

#### Block 6.2 — ENUM DELETION FOR NO-BMP [L16210-L16222]

Same ENUM deletion logic when BMP is not present.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `bmpUm != BMP_UM_ARI` | BMP not active |
| 2 | IF | `!isTajgsTelNo(...) AND isMonaiBmp(...)` | Own provider AND exclusive number |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_266)` | Delete ENUM setup |

### Block 7 — DSL END DATE CHECK (SUSPENSION END) [L16231]

Check if the DSL pause token end date matches the operation date (i.e., suspension is ending today).

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `itntokiStaYmd != blank AND itntokiEndYmd != blank AND opeDate == itntokiEndYmd` | Token end date matches operation date |

#### Block 7.1 — SUSPENDED STATUS AT END [L16245-L16280]

When the service status is "Suspended" (210) and the token is a pause token at end date.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `svcKeiUcwkStat == SVC_KEI_STAT_210 (Suspended)` | Service is suspended |
| 2 | IF | `itntokiAddCd == ITNTOKI_ADD_CD_PAUSE (suspension)` | Token matches suspension |
| 3 | SET | `sameTrnNo = new String[1]` | Allocate holder |
| 4 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` | Get same transaction number |
| 5 | SET | `this.same_trn_no = sameTrnNo[0]` | Store in instance |
| 6 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_263)` | SIP/token (suspension) termination |
| 7 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_264)` | SIP/token (suspension) deletion |
| 8 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_218)` | SIP/register (phone restart request) |
| 9 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_219)` | Options bulk register (050 excl.) |

##### Block 7.1.1 — PHONE REGISTRATION [L16286-L16293]

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | CALL | `isTelnoSODJudge(handle, param, svc_kei_ucwk_no, chaf_svc_kei_ucwk_gene_add_dtm, null, TELNO_JUDGE_001)` | Phone state check |
| 2 | IF | `isTelnoSODJudge returns true` | Phone state requires registration |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_225)` | Phone info register |

##### Block 7.1.2 — PAUSE JUDGMENT [L16299-L16307]

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | SET | `pause_jdg_cd = new String[1]` | Allocate pause code holder |
| 2 | CALL | `param = pauseJdg(param, handle, null, svc_kei_no, pause_jdg_cd)` | Determine suspension state |
| 3 | IF | `pause_jdg_cd[0] == PAUSE_JDG_CD_1 (pause in progress)` | Still in pause |
| 4 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_223)` | SIP/temporary stop |

#### Block 7.2 — DEFAULT BRANCH (OTHER SERVICE STATUS) [L16311-L16320]

When the service status is neither "Terminated" nor "Suspended" (e.g., "Service in progress" after OM-2015-0000151 change).

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | (default — other status codes) | Service has a non-standard status |

##### Block 7.2.1 — PORTING ORIGINAL-TERMINATION AT END [L16324-L16336]

When the token indicates porting original-termination and the service is at its end date.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `itntokiAddCd == ITNTOKI_ADD_CD_DSL (porting original-termination)` | Token matches porting original-termination |
| 2 | SET | `sameTrnNo = new String[1]` | Allocate holder |
| 3 | CALL | `getSame_trn_no(param, handle, null, sameTrnNo)` | Get same transaction number |
| 4 | SET | `this.same_trn_no = sameTrnNo[0]` | Store in instance |
| 5 | SET | `naiyoCdDsl = ODR_NAIYO_CD_221` | SIP/token (porting orig-termination) termination |
| 6 | SET | `naiyoCdDel = ODR_NAIYO_CD_222` | SIP/token (porting orig-termination) deletion |
| 7 | CALL | `param = addSOD(handle, param, naiyoCdDsl)` | Issue termination order |
| 8 | CALL | `param = addSOD(handle, param, naiyoCdDel)` | Issue deletion order |

##### Block 7.2.2 — ENUM DELETION FOR NO-BMP [L16343-L16355]

Same ENUM deletion logic as other blocks when BMP is not present.

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | IF | `bmpUm != BMP_UM_ARI` | BMP not active |
| 2 | IF | `!isTajgsTelNo(...) AND isMonaiBmp(...)` | Own provider AND exclusive number |
| 3 | CALL | `param = addSOD(handle, param, ODR_NAIYO_CD_266)` | Delete ENUM setup |

### Block 8 — RETURN [L16358]

| # | Type | Code | Description |
|---|------|------|-------------|
| 1 | RETURN | `return param;` | Return the updated parameter object with all SOD entries accumulated |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| SOD | Acronym | Service Order Data — the core order entity in the K-Opticom system. Represents a work order to be dispatched to field technicians or automated systems. |
| JKKHakkoSODCC | Class | Hakko (issuance) SOD Common Component — the shared component class handling service order issuance logic for various contract scenarios. |
| 光電話移転トーキオーダ制御処理 | Japanese | Light/Phone Transfer Token Order Control Processing — the business process of managing SIP/phone service orders during a number portability transfer. |
| htItntoki | Abbreviation | Hikari/Telefon Ido Toki — "at the time of light/phone transfer" (porting operation). |
| ODR_NAIYO_CD | Field | Order Content Code — classifies the type of SOD order to be created (e.g., 220 = SIP/Token register at porting original-termination start). |
| SVC_KEI_NO | Field | Service Contract Number — the unique identifier for a service contract line item. |
| SVC_KEI_UCWK_NO | Field | Service Contract Inner Details Number — the unique identifier for a specific service contract inner details entry (post-change). |
| SVC_KEI_UCWK_STAT | Field | Service Contract Inner Details Status — the current status code of a service contract (100 = Service in progress, 210 = Suspended, 910 = Terminated). |
| SVC_KEI_STAT_100 | Constant | "100" — Service in progress status code. |
| SVC_KEI_STAT_210 | Constant | "210" — Suspended/paused status code. |
| SVC_KEI_STAT_910 | Constant | "910" — Terminated (contract ended) status code. |
| ITNTOKI_ADD_CD | Field | Porting Token Add Code — the code that classifies what type of porting token event triggered (220 = porting original-termination, 259 = porting registration, 262 = suspension). |
| ITNTOKI_ADD_CD_ADD | Constant | Porting registration token code — token triggered by "registration due to porting destination registration". |
| ITNTOKI_ADD_CD_DSL | Constant | Porting original-termination token code — token triggered by "token due to porting original-termination". |
| ITNTOKI_ADD_CD_PAUSE | Constant | Suspension token code — token triggered by "token due to suspension". |
| ITENS_OPAF_TOKI_ADD_CD | Field | Transfer destination token add code — the token code specific to the porting destination side. |
| ITNS_OPAF_TOKI_TSS_SVKUWNO | Field | Transfer destination service contract inner details number — the SVC_KEI_UCWK_NO of the destination (new) provider contract. |
| BMP_UM | Field | BMP presence/absence flag — indicates whether number portability (BMP: Number Portability) is active for this line. |
| BMP_UM_ARI | Constant | "1" — BMP (number portability) is present/active. |
| OPE_DATE | Field | Operation Date — the system's current business date, used for date-based gating of order issuance. |
| GENE_ADD_DTM | Field | Generation Registration Date-Time — the timestamp when a service contract inner details entry was generated/registered. |
| TELNO_JUDGE_001 | Constant | Phone number judgment code 001 — used to evaluate phone number state for SOD decisions. |
| PAUSE_JDG_CD_1 | Constant | Pause judgment code "1" — indicates the service is currently in a paused/suspended state. |
| ADCHG_STAT | Field | Address Change Status — the status of a residence (address) change request (e.g., "registered" = in-progress). |
| ADCHG_STAT_REG | Constant | "Registered" — residence change request is registered and in-progress. |
| ADCHG_NO | Field | Address Change Number — unique identifier for the residence change request. |
| CHBF_SKBT_NO | Field | Pre-Change Identification Number — the customer/scheme identification number before the residence change. |
| CHAF_SKBT_NO | Field | Post-Change Identification Number — the customer/scheme identification number after the residence change. |
| KOJIAK_STAT_200 | Constant | Work status "200" — construction/work case is completed. |
| Kojiak | Japanese | Work case / construction case — the field work record tied to a residence change. |
| Same Transaction Number | Field | A transaction grouping number (`same_trn_no`) used to batch related SOD orders under a single transaction for coordinated processing. |
| addSOD | Method | Service Order Data creation method — writes a new SOD order entry with the specified order content code. |
| callEKK0161A010SC | Method | Service Component call to retrieve service contract inner details status and related data. |
| callEKK0191A010SC | Method | Service Component call to retrieve DSL pause/termination token data (start/end dates, add codes, BMP status). |
| getAdChgInfo | Method | Retrieves residence change information including status, numbers, and pre/post-change identification. |
| getKojiakState | Method | Queries the work case status for a residence change. |
| getSame_trn_no | Method | Retrieves the same transaction number to group related SOD entries. |
| pauseJdg | Method | Determines the current suspension/pause judgment state of a service line. |
| isTajgsTelNo | Method | Judge whether the phone number belongs to the same (own) telecom provider. |
| isMonaiBmp | Method | Judge whether the phone number is an exclusive/unique number eligible for number portability. |
| isTelnoSODJudge | Method | Comprehensive phone number state judgment for SOD order creation decisions. |
| isBlankDate | Method | Utility to check if a date string field is blank/null/empty. |
| shkkaMap | Method | Null-safe map lookup utility — wraps a map.get() call with null-handling. |
| ENUM | Business term | ENUM (E.164 Number Mapping) — a VoIP number mapping system that maps phone numbers to SIP URIs. |
| SIP | Business term | Session Initiation Protocol — the VoIP signaling protocol used for managing telephone services in the IP network. |
| OPE_DATE | Constant | System operation date — the current business date used for date-gating of order issuance. |
| FUNC_CODE_1 | Constant | Function code "1" — used in EKK0161A010SC/EKK0191A010SC calls to indicate the operation type (status query). |
| FUNC_CODE_2 | Constant | Function code "2" — used in EKK0161A010SC calls for destination contract status queries. |
| TEMERMINATED | Constant | "910" — Service contract is terminated. |
| 移転 | Japanese | Ido — Transfer / porting (of a phone service to a new provider). |
| トークイ | Japanese | Toki — "At the time of" (a specific timing/event). |
| 登録 | Japanese | Toki-Register — Token registration / activation. |
| 解除 | Japanese | Kaijo — Termination / cancellation (of a service or order). |
| 休止 | Japanese | Kyushi — Suspension / pause (of a service). |
| 住所変更 | Japanese | Jusho Henkou — Residence/Address change (customer moved during service period). |
