# (DD24) Business Logic — JFUSvcOrderAddCC.setInMapOdrSetChg() [25 LOC]

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

## 1. Role

### JFUSvcOrderAddCC.setInMapOdrSetChg()

This method performs the **upstream mapping (上りマッピング処理) for order setting information changes** (オーダ設定情報変更) within the service order addition workflow. It acts as a data preparation bridge that copies existing order setting data into a request parameter map and enriches it with metadata required by the downstream service component (EKK1041C010CBS), which handles the actual order setting update via a service interface call.

The method handles two distinct business scenarios based on the `yokyuSbtCd` (request type code) value: when the code is `"08"` (CD00317_08 — **Cancellation / 消去**), it additionally populates two SOD (Service Order Data) transmission date fields (`stp_sod_send_ymd` and `del_sod_send_ymd`) with the current operation date, ensuring that the downstream CBS knows the exact date the SOD should be stopped or removed. For all other request types (e.g., `"04"` — Modification / 変更), the method only performs the basic mapping without SOD date adjustments.

The method implements a **data enrichment and routing pattern**: it first copies all existing order setting fields verbatim from the incoming map to the output map (preserving original data), then injects derived values (most recent request type code, previous update timestamp, and conditionally SOD dates) that the service component needs to properly execute the order setting update. It is a private utility method called from the main `addMladSvcOrder` entry point, specifically within the order setting update branch where existing order records are found (non-empty `odrSetList`).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setInMapOdrSetChg called"])
    STEP1["setFuncCode - Set function code to FUNC_CD 1"]
    STEP2["Get inMap from param.getData"]
    STEP3["copyProperties - Copy inMap to odrSetMap"]
    STEP4["Put RCNT_YOKYU_SBT_CD into inMap"]
    STEP5["Put UPD_DTM_BF into inMap"]
    COND{yokyuSbtCd equals 08?}
    STEP7["Put STP_SOD_SEND_YMD"]
    STEP8["Put DEL_SOD_SEND_YMD"]
    END_NODE(["Return - Processing complete"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> COND
    COND -- Yes --> STEP7
    STEP7 --> STEP8
    COND -- No --> END_NODE
    STEP8 --> END_NODE
```

**Processing flow:**

1. **setFuncCode** — Sets the function code to `FUNC_CD_1` for audit trail and access control.
2. **getData** — Retrieves the current request parameter data map keyed by `fixedText` (service message key).
3. **copyProperties** — Copies all key-value pairs from `inMap` (the source request data) into `odrSetMap` (the existing order setting record), effectively merging the new input data with the existing order setting values.
4. **RCNT_YOKYU_SBT_CD** — Stores the most recent request type code into `inMap` so the downstream CBS can track what type of operation is being performed.
5. **UPD_DTM_BF** — Retrieves the previous update datetime (`upd_dtm`) from `odrSetMap` and stores it as `upd_dtm_bf` (update datetime before) in `inMap`, enabling the CBS to detect if the record was modified by another user (optimistic locking).
6. **Conditional Branch (CD00317_08 = "08")** — If the request type code indicates cancellation (消去):
   - **STP_SOD_SEND_YMD** — Sets the SOD stop transmission date to the current operation date (via `JCCBPCommon.getOpeDate(null)`), telling downstream systems to halt SOD (Service Order Data) transmissions.
   - **DEL_SOD_SEND_YMD** — Sets the SOD delete transmission date to the current operation date, instructing downstream systems to remove associated SOD records.
7. **Return** — Method completes. The enriched `inMap` is used by the caller (`addMladSvcOrder`) to execute the service interface (`executeSC`).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Request parameter container that carries data between processing stages. Holds the mapped output data via `setData` and provides access to the request data map via `getData(fixedText)`. It is the primary data exchange vehicle between the mapping layer and the service interface layer. |
| 2 | `fixedText` | `String` | Service message key — acts as a namespace/dictionary key to identify which data section within the request parameter to read and write. It corresponds to the template identifier used in the broader order addition workflow (e.g., `TEMPLATE_ID_6` context). |
| 3 | `yokyuSbtCd` | `String` | Request type code (要求種別コード) — classifies the operation being performed. Key values: `"08"` (CD00317_08) for cancellation (消去), `"04"` (CD00317_04) for modification (変更). This code determines whether SOD stop/delete dates are populated. Set by the caller based on `ACTION_NAME_UPDATE` flag. |
| 4 | `odrSetMap` | `HashMap` | Order setting map (オーダ設定マップ) — contains existing order setting data retrieved from the service component's search query (EKK1041B001CBS). Provides the previous update datetime (`upd_dtm`) used for optimistic concurrency control and holds the original order setting values that are merged into the output map via `copyProperties`. |

**External state accessed:**
- `JCCBPCommon.getOpeDate(null)` — Retrieves the current system operation date (used for SOD stop/delete date fields in cancellation scenario).

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCBPCommon.getOpeDate` | — | — | Calls `getOpeDate` to retrieve the current operation date. Used when `yokyuSbtCd` is `"08"` (cancellation) to populate SOD stop/delete transmission dates. |
| R | `EKK1041B001CBSMsg1List.UPD_DTM` | — | — | Reads `upd_dtm` (update datetime) from `odrSetMap`. Represents the previous update timestamp of the order setting record, used for optimistic concurrency detection. |
| - | `JFUBaseCC.setFuncCode` | — | — | Sets the function code (`FUNC_CD_1`) in the request parameter for audit trail and authorization. |
| - | `JFUBaseCC.copyProperties` | — | — | Copies all properties from `inMap` (source request data) to `odrSetMap` (target order setting data), merging the data layers. |
| - | `IRequestParameterReadWrite.getData` | — | — | Retrieves the data map associated with `fixedText` from the request parameter container. Returns the map containing template data for the current service message context. |

**Notes on SC Code:** No direct SC (Service Component) method is called within this method. The SC call (`executeSC`) is performed by the caller (`addMladSvcOrder`) after this mapping method returns. The CBS message constants referenced (EKK1041C010CBSMsg, EKK1041B001CBSMsg1List) correspond to the service interface `EKK1041C010CBS` which handles order setting updates.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0275 | `KKSV0275OPOperation.execute` -> `JFUSvcOrderAddCC.addMladSvcOrder` -> conditional branch (order setting update) -> `setInMapOdrSetChg` | `executeSC(EKK1041C010CBS) [U] KK_T_ODR_SET` |

**Caller details:**
- The only direct caller is `addMladSvcOrder` within the same class `JFUSvcOrderAddCC`.
- `addMladSvcOrder` is invoked by Screen KKSV0275 (Mail Address Service Order Registration screen) during the order setting update workflow.
- The method is called only when an existing order setting record is found (`odrSetList.size() > 0`) and the action name indicates an update (as opposed to initial registration).

**Terminal operations from this method:**
- `getOpeDate` [R] — Current operation date retrieval (JCCBPCommon)
- `copyProperties` [-] — Property copy (JFUBaseCC)
- `setFuncCode` [-] — Function code setting (JFUBaseCC)
- `getData` [R] — Data map retrieval from param (IRequestParameterReadWrite)
- No direct SC/CBS invocation — the service interface call is deferred to the caller's subsequent `executeSC` call.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET/FUNCTION CALL] `(setup and initial mapping)` (L1099)

> Sets the function code and retrieves the request data map for processing. Prepares the foundation for merging order setting data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setFuncCode(param, fixedText, JPCModelConstant.FUNC_CD_1)` // Set function code for audit trail [-> JPCModelConstant.FUNC_CD_1 = "1"] |
| 2 | CALL | `inMap = param.getData(fixedText)` // Get request data map keyed by service message identifier |

**Block 2** — [EXEC] `(copyProperties data merge)` (L1108)

> Copies all fields from the incoming request data map (`inMap`) to the existing order setting map (`odrSetMap`). This is a deep merge that preserves existing order setting fields not present in the new input.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.copyProperties(inMap, odrSetMap)` // Transfer source request data to target order setting map |

**Block 3** — [SET] `(inject request type code)` (L1111)

> Stores the most recent request type code into the output map so the downstream CBS can identify the operation type being performed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1041C010CBSMsg.RCNT_YOKYU_SBT_CD, yokyuSbtCd)` // Most recent request type code [-> EKK1041C010CBSMsg.RCNT_YOKYU_SBT_CD = "rcnt_yokyu_sbt_cd"] |

**Block 4** — [SET] `(inject previous update datetime)` (L1113)

> Retrieves the last update datetime from the existing order setting record and stores it as a "before update" snapshot. This enables the CBS to perform optimistic concurrency control — if the stored "before" datetime does not match the current database value, the update will detect a conflicting modification.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1041C010CBSMsg.UPD_DTM_BF, odrSetMap.get(EKK1041B001CBSMsg1List.UPD_DTM))` // Previous update datetime [-> EKK1041C010CBSMsg.UPD_DTM_BF = "upd_dtm_bf", -> EKK1041B001CBSMsg1List.UPD_DTM = "upd_dtm"] |

**Block 5** — [IF] `(yokyuSbtCd equals "08" — Cancellation / 消去)` (L1115)

> When the request type code is `"08"` (CD00317_08), indicating a cancellation operation, this block sets the SOD (Service Order Data) stop and delete transmission dates to the current operation date. This ensures downstream SOD processing systems are notified to halt and remove SOD records associated with the cancelled order setting.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap.put(EKK1041C010CBSMsg.STP_SOD_SEND_YMD, JCCBPCommon.getOpeDate(null))` // SOD stop transmission date [-> EKK1041C010CBSMsg.STP_SOD_SEND_YMD = "stp_sod_send_ymd"] |
| 2 | SET | `inMap.put(EKK1041C010CBSMsg.DEL_SOD_SEND_YMD, JCCBPCommon.getOpeDate(null))` // SOD delete transmission date [-> EKK1041C010CBSMsg.DEL_SOD_SEND_YMD = "del_sod_send_ymd"] |

**Block 5.1** — [ELSE] `(yokyuSbtCd not "08" — Modification / 変更)` (L1120)

> When the request type code is NOT `"08"` (e.g., `"04"` for modification), the method completes without setting SOD dates. The order setting is modified but SOD transmission is not halted or deleted.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return` // Method exits — SOD dates remain unset |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `yokyuSbtCd` | Field | Request type code (要求種別コード) — classifies the type of request operation. `"08"` = cancellation (消去), `"04"` = modification (変更) |
| `fixedText` | Field | Service message identifier — acts as a key to access the correct data section within the request parameter container |
| `odrSetMap` | Field | Order setting map (オーダ設定マップ) — data structure containing existing order setting record values retrieved from the database via service component search |
| `inMap` | Field | Internal request data map — temporary working map holding data being prepared for the service interface call |
| RCNT_YOKYU_SBT_CD | Field | Most recent request type code (最新要求種別コード) — field key for tracking the latest request operation type sent to the CBS |
| UPD_DTM_BF | Field | Update datetime before (更新年月日時分秒(更新前)) — snapshot of the record's last update time before this change, used for optimistic concurrency control |
| UPD_DTM | Field | Update datetime (更新年月日時分秒) — current last-update timestamp stored on the order setting record in the database |
| STP_SOD_SEND_YMD | Field | SOD stop transmission date (停止SOD送信年月日) — date on which SOD (Service Order Data) transmissions should be halted for this order |
| DEL_SOD_SEND_YMD | Field | SOD delete transmission date (削除SOD送信年月日) — date on which SOD records should be deleted from downstream systems |
| SOD | Acronym | Service Order Data — inter-system data exchanged between Fujitsu's KPT (Keihan Telecom) operations support system and external partner/service provider systems |
| CBS | Acronym | Central Business System — the core telecom billing and order management backend system |
| SC | Acronym | Service Component — a client-side proxy class that invokes remote CBS service methods via the service interface layer |
| FUNC_CD_1 | Constant | Function code 1 — typically indicates a data registration/update function (as opposed to FUNC_CD_2 for inquiry/check-only) |
| JCCBPCommon | Class | Common utility class providing cross-module shared methods including `getOpeDate` (operation date retrieval) |
| JFUStrConst.CD00317_08 | Constant | Value `"08"` — cancellation request type code (消去) |
| JFUStrConst.CD00317_04 | Constant | Value `"04"` — modification request type code (変更) |
| JFUSvcOrderAddCC | Class | Service Order Addition Common Component — handles mapping and data preparation for mail address service order registration |
| `addMladSvcOrder` | Method | Mail address service order registration processing — the public entry point that orchestrates the full order setting workflow |
| KKSV0275 | Screen | Mail Address Service Order Registration screen — the web screen that triggers the order setting addition workflow |
| ACTION_NAME_UPDATE | Constant | Action name constant indicating an update operation (as opposed to initial registration) |
| upstream mapping (上りマッピング処理) | Process | Data preparation phase where business layer data is transformed and enriched into the format expected by the service interface layer |
| optimistic concurrency | Concept | A conflict detection mechanism using a version/timestamp field (upd_dtm) to detect if a record was modified by another user since it was read |