# 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 component) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKHakkoSODCC.opSetOdrCtrl()

This method is the central **order control hub** for SOD (Service Order Data) issuance within the NTT East optical service fulfillment system. It receives a comprehensive SOD map containing pre-fetched SOD basic info, service contract info, service detail info, optional service contract info, and equipment-provided service contract info, then determines which SOD order records to create based on the operation service code (opSvcCd) and the before/after state transitions of optional service contracts.

The method handles approximately **15 distinct service types** including: Email (MAIL), Home Page (HP), Mail List (MLIST), Fixed Global IP Address (FIXIPAD), Multi-Session (MLTISE), Dial-up Connection (DUP), Format Cell (FMTCEL), Caller Number Notification (DSP_ME, DSP), Transfer Phone (TENSO), 050 Number Plate (N050), IPV6, Number Porting (TIKAN), ANSHIN Caller ID (B135), and various SIP-based features (display number, confusing call rejection, designated number rejection, international call stop). For each service type, it branches by operation state: new registration (NEW), cancellation (DSL), restoration (KAIHK), or modification (CHG).

It implements a **routing/dispatch pattern** - branching on opSvcCd to route to service-type-specific SOD issuance logic - and a **builder pattern** - repeatedly calling addSOD(), addTakinoSOD(), add050AddSod(), or add050DelSod() to accumulate SOD order records. Every branch performs before/after comparison of the optional service contract status to determine the correct action.

This is a **shared utility** called by 6 methods within the same class (JKKHakkoSODCC): dslOdrCtrl(), hakkoSOD(), htelNoDslOdrCtrl(), htelNoInfoChgeOdrCtrl(), htelNoKaihkOdrCtrl(), and kaihkOdrCtrl(). It is the primary entry point for generating SOD orders across all optional service operations in the system.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["opSetOdrCtrl(params)"])
    START --> EXTRA("Extract 5 sub-maps from sodMap")
    EXTRA --> SHKKA("Apply shkkaMap null-safe mapping")
    SHKKA --> EXTRACT("Extract: ido_div, svc_kei_no, chbf/chaf fields")
    EXTRACT --> TRIM("Trim fields via shkkaChr")
    TRIM --> IPV6_STORE("Store ipv6_svc_kei_ucwk fields")
    IPV6_STORE --> CHECK_BF("Has chbf_opsvkei_no AND chbf_gene_add_dtm?")
    CHECK_BF -->|Yes| CHBF_GET("Call EKK0351A010SC -> chbf hash")
    CHECK_BF -->|No| SKIP_CHBF("Skip before-info")
    CHBF_GET --> OP_SVC_CD("Get opSvcCd from chbf hash")
    OP_SVC_CD --> JUDGE("Call jdgOpSvcKind(opSvcCd)")
    JUDGE --> NO_SOD("opSvcKind == null?")
    NO_SOD -->|Yes| RET1("Return param")
    NO_SOD -->|No| NET_TEL("opSvcKind[0] = NET or TEL?")
    NET_TEL -->|"NET = "1""| CHBF_NET("Call EKK0361A010SC")
    NET_TEL -->|"TEL = "2"| CHBF_TEL("Commented: EKK0371A010SC")
    CHBF_NET --> SUBCHBF("opSvcKind[1]=="1" AND chbf_sbopsvkei_no?")
    SUBCHBF -->|"Yes"| SBOP_ISP("SVC_KIND_NET?")
    SBOP_ISP -->|"Yes"| CHBF_SBOP_ISP("Call EKK0411A010SC")
    SUBCHBF -->|"Common"| CHBF_SBOP("Call EKK0401A010SC")
    SKIP_CHBF --> CHAF_GET("Call EKK0351A010SC -> chaf hash")
    CHBF_SBOP_ISP --> CHAF_GET
    CHBF_SBOP --> CHAF_GET
    CHBF_TEL --> CHAF_GET
    CHAF_NET --> CHAF_GET
    CHAF_GET --> FUNC_CHECK("chaf_gene_add_dtm length==17?")
    FUNC_CHECK -->|"Yes"| FUNC1("funcCode = FUNC_CODE_1")
    FUNC_CHECK -->|"No"| FUNC2("funcCode = FUNC_CODE_2")
    FUNC1 --> CHAF_ERR("statusCode != 0?")
    FUNC2 --> CHAF_ERR
    CHAF_ERR -->|Yes| THROW1("Throw CCException")
    CHAF_ERR -->|No| CHAF_SVC_CD("Get opSvcCd")
    CHAF_SVC_CD --> CHAF_FILL("gene_add_dtm null or len<17?")
    CHAF_FILL -->|Yes| CHAF_FILL_SET("Fill from SC result")
    CHAF_FILL -->|No| CHAF_JUDGE("Call jdgOpSvcKind")
    CHAF_FILL_SET --> CHAF_JUDGE
    CHAF_JUDGE --> CHAF_NO_SOD("opSvcKind == null?")
    CHAF_NO_SOD -->|Yes| RET2("Return param")
    CHAF_NO_SOD -->|No| CHAF_NT("opSvcKind[0] = NET or TEL?")
    CHAF_NT -->|"NET"| CHAF_NS("Call EKK0361A010SC")
    CHAF_NT -->|"TEL"| CHAF_TS("Commented out")
    CHAF_NS --> CHAF_SUB("opSvcKind[1]=="1" AND chaf_sbopsvkei_no?")
    CHAF_SUB -->|"Yes"| CHAF_SN("SVC_KIND_NET?")
    CHAF_SN -->|"Yes"| CS_ISP("Call EKK0411A010SC")
    CHAF_SUB -->|"Common"| CS_GEN("Call EKK0401A010SC")
    CS_ISP --> STATE_CMP
    CS_GEN --> STATE_CMP("State Comparison Section")
    CHAF_TS --> STATE_CMP
    STATE_CMP --> CMP_NEW("isNewOpsvkei?")
    CMP_NEW -->|True| EXCL("statAfter == 920?")
    EXCL -->|Yes| CMP_NEW
    STATE_CMP --> DSL_KAI["Set isDslOpsvkei, isKaihkOpsvkei,
isChgOpsvkei, isShosaCl"]
    DSL_KAI --> OP_SVC_BRANCH("opSvcCd dispatch")
    OP_SVC_BRANCH --> B1("Email MAIL 108/116/118/120/117/119")
    OP_SVC_BRANCH --> B2("HP 121/126/127/128/123")
    OP_SVC_BRANCH --> B3("Mail List 129/131/132/133")
    OP_SVC_BRANCH --> B4("Fixed IP 152/107/154/104/101/106/153")
    OP_SVC_BRANCH --> B5("Multi-Session 144/145/161/162/142/143")
    OP_SVC_BRANCH --> B6("Dial-up 134/137/138/136")
    OP_SVC_BRANCH --> B7("Format Cell 164/166/167")
    OP_SVC_BRANCH --> B8("Caller Num Notify")
    OP_SVC_BRANCH --> B9("Transfer Phone")
    OP_SVC_BRANCH --> B10("IPV6 jdgIpv6()")
    OP_SVC_BRANCH --> B11("050 Number")
    OP_SVC_BRANCH --> B12("ANSHIN Caller ID")
    OP_SVC_BRANCH --> B13("Number Porting")
    OP_SVC_BRANCH --> B14("Display Number")
    OP_SVC_BRANCH --> B15("Split Phone")
    OP_SVC_BRANCH --> B16("Confusing Call Reject")
    OP_SVC_BRANCH --> B17("Designated Num Reject")
    OP_SVC_BRANCH --> B18("Int'l Stop")
    B1 --> Z1_CHK
    B2 --> Z1_CHK
    B3 --> Z1_CHK
    B4 --> Z1_CHK
    B5 --> Z1_CHK
    B6 --> Z1_CHK
    B7 --> Z1_CHK
    B8 --> Z1_CHK
    B9 --> Z1_CHK
    B10 --> Z1_CHK
    B11 --> Z1_CHK
    B12 --> Z1_CHK
    B13 --> Z1_CHK
    B14 --> Z1_CHK
    B15 --> Z1_CHK
    B16 --> Z1_CHK
    B17 --> Z1_CHK
    B18 --> Z1_CHK
    Z1_CHK --> KIKI_CHK("isExecuteKikiSeizoNoCheck?")
    KIKI_CHK -->|Yes| KIKI_EXEC("Run isKikiSeizoNoCheck")
    KIKI_EXEC --> FINAL("Set mae_recode fields")
    KIKI_CHK -->|No| FINAL
    FINAL --> END(["Return param"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session manager handle carrying context (database connection, transaction info) required for all SC (Service Component) calls. Passed through to every downstream method. |
| 2 | `param` | `IRequestParameterReadWrite` | Parameter object containing model groups, control maps, and work data. Used to read/write business data via getData(), setData(), and other CRUD methods. Returns the modified param with accumulated SOD records. |
| 3 | `fixedText` | `String` | User-specified arbitrary string used for same transaction number (sameTrnNo) determination and duplicate processing detection. |
| 4 | `sodMap` | `HashMap<String, Object>` | Master map containing 5 sub-maps: `sod_kihon_info` (SOD basic info), `svc_kei_info` (service contract info), `svc_kei_ucwk_info` (service detail info), `opsvkei_info` (optional service contract info), `kktsvkei_info` (equipment-provided service contract info). These are the pre-fetched data from prior SC calls. |

### Instance fields read by this method

| Field | Type | Business Description |
|-------|------|---------------------|
| `ipv6_svc_kei_ucwk_no` / `ipv6_svc_kei_ucwk_gadtm` | `String` | Stores the after-change service detail number and generation datetime for IPV6 determination processing (ANK-0046-00-01) |
| `same_trn_no` | `String` | Shared transaction number for coordinating related service operations (e.g., cancel+restore in same batch) |
| `op_svc_kei_no_ml` / `op_gadtm_ml` | `String` | Key information (op_svc_kei_no, op_gadtm) for Email optional service - used before/after comparisons |
| `op_svc_kei_no_hp` / `op_gadtm_hp` | `String` | Key information for Home Page optional service |
| `op_svc_kei_no_mlist` / `op_gadtm_mlist` | `String` | Key information for Mail List optional service |
| `op_svc_kei_no_fixipad` / `op_gadtm_fixipad` | `String` | Key information for Fixed Global IP Address service |
| `op_svc_kei_no_mltise` / `op_gadtm_mltise` | `String` | Key information for Multi-Session service |
| `svc_kei_ucwk_no[]` / `svc_kei_ucwk_gadtm[]` | `String[]` | Service detail number and generation registration datetime - key for many SOD records |
| `svc_kei_kaisen_ucwk_no` / `svc_kei_kaisen_ucwk_gadtm` | `String` | Service wiring detail number and generation datetime (from EKK0251B001) |
| `kktk_svc_kei_no[]` / `kktk_svc_kei_gadtm[]` | `String[]` | Equipment-provided service contract number and generation datetime |
| `taknkiki_model_cd[]` / `kiki_seizo_no[]` | `String[]` | Indoor equipment model code and device serial number (for VA equipment) |
| `sod_pattern_ipv6` | `int` | IPV6 SOD issuance pattern: 1=new registration, 3=cancellation |
| `pplan_cd` | `String` | Pricing plan code - used in old VR identification logic |
| `old_vrsb_jdg_svc_dtl_cd` | `String` | Service detail code for old VR identification judgment |
| `mae_recode_chaf_*` / `mae_recode_chbf_*` | `String` | Previous record before/after optional service contract number and generation datetime - audit trail |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK0351A010SC` | EKK0351A010SC | KK_T_OPSVKEI_AGREEMENT | Calls EKK0351A010SC (Optional service contract agreement) to retrieve optional service contract info - called for both before and after states |
| R | `callEKK0361A010SC` | EKK0361A010SC | KK_T_OPSVKEI_ISP | Calls EKK0361A010SC (Optional service contract <ISP> agreement) to retrieve ISP-specific optional service contract data |
| R | `callEKK0411A010SC` | EKK0411A010SC | KK_T_SBOP_OPSVKEI_ISP | Calls EKK0411A010SC (Sub-optional service contract <ISP> agreement) to retrieve ISP sub-optional service data |
| R | `callEKK0401A010SC` | EKK0401A010SC | KK_T_SBOP_OPSVKEI | Calls EKK0401A010SC (Sub-optional service contract agreement) to retrieve sub-optional service contract data |
| C | `addSOD` | JKKHakkoSODCC | KK_T_ODR_HAKKO_JOKEN | Calls addSOD() to create a new SOD order record. Called with ODR_NAIYO_CD values 101, 104, 106, 107, 108, 110-120, 121-138, 142-167, 211-254 |
| C | `addTakinoSOD` | JKKHakkoSODCC | KK_T_ODR_HAKKO_JOKEN | Calls addTakinoSOD() to create a multi-function router (Takino) SOD order record. Used for ODR_NAIYO_CD 411, 412, 425, 426 |
| C | `add050AddSod` | JKKHakkoSODCC | KK_T_ODR_HAKKO_JOKEN | Calls add050AddSod() to create a 050 number plate SOD order record (number porting add) |
| C | `add050DelSod` | JKKHakkoSODCC | KK_T_ODR_HAKKO_JOKEN | Calls add050DelSod() to create a 050 number plate SOD order record (number porting delete) |
| R | `callEKK0161B004SC` | EKK0161B004SC | KK_T_SVC_KEI_UCWK | Calls EKK0161B004SC (Service contract detail list agreement) to retrieve service detail info |
| R | `callEKK0351B002SC` | EKK0351B002SC | KK_T_OPSVKEI | Calls EKK0351B002SC (Optional service contract list agreement by service contract number) to retrieve optional service contract list |
| R | `callEKK0341B008SC` | EKK0341B008SC | KK_T_KKTSVKEI | Calls EKK0341B008SC (Equipment-provided service contract agreement) to retrieve equipment service contract info |
| R | `callEKK0341B008_02SC` | EKK0341B008_02SC | KK_T_KKTSVKEI | Calls EKK0341B008_02SC (Equipment-provided service contract agreement alternate) during EG switching |
| R | `callEKK0191A010SC` | EKK0191A010SC | KK_T_SVC_KEI_UCWK | Calls EKK0191A010SC (Service contract detail <eo optical phone> agreement) to retrieve service detail info for eo optical phone |
| R | `callEKK0191B001_2SC` | EKK0191B001_2SC | KK_T_SVC_KEI_UCWK | Calls EKK0191B001_2SC (Service contract detail list <eo optical phone> alternate 2) to count service detail records |
| R | `callEKK0251B001SC` | EKK0251B001SC | KK_T_SVC_KEI_KAISEN | Calls EKK0251B001SC (Service wiring detail list by service contract number) to retrieve service wiring info |
| R | `callEKK0361A010SC` | EKK0361A010SC | KK_T_OPSVKEI_ISP | Calls EKK0361A010SC (Optional service contract <ISP> agreement) for after-change ISP optional service data |
| R | `callEKK0371A010SC` | EKK0371A010SC | - | Commented out - would call EKK0371A010SC (Optional service contract <phone> agreement) for phone optional service |
| R | `callEKK0411A010SC` | EKK0411A010SC | KK_T_SBOP_OPSVKEI_ISP | Calls EKK0411A010SC (Sub-optional service contract <ISP> agreement) for before and after change ISP sub-optional data |
| R | `callEKK0401A010SC` | EKK0401A010SC | KK_T_SBOP_OPSVKEI | Calls EKK0401A010SC (Sub-optional service contract agreement) for before and after change general sub-optional data |
| R | `callEKK0161A010SC` | EKK0161A010SC | KK_T_SVC_KEI_UCWK | Called via searchSvcKeiUcwk() to retrieve service detail info for fixed IP address option |
| R | `searchSvcKeiUcwk` | EKK0161A010SC | KK_T_SVC_KEI_UCWK | Wrapper that calls EKK0161A010SC for service detail info lookup during FIXIPAD processing |
| R | `getEKK0251B001SC` | EKK0251B001SC | KK_T_SVC_KEI_KAISEN | Wrapper for EKK0251B001SC to retrieve service wiring detail during DSP_ME processing |
| R | `getSame_trn_no` | - | - | Calls getSame_trn_no() to acquire a shared transaction number for coordinated operations |
| R | `pauseJdg` | - | - | Calls pauseJdg() to determine if the main service is suspended (returns PAUSE_JDG_CD_1 or _0) |
| R | `chgOpsvKeiJdg` | - | - | Calls chgOpsvKeiJdg() to compare before/after optional service contract numbers and generation datetimes |
| R | `sameTrnJdg` | - | - | Calls sameTrnJdg() to determine if same transaction number acquisition is needed |
| R | `jdgIpv6` | - | - | Calls jdgIpv6() to determine if IPV6 SOD should be issued based on conditions |
| R | `isKikiSeizoNoCheck` | - | - | Calls isKikiSeizoNoCheck() to verify device serial number registration status |
| R | `isExecuteKikiSeizoNoCheck` | - | - | Calls isExecuteKikiSeizoNoCheck() to determine if serial number check is necessary |
| R | `checkTakinoRT` | - | - | Calls checkTakinoRT() to check multi-function router (Takino) registration status for Takino-type SOD |
| R | `getOldVrsbIdgSvcDtlCd` | - | - | Calls getOldVrsbIdgSvcDtlCd() to retrieve service detail code for old VR identification |
| R | `findZ1OrderAtKK1041SvcKeiUcwk` | EKK1041B001 | KK_T_ORDER | Calls findZ1OrderAtKK1041SvcKeiUcwk() to count Z1 orders for Z1 order presence check |
| R | `takeCurrentSvcKeiUcwk` | EKK0161B004SC | KK_T_SVC_KEI_UCWK | Calls takeCurrentSvcKeiUcwk() to extract current service detail from EKK0161B004SC results |
| - | `shkkaMap` | - | - | Calls shkkaMap() for null-safe HashMap mapping |
| - | `shkkaChr` | - | - | Calls shkkaChr() for null-safe String trimming |
| - | `isBlank` | - | - | Calls isBlank() for null/empty string checking |
| - | `JBSbatDKNyukaFinAdd.getData` | JBSbatDKNyukaFinAdd | - | Called for data retrieval in FinAdd processing |
| - | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Called for string retrieval in case file ranking |
| - | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Called for string retrieval in move navigation |
| - | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Called for string retrieval in ZMAdDataSet |
| - | `JFUeoTelOpTransferCC.getData` | JFUeoTelOpTransferCC | - | Called for data retrieval in eo tel op transfer |
| - | `JFUTransferCC.getData` | JFUTransferCC | - | Called for data retrieval in transfer processing |
| - | `JFUTransferListToListCC.getData` | JFUTransferListToListCC | - | Called for data retrieval in transfer list-to-list |
| - | `printBpDebugLog` (JKKBpCommon) | JKKBpCommon | - | Called for debug logging during device serial number check |
| - | `printBpDebugLog` (JKKBPActCommon) | JKKBPActCommon | - | Called for debug logging |

### Classification

- **R (Read)**: All EKK-prefixed SC calls that retrieve data - EKK0351A010SC (optional service contract agreement), EKK0361A010SC (optional service contract <ISP>), EKK0401A010SC (sub-optional service contract), EKK0411A010SC (sub-optional <ISP>), EKK0161B004SC (service detail list), EKK0351B002SC (optional service list), EKK0341B008SC (equipment service contract), EKK0191A010SC (service detail eo optical), EKK0191B001_2SC (service detail list alternate), EKK0251B001SC (service wiring list), EKK0161A010SC (service detail)
- **C (Create)**: addSOD() with ODR_NAIYO_CD codes 101-266 range, addTakinoSOD() for router-specific SOD (411, 412, 425, 426), add050AddSod/add050DelSod for number porting (050)
- **- (Other)**: Utility methods (shkkaMap, shkkaChr, isBlank), internal logic methods (getSame_trn_no, pauseJdg, chgOpsvKeiJdg, sameTrnJdg, jdgIpv6, checkTakinoRT), and cross-module helpers
