# Business Logic — JKKKikiIchiranKkCreateCC.execShinchokuToroku() [140 LOC]

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

## 1. Role

### JKKKikiIchiranKkCreateCC.execShinchokuToroku()

This method performs **progress registration** (進捗登録) for a device creation order within the telecom service provisioning system. When a user registers new equipment (such as a multi-function router or home gateway) through the Kiki (device) creation screen, this method records the progress state into the backend EKK1091D010 service component, ensuring the order lifecycle is updated with the current processing stage.

The method implements a **defensive early-return pattern**: it first retrieves the current progress status, validates that a valid status exists, and checks whether progress registration is permissible for the given context. Only when all preconditions are satisfied does it proceed to build and dispatch the registration payload.

A key differentiator of this method is its **progress remark aggregation**. It assembles a descriptive `PRG_TKJK_1` (progress remark) string by evaluating multiple business conditions: whether the service is a router-type service (multi-function router `C024` or home gateway `C025`) with a valid route function code, whether new service cost application flags indicate "use from new service" or "use immediately", and whether a model number specification registration is active. These conditions are chained — later conditions append to the remark rather than replacing it, producing a cumulative business description.

In the larger system, this method serves as the **shared progress registration handler** for the Kiki (device) creation screen (KKSV0194 and KKSV0211). It is called after the user submits device creation data, bridging the UI submission with the persistence layer via the EKK1091D010CBS service component.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execShinchokuToroku"])
    
    STEP1["取得: ccMsg = param.getData(dataMapKey)"]
    STEP2["取得: workMap = param.getMappingWorkArea()"]
    STEP3["取得: prg_stat = getPrgStat(param, dataMapKey)"]
    COND1{prg_stat equals empty?}
    EARLY_RET1["return — progress status not set"]
    STEP4["判定: isExecShinchokuToroku(param, prg_stat, empty)"]
    COND2{Exec allowed?}
    EARLY_RET2["return — not an exec progress status"]
    STEP5["取得: rutaKinoCd, kktkSvcCd, rtNewPcrsAplyFlg from ccMsg"]
    STEP6["取得: rtNewPcrsAplyFlg from ccMsg"]
    COND3{kktkSvcCd == TAKINORT (C024) or HGW (C025) AND rutaKinoCd not blank?}
    COND4{rtNewPcrsAplyFlg == NEWPCRS (1)?}
    STEP7["tkjikou = Router function valid timing: use from new service"]
    STEP8["tkjikou = Router function valid timing: use immediately"]
    STEP9["取得: mdlNoShiteiAdd from ccMsg"]
    COND5{mdlNoShiteiAdd == CD_DIV_UM_ARI (1)?}
    STEP10["Append Registration with model number specification to tkjikou"]
    STEP11["取得: ekk0081a010 from temporaryData"]
    STEP12["構築: ekk1091d010IN array for EKK1091D010CBSMsg"]
    STEP13["構築: inMap/inList for IDO_RSN_CD, IDO_RSN_MEMO"]
    STEP14["CALL: callSCArray - EKK1091D010CBSMsg1List"]
    STEP15["CALL: setShinchokuTkjk(param, prg_stat, empty)"]
    END_NODE(["Return"])
    
    START --> STEP1 --> STEP2 --> STEP3 --> COND1
    COND1 -- Yes --> EARLY_RET1
    COND1 -- No --> STEP4 --> COND2
    COND2 -- No --> EARLY_RET2
    COND2 -- Yes --> STEP5 --> STEP6 --> COND3
    COND3 -- Yes --> COND4
    COND4 -- Yes --> STEP7
    COND4 -- No --> STEP8
    STEP8 --> STEP9
    STEP7 --> STEP9
    COND3 -- No --> STEP9
    STEP9 --> COND5
    COND5 -- Yes --> STEP10
    COND5 -- No --> STEP11
    STEP10 --> STEP11
    STEP11 --> STEP12 --> STEP13 --> STEP14 --> STEP15 --> END_NODE
```

**Constant Resolution:**
- `JKKStrConst.KKTK_SVC_CD_TAKINORT` = `"C024"` (Multi-function Router service code)
- `JKKStrConst.KKTK_SVC_CD_HGW` = `"C025"` (Home Gateway service code)
- `JKKStrConst.NEW_PCRS_APLY_FLG_NEWPCRS` = `"1"` (New service cost application flag — "use from new service")
- `JKKStrConst.CD_DIV_UM_ARI` = `"1"` (Code division: with specification — model number specification)

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle used for persistence operations. Provides the transactional context for the EKK1091D010CBS registration call. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service component invocation dispatcher. Used to invoke the EKK1091D010 progress registration service component (`EKK1091D010CBS`) via `callSCArray`. |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter carrier containing screen-submitted data. Used to retrieve the progress status (`getPrgStat`), write the progress remark (`setShinchokuTkjk`), and access the mapping work area. |
| 4 | `dataMapKey` | `String` | Key identifying the message map within the request parameter. Used to retrieve `ccMsg` (the central message map containing service codes, function codes, reason codes, and other screen data). |
| 5 | `temporaryData` | `HashMap<String, Object>` | Temporary storage map passed through the request lifecycle. Used to retrieve the EKK0081A010 template message (`TEMPLATE_ID_EKK0081A010`) which determines the detail number for the progress registration. |

**Instance Fields / External State:**
- `TEMPLATE_ID_EKK1091D010` — Template ID constant for the EKK1091D010 progress registration service component.
- `TEMPLATE_ID_EKK0081A010` — Template ID constant for the router registration template used to determine the detail number (`mskm_dtl_no`).
- `JKKStrConst.KKTK_SVC_CD_TAKINORT` = `"C024"` — Multi-function router service code constant.
- `JKKStrConst.KKTK_SVC_CD_HGW` = `"C025"` — Home gateway service code constant.
- `JKKStrConst.NEW_PCRS_APLY_FLG_NEWPCRS` = `"1"` — New service cost application flag constant.
- `JKKStrConst.CD_DIV_UM_ARI` = `"1"` — With specification division constant.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKKikiIchiranKkCreateCC.getPrgStat` | - | - | Retrieves the current progress status (`prg_stat`) from the request parameter. Returns empty string if not set. |
| R | `JKKKikiIchiranKkCreateCC.isExecShinchokuToroku` | - | - | Checks whether the current progress status allows progress registration execution. Returns true if registration is permitted. |
| R | `JKKKikiIchiranKkCreateCC.getMskmDtlNo` | - | - | Resolves the service detail number (`mskm_dtl_no`) from the parameter and the EKK0081A010 template message. |
| R | `JKKKikiIchiranKkCreateCC.getIdoUpDtm` | - | - | Retrieves the installation update date-time (`ido_dtm`) from the request context. |
| R | `JKKKikiIchiranKkCreateCC.getNullToStr` | - | - | Null-safe conversion: converts null to empty string for the IDO reason code (`ido_rsn_cd`). |
| C | `EKK1091D010CBS` (via `callSCArray`) | `EKK1091D010` | `KIK_T_PROGRESS` (estimated — progress management table) | **Create** — Registers the progress state for the device creation order. Sends `ekk1091d010IN` (main record) and `inList` (IDO reason code list) as input parameters. Records the progress status, service detail number, installation date-time, and the aggregated progress remark (`PRG_TKJK_1`). |
| U | `JKKKikiIchiranKkCreateCC.setShinchokuTkjk` | - | - | **Update** — Writes the progress remark back to the parameter work area after the registration call completes. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0194 | `KKSV0194OPOperation.execKikiIchiranKikiCreate` -> `JKKKikiIchiranKkCreateCC.execShinchokuToroku` | `EKK1091D010CBS [C] KIK_T_PROGRESS` |
| 2 | Screen:KKSV0211 | `KKSV0211OPOperation.execKikiIchiranKikiCreate` -> `JKKKikiIchiranKkCreateCC.execShinchokuToroku` | `EKK1091D010CBS [C] KIK_T_PROGRESS` |

**Note:** The direct callers (`JKKKikiIchiranKkCreateCC.execKikiIchiranKikiCreate`) are invoked by the device creation screen operations. KKSV0194 handles multi-function router / home gateway device creation, and KKSV0211 handles similar device creation flows.

**Terminal operations from this method:** `setShinchokuTkjk` [U], `callSCArray` [C], `getNullToStr` [R], `getIdoUpDtm` [R], `getMskmDtlNo` [R], `isNullBlank` [-], `getPrgStat` [R], `isExecShinchokuToroku` [-], `getData` [R]

## 6. Per-Branch Detail Blocks

### Block 1 — GET (L1088)
> Retrieves the central message map from the request parameter using the data map key. This map contains all screen-submitted business data including service codes, function codes, and reason codes.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = (HashMap) param.getData(dataMapKey)` |

### Block 2 — GET (L1091)
> Retrieves the mapping work area from the request parameter. This is a general-purpose work area used for data exchange between processing components.

| # | Type | Code |
|---|------|------|
| 1 | SET | `workMap = param.getMappingWorkArea()` |

### Block 3 — IF [GET progress status] (L1095)

> Retrieves the current progress status code from the request. This determines the lifecycle stage of the order and drives the progress registration logic.

| # | Type | Code |
|---|------|------|
| 1 | SET | `prg_stat = getPrgStat(param, dataMapKey)` |

### Block 4 — IF [early return: progress status not set] (L1097)

> If `prg_stat` is empty, the method exits early. No progress status means this request is not associated with a progress-registration context.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if ("".equals(prg_stat))` |
| 2 | RETURN | `return` |

### Block 5 — IF [permission check: exec allowed] (L1103)

> Validates that the current progress status is one that permits progress registration execution. The `isExecShinchokuToroku` method checks against a list of valid execution progress status codes.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `isExecShinchokuToroku(param, prg_stat, "")` |
| 2 | RETURN | `return` (when result is false) |

### Block 6 — IF [router service check + new service cost flag] (L1107)

> Sets up the remark aggregation variables. Retrieves three fields from `ccMsg`: the route function code (`ruta_kino_cd`), the device-provided service code (`kktk_svc_cd`), and the new service cost application flag (`rt_new_pcrs_aply_flg`). These are used to determine the processing remark for progress tracking.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tkjikou = ""` — Initialize remark accumulator |
| 2 | SET | `rutaKinoCd = (String) ccMsg.get("ruta_kino_cd")` — Route function code |
| 3 | SET | `kktkSvcCd = (String) ccMsg.get("kktk_svc_cd")` — Device-provided service code |
| 4 | SET | `rtNewPcrsAplyFlg = (String) ccMsg.get("rt_new_pcrs_aply_flg")` — New service cost application flag |

### Block 6.1 — IF [router service type check] (L1113)

> Checks if the service is a multi-function router (TAKINORT = "C024") or a home gateway (HGW = "C025"), AND the route function code is not blank. If so, this is a router-type device registration that requires special progress remark handling.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `kktkSvcCd == TAKINORT (C024) OR kktkSvcCd == HGW (C025)` |
| 2 | EXEC | `!JKKStringUtil.isNullBlank(rutaKinoCd)` |
| 3 | SET | (enters inner block on true) |

### Block 6.1.1 — IF [new service cost application flag] (L1116)

> Within the router service block, checks whether the new service cost application flag equals "1" (NEWPCRS — "use from new service"). This determines the specific timing remark to record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtNewPcrsAplyFlg == NEWPCRS (1)` |
| 2 | SET | `tkjikou = "Router function valid timing: use from new service"` (if true) |
| 3 | SET | `tkjikou = "Router function valid timing: use immediately"` (if false/else) |

**Japanese original comments:**
- `ルーター機能の有効タイミング：新コースから利用する` (Router function valid timing: use from new service) — Line 1117
- `ルーター機能の有効タイミング：すぐに利用する` (Router function valid timing: use immediately) — Line 1120

### Block 7 — IF [model number specification registration] (L1131)

> After the router service block, checks whether a model number specification registration is active (`mdl_no_shitei_add` from `ccMsg`). If the code equals "1" (CD_DIV_UM_ARI — with specification), appends "Registration with model number specification" to the `tkjikou` remark. This is an additive operation: if `tkjikou` already contains a router-type remark, the model number remark is appended with a space separator.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mdlNoShiteiAdd = (String) ccMsg.get("mdl_no_shitei_add")` |
| 2 | EXEC | `JKKStrConst.CD_DIV_UM_ARI (1).equals(mdlNoShiteiAdd)` |
| 3 | EXEC | If `tkjikou` is blank: `tkjikou = "Registration with model number specification"` |
| 4 | EXEC | If `tkjikou` is not blank: `tkjikou = tkjikou + " Registration with model number specification"` |

**Japanese original comments:**
- `型番指定での登録` (Registration with model number specification) — Line 1134, 1137

### Block 8 — GET (L1144)
> Retrieves the EKK0081A010 template message from the temporary data map. This template is used to determine the service detail number (`mskm_dtl_no`) for the progress registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081a010 = (CAANMsg) temporaryData.get(TEMPLATE_ID_EKK0081A010 ("EKK0081A010"))` |

### Block 9 — SET [build progress registration input array] (L1149)

> Constructs the main input array (`ekk1091d010IN`) for the EKK1091D010 progress registration service component. Each row is a key-value pair where the key is a message field constant and the value is the corresponding business data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `[TEMPLATEID, TEMPLATE_ID_EKK1091D010 ("EKK1091D010")]` |
| 2 | SET | `[FUNC_CODE, (String) ccMsg.get("func_code")]` |
| 3 | SET | `[MSKM_DTL_NO, getMskmDtlNo(param, ekk0081a010, ccMsg)]` |
| 4 | SET | `[SEIKY_KEI_NO, ""]` — Settlement plan number (empty) |
| 5 | SET | `[SEIKY_WAY_NO_KOZA, ""]` — Settlement method account number (empty) |
| 6 | SET | `[SEIKY_WAY_NO_CRECARD, ""]` — Settlement method credit card number (empty) |
| 7 | SET | `[SVC_KEI_NO, (String) ccMsg.get("svc_kei_no")]` — Service key number |
| 8 | SET | `[SVC_KEI_UCWK_NO, ""]` — Service detail work number (empty) |
| 9 | SET | `[SVC_KEI_KAISEN_UCWK_NO, ""]` — Service improvement work number (empty) |
| 10 | SET | `[KKTK_SVC_KEI_NO, ""]` — Device-provided service key number (empty) |
| 11 | SET | `[OP_SVC_KEI_NO, ""]` — Operator service key number (empty) |
| 12 | SET | `[SEIOPSVC_KEI_NO, ""]` — Service operator service key number (empty) |
| 13 | SET | `[SBOP_SVC_KEI_NO, ""]` — Sub-operator service key number (empty) |
| 14 | SET | `[WRIB_SVC_KEI_NO, ""]` — Writer service key number (empty) |
| 15 | SET | `[IDO_DIV, (String) ccMsg.get("ido_div")]` — Installation division (transfer reason division) |
| 16 | SET | `[IDO_DTM, getIdoUpDtm(handle, scCall, param, dataMapKey, temporaryData)]` — Installation update date-time |
| 17 | SET | `[PRG_STAT, prg_stat]` — Progress status (dynamic, not hardcoded "3302") |
| 18 | SET | `[PRG_MEMO, ""]` — Progress memo (empty) |
| 19 | SET | `[PRG_TKJK_1, tkjikou]` — Progress remark 1 (aggregated business description) |
| 20 | SET | `[PRG_TKJK_2, ""]` — Progress remark 2 (empty) |

### Block 10 — SET [build IDO reason code list] (L1173)

> Constructs the secondary input list (`inList`) containing IDO (installation) reason code data. This is a child list sent as the `EKK1091D010CBSMsg1List` parameter to the service component.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inList = new ArrayList<HashMap<String, Object>>()` |
| 2 | SET | `inMap = new HashMap<String, Object>()` |
| 3 | SET | `inMap.put(IDO_RSN_CD, getNullToStr((String) ccMsg.get("ido_rsn_cd")))` — Transfer reason code (null-safe) |
| 4 | SET | `inMap.put(IDO_RSN_MEMO, "")` — Transfer reason memo (empty) |
| 5 | EXEC | `inList.add(inMap)` |

### Block 11 — CALL [execute progress registration] (L1179)

> Invokes the EKK1091D010 progress registration service component via `callSCArray`. This is the primary CREATE operation — it persists the progress state for the device creation order, including the aggregated remark (`PRG_TKJK_1`) and the IDO reason code list.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callSCArray(handle, scCall, param, dataMapKey, ekk1091d010IN, "EKK1091D010CBSMsg1List", inList)` |

**Japanese original comment:**
- `登録データを格納します。` (Store the registration data.) — Line 1176

### Block 12 — CALL [write progress remark back] (L1184)

> After the registration call completes, writes the progress status back to the parameter work area via `setShinchokuTkjk`. This ensures the UI retains the progress state for subsequent processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setShinchokuTkjk(param, prg_stat, "")` |

### Block 13 — RETURN (L1186)

> The method has `void` return type. Execution reaches here implicitly after Block 12 completes.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return` (implicit, void method) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `prg_stat` | Field | Progress status — the current lifecycle stage code of an order (e.g., "3302" for device creation screen processing) |
| `tkjikou` | Field | Processing remark — an aggregated human-readable description of the progress, assembled from multiple business conditions |
| `kktk_svc_cd` | Field | Device-provided service code — identifies the type of device/service being registered (e.g., router, home gateway) |
| `ruta_kino_cd` | Field | Route function code — indicates whether the device has routing capability enabled |
| `rt_new_pcrs_aply_flg` | Field | New service cost application flag — indicates whether cost applies from new service enrollment or immediately |
| `mdl_no_shitei_add` | Field | Model number specification registration flag — "1" indicates registration with a specific model number |
| `ido_rsn_cd` | Field | Installation/transfer reason code — classifies the reason for device installation or transfer |
| `mskm_dtl_no` | Field | Service detail work number — internal tracking ID for a specific service contract line item |
| `svc_kei_no` | Field | Service key number — primary identifier for a service contract |
| `ido_div` | Field | Installation division — classification of installation type (e.g., new, transfer, change) |
| `ido_dtm` | Field | Installation date-time — timestamp of the installation or modification event |
| `PRG_TKJK_1` | Field | Progress remark 1 — primary human-readable remark field stored during progress registration |
| TAKINORT | Constant | Multi-function router service code (`"C024"`) — a router with advanced networking features |
| HGW | Constant | Home gateway service code (`"C025"`) — a residential gateway device for broadband access |
| NEWPCRS | Constant | New service cost application flag (`"1"`) — indicates "use from new service" cost timing |
| CD_DIV_UM_ARI | Constant | With specification division code (`"1"`) — indicates a model number is specified during registration |
| EKK1091D010 | Service component | Progress registration service — persists progress state for service orders in the KIK_T_PROGRESS table |
| EKK0081A010 | Template | Router registration template message — contains router-specific configuration data used to resolve detail numbers |
| EXEC_SHINCHOKU | Method concept | "Exec progress" — a flag indicating whether the current progress status permits execution of progress registration |
| Kiki (device) | Business term | Device — refers to customer-premises equipment such as routers, modems, and gateways in the telecom provisioning domain |
| 進捗登録 (Shinchoku Toroku) | Japanese term | Progress registration — the business operation of recording the current processing stage of an order |
| CC (Common Component) | Architecture term | Shared component — a reusable business logic class that is referenced by multiple screens and services |