# Business Logic — JKKWrisvcAutoAplyGetSvcInfoCC.editErrInfoEKK0081A010() [37 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKWrisvcAutoAplyGetSvcInfoCC` |
| Layer | CC / Common Component (business logic bridge between BPM operations and service component responses) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKWrisvcAutoAplyGetSvcInfoCC.editErrInfoEKK0081A010()

This method performs **error information mapping** for the Service Contract Confirmation Agreement inquiry (サービス契約一意照会) flow within the discount service automatic application system (割引サービス自動適用). It acts as a bridge transformer: after a service component (SC `EKK0081A010`) is invoked and returns a template response carrying error status data, this method copies selected error fields from that template into the request parameter's working map, so the downstream screen layer can display meaningful error messages to the user.

The method implements a **delegation + guarded merge** pattern. It first delegates to `setControlMapErrInfo`, which resolves the final return code and associated message by comparing the template's status against the BPM layer's current status. Then, for each of the three error fields (service contract number, generation registration date/time, and reservation application date), it conditionally copies the value from the template into the inMap — but only if the template carries that error key AND the inMap does not already contain a value for it. This "write-once" guard ensures that earlier processing steps' error data is never silently overwritten by later template data.

Its role in the larger system is that of a **shared error normalization utility** called by `editRetEKK0081A010`, the broader return-processing method used across many BPM operations that invoke the `EKK0081A010` service component (e.g., service inquiry, cancellation, addition screens).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editErrInfoEKK0081A010(iparam, template, returnCode, fixedText)"])
    CALL_SET["setControlMapErrInfo(iparam,
template.getInt(EKK0081A010CBSMsg.STATUS),
returnCode)
Resolve return code & message"]
    GET_DATA["inMap = (HashMap)param.getData(fixedText)
Retrieve working map from request parameter"]
    CHECK_SVC["template.isNull(
KEY_SVC_KEI_NO_ERR)"]
    CHECK_SVC_INMAP["inMap.containsKey(
key_svc_kei_no_err)"]
    PUT_SVC["inMap.put(
key_svc_kei_no_err,
template.getString(
KEY_SVC_KEI_NO_ERR))
Copy service contract number error"]
    CHECK_GEN["template.isNull(
KEY_GENE_ADD_DTM_ERR)"]
    CHECK_GEN_INMAP["inMap.containsKey(
key_gene_add_dtm_err)"]
    PUT_GEN["inMap.put(
key_gene_add_dtm_err,
template.getString(
KEY_GENE_ADD_DTM_ERR))
Copy generation registration date/time error"]
    CHECK_RSV["template.isNull(
KEY_RSV_APLY_YMD_ERR)"]
    CHECK_RSV_INMAP["inMap.containsKey(
key_rsv_aply_ymd_err)"]
    PUT_RSV["inMap.put(
key_rsv_aply_ymd_err,
template.getString(
KEY_RSV_APLY_YMD_ERR))
Copy reservation application date error"]
    RETURN(["return param
Back to editRetEKK0081A010"])

    START --> CALL_SET
    CALL_SET --> GET_DATA
    GET_DATA --> CHECK_SVC
    CHECK_SVC -->|false| CHECK_SVC_INMAP
    CHECK_SVC_INMAP -->|false| PUT_SVC
    CHECK_SVC_INMAP -->|true| CHECK_GEN
    PUT_SVC --> CHECK_GEN
    CHECK_GEN -->|false| CHECK_GEN_INMAP
    CHECK_GEN_INMAP -->|false| PUT_GEN
    CHECK_GEN_INMAP -->|true| CHECK_RSV
    PUT_GEN --> CHECK_RSV
    CHECK_RSV -->|false| CHECK_RSV_INMAP
    CHECK_RSV_INMAP -->|false| PUT_RSV
    CHECK_RSV_INMAP -->|true| RETURN
    PUT_RSV --> RETURN
```

**CRITICAL — Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|-----------------|
| `EKK0081A010CBSMsg.STATUS` | (template message key) | Service response status code returned by the `EKK0081A010` service component |
| `EKK0081A010CBSMsg.KEY_SVC_KEI_NO_ERR` | (template message key) | Error flag for service contract number (サービス契約番号) |
| `EKK0081A010CBSMsg.KEY_GENE_ADD_DTM_ERR` | (template message key) | Error flag for generation registration date/time (世代登録年月日) |
| `EKK0081A010CBSMsg.KEY_RSV_APLY_YMD_ERR` | (template message key) | Error flag for reservation application date (予約適用年月日) |

These message key constants originate from the `EKK0081A010CBSMsg` class (package: `eo.ejb.cbs.cbsmsg`), which defines the schema of the `EKK0081A010` service component's return message.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `iparam` | `IRequestParameterReadWrite` | The request parameter object carrying the entire request context for the BPM operation. It holds control map data (return codes, messages) and named working maps (identified by `fixedText`). This method reads from and writes into `iparam` via `setControlMapErrInfo` and the `inMap` HashMap extracted from it. |
| 2 | `template` | `CAANMsg` | The template response list returned by the `EKK0081A010` service component. It carries error status codes, error flags, and error text for the service contract inquiry. The method reads `STATUS`, `KEY_SVC_KEI_NO_ERR`, `KEY_GENE_ADD_DTM_ERR`, and `KEY_RSV_APLY_YMD_ERR` from this template. |
| 3 | `returnCode` | `int` | The raw return code from the preceding service component call. Used by `setControlMapErrInfo` to determine the final effective status — if non-zero, it overrides the template's status to 9000 (indicating a general service component error). |
| 4 | `fixedText` | `String` | The service message key / fixed text identifier (e.g., `"EKK0081A010"`). Used as the map key to extract the correct working `HashMap` from `iparam` where error data is accumulated. In business terms, it identifies which logical data region within the request parameter to operate on. |

**External state / instance fields read:** None directly. All external state is accessed through the `setControlMapErrInfo` private method or through the method parameters.

**Constants referenced:**
| Constant | Value | Usage |
|----------|-------|-------|
| `RETURN_MESSAGE_STRING` | `"RETURN_MESSAGE_"` | Used internally by `setControlMapErrInfo` to build message lookup keys |
| `RETURN_MESSAGE_FORMAT` | `"%1$04d"` | Used internally by `setControlMapErrInfo` to format status codes as 4-digit zero-padded strings |
| `SCControlMapKeys.RETURN_CODE` | (constant from `com.fujitsu.futurity.common.x01.sc`) | Key for return code in the control map |
| `SCControlMapKeys.RETURN_MESSAGE` | (constant from `com.fujitsu.futurity.common.x01.sc`) | Key for return message in the control map |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKWrisvcAutoAplyGetSvcInfoCC.setControlMapErrInfo` | EKK0081A010 | - | Internal delegation — resolves the final return code and message by comparing the template's status against the BPM's current status. If template status > BPM status, sets the control map return code and message. |
| R | `CAANMsg.getInt(EKK0081A010CBSMsg.STATUS)` | EKK0081A010 | - | Reads the status code integer from the EKK0081A010 service response template. |
| R | `CAANMsg.isNull(EKK0081A010CBSMsg.KEY_SVC_KEI_NO_ERR)` | EKK0081A010 | - | Checks whether the template carries an error value for the service contract number field. |
| R | `CAANMsg.getString(EKK0081A010CBSMsg.KEY_SVC_KEI_NO_ERR)` | EKK0081A010 | - | Reads the actual error text for the service contract number from the template. |
| R | `CAANMsg.isNull(EKK0081A010CBSMsg.KEY_GENE_ADD_DTM_ERR)` | EKK0081A010 | - | Checks whether the template carries an error value for the generation registration date/time field. |
| R | `CAANMsg.getString(EKK0081A010CBSMsg.KEY_GENE_ADD_DTM_ERR)` | EKK0081A010 | - | Reads the actual error text for the generation registration date/time from the template. |
| R | `CAANMsg.isNull(EKK0081A010CBSMsg.KEY_RSV_APLY_YMD_ERR)` | EKK0081A010 | - | Checks whether the template carries an error value for the reservation application date field. |
| R | `CAANMsg.getString(EKK0081A010CBSMsg.KEY_RSV_APLY_YMD_ERR)` | EKK0081A010 | - | Reads the actual error text for the reservation application date from the template. |
| R | `IRequestParameterReadWrite.getData(fixedText)` | EKK0081A010 | - | Retrieves the working HashMap from the request parameter identified by the fixedText key. |

**How to classify:** All operations in this method are **Read (R)** — they extract values from the template or request parameter and write them into a local HashMap. No database access or service component invocation occurs directly within this method; the actual data retrieval was performed by the `EKK0081A010` service component in a prior call. The `setControlMapErrInfo` call is an internal processing step that does not access external resources.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC: `editRetEKK0081A010` (JKKWrisvcAutoAplyGetSvcInfoCC) | `editRetEKK0081A010(result, param, fixedText, ...)` -> `editErrInfoEKK0081A010(iparam, template, returnCode, fixedText)` | `setControlMapErrInfo [-]`, `getString [R] x3`, `isNull [R] x3` |
| 2 | Screen:KKSV0001 (example) | `KKSV0001OPOperation` -> SC call -> `EKK0081A010` -> `editRetEKK0081A010` -> `editErrInfoEKK0081A010` | `getString [R]`, `isNull [R]` |
| 3 | Screen:KKSV0024 (example) | `KKSV0024OPOperation` -> SC call -> `EKK0081A010` -> `editRetEKK0081A010` -> `editErrInfoEKK0081A010` | `getString [R]`, `isNull [R]` |
| 4 | Screen:KKSV0036 (example) | `KKSV0036OPOperation` -> SC call -> `EKK0081A010` -> `editRetEKK0081A010` -> `editErrInfoEKK0081A010` | `getString [R]`, `isNull [R]` |
| 5 | Screen:KKSV0051 (example) | `KKSV0051OPOperation` -> SC call -> `EKK0081A010` -> `editRetEKK0081A010` -> `editErrInfoEKK0081A010` | `getString [R]`, `isNull [R]` |
| 6 | Screen:KKSV0059 (example) | `KKSV0059OPOperation` -> SC call -> `EKK0081A010` -> `editRetEKK0081A010` -> `editErrInfoEKK0081A010` | `getString [R]`, `isNull [R]` |
| 7 | Screen:KKSV0148 (example) | `KKSV0148OPOperation` -> SC call -> `EKK0081A010` -> `editRetEKK0081A010` -> `editErrInfoEKK0081A010` | `getString [R]`, `isNull [R]` |
| 8 | Screen:KKSV0202 (example) | `KKSV0202OPOperation` -> SC call -> `EKK0081A010` -> `editRetEKK0081A010` -> `editErrInfoEKK0081A010` | `getString [R]`, `isNull [R]` |

**Note:** The direct caller of `editErrInfoEKK0081A010` is the sibling method `editRetEKK0081A010` within `JKKWrisvcAutoAplyGetSvcInfoCC`. This `editRetEKK0081A010` method is itself widely reused across many BPM operation classes (see pre-computed callers), each of which is typically triggered by a screen operation (`KKSVxxxx`).

**Terminal operations from this method:** `getString` [R] x3, `isNull` [R] x3, `setControlMapErrInfo` [-], `getData` [R] — all terminal operations read from the `EKK0081A010` service response template or the request parameter; no writes to external resources occur.

## 6. Per-Branch Detail Blocks

**Block 1** — [CALL] `setControlMapErrInfo` (L688)

Calls the internal method to resolve the final return code and status message. This method delegates the error status logic: it compares the template's status (from `EKK0081A010CBSMsg.STATUS`) against the BPM layer's current return code, and if the template's status is higher, it sets the control map with the template's status and a formatted message.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setControlMapErrInfo(iparam, template.getInt(EKK0081A010CBSMsg.STATUS), returnCode)` // Resolves return code and message into iparam control map |

**Block 2** — [SET] Extract working map (L690)

Retrieves the working HashMap from the request parameter using the `fixedText` key. This map is the shared working area where error data is accumulated for the screen layer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap = (HashMap)param.getData(fixedText)` // Extract working map [-> fixedText identifies the data region] |

**Block 3** — [IF] Service contract number error check (L693-698)

> サーチ契約一意照会.K-OPTサービス契約番号 → K-OPTサービス契約番号のエラー情報返却 (Service Contract Confirmation — return error info for K-Opt service contract number)

Checks if the template carries an error value for the service contract number field. If yes, and if the working map does not already have a value for `key_svc_kei_no_err`, copies the template's error value into the map. This "write-once" guard prevents overwriting any previously set error value.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `!template.isNull(EKK0081A010CBSMsg.KEY_SVC_KEI_NO_ERR)` // Template has service contract number error |
| 2 | IF [nested] | `!inMap.containsKey("key_svc_kei_no_err")` // Map does not yet have this key |
| 3 | SET | `inMap.put("key_svc_kei_no_err", template.getString(EKK0081A010CBSMsg.KEY_SVC_KEI_NO_ERR))` // Copy error value |

**Block 4** — [IF] Generation registration date/time error check (L700-705)

> サーチ契約一意照会.K-OPT世代登録年月日 → K-OPT世代登録年月日のエラー情報返却 (Service Contract Confirmation — return error info for K-Opt generation registration date/time)

Checks if the template carries an error value for the generation registration date/time field. If yes, and if the working map does not already have a value for `key_gene_add_dtm_err`, copies the template's error value into the map.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `!template.isNull(EKK0081A010CBSMsg.KEY_GENE_ADD_DTM_ERR)` // Template has generation registration date/time error |
| 2 | IF [nested] | `!inMap.containsKey("key_gene_add_dtm_err")` // Map does not yet have this key |
| 3 | SET | `inMap.put("key_gene_add_dtm_err", template.getString(EKK0081A010CBSMsg.KEY_GENE_ADD_DTM_ERR))` // Copy error value |

**Block 5** — [IF] Reservation application date error check (L707-712)

> サーチ契約一意照会.K-OPT予約適用年月日 → K-OPT予約適用年月日のエラー情報返却 (Service Contract Confirmation — return error info for K-Opt reservation application date)

Checks if the template carries an error value for the reservation application date field. If yes, and if the working map does not already have a value for `key_rsv_aply_ymd_err`, copies the template's error value into the map.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `!template.isNull(EKK0081A010CBSMsg.KEY_RSV_APLY_YMD_ERR)` // Template has reservation application date error |
| 2 | IF [nested] | `!inMap.containsKey("key_rsv_aply_ymd_err")` // Map does not yet have this key |
| 3 | SET | `inMap.put("key_rsv_aply_ymd_err", template.getString(EKK0081A010CBSMsg.KEY_RSV_APLY_YMD_ERR))` // Copy error value |

**Block 6** — [RETURN] Return processed parameter (L715)

Returns the fully processed `param` object back to the caller (`editRetEKK0081A010`), now containing both the resolved return code/message (from `setControlMapErrInfo`) and the accumulated error field values (from the three conditional copies above).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` // Return to editRetEKK0081A010 |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the unique identifier for a service contract line item within the K-Opt system |
| `svc_kei_no_err` | Field | Service contract number error — error message for the service contract number field, returned by the EKK0081A010 SC |
| `key_svc_kei_no_err` | Field | Internal map key for the service contract number error value within the working HashMap |
| `gene_add_dtm` | Field | Generation registration date/time (世代登録年月日) — the timestamp when a service contract generation was registered |
| `key_gene_add_dtm_err` | Field | Internal map key for the generation registration date/time error value |
| `rsv_aply_ymd` | Field | Reservation application date (予約適用年月日) — the date when a reservation service application is effective |
| `key_rsv_aply_ymd_err` | Field | Internal map key for the reservation application date error value |
| `EKK0081A010` | SC Code | Service Component for Service Contract Confirmation Agreement inquiry — queries service contract details and returns status/error data |
| `CAANMsg` | Type | Fujitsu's message/template class used to pass structured data between layers; supports `isNull`, `getString`, `getInt` accessors |
| `IRequestParameterReadWrite` | Type | Request parameter interface that holds control map data (return codes, messages) and named working maps for BPM operations |
| `fixedText` | Field | Service message identifier — used as the key to extract the correct working map from the request parameter |
| `setControlMapErrInfo` | Method | Internal helper that resolves the final return code and message by comparing template status against BPM status |
| K-Opt | Business term | K-Opticom — a Japanese telecom service provider; the system manages subscriber service contracts |
| SC | Acronym | Service Component — a reusable business logic module in the Fujitsu Futurity framework that executes a specific operation |
| BPM | Acronym | Business Process Management — the workflow orchestration layer that coordinates screens, service components, and data processing |
| STATUS | Constant | Template message key for the service response status code (integer) returned by EKK0081A010 |
| KEY_SVC_KEI_NO_ERR | Constant | Template message key for the service contract number error field |
| KEY_GENE_ADD_DTM_ERR | Constant | Template message key for the generation registration date/time error field |
| KEY_RSV_APLY_YMD_ERR | Constant | Template message key for the reservation application date error field |
| `RETURN_MESSAGE_STRING` | Constant | String prefix `"RETURN_MESSAGE_"` used to build message lookup keys for return codes |
| `RETURN_MESSAGE_FORMAT` | Constant | Format string `"%1$04d"` used to format status codes as 4-digit zero-padded strings |
| `SCControlMapKeys.RETURN_CODE` | Constant | Key name for the return code in the request parameter's control map |
| `SCControlMapKeys.RETURN_MESSAGE` | Constant | Key name for the return message in the request parameter's control map |
