# Business Logic — JFUSetVariTsushinKikiMskmCC.getNewKkopSvcCd() [28 LOC]

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

## 1. Role

### JFUSetVariTsushinKikiMskmCC.getNewKkopSvcCd()

This method retrieves the latest equipment option (device add-on service) information for a multifunction router associated with a given device provision service contract number (`kktkSvcKeiNo`). It is a shared utility component called by screen logic (e.g., when setting up equipment information for varying telecommunication business occasions) — specifically invoked in the context of multifunction router setup when the service type matches a home multifunction router pattern. The method performs a composite search for equipment option service contracts via a Service Component (SC) call `EKK2811B504`, then iterates over the returned result set to extract active equipment option service codes. It filters out records whose service contract status code is `910` (Terminated — 解約) or `920` (Canceled — キャンセル) using the `KKOP_SVC_KEI_STAT_MUKO` exclusion list, and stores each valid equipment option service code (`kkopSvcCd`) into the `tempData` work HashMap using the code itself as both key and value. The method implements a standard fetch-filter-store pattern: it initializes search parameters, executes the service component for data retrieval, and post-processes results to populate a caller-facing work area.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getNewKkopSvcCd"])
    START --> GET_DATA["Get HashMap inMap from param.getData"]
    GET_DATA --> INIT_DATA["initData: Initialize request parameters with IN_COLUMN_LIST_EKK2811B504_NEW"]
    INIT_DATA --> SET_NEW["setEKK2811B504_NEW: Setup search criteria"]
    SET_NEW --> IGNORE_ERROR["ignoreSearchError: Disable search error throwing"]
    IGNORE_ERROR --> EXEC_SC["executeSC: Execute Service Component EKK2811B504_NEW"]
    EXEC_SC --> FOR_LOOP["for each dataMap in getTemplateList"]
    FOR_LOOP --> EXTRACT["Extract kkopSvcKeiStat and kkopSvcCd from dataMap"]
    EXTRACT --> CHECK_STATUS{"KKOP_SVC_KEI_STAT_MUKO contains kkopSvcKeiStat?"}
    CHECK_STATUS -->|Yes 910 or 920| SKIP["continue - skip this record"]
    CHECK_STATUS -->|No - Active| PUT_DATA["tempData.put kkopSvcCd"]
    SKIP --> NEXT_LOOP["Next iteration"]
    PUT_DATA --> NEXT_LOOP
    NEXT_LOOP --> END_NODE(["End"])
```

**CRITICAL — Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `KKOP_SVC_KEI_STAT_MUKO` | `["910", "920"]` | Status codes to exclude — equipment option service contracts that are Terminated (解約, 910) or Canceled (キャンセル, 920) |
| `JFUStrConst.CD01616_910` | `"910"` | Service contract status — Terminated |
| `JFUStrConst.CD01616_920` | `"920"` | Service contract status — Canceled |
| `IN_COLUMN_LIST_EKK2811B504_NEW` | List | Input column list for the EKK2811B504 composite search template |
| `TEMP_TEMPLATE_KEY_EKK2811B504_NEW` | String | Template key for temporary template storage |
| `TEMPLATE_ID_EKK2811B504_NEW` | String | Header template ID for the SC call |
| `TEMPLATE_ID_DETAIL_EKK2811B504_NEW` | String | Detail template ID for iterating result rows |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle carrying the current user session context, used to execute the Service Component |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying inbound data; used to retrieve the input HashMap (`getData`) and to initialize and configure search criteria for the SC call |
| 3 | `fixedText` | `String` | Service message identifier (template key) — used as a lookup key for retrieving the correct data map from `param` and for template IDs; serves as the namespace for request parameter data |
| 4 | `tempData` | `HashMap<String, String>` | Inter-system linkage work area (情報連携用ワーク) — an internal temporary storage HashMap used within this function's scope to pass data between methods; the method populates it with valid equipment option service codes |
| 5 | `inKktkSvcKeiNo` | `String` | Device provision service contract number (機器提供サービス契約番号) — the primary search key identifying which service contract's equipment option details to retrieve |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JFUSetVariTsushinKikiMskmCC.initData` | EKK2811B504 | KK_T_OPSVKEI_INFO (inferred) | Initialize request parameters with column list for equipment option service contract composite search |
| R | `JFUSetVariTsushinKikiMskmCC.setEKK2811B504_NEW` | EKK2811B504 | KK_T_OPSVKEI_INFO (inferred) | Setup search criteria — sets SYSID, kktkSvcKeiNo, and rsv_aply_ymd (reservation application date) from operation date |
| R | `JFUSetVariTsushinKikiMskmCC.ignoreSearchError` | EKK2811B504 | - | Disable search error throwing — allows the SC call to return empty results without exception |
| R | `JFUBaseCC.executeSC` | EKK2811B504SC | KK_T_OPSVKEI_INFO | Execute the Service Component for composite Equipment Option Service Contract search — queries the equipment option service contract database table |
| R | `JFUBaseCC.getTemplateList` | - | - | Iterate over result rows from the SC call using the detail template |
| R | `JFUBaseCC.getMaxTempTempleteKey` | - | - | Get the maximum temporary template key for the result set |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS/CC: `JFUSetVariTsushinKikiMskmCC` | `getKikiInfo` (internal) -> `isKktkSvcTakino` -> `getNewKkopSvcCd` | `getTemplateList [R]`, `getMaxTempTempleteKey [R]`, `executeSC [R] EKK2811B504SC` |

**Terminal operations from this method:** `getTemplateList` [R], `getMaxTempTempleteKey` [R], `executeSC` [-], `ignoreSearchError` [-], `initData` [-]

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] `(data retrieval)` (L4016–L4017)

> Retrieve the HashMap from the request parameter using the fixedText as the key.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `HashMap inMap = (HashMap)param.getData(fixedText)` // Retrieve user data HashMap from param [-> "ユーザデータ取得"] |

**Block 2** — [EXEC] `(initialization)` (L4019–L4020)

> Initialize the request parameter structure with the input column list for the EKK2811B504 composite search.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `initData(param, fixedText, IN_COLUMN_LIST_EKK2811B504_NEW)` // Initialize with input column list ["EKK2811B504 機器オプションサービス契約一覧照会（複合検索）"] |

**Block 3** — [EXEC] `(mapping setup)` (L4022–L4023)

> Configure the search criteria for the EKK2811B504 query. Sets SYSID from tempData, the device provision service contract number (`inKktkSvcKeiNo`), and the reservation application date from the operation date.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setEKK2811B504_NEW(param, fixedText, tempData, inKktkSvcKeiNo)` // Setup mapping [-> "上りマッピング"] |
| 2 | CALL | (inside setEKK2811B504_NEW) `ignoreSearchError(param, fixedText)` // Disable search errors |
| 3 | CALL | (inside setEKK2811B504_NEW) `setFuncCode(param, fixedText, JPCModelConstant.FUNC_CD_1)` // Set function code FUNC_CD_1 = "1" [-> "抽出条件に一致するレコードの照会"] |
| 4 | SET | (inside setEKK2811B504_NEW) `inMap.put(EKK2811B504CBSMsg.KEY_SYSID, tempData.get(EKK0341D010CBSMsg.SYSID))` // Set SYSID |
| 5 | SET | (inside setEKK2811B504_NEW) `inMap.put(EKK2811B504CBSMsg.KEY_KKTK_SVC_KEI_NO, inKktkSvcKeiNo)` // Set device provision service contract number |
| 6 | SET | (inside setEKK2811B504_NEW) `inMap.put(EKK2811B504CBSMsg.KEY_RSV_APLY_YMD, JCCBPCommon.getOpeDate(null))` // Set reservation application date from operation date |

**Block 4** — [EXEC] `(search error suppression)` (L4025–L4026)

> Suppress search-related errors so the SC call returns empty results gracefully instead of throwing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `ignoreSearchError(param, fixedText)` // Suppress search errors ["検索エラーなし設定"] |

**Block 5** — [EXEC] `(Service Component execution)` (L4028–L4030)

> Execute the Service Component to perform the composite equipment option service contract search.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeSC(handle, param, fixedText, TEMPLATE_ID_EKK2811B504_NEW, TEMPLATE_ID_DETAIL_EKK2811B504_NEW, IN_COLUMN_LIST_EKK2811B504_NEW, ERROR_COLUMN_EKK2811B504_NEW)` // Execute SC ["サービスIF実行"] |

**Block 6** — [FOR] `(iterate results)` (L4032–L4040)

> Iterate over all returned data maps from the SC call and process each record.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `for (HashMap dataMap : getTemplateList(inMap, getMaxTempTempleteKey(inMap, TEMP_TEMPLATE_KEY_EKK2811B504_NEW), TEMPLATE_ID_DETAIL_EKK2811B504_NEW))` // Iterate over detail rows |

**Block 6.1** — [NESTED FOR BODY] `(extract fields)` (L4033–L4034)

> Extract the service contract status code and equipment option service code from the current result row.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String kkopSvcKeiStat = (String)dataMap.get(EKK2811B504CBSMsg1List.KKOP_SVC_KEI_STAT)` // Extract service contract status |
| 2 | SET | `String kkopSvcCd = (String)dataMap.get(EKK2811B504CBSMsg1List.KKOP_SVC_CD)` // Extract equipment option service code |

**Block 6.2** — [IF] `(status filter: KKOP_SVC_KEI_STAT_MUKO.contains(kkopSvcKeiStat))` [KKOP_SVC_KEI_STAT_MUKO="910", "920"] (L4035)

> Skip records whose service contract status is terminated (910) or canceled (920). These are inactive contracts and should not be returned as valid equipment options.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `KKOP_SVC_KEI_STAT_MUKO.contains(kkopSvcKeiStat)` // Check against exclusion list ["910", "920"] |
| 2 | EXEC | `continue` // Skip this record ["—"] |

**Block 6.3** — [ELSE-BODY] `(store valid code)` (L4038–L4039)

> When the status is NOT in the exclusion list (i.e., the contract is active), store the equipment option service code into the tempData work area. The code serves as both the key and the value, enabling quick lookup by the calling method.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tempData.put(kkopSvcCd, kkopSvcCd)` // Store valid equipment option service code in tempData work area |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kkopSvcKeiNo` | Field | Equipment Option Service Contract Number — the unique identifier for an equipment option service contract line item |
| `kkopSvcCd` | Field | Equipment Option Service Code — the code identifying a specific equipment option add-on service (e.g., multifunction router add-on) |
| `kkopSvcKeiStat` | Field | Equipment Option Service Contract Status — the current lifecycle status of the equipment option service contract |
| `kktkSvcKeiNo` | Field | Device Provision Service Contract Number — the parent service contract under which equipment (e.g., multifunction router) is provisioned to the customer |
| `SYSID` | Field | System ID — the unique identifier of the system instance processing the request |
| `rsv_aply_ymd` | Field | Reservation Application Year-Month-Day — the date from which the reservation/service application is effective |
| `KKOP_SVC_KEI_STAT_MUKO` | Constant | Exclusion list of service contract statuses to filter out (Terminated: 910, Canceled: 920) |
| CD01616_910 | Constant | Status code "910" — Service Contract Terminated (解約) |
| CD01616_920 | Constant | Status code "920" — Service Contract Canceled (キャンセル) |
| EKK2811B504 | CBS/SC | Equipment Option Service Contract Composite Search — a Service Component for querying equipment option service contract records |
| FUNC_CD_1 | Constant | Function Code "1" — Retrieve all records matching the specified conditions |
| multifunction router | Business term | Multifunction Router (多機能ルーター) — a network device providing routing, WiFi, and sometimes set-top box functionality |
| 機器オプション | Business term | Equipment Option — add-on hardware services such as multifunction routers provided to subscribers |
| 機器提供サービス契約 | Business term | Device Provision Service Contract — the contractual arrangement for providing equipment (router, STB, etc.) to a customer |
| 複合検索 | Business term | Composite Search — a search operation combining multiple criteria/fields to filter results |
| tempData | Field | Inter-system linkage work area — a temporary HashMap used to pass data between methods within the same business process |
| fixedText | Field | Service message identifier / template key — a string used as a namespace key to retrieve the correct data map from the request parameter |
