# Business Logic — FUW02201SFLogic.checkException() [47 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02201SF.FUW02201SFLogic` |
| Layer | Service (Webview Logic — sits between the controller/screen layer and the SC/CBS service components) |
| Module | `FUW02201SF` (Package: `eo.web.webview.FUW02201SF`) |

## 1. Role

### FUW02201SFLogic.checkException()

This method is the exception classification and routing handler for the "Mail Wire-less Check Service Application" screen (FUW02201SF), a business logic class that processes wire-less service subscription applications. When a `JCCWebServiceException` is thrown during the `invokeService()` call — which internally dispatches to multiple service components (SCs) for operations ranging from order content registration to sub-option service contract management — this method inspects the exception payload and re-throws a more context-specific `JCCBusinessException` to provide meaningful, user-facing error messages.

The method implements a **conditional exception routing pattern**. It extracts metadata from the web service exception (template ID, item ID, status code, and error flag), checks whether the error originates from a **relation check** (a data consistency validation that occurs before the actual service invocation), and then dispatches to one of four error-specific branches based on the combination of template ID and item ID. The template IDs correspond to Sub-Option Service Contract ISP operations: Registration (EKK0411D010), Confirmation Termination (EKK0411C040), and Usage Start (EKK0411C050). If the status is not a relation error, or if no specific condition matches, the exception is treated as a generic system error.

This method's role in the larger system is that of an **exception translation intermediary**. It ensures that business users see specific, actionable error codes (0103 for option service contract number errors, 0204 for update timestamp conflicts, 0002 for generic system errors) rather than low-level web service exception details. It is called exclusively from `execute()`, which is the main entry point for the wire-less check service application flow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["checkException JCCWebServiceException"])
    EXTRACT["Extract Exception Info from se"]
    EXTRACT --> GET_LIST["msgResult = se.getMessageList()"]
    GET_LIST --> GET_MORE["moreInfo = msgResult.getMessageMoreInfoList()"]
    GET_MORE --> GET_FIRST["info = moreInfo[0]"]
    GET_FIRST --> DECODE["Decode: templateid, itemid, status, errFlg"]
    DECODE --> COND_STATUS{"status == RELATION_ERR (1100)?"}
    COND_STATUS -->|"Yes"| RELATION_BRANCH["Relation Check Branch"]
    COND_STATUS -->|"No"| SYSTEM_ERROR["throw JCCBusinessException ERROR_CODE_0002 (System Error)"]
    RELATION_BRANCH --> COND_TEMPLATE1{"templateid == EKK0411D010 and errFlg == EF and itemid == op_svc_kei_no?"}
    COND_TEMPLATE1 -->|"Yes"| THROW_OP["throw JCCBusinessException ERROR_CODE_0103 (Option Service Contract Number)"]
    COND_TEMPLATE1 -->|"No"| COND_TEMPLATE2{"templateid == EKK0411D010 and errFlg == EA and itemid == upd_dtm_bf?"}
    COND_TEMPLATE2 -->|"Yes"| THROW_UPD1["throw JCCBusinessException ERROR_CODE_0204 (Update Date Time Before)"]
    COND_TEMPLATE2 -->|"No"| COND_TEMPLATE3{"templateid == EKK0411C040 and errFlg == EA and itemid == upd_dtm_bf?"}
    COND_TEMPLATE3 -->|"Yes"| THROW_C040["throw JCCBusinessException ERROR_CODE_0204 (Update Date Time Before)"]
    COND_TEMPLATE3 -->|"No"| COND_TEMPLATE4{"templateid == EKK0411C050 and errFlg == EA and itemid == upd_dtm_bf?"}
    COND_TEMPLATE4 -->|"Yes"| THROW_C050["throw JCCBusinessException ERROR_CODE_0204 (Update Date Time Before)"]
    COND_TEMPLATE4 -->|"No"| FALLTHROUGH["Fall Through — No specific match"]
    THROW_OP --> END_RETURN(["Return / Next"])
    THROW_UPD1 --> END_RETURN
    THROW_C040 --> END_RETURN
    THROW_C050 --> END_RETURN
    FALLTHROUGH --> SYSTEM_ERROR
    SYSTEM_ERROR --> END_RETURN
```

### Branch Summary

| Branch | Condition | Error Code Thrown | Business Meaning |
|--------|-----------|-------------------|-----------------|
| Upper Check | status=RELATION_ERR(1100) + templateid=EKK0411D010 + errFlg=EF + itemid=op_svc_kei_no | 0103 | Option Service Contract Number validation error |
| Exclude Check 1 | status=RELATION_ERR(1100) + templateid=EKK0411D010 + errFlg=EA + itemid=upd_dtm_bf | 0204 | Update timestamp conflict (before value) for Registration |
| Exclude Check 2 | status=RELATION_ERR(1100) + templateid=EKK0411C040 + errFlg=EA + itemid=upd_dtm_bf | 0204 | Update timestamp conflict for Confirmation Termination |
| Exclude Check 3 | status=RELATION_ERR(1100) + templateid=EKK0411C050 + errFlg=EA + itemid=upd_dtm_bf | 0204 | Update timestamp conflict for Usage Start |
| System Error | status != RELATION_ERR(1100) OR no specific match | 0002 | Generic system error |

### Constant Resolution

| Constant | Resolved Value | Business Meaning |
|----------|---------------|-----------------|
| `JPCModelConstant.RELATION_ERR` | `1100` | Relation check error status |
| `JFUStrConst.RELATION_CHECK_ERR_EA` | `"EA"` | Relation check error flag — update timestamp conflict |
| `JFUStrConst.RELATION_CHECK_ERR_EF` | `"EF"` | Relation check error flag — option service contract number |
| `JFUStrConst.ERROR_CODE_0103` | `"0103"` | Error: Option Service Contract Number |
| `JFUStrConst.ERROR_CODE_0204` | `"0204"` | Error: Update Date/Time Before (conflict) |
| `JFUStrConst.ERROR_CODE_0002` | `"0002"` | Error: System Error |
| `EKK0411D010` | `"EKK0411D010"` | Sub-Option Service Contract <ISP> Registration template ID |
| `EKK0411C040` | `"EKK0411C040"` | Sub-Option Service Contract <ISP> Confirmation Termination template ID |
| `EKK0411C050` | `"EKK0411C050"` | Sub-Option Service Contract <ISP> Usage Start template ID |
| `OP_SVC_KEI_NO` | `"op_svc_kei_no"` | Option Service Contract Number field |
| `UPD_DTM_BF` | `"upd_dtm_bf"` | Update Year/Month/Day/Time/Second (Before) field |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `se` | `JCCWebServiceException` | A web service exception thrown by the `invokeService()` call during the wire-less check service application flow. Contains a message list (`X31CMessageResult`) with metadata extracted from SC validation — specifically relation check results that include template ID, item ID, status code, and error flag. This object carries the context of which service component operation failed and what kind of validation error occurred. |

**No instance fields or external state** are read by this method. All required information is extracted from the parameter `se`.

## 4. CRUD Operations / Called Services

This method does **not** call any SC/CBS services or perform any CRUD operations on data sources. It is a pure exception classification utility that only inspects exception metadata and throws `JCCBusinessException`.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | `se.getMessageList()` | — | — | Extracts message list from the web service exception (no DB access) |
| — | `se.getMessageMoreInfoList()` | — | — | Extracts detail metadata array from the message result (no DB access) |

The `JCCBusinessException` instances thrown here are caught higher up the call stack (e.g., by the screen controller) and translated into user-facing error messages. The actual CRUD operations occurred earlier in the flow, within the SC components invoked by `invokeService()`.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `JCCBusinessException(0103)` [throw], `JCCBusinessException(0204)` [throw], `JCCBusinessException(0002)` [throw]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic: `FUW02201SFLogic.execute()` | `execute()` calls `invokeService()` (inside try-catch) -> catches `JCCWebServiceException` -> `checkException(se)` | `JCCBusinessException(0103)` [throw] Option Service Contract Number error<br>`JCCBusinessException(0204)` [throw] Update timestamp conflict error<br>`JCCBusinessException(0002)` [throw] System error |

**Full call chain context:**
The `execute()` method is the main processing entry point of the FUW02201SFLogic class. It prepares parameter maps for multiple SCs (Order Content Registration EKK0011D020, Sub-Option Service Contract Registration EKK0411D010, Confirmation SC EKK0411C020, Confirmation Termination EKK0411C040, Usage Start EKK0411C050, Advancement Registration EKK1091D010, Application Details Confirmation EKK0021C060), then calls `invokeService(paramMap, dataMap, outputMap)` inside a try-catch block. When `invokeService` throws a `JCCWebServiceException`, this `checkException()` method is invoked to reclassify and re-throw the exception with a specific business error code.

## 6. Per-Branch Detail Blocks

**Block 1** — EXEC (exception extraction) (L522)

> Extracts exception information from the web service exception parameter. The Japanese comment states: "例外情報を取得" (Retrieve exception information).

| # | Type | Code |
|---|------|------|
| 1 | SET | `msgResult = se.getMessageList()` // Retrieve message list from exception |
| 2 | SET | `moreInfo = msgResult.getMessageMoreInfoList()` // Retrieve detail metadata array |
| 3 | SET | `info = moreInfo[0]` // Get first element — Japanese comment: 関連チェック系は必ずエラーが1つのため0番目から取得する (Relation check errors always have exactly one entry, so retrieve from index 0) |
| 4 | SET | `templateid = info.getTemplateId()` // Template ID identifying which SC operation triggered the error |
| 5 | SET | `itemid = info.getItemId()` // Field/item name that caused the error |
| 6 | SET | `status = info.getStatus()` // Status code indicating error type |
| 7 | SET | `errFlg = info.getItemCheckErr()` // Error flag indicating the specific validation failure |

**Block 2** — IF-ELSE (relation check status) `(status == JPCModelConstant.RELATION_ERR = "1100")` (L530)

> Japanese comment: 関連チェック (Relation Check). This is the top-level branching condition. If the exception is NOT a relation check error, flow falls through directly to the system error throw.

| # | Type | Code |
|---|------|------|
| 1 | IF | `String.valueOf(JPCModelConstant.RELATION_ERR).equals(status)` // RELATION_ERR = "1100" (Relation check error) |

---

**Block 2.1** — IF-ELSE-IF chain (template-specific error routing) (L532)

> Japanese comment: 上限チェック (Upper Check) and 排他チェック (Exclusive Check). Processes relation check errors by template ID.

| # | Type | Code |
|---|------|------|
| 1 | IF | `EKK0411D010.equals(templateid) && JFUStrConst.RELATION_CHECK_ERR_EF.equals(errFlg) && OP_SVC_KEI_NO.equals(itemid)` |
| 1.1 | IF-Body | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0103)` // ERROR_CODE_0103 = "0103" (Option Service Contract Number error). Japanese comment: 返却値の設定 (Return value setting) |
| 2 | IF | `EKK0411D010.equals(templateid) && JFUStrConst.RELATION_CHECK_ERR_EA.equals(errFlg) && UPD_DTM_BF.equals(itemid)` |
| 2.1 | IF-Body | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0204)` // ERROR_CODE_0204 = "0204" (Update timestamp conflict). Japanese comment: 返却値の設定 (Return value setting) |
| 3 | IF | `EKK0411C040.equals(templateid) && JFUStrConst.RELATION_CHECK_ERR_EA.equals(errFlg) && UPD_DTM_BF.equals(itemid)` |
| 3.1 | IF-Body | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0204)` // ERROR_CODE_0204 = "0204" (Update timestamp conflict) |
| 4 | IF | `EKK0411C050.equals(templateid) && JFUStrConst.RELATION_CHECK_ERR_EA.equals(errFlg) && UPD_DTM_BF.equals(itemid)` |
| 4.1 | IF-Body | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0204)` // ERROR_CODE_0204 = "0204" (Update timestamp conflict) |

---

**Block 2.2** — THROW (system error fallback) (L563)

> Japanese comment: システムエラー (System Error). This executes when status is not RELATION_ERR (1100), or when the status is RELATION_ERR but no template-specific condition matches. This is the catch-all for unclassified exceptions.

| # | Type | Code |
|---|------|------|
| 1 | THROW | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0002)` // ERROR_CODE_0002 = "0002" (System Error) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-----------------|
| `FUW02201SF` | Module | Mail Wire-less Check Service Application — the screen module for processing wire-less internet service subscription applications |
| `JCCWebServiceException` | Exception | Web service exception containing structured error messages from SC (Service Component) operations |
| `JCCBusinessException` | Exception | Business-level exception with specific error codes displayed to users |
| `X31CMessageResult` | Class | Container for error/warning messages returned by SC operations |
| `X31CMessageMoreInfo` | Class | Detailed metadata for a single message, including template ID, item ID, status, and error flag |
| `RELATION_ERR` | Constant | Status code 1100 — indicates a relation check error (data consistency validation failure before SC invocation) |
| `RELATION_CHECK_ERR_EA` | Constant | Error flag "EA" — update timestamp conflict (optimistic locking / concurrent modification detected) |
| `RELATION_CHECK_ERR_EF` | Constant | Error flag "EF" — option service contract number validation failure |
| `ERROR_CODE_0103` | Constant | Business error "0103" — Option Service Contract Number is invalid or missing |
| `ERROR_CODE_0204` | Constant | Business error "0204" — Update Date/Time Before conflict (record was modified by another user) |
| `ERROR_CODE_0002` | Constant | Business error "0002" — Generic system error (uncategorized exception) |
| `EKK0411D010` | Template ID | Sub-Option Service Contract <ISP> Registration — SC for registering ISP sub-option service contracts |
| `EKK0411C040` | Template ID | Sub-Option Service Contract <ISP> Confirmation Termination — SC for terminating ISP confirmation |
| `EKK0411C050` | Template ID | Sub-Option Service Contract <ISP> Usage Start — SC for activating ISP sub-option service |
| `op_svc_kei_no` | Field | Option Service Contract Number — the field identifier for the option service contract number field |
| `upd_dtm_bf` | Field | Update Year/Month/Day/Time/Second (Before) — the pre-modification timestamp used for optimistic locking |
| `invokeService()` | Method | Core service invocation method that calls the SC chain and may throw `JCCWebServiceException` |
| SC | Acronym | Service Component — a backend component that handles specific business operations (e.g., registration, confirmation) |
| ISP | Business term | Internet Service Provider — the sub-option service context for this application flow |
| Relation Check | Business concept | A pre-invocation validation that verifies data consistency (e.g., contract number validity, timestamp conflicts) before calling the actual SC |
