# (DD10) Business Logic — JFUSetVariTsushinKikiMskmCC.getKojiTknikiki() [48 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JFUSetVariTsushinKikiMskmCC` |
| Layer | CC/Common Component (shared business logic component within the BP/custom/common package) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JFUSetVariTsushinKikiMskmCC.getKojiTknikiki()

This method retrieves and filters the list of existing construction target indoor equipment (宅内機器) associated with a given construction order (工事案件). It serves as a data preparation step within the construction company delivery flow for multi-functional router online/offline switching operations. The method performs a **Read** operation by invoking the CBS `EKU0141B020` (Construction Target Indoor Equipment List Meeting 2) to fetch all indoor equipment records, then applies business-level filtering rules to exclude equipment that is either in status `110` (not a valid target) or has a removal flag set to `9` (disconnected/unlinked). After filtering, it calls `getKikiChgNo` to resolve the equipment change number for each valid record, and finally returns a HashMap where the keys and values are both the equipment provider service contract number (機器提供サービス契約番号). This HashMap is subsequently used by the caller to determine whether any equipment records require update processing during construction-related delivery workflows — effectively acting as a **gatekeeper** that determines if the subsequent `execKojiAnkenRenkei` (construction order linkage) update call should proceed with a filtered work list.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getKojiTknikiki(params)"])
    INIT_VARS["Declare local variables: kikiChgNo, stcTekkyoFlg, kojiakTrgtTaknkikiStat, kktk_svc_kei_no, kikiMap"]
    CALL_CBS["Call execEKU0141B020(handle, param, fixedText, inKojiakNo)"]
    CHECK_LIST["List is not null
and size > 0?"]
    FOR_LOOP["For each eku0141b020cbsMsg in list"]
    EXTRACT_STC["stcTekkyoFlg = convNull(msg, STC_TEKKYO_FLG)"]
    EXTRACT_STAT["kojiakTrgtTaknkikiStat = convNull(msg, KOJIAK_TRGT_TAKNKIKI_STAT)"]
    EXTRACT_SVC["kktk_svc_kei_no = convNull(msg, KKTK_SVC_KEI_NO)"]
    CHECK_STAT["kojiakTrgtTaknkikiStat == 110
OR stcTekkyoFlg == 9?"]
    SKIP["continue (skip)"]
    CALL_CHGNO["kikiChgNo = getKikiChgNo(msg)"]
    CHECK_CHGNO["kikiChgNo is empty?"]
    SKIP2["continue (skip)"]
    MAP_PUT["kikiMap.put(kktk_svc_kei_no, kktk_svc_kei_no)"]
    END_FOR["End of for loop"]
    RETURN["Return kikiMap"]

    START --> INIT_VARS
    INIT_VARS --> CALL_CBS
    CALL_CBS --> CHECK_LIST
    CHECK_LIST -->|Yes| FOR_LOOP
    CHECK_LIST -->|No| RETURN
    FOR_LOOP --> EXTRACT_STC
    EXTRACT_STC --> EXTRACT_STAT
    EXTRACT_STAT --> EXTRACT_SVC
    EXTRACT_SVC --> CHECK_STAT
    CHECK_STAT -->|Yes| SKIP
    CHECK_STAT -->|No| CALL_CHGNO
    SKIP --> END_FOR
    CALL_CHGNO --> CHECK_CHGNO
    CHECK_CHGNO -->|Yes| SKIP2
    CHECK_CHGNO -->|No| MAP_PUT
    SKIP2 --> END_FOR
    MAP_PUT --> END_FOR
    END_FOR --> RETURN
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle carrying the database session context and transaction state for the current user session. Used to execute database queries via the CBS layer. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object that reads and writes HTTP/request parameters exchanged between the screen and the backend. Carries input data from the calling screen context. |
| 3 | `fixedText` | `String` | Service message string used for message formatting/localization in CBS calls. Passed through to `execEKU0141B020` for error or status message resolution. |
| 4 | `inKojiakNo` | `String` | Construction order number (工事案件番号) — the unique identifier of the construction project/order. This key determines which set of construction target indoor equipment records are fetched from the database. |

**External state / instance fields read:** None directly. The method reads no instance fields; all state is derived from parameters. However, it delegates to `convNull` within the same class `JFUSetVariTsushinKikiMskmCC` and calls `getKikiChgNo` (also defined in the same class).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JFUSetVariTsushinKikiMskmCC.execEKU0141B020` | EKU0141B020 | EKU0141B020CBSMsg1List | Calls `execEKU0141B020` — retrieves construction target indoor equipment list (工事案件対象宅内機器一覧照会2). Returns a list of equipment records keyed by `KOJIAK_NO`, `STC_TEKKYO_FLG`, `KOJIAK_TRGT_TAKNKIKI_STAT`, and `KKTK_SVC_KEI_NO`. |
| R | `JFUSetVariTsushinKikiMskmCC.getKikiChgNo` | JFUSetVariTsushinKikiMskmCC | - | Calls `getKikiChgNo(eku0141b020cbsMsg)` to resolve the equipment change number (機器変更番号) associated with the indoor equipment record. An empty result indicates no change record exists, and the item is skipped. |
| - | `JFUSetVariTsushinKikiMskmCC.convNull` | JFUSetVariTsushinKikiMskmCC | - | Utility call that safely extracts a String value from a HashMap, returning an empty string if the key is absent or the value is null. Called three times per loop iteration for `STC_TEKKYO_FLG`, `KOJIAK_TRGT_TAKNKIKI_STAT`, and `KKTK_SVC_KEI_NO`. |

**Classification rationale:**
- `execEKU0141B020` is a **Read** operation: its name follows the `exec*` naming convention for CBS (Common Business Service) queries, and the Japanese comment identifies it as "工事案件対象宅内機器一覧照会2" (Construction Target Indoor Equipment List Meeting 2) — a list query operation.
- `getKikiChgNo` is a **Read** operation: the `get*` prefix indicates it retrieves a single value (equipment change number) from an equipment record.
- `convNull` is an internal utility call, classified as **-** (not a CRUD operation).

## 5. Dependency Trace

### Direct callers found: 1 method

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC: `JFUSetVariTsushinKikiMskmCC` (internal caller) | `execProcessing` (or equivalent BP method) -> `isKojiHaiso(inKojiakNo)` -> `getKojiTknikiki(handle, param, fixedText, inKojiakNo)` -> `execEKU0141B020 [R] EKU0141B020CBSMsg1List` \| `getKikiChgNo [R] kikiChgNo` | `execEKU0141B020 [R] EKU0141B020CBSMsg1List` |

**Call context detail:** The method is called at line 1594 of the same class, within the `else` branch that handles "multi-functional router online/offline switching" (多機能ルーターの有線無線切替). When `isKojiHaiso(inKojiakNo)` returns `true` (indicating a construction delivery scenario), `getKojiTknikiki` is invoked to retrieve valid indoor equipment records. The returned `kojiKikiMap` is then used to filter `kojiHaisoList` — only records whose service contract numbers appear in the map are added to `workList`, which in turn triggers `execKojiAnkenRenkei` (construction order linkage update processing). This makes `getKojiTknikiki` a critical gatekeeper: if it returns an empty map, no update processing occurs for the construction delivery.

**Terminal operations from this method:** `getKikiChgNo` [R], `convNull` [-], `convNull` [-], `convNull` [-], `execEKU0141B020` [R]

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Variable declarations (L3839–L3853)

> Initializes local variables and the return HashMap. All String fields are initialized to empty strings. The HashMap `kikiMap` will hold the final result mapping service contract numbers.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kikiChgNo = ""` // Equipment change number, resolved per record |
| 2 | SET | `stcTekkyoFlg = ""` // Installation/removal flag (設置撤去フラグ) |
| 3 | SET | `kojiakTrgtTaknkikiStat = ""` // Construction target indoor equipment status (工事案件対象宅内機器ステータス) |
| 4 | SET | `kktk_svc_kei_no = ""` // Equipment provider service contract number (機器提供サービス契約番号) |
| 5 | SET | `kikiMap = new HashMap<String, String>()` // Return value map |

**Block 2** — [CALL] CBS call for equipment list retrieval (L3855–L3856)

> Invokes the CBS `EKU0141B020` (Construction Target Indoor Equipment List Meeting 2) to fetch all indoor equipment records associated with the given construction order number.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `eku0141b020cbsMsg1list = execEKU0141B020(handle, param, fixedText, inKojiakNo)` // Retrieves construction target indoor equipment list [-> EKU0141B020] |

**Block 3** — [IF] Check list null and empty guard (L3858–L3859)

> Before iterating the CBS result list, checks that it is neither null nor empty.

| # | Type | Code |
|---|------|------|
| 1 | IF | `eku0141b020cbsMsg1list != null && 0 < eku0141b020cbsMsg1list.size()` // Guard: skip if no equipment records returned |

**Block 4** — [FOR] Iterate over equipment records (L3860)

> Loops through each equipment record in the CBS result list. Each record is a `HashMap` containing fields like `STC_TEKKYO_FLG`, `KOJIAK_TRGT_TAKNKIKI_STAT`, and `KKTK_SVC_KEI_NO`.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (HashMap eku0141b020cbsMsg : eku0141b020cbsMsg1list)` // Iterate each indoor equipment record |

**Block 4.1** — [SET] Extract STC_TEKKYO_FLG (L3862–L3863)

> Extracts the installation/removal flag from the current equipment record. This flag indicates whether the equipment has been installed or removed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `stcTekkyoFlg = convNull(eku0141b020cbsMsg, EKU0141B020CBSMsg1List.STC_TEKKYO_FLG)` // Installation/removal flag (設置撤去フラグ) |

**Block 4.2** — [SET] Extract KOJIAK_TRGT_TAKNKIKI_STAT (L3864–L3865)

> Extracts the construction target indoor equipment status. This status value determines whether the equipment is a valid target for processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kojiakTrgtTaknkikiStat = convNull(eku0141b020cbsMsg, EKU0141B020CBSMsg1List.KOJIAK_TRGT_TAKNKIKI_STAT)` // Construction target indoor equipment status (工事案件対象宅内機器ステータス) |

**Block 4.3** — [SET] Extract KKTK_SVC_KEI_NO (L3866–L3867)

> Extracts the equipment provider service contract number. This serves as both the key and value in the final result HashMap.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktk_svc_kei_no = convNull(eku0141b020cbsMsg, EKU0141B020CBSMsg1List.KKTK_SVC_KEI_NO)` // Equipment provider service contract number (機器提供サービス契約番号) |

**Block 5** — [IF] Filter by status and removal flag (L3869–L3873)

> **Skip condition**: Equipment records with status `110` (not a valid target — なし) or removal flag `9` (disconnected/unlinked — 撤去(9)) are excluded from further processing. The Japanese comment explains that these records are not linked and should be skipped (読み飛ばします).

| # | Type | Code |
|---|------|------|
| 1 | IF | `"110".equals(kojiakTrgtTaknkikiStat)` [KOJIAK_TRGT_TAKNKIKI_STAT = "110" (not a valid target)] OR `"9".equals(stcTekkyoFlg)` [STC_TEKKYO_FLG = "9" (disconnected)] — skip this record |
| 2 | EXEC | `continue` // Skip to next iteration |

**Block 6** — [CALL] Resolve equipment change number (L3875–L3876)

> Calls the local method `getKikiChgNo` to determine if there is an equipment change record associated with this indoor equipment. An empty result means no change record exists.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `kikiChgNo = getKikiChgNo(eku0141b020cbsMsg)` // Gets equipment change number (機器変更番号) for the indoor equipment |

**Block 7** — [IF] Check if equipment change number is empty (L3878–L3881)

> If no equipment change number was resolved, the record is skipped. This ensures only equipment with associated change records is included in the result.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"".equals(kikiChgNo)` — skip this record (no equipment change record found) |
| 2 | EXEC | `continue` // Skip to next iteration |

**Block 8** — [SET] Add to result map (L3883)

> Adds the service contract number to the result HashMap as both key and value. This deduplicated map is later used by the caller to filter records needing updates.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kikiMap.put(kktk_svc_kei_no, kktk_svc_kei_no)` // Maps service contract number to itself |

**Block 9** — [RETURN] Return result (L3885)

> Returns the filtered HashMap. If no valid records survived the filtering, an empty HashMap is returned.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return kikiMap` // Returns equipment service contract numbers that require processing |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kojiakNo` | Field | Construction order number (工事案件番号) — unique identifier for a construction project/order in the system |
| `kojiak_trgt_taknkiki_stat` | Field | Construction target indoor equipment status (工事案件対象宅内機器ステータス) — indicates the current state of indoor equipment for a construction order; status `110` means "not a valid target" |
| `stc_tekkyo_flg` | Field | Installation/removal flag (設置撤去フラグ) — indicates whether equipment has been installed or removed; flag `9` means disconnected/unlinked (撤去) |
| `kktk_svc_kei_no` | Field | Equipment provider service contract number (機器提供サービス契約番号) — the service contract number associated with indoor equipment supplied by the equipment provider |
| `kikiChgNo` | Field | Equipment change number (機器変更番号) — identifier for an equipment change record; empty value indicates no change record exists |
| `ek0141b020` | CBS | Construction Target Indoor Equipment List Meeting 2 (工事案件対象宅内機器一覧照会2) — CBS that queries the list of indoor equipment records for a given construction order |
| `KOJIAK_TRGT_TAKNKIKI_STAT` | Constant | Field key `kojiak_trgt_taknkiki_stat` in EKU0141B020CBSMsg1List — used to extract the equipment status from CBS result |
| `STC_TEKKYO_FLG` | Constant | Field key `stc_tekkyo_flg` in EKU0141B020CBSMsg1List — used to extract the installation/removal flag from CBS result |
| `KKTK_SVC_KEI_NO` | Constant | Field key `kktk_svc_kei_no` in EKU0141B020CBSMsg1List — used to extract the service contract number from CBS result |
| 工事案件 (Koji Anken) | Business term | Construction order/project — a work order for installing, modifying, or removing telecom equipment at a customer premises |
| 宅内機器 (Taknai Kiki) | Business term | Indoor equipment — customer premises equipment (CPE) such as ONUs, routers, STBs installed at the customer site |
| 設置撤去 (Setchi Tekkyo) | Business term | Installation/Removal — the lifecycle status of indoor equipment, indicating whether it has been installed (設置) or removed/disconnected (撤去) |
| 機器提供サービス (Kiki Teikyo Service) | Business term | Equipment provider service — the service contract through which indoor equipment is supplied to the customer by the equipment provider |
| 多機能ルーター (Takino Ruuter) | Business term | Multi-functional router — a converged router device that handles both wired and wireless connectivity for the customer |
| 工事会社配送 (Kouji Gaisha Haiso) | Business term | Construction company delivery — a delivery workflow where the construction company handles equipment delivery during a construction order |
| 工事案件諸変更要請 (Koji Anken Shohen Sei) | Business term | Construction order various modification request — a CBS that performs update operations (insert/update/delete) on construction order related records |
