# Business Logic — JFUSetVariTsushinKikiMskmCC.execOnuKokankojiAdd() [96 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JFUSetVariTsushinKikiMskmCC` |
| Layer | CC / Common Component (business helper component in the custom processing layer) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JFUSetVariTsushinKikiMskmCC.execOnuKokankojiAdd()

This method performs **ONU Exchange Work Registration** (ONU交換工事登録処理), a key business operation in the telecom service contract system. When an Internet service customer's Optical Network Unit (ONU) device needs to be replaced — due to hardware failure, upgrade, or service migration — this method registers the required on-site work order so that a field technician can be dispatched to the customer's premises to replace the equipment.

The method follows a **data assembly + delegation** design pattern. It does not directly perform any database I/O. Instead, it assembles a structured parameter map (`outMap`) containing all the work-order metadata — work reception code, work detail code, service contract number, system ID, order number, move category, pricing course code, and an optional list of indoor device (宅内機器, takunan equipment) information — and then delegates to `JKKKojiAnkenCC.executeKojiAnken()` which handles the actual work order persistence.

The method contains one primary conditional branch based on **work dispatch status** (工事配送, `isKojiHaiso`). If the work is a dispatch-type work (工事配送の場合), it processes the provided indoor device list (`createList`), extracting device contract numbers, generation timestamps, and optional pre-change device tracking data. If it is not a dispatch-type, the indoor device list is skipped entirely and the work scope code is set to "070" (indicating non-dispatch work scope).

This method is a **shared utility** called by the KK0081 service screen processing path (specifically within the Internet service registration/change flow), invoked after the service IF execution and pricing course resolution have completed. It serves as the bridge between service contract processing and field work order creation.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> S1["S1: Get ccMsg from param using fixedText"]

    S1 --> S2["S2: Create outMap HashMap"]

    S2 --> S3["S3: Set KOJI_UK_CD = 007"]

    S3 --> S4["S4: Set KOJI_UK_DTL_CD = E0 ONU Exchange"]

    S4 --> S5["S5: Set SVC_KEI_NO from ccMsg"]

    S5 --> S6["S6: Set SYSID from ccMsg"]

    S6 --> S7["S7: Set MSKM_NO from parameter"]

    S7 --> S8["S8: Set MSKM_DTL_NO from parameter"]

    S8 --> S9["S9: Set IDO_DIV from parameter"]

    S9 --> S10["S10: Set PCRS_CD from parameter"]

    S10 --> S11["S11: Create taknkiki_info_list ArrayList"]

    S11 --> COND1{isKojiHaiso<br/>check KOJIAK_NO}

    COND1 -->|Yes Work dispatch| LOOP["S12: Loop createList items"]

    COND1 -->|No No dispatch| ELSE1["S13: Set KOJI_SCOPE_CD = 070"]

    LOOP --> FOR_INIT["FOR i = 0 to createList.size"]

    FOR_INIT --> FOR_BODY["S12.1: Create taknkikiinfolistmsg HashMap"]

    FOR_BODY --> S12_2["S12.2: Get createDataMap from createList.get(i)"]

    S12_3["S12.3: Put KKTK_SVC_KEI_NO from createDataMap"]

    S12_2 --> S12_3

    S12_3 --> S12_4["S12.4: Put KKTK_SVC_KEI_NO_GENE_ADD_DTM from createDataMap"]

    S12_4 --> COND_INSIDE{Is CHGBF_KKTK_SVC_KEI_NO<br/>not null?}

    COND_INSIDE -->|Yes| S12_5["S12.5: Put pre-change fields"]

    COND_INSIDE -->|No| S12_6["S12.6: Skip pre-change fields"]

    S12_5 --> S12_7["S12.7: Add taknkikiinfolistmsg to list"]

    S12_6 --> S12_7

    S12_7 --> FOR_NEXT{"i less than size?"}

    FOR_NEXT -->|Yes| FOR_BODY

    FOR_NEXT -->|No| S13_1["S13.1: Set KOJI_SCOPE_CD = empty string<br/>Set TAKNKIKI_INFO_LIST in outMap"]

    S13_1 --> S14["S14: param.setData JKK_KOJI_ANKEN_CC outMap"]

    ELSE1 --> S15["S15: param.setData JKK_KOJI_ANKEN_CC outMap"]

    S14 --> S16["S16: Create JKKKojiAnkenCC instance"]

    S15 --> S16

    S16 --> S17["S17: executeKojiAnken handle param key"]

    S17 --> END(["Return / Next"])
```

**Constant Resolution:**

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `JKKKojiAnkenConstCC.KOJI_UK_CD` | `"koji_uk_cd"` | Work reception code key |
| `JKKStrConst.KOJI_UK_CD_007` | `"007"` | Work reception code 007 (ONU exchange context) |
| `JKKKojiAnkenConstCC.KOJI_UK_DTL_CD` | `"koji_uk_dtl_cd"` | Work reception detail code key |
| `JKKStrConst.CD00885_ONU_KOKAN_KOJI` | `"E0"` | Work detail code for ONU exchange work (ONU交換工事) |
| `JKKKojiAnkenConstCC.SVC_KEI_NO` | `"svc_kei_no"` | Service contract number key |
| `JKKKojiAnkenConstCC.SYSID` | `"sysid"` | System ID key |
| `JKKKojiAnkenConstCC.MSKM_NO` | `"mskm_no"` | Order number key |
| `JKKKojiAnkenConstCC.MSKM_DTL_NO` | `"mskm_dtl_no"` | Order detail number key |
| `JKKKojiAnkenConstCC.IDO_DIV` | `"ido_div"` | Move/change category key |
| `JKKKojiAnkenConstCC.PCRS_CD` | `"pcrs_cd"` | Pricing course code key |
| `JKKKojiAnkenConstCC.KOJI_SCOPE_CD` | `"koji_scope_cd"` | Work scope code key |
| `JKKKojiAnkenConstCC.TAKNKIKI_INFO_LIST` | `"taknkiki_info_list"` | Indoor device information list key |
| `JFUStrConst.CD00484_070` | `"070"` | Non-dispatch work scope code (工事配送なし) |
| `JKKKojiAnkenConstCC.KKTK_SVC_KEI_NO` | `"kktk_svc_kei_no"` | Device-provided service contract number key |
| `JKKButuryuCtrlCC.KEY_KKTK_SVC_KEI_NO` | `"kktk_svc_kei_no"` | Same as above — key for device service contract number |
| `EKK0341A010CBSMsg1List.GENE_ADD_DTM` | `"gene_add_dtm"` | Generation registration timestamp key |
| `JKKKojiAnkenConstCC.CHGBF_KKTK_SVC_KEI_NO` | `"chgbf_kktk_svc_kei_no"` | Pre-change device service contract number key |
| `JKKKojiAnkenConstCC.CHGBF_KKTK_SVC_KEI_NO_GENE_ADD_DTM` | `"chgbf_kktk_svc_kei_no_gene_add_dtm"` | Pre-change device generation timestamp key |
| `JKK_KOJI_ANKEN_CC` | `"JKKKojiAnkenCC"` | Parameter key for work order registration CC |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle — provides the database connection context for the delegated `executeKojiAnken` call. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object — used to read the service message map (`ccMsg`) via `getData(fixedText)` and to write the assembled work order data via `setData(JKK_KOJI_ANKEN_CC, outMap)`. |
| 3 | `fixedText` | `String` | Service message key — used as the lookup key to retrieve the `ccMsg` map from `param`. This key identifies which service message buffer contains the service contract and system ID data. |
| 4 | `idoDiv` | `String` | Move/change category (異動区分) — indicates the type of service contract change (e.g., new registration, modification, cancellation). Passed through to the work order as `IDO_DIV`. |
| 5 | `mskmNo` | `String` | Order number (申込番号) — the unique identifier for the service order. Passed directly to the work order registration. |
| 6 | `mskmDtlNo` | `String` | Order detail number (申込明細番号) — identifies the specific line item within the order. Passed directly to the work order registration. |
| 7 | `pcrsCd` | `String` | Pricing course code (料金コースコード) — identifies the pricing plan/course associated with the service. Passed directly to the work order registration. |
| 8 | `createList` | `List<HashMap<String, Object>>` | Indoor device list (宅内機器リスト) — a list of device information maps, each containing the device's service contract number, generation timestamp, and optionally pre-change tracking data. Only processed when `isKojiHaiso()` returns true. |

**Instance fields read:**

| Field | Type | Usage |
|-------|------|-------|
| `IN_PARAM_KK0081_SVC_KEI_NO` | `String` constant = `"KK0081_svc_kei_no"` | Key to retrieve service contract number from ccMsg |
| `IN_PARAM_KK0081_SYSID` | `String` constant = `"KK0081_sysid"` | Key to retrieve system ID from ccMsg |
| `IN_PARAM_KU0011_KOJIAK_NO` | `String` constant = `"KU0011_kojiak_no"` | Key to retrieve work project number for isKojiHaiso check |
| `JKK_KOJI_ANKEN_CC` | `String` constant = `"JKKKojiAnkenCC"` | Parameter key used in param.setData() |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JFUSetVariTsushinKikiMskmCC.isKojiHaiso` | (Self) | - | Checks whether the work project type is a dispatch-type work. Returns true if the work requires field technician dispatch, which determines whether indoor device list is processed. |
| - | `JFUBPCommon.isNull` | JFUBPCommon | - | Null-check utility called on `createDataMap.get(CHGBF_KKTK_SVC_KEI_NO)` to determine if pre-change device tracking data is available. |
| C | `JKKKojiAnkenCC.executeKojiAnken` | JKKKojiAnken | KK_T_KOJIAK (Work project table) | Creates the work order registration by assembling the work reception code, detail code, service contract info, order info, and optional indoor device list. This is the terminal create operation that persists the work order. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS (KK0081 path) | `execOnuKokankojiAdd(handle, param, fixedText, idoDiv, mskmNo, mskmDetailNo, pcrsCd, kktkSvcKeiNoList)` — called within the KK0081 service registration/change processing flow after service IF execution and pricing course resolution | `executeKojiAnken [C] KK_T_KOJIAK` |

**No screen/batch entry points found within 8 hops.** The method is called directly from a CBS processing path (KK0081 related service).

**Terminal operations from this method:** `executeKojiAnken [C]`, `isKojiHaiso [-]`, `isNull [-]`

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(Data assembly: outMap initialization and field population) (L4261)`

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = param.getData(fixedText)` // Retrieve service message map from request parameter using the fixedText key [IN_PARAM_KK0081_SVC_KEI_NO="KK0081_svc_kei_no", IN_PARAM_KK0081_SYSID="KK0081_sysid"] |
| 2 | SET | `outMap = new HashMap<String, Object>()` // Create new HashMap to hold work order registration data |
| 3 | SET | `outMap.put(JKKKojiAnkenConstCC.KOJI_UK_CD, JKKStrConst.KOJI_UK_CD_007)` // Set work reception code [KOJI_UK_CD="koji_uk_cd", KOJI_UK_CD_007="007"] — Work reception code 007 for ONU exchange |
| 4 | SET | `outMap.put(JKKKojiAnkenConstCC.KOJI_UK_DTL_CD, JKKStrConst.CD00885_ONU_KOKAN_KOJI)` // Set work reception detail code [KOJI_UK_DTL_CD="koji_uk_dtl_cd", CD00885_ONU_KOKAN_KOJI="E0"] — E0 identifies this as ONU exchange work (ONU交換工事) |
| 5 | SET | `outMap.put(JKKKojiAnkenConstCC.SVC_KEI_NO, ccMsg.get(IN_PARAM_KK0081_SVC_KEI_NO))` // Set service contract number [SVC_KEI_NO="svc_kei_no"] — Retrieved from the service message map |
| 6 | SET | `outMap.put(JKKKojiAnkenConstCC.SYSID, ccMsg.get(IN_PARAM_KK0081_SYSID))` // Set system ID [SYSID="sysid"] — Retrieved from the service message map |
| 7 | SET | `outMap.put(JKKKojiAnkenConstCC.MSKM_NO, mskmNo)` // Set order number [MSKM_NO="mskm_no"] — Passed as method parameter |
| 8 | SET | `outMap.put(JKKKojiAnkenConstCC.MSKM_DTL_NO, mskmDtlNo)` // Set order detail number [MSKM_DTL_NO="mskm_dtl_no"] — Passed as method parameter |
| 9 | SET | `outMap.put(JKKKojiAnkenConstCC.IDO_DIV, idoDiv)` // Set move/change category [IDO_DIV="ido_div"] — Passed as method parameter |
| 10 | SET | `outMap.put(JKKKojiAnkenConstCC.PCRS_CD, pcrsCd)` // Set pricing course code [PCRS_CD="pcrs_cd"] — Passed as method parameter |

**Block 2** — [SET] `(Indoor device list initialization) (L4301)`

| # | Type | Code |
|---|------|------|
| 1 | SET | `taknkiki_info_list = new ArrayList<HashMap>()` // Create list to hold indoor (宅内) device information for this work order |

**Block 3** — [IF] `(isKojiHaiso check — Work dispatch decision) [KOJIAK_NO="KU0011_kojiak_no"] (L4306)`

> Determines whether the work requires field technician dispatch. If true (dispatch-type work), the indoor device list is processed and each device's information is added to the work order. If false (non-dispatch), the indoor device list is skipped and the work scope code is set to "070".

**Block 3.1** — [IF branch: True - Work dispatch] `(工事配送の場合 — Only for dispatch-type work, add indoor device list) (L4308)`

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (int i = 0; i < createList.size(); i++)` // Iterate over each device in the createList |
| 1.1 | SET | `taknkikiinfolistmsg = new HashMap<String, String>()` // Create new map for this device's information |
| 1.2 | SET | `createDataMap = createList.get(i)` // Get the device data map for the current iteration index |
| 1.3 | SET | `taknkikiinfolistmsg.put(JKKKojiAnkenConstCC.KKTK_SVC_KEI_NO, (String)createDataMap.get(JKKButuryuCtrlCC.KEY_KKTK_SVC_KEI_NO))` // Put device-provided service contract number [KKTK_SVC_KEI_NO="kktk_svc_kei_no"] — From device data map |
| 1.4 | SET | `taknkikiinfolistmsg.put(JKKKojiAnkenConstCC.KKTK_SVC_KEI_NO_GENE_ADD_DTM, (String)createDataMap.get(EKK0341A010CBSMsg1List.GENE_ADD_DTM))` // Put device-provided service contract number generation timestamp [KKTK_SVC_KEI_NO_GENE_ADD_DTM="kktk_svc_kei_no_gene_add_dtm", GENE_ADD_DTM="gene_add_dtm"] — Generation registration date/time for the device |
| 1.5 | IF | `!JFUBPCommon.isNull(createDataMap.get(JKKKojiAnkenConstCC.CHGBF_KKTK_SVC_KEI_NO))` // Check if pre-change device service contract number exists [CHGBF_KKTK_SVC_KEI_NO="chgbf_kktk_svc_kei_no"] |
| 1.5.1 | SET | `taknkikiinfolistmsg.put(JKKKojiAnkenConstCC.CHGBF_KKTK_SVC_KEI_NO, (String)createDataMap.get(JKKKojiAnkenConstCC.CHGBF_KKTK_SVC_KEI_NO))` // Put pre-change device service contract number — tracks the device number before the exchange |
| 1.5.2 | SET | `taknkikiinfolistmsg.put(JKKKojiAnkenConstCC.CHGBF_KKTK_SVC_KEI_NO_GENE_ADD_DTM, (String)createDataMap.get(JKKKojiAnkenConstCC.CHGBF_KKTK_SVC_KEI_NO_GENE_ADD_DTM))` // Put pre-change device generation timestamp — tracks when the pre-change device was registered |
| 1.6 | SET | `taknkiki_info_list.add(taknkikiinfolistmsg)` // Add this device's information to the indoor device list |
| 2 | SET | `outMap.put(JKKKojiAnkenConstCC.KOJI_SCOPE_CD, "")` // Set work scope code to empty string — dispatch-type work uses empty scope (all-inclusive) [KOJI_SCOPE_CD="koji_scope_cd"] |
| 3 | SET | `outMap.put(JKKKojiAnkenConstCC.TAKNKIKI_INFO_LIST, taknkiki_info_list)` // Set the assembled indoor device information list [TAKNKIKI_INFO_LIST="taknkiki_info_list"] |

**Block 3.2** — [ELSE] `(工事配送なし — Non-dispatch work scope) (L4334)`

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.put(JKKKojiAnkenConstCC.KOJI_SCOPE_CD, JFUStrConst.CD00484_070)` // Set work scope code to "070" (工事配送なし — No work dispatch) [KOJI_SCOPE_CD="koji_scope_cd", CD00484_070="070"] |

**Block 4** — [SET, EXEC, CALL] `(Write to param, instantiate CC, and delegate to work order registration) (L4338)`

| # | Type | Code |
|---|------|------|
| 1 | SET | `param.setData(JKK_KOJI_ANKEN_CC, outMap)` // Write the assembled work order map to param under key "JKKKojiAnkenCC" [JKK_KOJI_ANKEN_CC="JKKKojiAnkenCC"] |
| 2 | SET | `jkkKojiAnkenCC = new JKKKojiAnkenCC()` // Instantiate the work order registration CC |
| 3 | CALL | `jkkKojiAnkenCC.executeKojiAnken(handle, param, JKK_KOJI_ANKEN_CC)` // Execute the work order registration — this is the terminal operation that creates the work order entry |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `koji_uk_cd` | Field | Work reception code — classifies the type of work registration. Value "007" is used in the ONU exchange context. |
| `koji_uk_dtl_cd` | Field | Work reception detail code — further classifies the work type. Value "E0" specifically identifies ONU exchange work (ONU交換工事). |
| `svc_kei_no` | Field | Service contract number — the unique identifier for a telecom service contract line item. |
| `sysid` | Field | System ID — an identifier for the system/entity associated with the service contract. |
| `mskm_no` | Field | Order number (申込番号) — the unique identifier for a service order submission. |
| `mskm_dtl_no` | Field | Order detail number (申込明細番号) — identifies a specific line item within an order. |
| `ido_div` | Field | Move/change category (異動区分) — indicates the type of service change (new, modification, cancellation, etc.). |
| `pcrs_cd` | Field | Pricing course code (料金コースコード) — identifies the pricing plan or course associated with the service. |
| `koji_scope_cd` | Field | Work scope code (工事範囲コード) — defines the scope of the work. "070" indicates no dispatch; empty string indicates dispatch-type with full scope. |
| `taknkiki_info_list` | Field | Indoor device information list (宅内機器情報リスト) — contains device-level details for equipment located at the customer premises. |
| `kktk_svc_kei_no` | Field | Device-provided service contract number (機器提供サービス契約番号) — the service contract number assigned to a specific device (ONU, etc.) provided by the operator. |
| `gene_add_dtm` | Field | Generation registration timestamp (世代登録年月日時分秒) — the date/time when a device version was registered in the system. |
| `chgbf_kktk_svc_kei_no` | Field | Pre-change device service contract number (変更前_機器提供サービス契約番号) — the device contract number before the exchange, used for tracking the old device. |
| `chgbf_kktk_svc_kei_no_gene_add_dtm` | Field | Pre-change device generation timestamp (変更前_機器提供サービス契約番号_世代登録年月日時分秒) — timestamp for the old device version registration. |
| KOJI_UK_CD_007 | Constant | Work reception code "007" — used in ONU exchange context for work order registration. |
| CD00885_ONU_KOKAN_KOJI | Constant | Work detail code "E0" — specifically identifies ONU exchange work (ONU交換工事). Part of the CD00885 series of work detail codes. |
| CD00484_070 | Constant | Scope code "070" — indicates no work dispatch (工事配送なし), used for non-dispatch work scope. |
| isKojiHaiso | Method | Checks whether a work project (工事案件) is of dispatch type (配送対象). Returns true if field technician dispatch is required, triggering indoor device list processing. |
| JKKKojiAnkenCC | Class | Work order registration component (工事案件登録CC) — handles the creation and persistence of work order entries in the system. |
| executeKojiAnken | Method | Executes work order registration — creates a new work order entry with all provided metadata including service contract info, order info, and optional device list. |
| ONU | Acronym | Optical Network Unit — the customer premise equipment (CPE) used in fiber-optic broadband networks to convert optical signals to electrical signals for end-user devices. |
| ONU交換 | Business term | ONU Exchange — the process of replacing a customer's Optical Network Unit device, typically due to hardware failure, service upgrade, or equipment migration. |
| 工事配送 | Business term | Work dispatch (こうじはいそう) — a type of work order that requires field technician dispatch to the customer's premises. |
| 宅内機器 | Business term | Indoor equipment (たくないきき) — customer premise equipment (CPE) installed inside the customer's premises, such as ONU, routers, or set-top boxes. |
| KK0081 | Screen/CBS | A service registration/change screen processing component — the calling context for this method, handling Internet service contract operations. |
| KU0011_kojiak_no | Field | Work project number (工事案件番号) — the identifier for a work project, used in the isKojiHaiso determination. |
| JFUBPCommon.isNull | Method | Null-check utility method — wraps `JFUCommonUtil.isNull()` to safely check if an object is null or empty. |
| `KK0081_svc_kei_no` | Field | Service contract number from KK0081 context — key used to retrieve the service contract number from the service message map. |
| `KK0081_sysid` | Field | System ID from KK0081 context — key used to retrieve the system ID from the service message map. |
