# Business Logic — JKKHakkoSODCC.opSetOdrCtrl() [2927 LOC]

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

## 1. Role

### JKKHakkoSODCC.opSetOdrCtrl()

This method is the central order-control dispatcher for Fujitsu's telecom Service Order Data (SOD) system. Its Japanese Javadoc reads オプション設定オーダ制御処理 (Option Setting Order Control Processing). It orchestrates the creation of order directives based on the state transitions of an option service contract, determining whether a new order, cancellation, or modification directive should be emitted into the order pipeline.

The method handles a wide spectrum of service types: Email (OP_SVC_CD_EMAIL), Home Page (OP_SVC_CD_HP), M-List (OP_SVC_CD_MLIST), Fixed IP Address (OP_SVC_CD_FIXIPAD), Multi-Session Internet (OP_SVC_CD_MLTISE), Dial-up (OP_SVC_CD_DUP), Format Cell (OP_SVC_CD_FMTCEL), Caller ID Display (OP_SVC_CD_DSP_ME), Voice (OP_SVC_CD_DSP), Call Forwarding (OP_SVC_CD_TENSO), Anonymous Call Rejection (OP_SVC_CD_MWKTEL), Restricted Number Selection (OP_SVC_CD_STINO), International Call Suspension (OP_SVC_CD_KOKUSAI_STP), IPv6 (OP_SVC_CD_IPV6), Number Portability (OP_SVC_CD_N050), and Ani-koro Call Service (OP_SVC_CD_B135).

It implements a routing/dispatch pattern: extracting option service codes from the input map, fetching before/after option service contract agreement data from external service components, comparing state transitions, and then dispatching to one of over 40 distinct SOD order creation paths based on the service code and the observed state change. For each path, it creates the appropriate SOD order using addSOD(), addTakinoSOD(), or add050AddSod().

Its role in the larger system is that of a shared utility called by many screen-level methods (dslOdrCtrl, hakkoSOD, htelNoDslOdrCtrl, htelNoInfoChgeOdrCtrl, htelNoKaihkOdrCtrl, kaihkOdrCtrl). It sits between the screen entry point and the SOD emission logic, acting as the single decision point for option-level order control.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["opSetOdrCtrl(params)"])
    START --> EXTRACT["Extract Maps from sodMap"]
    EXTRACT --> SHKKA["Clean maps with shkkaMap"]
    SHKKA --> RETRIEVE["Retrieve option info fields"]
    RETRIEVE --> CHKBF{"Has before-op option? chbf_opsvkei_no NOT blank"}
    CHKBF -->|Yes| CALLBF["callEKK0351A010SC before"]
    CALLBF --> JUDGE_BF["jdgOpSvcKind"]
    JUDGE_BF --> NET_BF{"kind[0] == SVC_KIND_NET?"}
    NET_BF -->|Yes| CALL_NET_BF["callEKK0361A010SC ISP before"]
    NET_BF -->|No| CHKSUB_BF{"kind[1] == FLG_ON && sbopkei_no NOT blank?"}
    CALL_NET_BF --> CHKSUB_BF
    CHKSUB_BF -->|Yes| CALL_SBOP_BF["callEKK0411A010SC + callEKK0401A010SC"]
    CHKSUB_BF -->|No| CALLAF["callEKK0351A010SC after"]
    CALLAF --> JUDGE_AF["jdgOpSvcKind"]
    JUDGE_AF --> NET_AF{"kind[0] == SVC_KIND_NET?"}
    NET_AF -->|Yes| CALL_NET_AF["callEKK0361A010SC ISP after"]
    NET_AF -->|No| CHKSUB_AF{"kind[1] == FLG_ON && sbopkei_no NOT blank?"}
    CALL_NET_AF --> CHKSUB_AF
    CHKSUB_AF -->|Yes| CALL_SBOP_AF["callEKK0411A010SC + callEKK0401A010SC"]
    CHKSUB_AF -->|No| COMPARE["Compare before/after states"]
    CALL_SBOP_BF --> COMPARE
    CALL_SBOP_AF --> COMPARE
    COMPARE --> DISPATCH{"Dispatch by OP_SVC_CD"}
    DISPATCH --> EMAIL["OP_SVC_CD_EMAIL"]
    DISPATCH --> HP["OP_SVC_CD_HP"]
    DISPATCH --> MLIST["OP_SVC_CD_MLIST"]
    DISPATCH --> FIXIPAD["OP_SVC_CD_FIXIPAD"]
    DISPATCH --> MLTISE["OP_SVC_CD_MLTISE"]
    DISPATCH --> DIAL["OP_SVC_CD_DUP"]
    DISPATCH --> FMTCEL["OP_SVC_CD_FMTCEL"]
    DISPATCH --> DSP_ME["OP_SVC_CD_DSP_ME"]
    DISPATCH --> TENSO["OP_SVC_CD_TENSO"]
    DISPATCH --> DSP["OP_SVC_CD_DSP"]
    DISPATCH --> MWKTEL["OP_SVC_CD_MWKTEL"]
    DISPATCH --> STINO["OP_SVC_CD_STINO"]
    DISPATCH --> KOKUSAI["OP_SVC_CD_KOKUSAI_STP"]
    DISPATCH --> IPV6["OP_SVC_CD_IPV6"]
    DISPATCH --> N050["OP_SVC_CD_N050"]
    DISPATCH --> B135["OP_SVC_CD_B135"]
    EMAIL --> Z1_CHECK{"isZ1Ordered?"}
    DSP_ME --> Z1_CHECK
    TENSO --> Z1_CHECK
    DSP --> Z1_CHECK
    MWKTEL --> Z1_CHECK
    STINO --> Z1_CHECK
    KOKUSAI --> Z1_CHECK
    N050 --> Z1_CHECK
    B135 --> KIKI_CHK{"isKikiSeizoNoCheckResult?"}
    Z1_CHECK --> ADDSOD["addSOD/addTakinoSOD"]
    KIKI_CHK --> ADDSOD
    IPV6 --> JUDGE_IPV6["jdgIpv6"]
    JUDGE_IPV6 --> ADDSOD
    ADDSOD --> SET_MAE["Set mae_recode fields"]
    SET_MAE --> RETURN(["Return param"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | handle | SessionHandle | Session handle carrying session manager context used for database connections and transaction management. Passed to all called service methods (SCs). |
| 2 | param | IRequestParameterReadWrite | Parameter object containing the model group, control map, and business data. Modified throughout processing by addSOD calls and populated with key information fields (op_svc_kei_no, svc_kei_ucwk_no, same_trn_no, etc.) for downstream consumers. |
| 3 | fixedText | String | User-defined arbitrary string. Used in sameTrnJdg to determine whether a shared transaction number is needed, particularly for sub-option cases. |
| 4 | sodMap | HashMap<String, Object> | SOD map containing sub-maps for different contract data: SOD_KIHON_INFO (SOD basic info), SVC_KEI_INFO (service contract info), SVC_KEI_UCWK_INFO (service contract detail info), OPSVKEI_INFO (option service contract info), and KKTSVKEI_INFO (equipment provision service contract info). |

### Instance Fields Read by This Method

| Field | Type | Business Description |
|-------|------|---------------------|
| this.ido_div | String | Displacement classification -- indicates whether the operation is registration, cancellation, modification, disconnection, etc. Values include IDO_DIV_CANCEL, IDO_DIV_DSL, IDO_DIV_HTELNODSL, IDO_DIV_OPSETTE, IDO_DIV_KYOSEIDSL, IDO_DIV_TEKKYODSL. |
| this.pplan_cd | String | Plan code -- identifies the product plan being processed, used in old VR identification judgment. |

## 4. CRUD Operations / Called Services

### Service Component (SC) Calls

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | callEKK0351A010SC | EKK0351A010SC | KK_T_OPSVKEI | Fetches before/after option service contract agreement data. Called twice per processing cycle. |
| R | callEKK0361A010SC | EKK0361A010SC | KK_T_OPSVKEI_ISP | Fetches option service contract ISP agreement when kind is NET. |
| R | callEKK0401A010SC | EKK0401A010SC | KK_T_SBOP_SVKEI | Fetches sub-option service contract agreement data. |
| R | callEKK0411A010SC | EKK0411A010SC | KK_T_SBOP_SVKEI_ISP | Fetches sub-option service contract ISP data when kind is NET. |
| R | callEKK0341B008SC | EKK0341B008SC | KK_T_KKTSVKEI | Fetches equipment provision service contract data (VA device info). |
| R | callEKK0341B008_02SC | EKK0341B008_02SC | KK_T_KKTSVKEI | Alternative equipment provision fetch with EG swap consideration. |
| R | callEKK0161B004SC | EKK0161B004SC | KK_T_SVC_KEI_UCWK | Fetches service contract detail info for FixIP, MLTISE, Dial types. |
| R | callEKK0191A010SC | EKK0191A010SC | KK_T_SVC_KEI_UCWK_EO | Fetches eo Hikari Phone contract detail. |
| R | callEKK0191B001_2SC | EKK0191B001_2SC | KK_T_SVC_KEI_UCWK | Counts active line items for multi-function router processing. |
| R | callEKK0351B002SC | EKK0351B002SC | KK_T_OPSVKEI | Lists option service contracts by service contract number (for MLTISE). |
| R | getEKK0251B001SC | EKK0251B001SC | KK_T_SVC_KEI_KAISEN_UCWK | Fetches service contract line detail for VLAN-ID processing. |
| R | findZ1OrderAtKK1041SvcKeiUcwk | EKK1041CBS | KK_T_ODR | Checks Z1 order count to gate downstream processing. |

### Internal CC Method Calls

| CRUD | Method | Operation Description |
|------|--------|----------------------|
| C | addSOD | Creates an SOD order directive with order content code (selectOdrNaiyoCd). Called throughout for email, home page, multi-list, IP address, multi-session, dial-up, format cell, call forwarding, anonymous call rejection, restricted number, international suspension, IPv6, and more. |
| C | addTakinoSOD | Creates SOD order for multi-function router services (IPv6, caller ID display, Ani-koro Call Service). |
| C | add050AddSod | Creates Number Portability registration order (OP_SVC_CD_N050). |
| C | add050DelSod | Creates Number Portability deletion order (OP_SVC_CD_N050). |
| C | tsuikabunAddSOD | Creates additional SOD order with special path (international call suspension). |
| R | getSame_trn_no | Retrieves shared transaction number for option services. |
| R | jdgIpv6 | Determines IPv6 SOD emission conditions. Sets sod_pattern_ipv6 field. |
| R | chgOpsvKeiJdg | Judges whether before/after option contract numbers/dates differ (real change). |
| R | checkTakinoRT | Checks if service involves multi-function router (Takino RT). |
| R | isAddSodTrgtStat | Checks if option service contract status qualifies as SOD emission target. |
| R | isBlank | Utility: checks if string is null or blank. |
| R | isExecuteKikiSeizoNoCheck | Determines if equipment serial number check is needed. |
| R | isKikiSeizoNoCheck | Performs equipment manufacturing serial number check. |
| R | isTajgsTelNo | Checks if telephone number belongs to the company's own number acquisition business. |
| R | isMonaiBmp | Checks if number is non-portable. |
| R | isRegalVaKiki | Checks if VA device is legacy equipment. |
| R | jdgOpSvcKind | Judges option service kind from service code. Returns [kind, sub_op_flag]. |
| R | getOldVrsbIdgSvcDtlCd | Retrieves old VR identification service detail code. |
| R | searchSvcKeiUcwk | Searches service contract detail by option service contract number (FixIP). |
| R | shkkaMap | Cleans HashMap by replacing null with empty string. |
| R | shkkaChr | Cleans string by replacing null with empty string. |
| R | takeCurrentSvcKeiUcwk | Extracts current service contract detail record from list result. |
| R | pauseJdg | Judges whether main service is suspended. Returns PAUSE_JDG_CD code. |
| R | sameTrnJdg | Judges whether shared transaction number is needed. Returns count. |
| R | callEKK1041B001SC | Order detail list query for N050 SOD emission check. |
| R | getEKK1041B001result | Retrieves EKK1041B001 order detail results. |

## 5. Dependency Trace

### Caller Chain

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JKKHakkoSODCC.dslOdrCtrl | dslOdrCtrl -> opSetOdrCtrl | addSOD [C], addTakinoSOD [C], add050AddSod [C], add050DelSod [C] |
| 2 | JKKHakkoSODCC.hakkoSOD | hakkoSOD -> opSetOdrCtrl | addSOD [C], addTakinoSOD [C] |
| 3 | JKKHakkoSODCC.htelNoDslOdrCtrl | htelNoDslOdrCtrl -> opSetOdrCtrl | addSOD [C], addTakinoSOD [C] |
| 4 | JKKHakkoSODCC.htelNoInfoChgeOdrCtrl | htelNoInfoChgeOdrCtrl -> opSetOdrCtrl | addSOD [C], addTakinoSOD [C] |
| 5 | JKKHakkoSODCC.htelNoKaihkOdrCtrl | htelNoKaihkOdrCtrl -> opSetOdrCtrl | addSOD [C], addTakinoSOD [C] |
| 6 | JKKHakkoSODCC.kaihkOdrCtrl | kaihkOdrCtrl -> opSetOdrCtrl | addSOD [C], addTakinoSOD [C] |

### Terminal Operations from This Method

| Terminal Operation | CRUD | Description |
|-------------------|------|-------------|
| addSOD | C | Primary SOD order creation for email, home page, multi-list, IP, multi-session, dial-up, format cell, call forwarding, anonymous call rejection, restricted number, international suspension, IPv6, and more |
| addTakinoSOD | C | Multi-function router SOD creation for IPv6, caller ID display, Ani-koro Call Service |
| add050AddSod | C | Number Portability registration |
| add050DelSod | C | Number Portability deletion |
| tsuikabunAddSOD | C | Additional SOD order (international call suspension) |
| callEKK0351A010SC | R | Option service contract agreement fetch |
| callEKK0361A010SC | R | Option service contract ISP agreement fetch |
| callEKK0401A010SC | R | Sub-option service contract agreement fetch |
| callEKK0411A010SC | R | Sub-option service contract ISP agreement fetch |
| callEKK0341B008SC | R | Equipment provision service contract fetch |
| callEKK0341B008_02SC | R | Equipment provision service contract fetch (EG swap) |
| callEKK0161B004SC | R | Service contract detail list fetch |
| callEKK0191A010SC | R | Service contract detail eo Hikari Phone fetch |
| callEKK0191B001_2SC | R | Service contract detail count for multi-function router |
| callEKK0351B002SC | R | Option service contract list |
| getEKK0251B001SC | R | Service contract line detail list fetch |
| findZ1OrderAtKK1041SvcKeiUcwk | R | Z1 order count check |
| getSame_trn_no | R | Shared transaction number retrieval |
| getOldVrsbIdgSvcDtlCd | R | Old VR identification service detail code |
| shkkaMap | R | HashMap null-to-blank cleaning |
| shkkaChr | R | String null-to-blank cleaning |
| checkTakinoRT | - | Multi-function router check |
| chgOpsvKeiJdg | - | Option service contract change judgment |
| isAddSodTrgtStat | - | SOD emission target status check |
| isBlank | - | Blank string check |
| isExecuteKikiSeizoNoCheck | - | Equipment serial number check execution decision |
| isKikiSeizoNoCheck | - | Equipment serial number check |
| isMonaiBmp | - | Non-portable number check |
| isRegalVaKiki | - | Legacy VA device check |
| isTajgsTelNo | - | Company telephone number check |
| jdgIpv6 | - | IPv6 judgment |
| jdgOpSvcKind | - | Option service kind judgment |
| searchSvcKeiUcwk | R | Service contract detail search |
| takeCurrentSvcKeiUcwk | R | Current service contract detail extraction |
| pauseJdg | R | Suspension judgment |
| sameTrnJdg | R | Shared transaction number judgment |
| callEKK1041B001SC | R | Order detail list for N050 emission check |
| getEKK1041B001result | R | EKK1041B001 order detail results |
