# (DD07) Business Logic — JFUSetVariTsushinKikiMskmCC.execKojiAnkenRenkei() [67 LOC]

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

## 1. Role

### JFUSetVariTsushinKikiMskmCC.execKojiAnkenRenkei()

This method orchestrates the **construction work order linkage processing** (工事案件連携, "Koji Anken Renkei") — a critical business operation in the telecom service contract change workflow. When a customer changes their subscribed equipment (e.g., router swap, device upgrade, or return), this method ensures that all associated construction work orders are properly synchronized with the field operations system.

The method supports **two processing modes** controlled by the `koujiParamKind` parameter: **construction registration/updates** (`RENKEI`) for new or modified construction orders, and **construction cancellation** (`CANCEL`) when a previously linked construction order must be revoked. It acts as a **delegation hub**: first consulting an external agreement validation service (`execEKU0011A010`) to obtain the construction work order type, then retrieving the list of construction-targeted home equipment via `getKktkSvcKeiKojiMap`, and finally delegating the core update logic to `JFUKojiakUpdCC.updKojiInfo`.

This is a **shared utility** called by multiple screen processing paths, including the primary equipment provision service contract change flow (`JFUSetVariTsushinKikiMskmCC`) and the specialized update base CC (`JKKUpdSpMskmOtherOpBaseCC`). Its boolean return value signals downstream consumers whether construction linkage processing was actually performed (`true`) or whether there were no work orders to process (`false`), enabling conditional flow control in the calling screens.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execKojiAnkenRenkei(handle, param, fixedText, tempData, mskmDetailNo, koujiParamKind, kojiHaisoList)"])
    CHECK1["kojiHaisoList null or empty?"]
    EARLY_EXIT(["Return false"])
    GET_INMAP["HashMap inMap = param.getData(fixedText)"]
    CREATE_SCRNMAP["scrnItemMap = new HashMap<String, Object>()"]
    SET_SCRNMAP["scrnItemMap.put(kiki_edit_kbn, empty)
scrnItemMap.put(kinkyu_moto_tomson_cd_edit, empty)"]
    GET_KOJIAK_NO["kojiAkNoAf = inMap.get(KU0011_kojiak_no)
inParamSvcKeiNo = inMap.get(IN_PARAM_KK0081_SVC_KEI_NO)
kojiakSbtcd = empty"]
    CALL_EKU0011["execEKU0011A010(handle, param, fixedText, kojiAkNoAf)"]
    CALL_GET_SBT["kojiakSbtcd = getKojiakSbtCd(eku0011a010map)"]
    PUT_TEMP["tempData.put(KOJI_AK_SBT_CD, kojiakSbtcd)"]
    CALL_GET_MAP["kktkSvcOutList = getKktkSvcKeiKojiMap(handle, param, fixedText, koujiParamKind, kojiHaisoList, tempData)"]
    CHECK2["kktkSvcOutList null or empty?"]
    EARLY_EXIT2(["Return false"])
    CREATE_UPD["JFUKojiakUpdCC jFuKojiakUpCC = new JFUKojiakUpdCC()"]
    SET_UPD_DATA["param.setData(JFUKojiakUpdCC, new HashMap<String, Object>())
outMap = param.getData(JFUKojiakUpdCC)"]
    SET_BASIC["outMap.put(func_code, FUNC_CD_1)
outMap.put(mskm_dtl_no, mskmDetailNo)
outMap.put(ido_div, inMap.get(ido_div))"]
    SET_KOJI_CD["outMap.put(koji_uk_cd, 070)
outMap.put(koji_uk_dtail_cd, A6)"]
    SET_SVC["outMap.put(svc_kei_no, inParamSvcKeiNo)
outMap.put(kojiak_no, kojiAkNoAf)"]
    SET_LIST["outMap.put(kktkSvcOutList, kktkSvcOutList)"]
    SET_MSKM["setMskmDtlNo(param, mskmDetailNo)"]
    CALL_UPD["jFuKojiakUpCC.updKojiInfo(handle, param, JFUKojiakUpdCC)"]
    REMOVE_DATA["param.removeData(JFUKojiakUpdCC)"]
    FINAL_RETURN(["Return true"])

    START --> CHECK1
    CHECK1 -->|"Yes"| EARLY_EXIT
    CHECK1 -->|"No"| GET_INMAP
    GET_INMAP --> CREATE_SCRNMAP
    CREATE_SCRNMAP --> SET_SCRNMAP
    SET_SCRNMAP --> GET_KOJIAK_NO
    GET_KOJIAK_NO --> CALL_EKU0011
    CALL_EKU0011 --> CALL_GET_SBT
    CALL_GET_SBT --> PUT_TEMP
    PUT_TEMP --> CALL_GET_MAP
    CALL_GET_MAP --> CHECK2
    CHECK2 -->|"Yes"| EARLY_EXIT2
    CHECK2 -->|"No"| CREATE_UPD
    CREATE_UPD --> SET_UPD_DATA
    SET_UPD_DATA --> SET_BASIC
    SET_BASIC --> SET_KOJI_CD
    SET_KOJI_CD --> SET_SVC
    SET_SVC --> SET_LIST
    SET_LIST --> SET_MSKM
    SET_MSKM --> CALL_UPD
    CALL_UPD --> REMOVE_DATA
    REMOVE_DATA --> FINAL_RETURN
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | The active database/session handle used to maintain context (transactions, user session) across all service component calls within this method. |
| 2 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying data between processing layers. Used to store/retrieve the construction work update payload map and hold input data extracted from the screen. |
| 3 | `fixedText` | `String` | A service message key/map identifier used to retrieve input data from `param` via `param.getData(fixedText)`. Acts as a data bucket key for the current processing context. |
| 4 | `tempData` | `HashMap<String, String>` | Internal temporary data store scoped to this feature. Used to persist intermediate results such as the construction work order type code (`KOJI_AK_SBT_CD`) between method calls. |
| 5 | `mskmDetailNo` | `String` | The subscription detail number (申込明細番号) — the unique identifier for a line item within a service contract. Used to link the construction update to a specific order line. |
| 6 | `koujiParamKind` | `String` | The operation mode selector for construction linkage. Accepts either `RENKEI` (工事連携 — registration/update processing) or `CANCEL` (キャンセル処理 — cancellation processing). Determines what kind of construction work order changes are performed. Defined as [-> KOUJI_RENKEI_PARAM="RENKEI"] and [-> KOUJI_CANCEL_PARAM="CANCEL"] |
| 7 | `kojiHaisoList` | `List<HashMap>` | The construction delivery target equipment list (工事配送対象機器リスト) — a list of maps describing each piece of home equipment that needs to be registered for or cancelled from construction delivery. Each map contains service equipment numbers, model codes, and related fields. |

### Instance fields read by the method:

| Field | Type | Business Description |
|-------|------|---------------------|
| `JFU_KOJIAK_UPD_CC` | `String` | The data key used to store and retrieve the construction work order update component payload in the request parameter. Defined as [-> JFU_KOJIAK_UPD_CC="JFUKojiakUpdCC"] |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JFUSetVariTsushinKikiMskmCC.execEKU0011A010` | EKU0011A010 | Construction work agreement master table | Calls the external service agreement consultation method to validate and retrieve construction work order agreement data |
| R | `JFUSetVariTsushinKikiMskmCC.getKojiakSbtCd` | - | In-memory map | Retrieves the construction work order type code from the agreement result map |
| R | `JFUSetVariTsushinKikiMskmCC.getKktkSvcKeiKojiMap` | - | Home equipment delivery tables | Retrieves the mapping of construction-targeted home equipment service contracts for the specified operation mode |
| U | `JFUKojiakUpdCC.updKojiInfo` | JFUKojiakUpd | Construction work order tables (KK_T_KOJIAK*) | Updates construction work order information including subscription detail number, service contract number, work dispatch code (070/A6), and equipment list |
| R | `param.getData(fixedText)` | - | Request parameter map | Retrieves the input data map containing the construction work order number and service contract number |
| R | `param.getData(JFU_KOJIAK_UPD_CC)` | - | Request parameter map | Retrieves the output map populated by setData for the update CC |

**How classified:**
- **R (Read)**: `execEKU0011A010` performs an agreement consultation (reads/matches existing work order data); `getKojiakSbtCd` reads from the agreement map; `getKktkSvcKeiKojiMap` queries construction-targeted equipment; `param.getData` reads from the request map.
- **U (Update)**: `updKojiInfo` is the core update operation — it writes construction work order metadata and the linked equipment list to the database.

**SC Code inference:**
- `execEKU0011A010` contains "EKU0011A010" in its name → SC Code is `EKU0011A010` (Equipment Provision Service Contract Agreement Consultation).
- `JFUKojiakUpdCC.updKojiInfo` — the component name indicates construction work order update; typically targets construction work order master tables (`KK_T_KOJIAK*`).
- `getKktkSvcKeiKojiMap` — no explicit SC prefix; operates in-memory on data derived from screen parameters and the delivery equipment list.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 4 methods.
Terminal operations from this method: `updKojiInfo` [-], `setMskmDtlNo` [-], `getData` [R], `getData` [R], `getData` [R], `getData` [R], `getData` [R], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `getKktkSvcKeiKojiMap` [R], `getKojiakSbtCd` [R], `execEKU0011A010` [-], `getData` [R], `getData` [R], `getData` [R], `getData` [R], `getData` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC: JFUSetVariTsushinKikiMskmCC | `JFUSetVariTsushinKikiMskmCC (screen processing)` -> `execKojiAnkenRenkei(handle, param, fixedText, tempData, mskmDetailNo, KOUJI_CANCEL_PARAM, cancelKktkList)` (L1585) | `execEKU0011A010 [R]`, `getKktkSvcKeiKojiMap [R]`, `updKojiInfo [U] KK_T_KOJIAK*` |
| 2 | CC: JFUSetVariTsushinKikiMskmCC | `JFUSetVariTsushinKikiMskmCC (screen processing)` -> `execKojiAnkenRenkei(handle, param, fixedText, tempData, mskmDetailNo, KOUJI_RENKEI_PARAM, kojiHaisoList)` (L1587) | `execEKU0011A010 [R]`, `getKktkSvcKeiKojiMap [R]`, `updKojiInfo [U] KK_T_KOJIAK*` |
| 3 | CC: JFUSetVariTsushinKikiMskmCC | `JFUSetVariTsushinKikiMskmCC (screen processing)` -> `execKojiAnkenRenkei(handle, param, fixedText, tempData, mskmDetailNo, KOUJI_RENKEI_PARAM, workList)` (L1607) | `execEKU0011A010 [R]`, `getKktkSvcKeiKojiMap [R]`, `updKojiInfo [U] KK_T_KOJIAK*` |
| 4 | CBS: JKKUpdSpMskmOtherOpBaseCC | `JKKUpdSpMskmOtherOpBaseCC (extended update base)` -> `execKojiAnkenRenkei(handle, scCall, param, fixedText)` (L731) -> calls through its own `isExecKojiAnkenRenkei` in JKKKikiIchiranIkkatsuCC (L7453) | `execEKU0011A010 [R]`, `getKktkSvcKeiKojiMap [R]`, `updKojiInfo [U] KK_T_KOJIAK*` |

**Entry point context:**
- Callers at lines 1585 and 1587 are within the main `JFUSetVariTsushinKikiMskmCC` screen processing method, which handles equipment provision service contract changes (router swap, device upgrade, returns). This is the primary entry path.
- The caller at line 1607 is within a conditional branch handling multi-function router equipment (online/offline swap) where only equipment requiring correction is processed.
- `JKKUpdSpMskmOtherOpBaseCC` at line 731 calls a different overloaded version of `execKojiAnkenRenkei` (its own protected method with a different signature) — it is NOT calling this specific `execKojiAnkenRenkei` method directly. The method is called from a screen processing flow that goes through `JKKKikiIchiranIkkatsuCC.isExecKojiAnkenRenkei` (line 6875).

## 6. Per-Branch Detail Blocks

**Block 1** — IF (early exit guard) `(kojiHaisoList == null || kojiHaisoList.size() == 0)` (L3669)

> Guard clause: if there are no construction delivery target equipment items, the method exits immediately with `false` — no construction linkage is needed.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false;` |

**Block 2** — EXEC (extract input data) (L3672–3685)

> Retrieves the input data map and extracts the construction work order number and service contract number for later use.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap inMap = (HashMap)param.getData(fixedText);` // Retrieve input data map |
| 2 | SET | `HashMap<String, Object> scrnItemMap = new HashMap<String, Object>();` // Screen parameter map |
| 3 | SET | `scrnItemMap.put("kiki_edit_kbn", JFUStrConst.EMPTY);` // Equipment edit classification |
| 4 | SET | `scrnItemMap.put("kinkyu_moto_tomson_cd_edit", JFUStrConst.EMPTY);` // Emergency previous notice code edit |
| 5 | SET | `String kojiAkNoAf = (String)inMap.get(IN_PARAM_KU0011_KOJIAK_NO);` // Construction work order number [-> IN_PARAM_KU0011_KOJIAK_NO="KU0011_kojiak_no"] (L181) |
| 6 | SET | `String inParamSvcKeiNo = (String)inMap.get(IN_PARAM_KK0081_SVC_KEI_NO);` // Service contract number |
| 7 | SET | `String kojiakSbtcd = "";` // Construction work order type code |

**Block 3** — CALL (construction work order agreement consultation) (L3688–3691)

> Invokes the external agreement consultation to validate the construction work order and retrieves its type code, storing it in `tempData` for downstream use.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap eku0011a010map = execEKU0011A010(handle, param, fixedText, kojiAkNoAf);` // Agreement consultation |
| 2 | SET | `kojiakSbtcd = getKojiakSbtCd(eku0011a010map);` // Get work order type code |
| 3 | SET | `tempData.put(KEY_KOJI_AK_SBT_CD, kojiakSbtcd);` // Store in temp data [-> KEY_KOJI_AK_SBT_CD="KOJI_AK_SBT_CD"] (L840) |

**Block 4** — CALL (retrieve construction-targeted equipment) (L3694–3700)

> Retrieves the list of construction target home equipment service contracts filtered by the operation mode (cancel or registration).

| # | Type | Code |
|---|------|------|
| 1 | SET | `List<HashMap> kktkSvcOutList = getKktkSvcKeiKojiMap(handle, param, fixedText, koujiParamKind, kojiHaisoList, tempData);` // Filtered equipment list |
| 2 | IF | `if (kktkSvcOutList == null || kktkSvcOutList.size() == 0)` (L3695) |
| 3 | RETURN | `return false;` // No equipment to process — early exit |

**Block 5** — EXEC (build construction update payload) (L3703–3722)

> Constructs the complete update payload for the construction work order update component (`JFUKojiakUpdCC`). Sets all required fields including function code, subscription detail number, distinction code, work dispatch codes, service contract number, construction work order number, and the equipment list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JFUKojiakUpdCC jFuKojiakUpCC = new JFUKojiakUpdCC();` // Instantiate update component |
| 2 | EXEC | `param.setData(JFU_KOJIAK_UPD_CC, new HashMap<String, Object>());` // Initialize update data [-> JFU_KOJIAK_UPD_CC="JFUKojiakUpdCC"] (L763) |
| 3 | SET | `HashMap<String, Object> outMap = (HashMap<String, Object>)param.getData(JFU_KOJIAK_UPD_CC);` // Retrieve update data map |
| 4 | SET | `outMap.put("func_code", JPCModelConstant.FUNC_CD_1);` // Function code 1 = registration/update |
| 5 | SET | `outMap.put("mskm_dtl_no", mskmDetailNo);` // Subscription detail number |
| 6 | SET | `outMap.put("ido_div", inMap.get("ido_div"));` // Distinction (change) |
| 7 | SET | `outMap.put("koji_uk_cd", "070");` // Work dispatch code [-> "070"] |
| 8 | SET | `outMap.put("koji_uk_dtail_cd", "A6");` // Work dispatch detail code [-> "A6"] |
| 9 | SET | `outMap.put("svc_kei_no", inParamSvcKeiNo);` // Service contract number |
| 10 | SET | `outMap.put("kojiak_no", kojiAkNoAf);` // Construction work order number (update target) |
| 11 | SET | `outMap.put("kktkSvcOutList", kktkSvcOutList);` // Construction target equipment list |

**Block 6** — CALL (execute construction update) (L3724–3727)

> Sets the subscription detail number in the parameter, invokes the construction work info update, and cleans up the temporary data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setMskmDtlNo(param, mskmDetailNo);` // Set subscription detail number |
| 2 | CALL | `jFuKojiakUpCC.updKojiInfo(handle, param, JFU_KOJIAK_UPD_CC);` // Execute construction work order update |
| 3 | EXEC | `param.removeData(JFU_KOJIAK_UPD_CC);` // Clean up update data from parameter |
| 4 | RETURN | `return true;` // Construction linkage completed |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `koji` (工事) | Japanese term | Construction work — field operations performed by a contractor at the customer premises |
| `anken` (案件) | Japanese term | Case/order — a work item or project to be executed |
| `renkei` (連携) | Japanese term | Linkage/integration — data synchronization between systems |
| `mskm` (申込) | Abbreviation | Subscription/application — customer service contract subscription |
| `mskm_dtl_no` | Field | Subscription detail number — unique identifier for a line item within a service contract order |
| `mskm_no` | Field | Subscription number — identifier for the overall service contract subscription |
| `kojiak_no` (工事案件番号) | Field | Construction work order number — identifier for a construction work case assigned to a contractor |
| `kojiak_sbt_cd` (工事案件種別コード) | Field | Construction work order type code — classifies the type of construction work (e.g., new installation, swap, cancellation) |
| `koji_uk_cd` (工事受託コード) | Field | Work dispatch code — identifies the dispatch category (e.g., "070" for standard construction dispatch) |
| `koji_uk_dtail_cd` (工事受託詳細コード) | Field | Work dispatch detail code — sub-category of dispatch (e.g., "A6" for specific operation type) |
| `svc_kei_no` (サービス契約番号) | Field | Service contract number — unique identifier for a service contract line |
| `koji_haiso` (工事配送) | Japanese term | Construction delivery — delivery of equipment to the customer premises as part of a construction work order |
| `kktk_svc_kei_no` (機器提供サービス契約番号) | Field | Equipment provision service contract number — identifier for a service contract line that includes equipment provisioning |
| `kiki` (機器) | Japanese term | Equipment — the physical device (router, ONU, etc.) provided as part of a service contract |
| `kiki_edit_kbn` (機器編集区分) | Field | Equipment edit classification — indicates how equipment data is being edited (new, change, cancel) |
| `kinkyu_moto_tomson_cd_edit` (緊急事前通報コード編集) | Field | Emergency prior notice code edit — code for emergency notification of the customer before construction |
| `ido_div` (異動区分) | Field | Distinction/movement classification — indicates the type of service contract change (e.g., new, change, cancel) |
| `kojiak_rrk_jiko` | Field | Construction work order self-reference — self-referential construction work order indicator |
| `takcho_kibo_apo_kigen_ymd` (宅望.apo期限年月日) | Field | Preferred installation deadline date — the date the customer desires for installation |
| `tel_rrk_kibo_time_cd` (電話連絡希望時間コード) | Field | Preferred contact time code — the time period the customer prefers to be contacted |
| `FUNC_CD_1` | Constant | Function code 1 — represents registration/update operations in the component framework |
| `KOJI_AK_SBT_CD` | Constant | Key for construction work order type code stored in temporary data map |
| `JFU_KOJIAK_UPD_CC` | Constant | Data key for construction work order update component payload |
| `KOUJI_CANCEL_PARAM` | Constant | Value "CANCEL" — indicates cancellation processing mode |
| `KOUJI_RENKEI_PARAM` | Constant | Value "RENKEI" — indicates registration/update linkage processing mode |
| `EKU0011A010` | SC Code | Equipment Provision Service Contract Agreement Consultation Service Component |
| `JFUKojiakUpdCC` | Component | Construction Work Order Update Common Component — handles updating construction work order records |
| `JFUSetVariTsushinKikiMskmCC` | Component | Set Variable Service Device Subscription Detail Common Component — handles subscription detail operations for variable service equipment |
