# Business Logic — JFUDslOpSvcKeiCC.setInMapPrgAdd() [46 LOC]

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

## 1. Role

### JFUDslOpSvcKeiCC.setInMapPrgAdd()

This method populates a **progress registration** (progress state) data map for an **optional service contract/termination** line item. It is part of the DSL (Domain Specification Language) optional service ordering pipeline, specifically handling the "progress register" (shincho toroku) phase where the system records the current processing state of a service contract change.

The method implements a **data assembly** pattern: it extracts existing template data, derives a discrepancy classification (ido-bun) based on the optional service contract status, and populates a flat "header" map with all contract identifiers (request contract number, service contract number, service detail number, option service contract number), timestamps, progress status codes, and nested discrepancy reason details.

Its role in the larger system is a **shared data transformer** called by `dslOpSvcKei()` during the optional service consent processing flow. It is NOT a screen entry point — it is a private utility that prepares the `inMap` (a template data structure) for later persistence by the CBS (Component-Based Service) layer.

The method has **no conditional branches** of its own — it unconditionally assembles data. However, it delegates to `getIdoDiv()` which contains a branching decision that determines the discrepancy classification code ("00055" for option cancellation vs "00031" for option setup).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setInMapPrgAdd params"])

    START --> A["UserDataFetch"]
    A --> B["InMapCast"]

    B --> C["TemplateNoCalc"]

    C --> D["IdoDivFetch"]
    D --> E["IdoDivCheck"]

    E -->|"Yes CD00037 = 030"| E1["Set IDO DIV 00055"]
    E -->|"No else"| E2["Set IDO DIV 00031"]

    E1 --> F["TemplateListCall"]
    E2 --> F

    F --> G["MskmNaiyoMapGet"]

    G --> H["PutMSKM_DTL_NO"]
    H --> I["PutSEIKY_KEI_NO"]
    I --> J["PutSVC_KEI_NO"]
    J --> K["PutSVC_KEI_UCWK_NO"]
    K --> L["PutOP_SVC_KEI_NO"]
    L --> M["PutIDO_DIV"]
    M --> N["PutIDO_DTM"]
    N --> O["PutPRG_STAT"]
    O --> P["PutPRG_TKJK_1"]

    P --> Q["ChildMapInit"]
    Q --> R["PutIDO_RSN_CD"]
    R --> S["PutIDO_RSN_MEMO"]
    S --> T["InListAdd"]
    T --> U["PutTemplateDetail"]
    U --> END(["Return"])
```

**Constant Resolutions used in this method:**

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `JFUStrConst.CD00037_030` | `"030"` | Option service contract status — Terminated (completed) |
| `JFUStrConst.CD00576_00055` | `"00055"` | Discrepancy classification — Option cancellation (option预订 cancel) |
| `JFUStrConst.CD00576_00031` | `"00031"` | Discrepancy classification — Option setup (option registration) |
| `JFUStrConst.CD00647_5102` | `"5102"` | Progress status code — Progress registration state |
| `JFUStrConst.CD00846_56` | `"56"` | Discrepancy reason code — System-generated reason code |
| `CC_SEIKY_KEI_NO` | `"cc_seiky_kei_no"` | Request contract number field key |
| `CC_SVC_KEI_NO` | `"cc_svc_kei_no"` | Service contract number field key |
| `CC_SVC_KEI_UCWK_NO` | `"cc_svc_kei_ucwk_no"` | Service contract detail number field key |
| `CC_OP_SVC_KEI_NO` | `"cc_op_svc_kei_no"` | Option service contract number field key |
| `CC_PRG_TKJK_1` | `"cc_prg_tkjk_1"` | Progress special item 1 field key |
| `CC_OP_SVC_KEI_STAT` | `"cc_op_svc_kei_stat"` | Option service contract status field key |
| `TEMP_TEMPLATE_KEY_MSKM_NAIYO_SHONIN_ADD` | `template key prefix` | SC execution result fetch key (approval details) |
| `TEMPLATE_ID_DETAIL_PRG_ADD` | `EKK1091D010CBSMsg1List` | Template detail key for progress registration |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying all data from the calling screen/flow. It holds the raw template data map under the `fixedText` key, which contains upstream contract identifiers (request contract number, service contract number, etc.) that this method reads and propagates downstream. |
| 2 | `fixedText` | `String` | The service message key (used as a template data map key). It identifies which data section within `param` to read from. Acts as a namespace or message-type discriminator in the multi-message protocol. |
| 3 | `opSvcKeiDslMap` | `HashMap` | The optional service contract/termination information map. Contains the current optional service line item's data including the contract status (`CC_OP_SVC_KEI_STAT`), contract number (`CC_OP_SVC_KEI_NO`), and service detail number (`CC_SVC_KEI_UCWK_NO`). Drives the discrepancy classification decision. |
| 4 | `index` | `int` | The optional service contract processing target index. Used to compute the template number (`index + 1`) for fetching the corresponding template entry when reading approval details. Each optional service line item has its own index-based template slot. |

**Instance fields / external state read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `CC_SEIKY_KEI_NO` | `String` (static final) | Local constant: `"cc_seiky_kei_no"` — key for request contract number |
| `CC_SVC_KEI_NO` | `String` (static final) | Local constant: `"cc_svc_kei_no"` — key for service contract number |
| `CC_SVC_KEI_UCWK_NO` | `String` (static final) | Local constant: `"cc_svc_kei_ucwk_no"` — key for service contract detail number |
| `CC_OP_SVC_KEI_NO` | `String` (static final) | Local constant: `"cc_op_svc_kei_no"` — key for option service contract number |
| `CC_PRG_TKJK_1` | `String` (static final) | Local constant: `"cc_prg_tkjk_1"` — key for progress special item 1 |
| `CC_OP_SVC_KEI_STAT` | `String` (static final) | Local constant: `"cc_op_svc_kei_stat"` — key for option service contract status |
| `TEMP_TEMPLATE_KEY_MSKM_NAIYO_SHONIN_ADD` | `String` (static final) | Local constant: SC execution result fetch key for approval details |
| `TEMPLATE_ID_DETAIL_PRG_ADD` | `String` (static final) | Local constant: template detail key for progress registration (aliases `EKK1091D010CBSMSG1LIST`) |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JFUDslOpSvcKeiCC.getIdoDiv` | - | - | Reads `CC_OP_SVC_KEI_STAT` from `opSvcKeiDslMap` to determine discrepancy classification |
| R | `JFUBPCommon.getSysDateTimeStamp` | JFUBPCommon | - | Gets the current system date-time stamp for the discrepancy date-time field (`IDO_DTM`) |
| R | `JFUBPCommon.getTemplateList` | JFUBPCommon | - | Retrieves the approval details template list for the current template number from the data map |

**Detailed analysis of method calls within `setInMapPrgAdd`:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `param.getData(fixedText)` | - | - | Reads the template data map from the request parameter object using the `fixedText` key |
| R | `JFUDslOpSvcKeiCC.getIdoDiv(opSvcKeiDslMap)` | - | - | Determines discrepancy classification ("00055" = option cancel, "00031" = option setup) based on contract status |
| R | `JFUBPCommon.getTemplateList(dataMap, templateKey, templateId)` | JFUBPCommon | - | Fetches the list of approval details template records for the current service line item from the data map |
| R | `JFUBPCommon.getSysDateTimeStamp()` | JFUBPCommon | - | Retrieves the current system date-time stamp for the discrepancy date-time field |

**Note:** This method performs **no direct database operations** (no C/R/U/D on entities). It is a pure data assembly/presentation layer method that populates in-memory `HashMap` structures. The data it prepares is later persisted by the caller (`dslOpSvcKei()`) which invokes the actual CBS execution. The `getSysDateTimeStamp` call is a utility for timestamp generation; the actual DB write is deferred to the CBS layer (SC code `EKK1091D010SC` — inferred from the message class `EKK1091D010CBSMsg` which is the data transfer object for that SC).

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `getSysDateTimeStamp` [R], `getTemplateList` [R], `getIdoDiv` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: `JFUDslOpSvcKeiCC` | `dslOpSvcKei()` → `setInMapPrgAdd(param, fixedText, opSvcKeiDslMap, index)` | `getSysDateTimeStamp` [R] (timestamp), `getTemplateList` [R] (approval details), `getIdoDiv` [R] (discrepancy classification) |

**Call chain detail:** The method `dslOpSvcKei()` (also in `JFUDslOpSvcKeiCC`) calls `setInMapPrgAdd` as part of the optional service consent processing flow. The `dslOpSvcKei()` method is itself likely invoked by a CBS or screen handler for optional service DSL processing. The terminal operations from `setInMapPrgAdd` are all read-only utility calls — no database writes, no service component invocations that persist data.

## 6. Per-Branch Detail Blocks

### Block 1 — EXEC (UserDataFetch) (L555)

> Fetch the template data map from the request parameter object and cast to HashMap.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `HashMap inMap = (HashMap) param.getData(fixedText)` // ユーザーデータ取得 (Fetch user data) |

### Block 2 — SET (TemplateNoCalc) (L557)

> Compute the template number by adding 1 to the zero-based index. Each optional service line item gets its own template slot.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int templateNo = index + 1` // Compute template number from zero-based index |

### Block 3 — EXEC (IdoDivFetch) (L559)

> Delegate to `getIdoDiv()` to determine the discrepancy classification (ido-bun) based on the optional service contract status. The called method branches internally on whether the contract status is `"030"` (terminated).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `String idoDiv = getIdoDiv(opSvcKeiDslMap)` // 異動区分を取得 (Fetch discrepancy classification) |

**Block 3.1** — nested in `getIdoDiv()`: [IF] `CC_OP_SVC_KEI_STAT = "030"` (L718)

> When the option service contract status is `"030"` (Terminated), set discrepancy classification to `"00055"` (Option cancellation). Otherwise, set it to `"00031"` (Option setup).

| # | Type | Code |
|---|------|------|
| 1 | IF | `JFUStrConst.CD00037_030.equals(opSvcKeiDslMap.get(CC_OP_SVC_KEI_STAT))` [CD00037_030 = "030"] (Terminated) |
| 2 | SET | `idoDiv = JFUStrConst.CD00576_00055` [CD00576_00055 = "00055"] (Option cancel) |
| 3 | ELSE | (else) |
| 4 | SET | `idoDiv = JFUStrConst.CD00576_00031` [CD00576_00031 = "00031"] (Option setup) |
| 5 | RETURN | `return idoDiv` |

### Block 4 — EXEC (TemplateListCall) (L561-563)

> Retrieve the approval details template list from the data map. The template key is constructed as `TEMP_TEMPLATE_KEY_MSKM_NAIYO_SHONIN_ADD + templateNo`, and the template detail ID is `TEMPLATE_ID_DETAIL_MSKM_NAIYO_SHONIN_ADD`. This fetches the existing approval content records for the current service line item.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `List<HashMap> mskmNaiyoList = getTemplateList((HashMap) param.getData(fixedText), TEMP_TEMPLATE_KEY_MSKM_NAIYO_SHONIN_ADD + templateNo, TEMPLATE_ID_DETAIL_MSKM_NAIYO_SHONIN_ADD)` // 申込登録明細情報取得 (Fetch registration details info) |
| 2 | SET | `HashMap mskmNaiyoMap = mskmNaiyoList.get(0)` // Get first template entry |

### Block 5 — SET (PutMSKM_DTL_NO) (L566)

> Copy the application details number (mskm_dtl_no) from the approval details template into the output map. This is the internal tracking number for the application detail line.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.MSKM_DTL_NO, mskmNaiyoMap.get(EKK0011D020CBSMsg1List.MSKM_DTL_NO))` [-> "mskm_dtl_no"] // 申込詳細番号 (Application detail number) |

### Block 6 — SET (PutSEIKY_KEI_NO) (L568)

> Copy the request contract number from the input map (stored under the local constant key `CC_SEIKY_KEI_NO`) into the output map under the CBS message key `SEIKY_KEI_NO`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.SEIKY_KEI_NO, inMap.get(CC_SEIKY_KEI_NO))` [-> "seiky_kei_no"] // 請求契約番号 (Request contract number) |

### Block 7 — SET (PutSVC_KEI_NO) (L570)

> Copy the service contract number from the input map (under `CC_SVC_KEI_NO`) into the output map under the CBS message key `SVC_KEI_NO`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.SVC_KEI_NO, inMap.get(CC_SVC_KEI_NO))` [-> "svc_kei_no"] // サービス契約番号 (Service contract number) |

### Block 8 — SET (PutSVC_KEI_UCWK_NO) (L572)

> Copy the service contract detail number from the option service DSL map (under `CC_SVC_KEI_UCWK_NO`) into the output map under the CBS message key `SVC_KEI_UCWK_NO`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.SVC_KEI_UCWK_NO, opSvcKeiDslMap.get(CC_SVC_KEI_UCWK_NO))` [-> "svc_kei_ucwk_no"] // サービス契約内訳番号 (Service contract detail number) |

### Block 9 — SET (PutOP_SVC_KEI_NO) (L574)

> Copy the option service contract number from the option service DSL map (under `CC_OP_SVC_KEI_NO`) into the output map under the CBS message key `OP_SVC_KEI_NO`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.OP_SVC_KEI_NO, opSvcKeiDslMap.get(CC_OP_SVC_KEI_NO))` [-> "op_svc_kei_no"] // オプションサービス契約番号 (Option service contract number) |

### Block 10 — SET (PutIDO_DIV) (L576)

> Set the discrepancy classification code (computed in Block 3) into the output map under the CBS message key `IDO_DIV`. This code determines how downstream systems interpret this contract change.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.IDO_DIV, idoDiv)` // 異動区分 (Discrepancy classification) |

### Block 11 — SET (PutIDO_DTM) (L578)

> Set the discrepancy date-time stamp by calling `JFUBPCommon.getSysDateTimeStamp()`. This captures the system timestamp at the moment of progress registration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.IDO_DTM, JFUBPCommon.getSysDateTimeStamp())` // 異動年月日時分秒 (Discrepancy date-time) |

### Block 12 — SET (PutPRG_STAT) (L580)

> Set the progress status code to `"5102"` (`CD00647_5102`). This code indicates the progress registration state (shincho status) of this contract line item.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.PRG_STAT, JFUStrConst.CD00647_5102)` [-> "5102"] // 進捗ステータス (Progress status) |

### Block 13 — SET (PutPRG_TKJK_1) (L582)

> Copy the progress special item 1 value from the input map (stored under `CC_PRG_TKJK_1`) into the output map under the CBS message key `PRG_TKJK_1`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1091D010CBSMsg.PRG_TKJK_1, inMap.get(CC_PRG_TKJK_1))` // 進捗特記事項1 (Progress special item 1) |

### Block 14 — EXEC (DiscrepancyReasonDetail) (L584-594)

> Build the nested discrepancy reason detail list. Create a child map with the discrepancy reason code (`"56"` = `CD00846_56`) and an empty memo, add it to a list, and put the list into the output map under the template detail key `TEMPLATE_ID_DETAIL_PRG_ADD`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `List<HashMap> inList = new ArrayList()` // 異動理由明细 (Discrepancy reason details) |
| 2 | SET | `HashMap<String, String> childMap = new HashMap()` |
| 3 | SET | `childMap.put(EKK1091D010CBSMsg1List.IDO_RSN_CD, JFUStrConst.CD00846_56)` [-> "ido_rsn_cd", CD00846_56 = "56"] // 異動理由コード (Discrepancy reason code) |
| 4 | SET | `childMap.put(EKK1091D010CBSMsg1List.IDO_RSN_MEMO, "")` [-> "ido_rsn_memo"] // 異動理由メモ (Discrepancy reason memo) |
| 5 | EXEC | `inList.add(childMap)` |
| 6 | SET | `inMap.put(TEMPLATE_ID_DETAIL_PRG_ADD, inList)` // 異動理由明细リストを設定 (Set discrepancy reason detail list) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mskm_dtl_no` | Field | Application detail number — internal tracking ID for application detail line items in the contract system |
| `seiky_kei_no` | Field | Request contract number — the billing/charge contract number associated with the customer |
| `svc_kei_no` | Field | Service contract number — the primary service contract identifier |
| `svc_kei_ucwk_no` | Field | Service contract detail number — the sub-item number within a service contract |
| `op_svc_kei_no` | Field | Option service contract number — the identifier for an optional service line item attached to a service contract |
| `cc_seiky_kei_no` | Field | Internal key for request contract number in the DSL data map |
| `cc_svc_kei_no` | Field | Internal key for service contract number in the DSL data map |
| `cc_svc_kei_ucwk_no` | Field | Internal key for service contract detail number in the DSL data map |
| `cc_op_svc_kei_no` | Field | Internal key for option service contract number in the DSL data map |
| `cc_prg_tkjk_1` | Field | Internal key for progress special item 1 in the DSL data map |
| `cc_op_svc_kei_stat` | Field | Internal key for option service contract status in the DSL data map |
| `ido_div` | Field | Discrepancy classification code — determines whether this is a new setup or a cancellation/change |
| `ido_rsn_cd` | Field | Discrepancy reason code — the coded reason for the discrepancy/change |
| `ido_rsn_memo` | Field | Discrepancy reason memo — free-text explanation for the discrepancy |
| `ido_dtm` | Field | Discrepancy date-time stamp — when the discrepancy was registered |
| `prg_stat` | Field | Progress status code — the current state of processing for this contract line item |
| `prg_tkjk_1` | Field | Progress special item 1 — an additional progress-related field |
| `cd00037_030` | Constant | `"030"` — Option service contract status code meaning "Terminated" (締結済) |
| `cd00576_00055` | Constant | `"00055"` — Discrepancy classification code meaning "Option cancel" (オプション予約取消) |
| `cd00576_00031` | Constant | `"00031"` — Discrepancy classification code meaning "Option setup" (オプション設定) |
| `cd00647_5102` | Constant | `"5102"` — Progress status code for progress registration state |
| `cd00846_56` | Constant | `"56"` — Discrepancy reason code (system-generated) |
| `EKK1091D010CBSMsg` | Class | CBS message class for discrepancy/transfer operations — defines the field keys for the progress registration data structure |
| `EKK1091D010CBSMsg1List` | Class | CBS message list class for discrepancy reason detail items (child records) |
| `dslOpSvcKei` | Method | The caller method that orchestrates the full optional service DSL processing flow |
| `getTemplateList` | Method | Utility method that extracts a list of template records from a data map by key |
| `getSysDateTimeStamp` | Method | Utility method that returns the current system date-time as a formatted string |
| `getIdoDiv` | Method | Private helper method in `JFUDslOpSvcKeiCC` that determines discrepancy classification from contract status |
| DSL | Acronym | Domain Specification Language — the framework for optional service contract processing in K-Opticom |
| CBS | Acronym | Component-Based Service — the service layer that handles business logic and data persistence |
| SC | Acronym | Service Component — the lowest-level service execution unit (SC Code pattern: `EKK####A###SC`) |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity |
| Shincho toroku | Japanese term | Progress registration — the act of recording the current processing state of a service contract line item |
| Option service | Business term | An additional/auxiliary service attached to a primary service contract (e.g., optional FTTH features, additional lines) |
| Option setup | Business term | The registration of a new optional service line item (discrepancy classification "00031") |
| Option cancel | Business term | The cancellation of an existing optional service reservation (discrepancy classification "00055") |
| Templete key | Technical term | A composite string key used to look up template data in the request parameter's data map |
