# (DD43) Business Logic — JDKCommon08CC.setExceptionErr() [49 LOC]

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

## 1. Role

### JDKCommon08CC.setExceptionErr()

This method serves as a **centralized exception error setter** within the BP (Business Process) common component framework. Its purpose is to configure error information on the request parameter object (`param`) when a service interface (SIF) call fails, so that downstream processing and screen display logic can properly report the error to the user.

The method performs three coordinated business operations: (1) it **marks the error item** on the inbound parameter map (`inMap`) by setting the error item key to `"EZ"` (an error marker code), (2) it **upgrades the return status** on `param` if the service component's template status is worse than the current business process status — implementing a **worst-status-wins** policy for error propagation, and (3) it **constructs and appends a structured error record** into an error info list maintained on `param`, which contains the service interface ID, status code, and per-item error mappings.

This method implements a **delegation and aggregation design pattern**: it does not contain business-specific logic itself, but instead assembles a generic error envelope that any caller — regardless of which screen or service component triggered it — can attach to the request context. It is a **shared utility** called by multiple controller/bulk-change classes across the system.

The method handles two distinct branches of status comparison: if the template error status (`JPCModelConstant.RELATION_ERR`) is numerically greater than the current business process return code (`bpStatus`), it overwrites both the return code and the human-readable return message on `param`. This ensures that fatal errors from service components are never silently downgraded by intermediate processing layers.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setExceptionErr params"])
    
    START --> S1["inMap.put errItem = EZ"]
    
    S1 --> S2["templateStatus = JPCModelConstant.RELATION_ERR"]
    
    S2 --> S3["bpStatus = 0; obj = param.getControlMapData RETURN_CODE"]
    
    S3 --> COND1{obj == null}
    
    COND1 -->|Yes| S4["bpStatus = -1"]
    
    COND1 -->|No| S5["bpStatus = Integer.parseInt obj"]
    
    S4 --> COND2{templateStatus > bpStatus}
    S5 --> COND2
    
    COND2 -->|Yes| S6["formatStatus = String.format %1$04d templateStatus"]
    
    S6 --> S7["message = JCMAPLConstMgr.getString RETURN_MESSAGE_ + formatStatus"]
    
    S7 --> S8["param.setControlMapData RETURN_CODE = formatStatus"]
    
    S8 --> S9["param.setControlMapData RETURN_MESSAGE = message"]
    
    S9 --> S10["errList = param.getControlMapData ERROR_INFO"]
    
    S10 --> COND3{errList == null}
    
    COND3 -->|Yes| S11["errList = new ArrayList"]
    
    COND3 -->|No| S12["errList already initialized"]
    
    S11 --> S13["errorMap = new HashMap"]
    
    S12 --> S13
    
    S13 --> S14["errorMapChild = new HashMap"]
    
    S14 --> S15["errorMap.put RETURN_CODE = JPCModelConstant.NORMAL_END"]
    
    S15 --> S16["errorMap.put TEMPLATE_ID = errIfId"]
    
    S16 --> S17["errorMap.put STATUS = JPCModelConstant.RELATION_ERR"]
    
    S17 --> S18["errorMapChild.put errItem = EZ"]
    
    S18 --> S19["errorMap.put ITEM_CHECK_ERRORS = errorMapChild"]
    
    S19 --> S20["errList.add errorMap"]
    
    S20 --> S21["param.setControlMapData ERROR_INFO = errList"]
    
    S21 --> END(["return"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object that carries control data (return codes, error info lists, return messages) between processing layers. It is the primary communication channel between controller screens and common components. |
| 2 | `inMap` | `Map<String, Object>` | The inbound parameter map that holds the error item marker. After the method executes, the key specified by `errItem` will be set to `"EZ"` in this map, flagging it as having experienced a service interface error. |
| 3 | `errIfId` | `String` | The service interface (SIF) ID identifying which service component produced the error. Example values: `"EKK0081A010"`, `"EKU0081B010"`, `"ECNA0170001"`, `"EZM0411A010"`. This is stored in the error envelope's `TEMPLATE_ID` field for traceability. |
| 4 | `errItem` | `String` | The error item key identifying which specific field or operation triggered the error. Example values: `"key_svc_kei_no_err"`, `"key_kojiak_no_err"`, `"key_sysid_err"`. Used both as the key in `inMap` and inside the nested `ITEM_CHECK_ERRORS` map. |

**External state read:**

| No | Field | Type | Business Description |
|----|-------|------|---------------------|
| 1 | `JPCModelConstant.RELATION_ERR` | `int` | Template error status constant — the severity level assigned to relation errors from service components. |
| 2 | `JPCModelConstant.NORMAL_END` | `int` | Template status constant — the status value recorded in the error envelope's `RETURN_CODE` field, indicating the error was captured by this component (not a failure of the error capture itself). |
| 3 | `SCControlMapKeys.RETURN_CODE` | `String` | Control map key for the business process return code, used to read the current status for comparison. |
| 4 | `SCControlMapKeys.RETURN_MESSAGE` | `String` | Control map key for the human-readable return message associated with the current return code. |
| 5 | `SCControlMapKeys.ERROR_INFO` | `String` | Control map key for the error info list — a running list of structured error records accumulated during request processing. |
| 6 | `ErrorInfoMapKeys.RETURN_CODE` | `String` | Key for the return code field within each error envelope map. |
| 7 | `ErrorInfoMapKeys.TEMPLATE_ID` | `String` | Key for the service interface ID field within each error envelope map. |
| 8 | `ErrorInfoMapKeys.STATUS` | `String` | Key for the status field within each error envelope map. |
| 9 | `ErrorInfoMapKeys.ITEM_CHECK_ERRORS` | `String` | Key for the nested map containing per-item error codes within each error envelope. |
| 10 | `JCMAPLConstMgr.getString()` | `String` | Method that retrieves localized messages by key (e.g., `RETURN_MESSAGE_0003`). Used to build the human-readable error message string. |

## 4. CRUD Operations / Called Services

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

No external service component (SC) or CBS (Common Business Service) calls are made by this method. All operations are in-memory data manipulations on the `param` object's control map.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Calls `getString` in `JBSbatFUCaseFileRnkData` (no direct call in this method, pre-computed context) |
| R | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Calls `getString` in `JBSbatFUMoveNaviData` (no direct call in this method, pre-computed context) |
| R | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Calls `getString` in `JBSbatZMAdDataSet` (no direct call in this method, pre-computed context) |
| R | `JESC0101B010TPMA.getString` | JESC0101B010TPMA | - | Calls `getString` in `JESC0101B010TPMA` (no direct call in this method, pre-computed context) |
| R | `JESC0101B020TPMA.getString` | JESC0101B020TPMA | - | Calls `getString` in `JESC0101B020TPMA` (no direct call in this method, pre-computed context) |

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `param.getControlMapData(SCControlMapKeys.RETURN_CODE)` | — | In-memory control map | Reads the current business process return code to determine the existing error severity level |
| R | `param.getControlMapData(SCControlMapKeys.ERROR_INFO)` | — | In-memory control map | Reads the accumulated error info list; may be null if no errors have been recorded yet |
| W | `inMap.put(errItem, "EZ")` | — | In-memory map | Marks the specified error item key with the error code `"EZ"` in the inbound parameter map |
| W | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, ...)` | — | In-memory control map | Updates the business process return code with the formatted template status (only if template status is worse) |
| W | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, ...)` | — | In-memory control map | Updates the human-readable return message on param (only if template status is worse) |
| W | `param.setControlMapData(SCControlMapKeys.ERROR_INFO, errList)` | — | In-memory control map | Replaces the error info list on param with the updated list containing the new error envelope |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 4 methods (plus inherited override usage).
Terminal operations from this method: `getControlMapData` [R], `setControlMapData` [W], `put` [W], `put` [W], `add` [W]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC:KKOpSvcHktgiUpdCC | `KKOpSvcHktgiUpdCC.executeHikiMotoKakunin` (line 1629) | `setExceptionErr` → `param.setControlMapData` [W], `param.getControlMapData` [R] |
| 2 | CC:JKKSvkeiShosaCC | `JKKSvkeiShosaCC.execute` (lines 3197-3199) | `setExceptionErr` → `param.setControlMapData` [W], `param.getControlMapData` [R] |
| 3 | CC:JKKUpdSpMskmOtherOpBaseCC | `JKKUpdSpMskmOtherOpBaseCC.execute` (lines 419, 473) | `setExceptionErr` → `param.setControlMapData` [W], `param.getControlMapData` [R] |
| 4 | CC:JFUUpdSpMskmOtherOpCC | `JFUUpdSpMskmOtherOpCC.execute` (line 176, 228, calls `super.setExceptionErr`) | `super.setExceptionErr` → `param.setControlMapData` [W], `param.getControlMapData` [R] |
| 5 | CC:JDKCommon08CC (self) | `JDKCommon08CC` lines 618, 626 (internal calls within same class) | `setExceptionErr` → `param.setControlMapData` [W], `param.getControlMapData` [R] |
| 6 | CC:JCNSV0007UpdContentCC | `JCNSV0007UpdContentCC` line 158 (overrides this method with `HashMap<String, Object>`) | `setExceptionErr` → `param.setControlMapData` [W], `param.getControlMapData` [R] |

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] `(error item marker)` (L3408)

> Sets an error marker in the inbound parameter map. The key is determined by `errItem` and the value is always `"EZ"`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `inMap.put(errItem, "EZ")` // Mark the error item key with EZ error code in inMap |

**Block 2** — [SET] `(template and BP status initialization)` (L3410)

> Initializes the template error status constant and reads the current business process return code from `param` for comparison.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templateStatus = JPCModelConstant.RELATION_ERR` // Template status constant for relation errors |
| 2 | SET | `bpStatus = 0` // Initialize BP status |
| 3 | EXEC | `obj = param.getControlMapData(SCControlMapKeys.RETURN_CODE)` // Read current return code from param |

**Block 2.1** — [IF/ELSE] `[obj == null]` (L3412-3419)

> Determines the current business process status from the control map. If no return code exists yet (null), the status is set to -1, which means the template status will always be higher and the template's error status will override it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bpStatus = -1` // No previous return code; worst possible BP status |
| 2 | SET | `bpStatus = Integer.parseInt((String)param.getControlMapData(SCControlMapKeys.RETURN_CODE))` // Parse existing return code to integer |

**Block 3** — [IF/ELSE] `[templateStatus > bpStatus]` (L3421)

> Condition: If the template error severity (`RELATION_ERR`) is greater than the current BP return code, the template's error status takes precedence. This implements a **worst-status-wins** policy — higher numeric status values indicate more severe errors, so the method propagates the worse of the two statuses to `param`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `formatStatus = String.format("%1$04d", templateStatus)` // Format status as zero-padded 4-digit string, e.g., "0003" |
| 2 | SET | `message = JCMAPLConstMgr.getString("RETURN_MESSAGE_" + formatStatus)` // Lookup localized message by formatted status key |
| 3 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_CODE, formatStatus)` // [-> SCControlMapKeys.RETURN_CODE] Update param's return code with template status |
| 4 | SET | `param.setControlMapData(SCControlMapKeys.RETURN_MESSAGE, message)` // [-> SCControlMapKeys.RETURN_MESSAGE] Update param's return message |

**Block 4** — [EXEC] `(error info list retrieval)` (L3428)

> Reads the existing error info list from `param`. This is an accumulated list of structured error records. If this is the first error being recorded, the list will be null and must be initialized.

| # | Type | Code |
|---|------|------|
| 1 | SET | `errList = (ArrayList<Object>)param.getControlMapData(SCControlMapKeys.ERROR_INFO)` // [-> SCControlMapKeys.ERROR_INFO] Retrieve accumulated error info list; may be null |
| 2 | SET | `errList = new ArrayList<Object>()` // Initialize new empty list if null (first error being recorded) |

**Block 5** — [SET] `(error envelope construction)` (L3433-3434)

> Creates the two-level error envelope structure: a parent `errorMap` containing the service interface metadata, and a child `errorMapChild` containing the per-item error codes.

| # | Type | Code |
|---|------|------|
| 1 | SET | `errorMap = new HashMap<String, Object>()` // Parent error envelope |
| 2 | SET | `errorMapChild = new HashMap<String, String>()` // Child per-item error codes map |
| 3 | SET | `errorMap.put(ErrorInfoMapKeys.RETURN_CODE, JPCModelConstant.NORMAL_END)` // [-> ErrorInfoMapKeys.RETURN_CODE] Set envelope return code to NORMAL_END (error capture itself succeeded) |
| 4 | SET | `errorMap.put(ErrorInfoMapKeys.TEMPLATE_ID, errIfId)` // [-> ErrorInfoMapKeys.TEMPLATE_ID] Store the caller's service interface ID for traceability |
| 5 | SET | `errorMap.put(ErrorInfoMapKeys.STATUS, JPCModelConstant.RELATION_ERR)` // [-> ErrorInfoMapKeys.STATUS] Set the error severity to RELATION_ERR |
| 6 | SET | `errorMapChild.put(errItem, "EZ")` // [-> errItem] Map the specific error item to the EZ error code |
| 7 | SET | `errorMap.put(ErrorInfoMapKeys.ITEM_CHECK_ERRORS, errorMapChild)` // [-> ErrorInfoMapKeys.ITEM_CHECK_ERRORS] Attach child error map to parent envelope |
| 8 | SET | `errList.add(errorMap)` // Append the new error envelope to the accumulated list |
| 9 | SET | `param.setControlMapData(SCControlMapKeys.ERROR_INFO, errList)` // [-> SCControlMapKeys.ERROR_INFO] Store updated error list back on param |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `EZ` | Error Code | Error marker code — a two-character code indicating a service interface (SIF) error occurred. Used consistently across the system as the value for error item keys in parameter maps. |
| `RELATION_ERR` | Constant | Relation Error — a status severity level assigned to errors originating from service component calls, indicating a failure in the relationship between components. |
| `NORMAL_END` | Constant | Normal End — a status value indicating a component completed its own processing normally (even if the overall request is in error). Used as the envelope's `RETURN_CODE` to confirm the error capture mechanism itself succeeded. |
| `RETURN_CODE` | Control Map Key | The key used in the control map to store the business process return code, which determines the overall success/failure state passed back to the calling screen. |
| `RETURN_MESSAGE` | Control Map Key | The key used in the control map to store the human-readable error message corresponding to the return code, used for display to end users. |
| `ERROR_INFO` | Control Map Key | The key used in the control map to store the error info list — an `ArrayList` of structured error envelopes accumulated during request processing. |
| `TEMPLATE_ID` | Error Envelope Field | The service interface ID that identifies which service component produced the error. Used for log tracing and debugging. |
| `STATUS` | Error Envelope Field | The error severity level within the error envelope, always set to `RELATION_ERR` for service component errors. |
| `ITEM_CHECK_ERRORS` | Error Envelope Field | A nested map within each error envelope that maps individual error item keys to their error codes (e.g., `"key_svc_kei_no_err" -> "EZ"`). |
| `errIfId` | Parameter | Service Interface ID — the identifier of the service component that triggered the error (e.g., `"EKK0081A010"`, `"ECNA0170001"`). |
| `errItem` | Parameter | Error Item — the specific field or operation key that failed (e.g., `"key_svc_kei_no_err"`, `"key_sysid_err"`). |
| `param` | Parameter | IRequestParameterReadWrite — the request parameter object that flows through the entire processing chain, carrying control data, error info, and return codes between layers. |
| `inMap` | Parameter | Inbound Parameter Map — a `Map<String, Object>` that receives the error item marker at the start of error handling. |
| `JCMAPLConstMgr.getString()` | Utility Method | Message lookup method that retrieves localized strings by key prefix. Used here to build human-readable messages from `RETURN_MESSAGE_` + formatted status keys. |
| `SCControlMapKeys` | Constants Class | Class containing constant string keys for the control map (e.g., `RETURN_CODE`, `RETURN_MESSAGE`, `ERROR_INFO`). |
| `ErrorInfoMapKeys` | Constants Class | Class containing constant string keys for error envelope maps (e.g., `RETURN_CODE`, `TEMPLATE_ID`, `STATUS`, `ITEM_CHECK_ERRORS`). |
| `JPCModelConstant` | Constants Class | Class containing business process model constants including `RELATION_ERR` and `NORMAL_END` status values. |
| `String.format("%1$04d", ...)` | Format Pattern | Zero-pads an integer to 4 digits (e.g., `3` → `"0003"`). Used to construct the message lookup key as `"RETURN_MESSAGE_0003"`. |
