# Business Logic — FUW02701SFLogic.checkException() [52 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02701SF.FUW02701SFLogic` |
| Layer | Controller (Web View Logic Layer) |
| Module | `FUW02701SF` (Package: `eo.web.webview.FUW02701SF`) |

## 1. Role

### FUW02701SFLogic.checkException()

This method is a centralized exception classifier and translator for the Web Contract Capacity Addition Application (`FUW02701SF`) screen module. It receives a `JCCWebServiceException` — the wrapped service-layer exception thrown when an underlying web service call fails during subscription service operations — and inspects its embedded error metadata to determine the specific business failure scenario. Based on the combination of error template identifier (`templateid`), error classification code (`errFlg`), and the specific form field that triggered the error (`itemid`), the method dispatches to one of four known business error conditions, translating each into a typed `JCCBusinessException` with a corresponding system error code. The four handled conditions cover: (1) a contract-already-completed error during option service contract information change, (2) an update-impossibility error (stale timestamp) during option service contract change, (3) a contract-status error during sub subscription service contract ISP registration, and (4) a contract-status error during sub subscription service contract ISP change. If the incoming exception does not match any of these four known patterns, the method falls through to a generic system error (`ERROR_CODE_0002`). This method implements a **routing/dispatch design pattern**: it centralizes exception handling for the entire screen, ensuring that all error paths are explicitly known and typed. It is a private utility method called from two entry points within the same class — `cfm()` (the capacity addition submission handler) and `mskm()` (the capacity addition input handler) — both of which wrap their service invocations in try-catch blocks to funnel any `JCCWebServiceException` here.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START["checkException(se)"]
    START --> EXTRACT["Extract error info from exception"]

    EXTRACT --> STEP1["Extract X31CMessageResult from se.getMessageList()"]
    STEP1 --> STEP2["Get messageMoreInfo array from msgResult.getMessageMoreInfoList()"]
    STEP2 --> STEP3["Get first element moreInfo0 - related check always has exactly 1 error"]
    STEP3 --> STEP4["Extract fields: templateid, itemid, status, errFlg"]

    STEP4 --> COND_STATUS{status equals RELATION_ERR<br/>1100}

    COND_STATUS -- No --> FALLBACK["Throw ERROR_CODE_0002<br/>System Error fallback"]
    FALLBACK --> END_RETURN["End"]

    COND_STATUS -- Yes --> COND1{templateid equals EKK0361C050<br/>errFlg equals ED<br/>itemid equals capa}

    COND1 -- No --> COND2{templateid equals EKK0361C050<br/>errFlg equals EA<br/>itemid equals upd_dtm_bf}

    COND2 -- No --> COND3{templateid equals EKK0411D010<br/>errFlg equals EB<br/>itemid equals add_capa}

    COND3 -- No --> COND4{templateid equals EKK0411C010<br/>errFlg equals EL<br/>itemid equals sbop_svc_kei_no}

    COND4 -- No --> FALLBACK

    COND1 -- Yes --> THROW1["Throw ERROR_CODE_0103<br/>Contract Completed Error"]
    THROW1 --> END_RETURN

    COND2 -- Yes --> THROW2["Throw ERROR_CODE_0204<br/>Update Impossibility Error"]
    THROW2 --> END_RETURN

    COND3 -- Yes --> THROW3["Throw ERROR_CODE_0102<br/>Contract Status Error"]
    THROW3 --> END_RETURN

    COND4 -- Yes --> THROW4["Throw ERROR_CODE_0102<br/>Contract Status Error"]
    THROW4 --> END_RETURN
```

**CRITICAL -- Constant Resolution:**

| Condition | Constant | Resolved Value | Business Meaning |
|-----------|----------|---------------|------------------|
| Status check | `JPCModelConstant.RELATION_ERR` | `1100` | Relation error flag — indicates a correlated/related system error rather than a field-level error |
| Template ID 1 | `EKK0361C050` | `"EKK0361C050"` | Option Service Contract (ISP) Information Change template |
| Template ID 2 | `EKK0411D010` | `"EKK0411D010"` | Sub Option Service Contract (ISP) Registration template |
| Template ID 3 | `EKK0411C010` | `"EKK0411C010"` | Sub Option Service Contract (ISP) Change template |
| Error flag ED | `JFUStrConst.RELATION_CHECK_ERR_ED` | `"ED"` | Related check error — already contracted (contract completed) |
| Error flag EA | `JFUStrConst.RELATION_CHECK_ERR_EA` | `"EA"` | Related check error — update impossibility (stale data) |
| Error flag EB | `JFUStrConst.RELATION_CHECK_ERR_EB` | `"EB"` | Related check error — contract status error |
| Error flag EL | `JFUStrConst.RELATION_CHECK_ERR_EL` | `"EL"` | Related check error — contract status error (change path) |
| Item CAPA | `CAPA` | `"capa"` | Capacity field identifier |
| Item ADD_CAPA | `ADD_CAPA` | `"add_capa"` | Additional capacity field identifier |
| Item SBOP_SVC_KEI_NO | `SBOP_SVC_KEI_NO` | `"sbop_svc_kei_no"` | Subscription service line number field identifier |
| Item UPD_DTM_BF | `UPD_DTM_BF` | `"upd_dtm_bf"` | Pre-update timestamp field identifier |
| Error code 0103 | `JFUStrConst.ERROR_CODE_0103` | `"0103"` | System Error — Contract Completed Error |
| Error code 0204 | `JFUStrConst.ERROR_CODE_0204` | `"0204"` | System Error — Update Impossibility Error |
| Error code 0102 | `JFUStrConst.ERROR_CODE_0102` | `"0102"` | System Error — Contract Status Error |
| Error code 0002 | `JFUStrConst.ERROR_CODE_0002` | `"0002"` | System Error — Generic fallback |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `se` | `JCCWebServiceException` | A service-layer exception wrapper thrown when a downstream web service call (e.g., contract registration, contract change, capacity addition) fails. Contains an embedded list of `X31CMessageResult` objects with error metadata: template ID (identifying which screen/business logic generated the error), item ID (identifying which form field triggered the error), status (error category code), and error flag (detailed error classification). In practice, this exception is caught from `invokeService()` calls during the capacity addition workflow. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `EKK0361C050` | `String` | Template ID constant for Option Service Contract (ISP) Information Change error detection |
| `EKK0411D010` | `String` | Template ID constant for Sub Option Service Contract (ISP) Registration error detection |
| `EKK0411C010` | `String` | Template ID constant for Sub Option Service Contract (ISP) Change error detection |
| `CAPA` | `String` | Form item ID for the capacity field |
| `ADD_CAPA` | `String` | Form item ID for the additional capacity field |
| `SBOP_SVC_KEI_NO` | `String` | Form item ID for the subscription service line number field |
| `UPD_DTM_BF` | `String` | Form item ID for the pre-update timestamp field |

## 4. CRUD Operations / Called Services

This method performs **no direct database or SC/CBS calls**. It is purely an exception inspection and re-throwing utility. The only operations are:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebServiceException.getMessageList` | - | - | Reads the embedded error message list from the caught service exception |
| R | `X31CMessageResult.getMessageMoreInfoList` | - | - | Reads the message metadata array containing template ID, item ID, status, and error flag |
| R | `X31CMessageMoreInfo.getTemplateId` | - | - | Extracts the template ID string identifying which business operation generated the error |
| R | `X31CMessageMoreInfo.getItemId` | - | - | Extracts the form field identifier that triggered the error |
| R | `X31CMessageMoreInfo.getStatus` | - | - | Extracts the error status code (e.g., relation error flag) |
| R | `X31CMessageMoreInfo.getItemCheckErr` | - | - | Extracts the error classification flag (e.g., "ED", "EA", "EB", "EL") |
| E | `JCCBusinessException` constructor (throw) | - | - | Constructs and throws a typed business exception with a resolved error code |

**Note:** The `getStatus()` method calls referenced in the pre-computed evidence come from the **callers** of this method (`cfm()` and `mskm()`), not from `checkException()` itself. This method exclusively inspects exception metadata and throws typed exceptions.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `getMessageList` [R], `getMessageMoreInfoList` [R], `getTemplateId` [R], `getItemId` [R], `getStatus` [R], `getItemCheckErr` [R]

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `FUW02701SFLogic.cfm()` | `cfm()` -> `invokeService(paramMap, dataMap, outputMap)` -> throws `JCCWebServiceException` -> `checkException(se)` | `getMessageList` [R], `getStatus` [R] |
| 2 | `FUW02701SFLogic.mskm()` | `mskm()` -> `invokeService(paramMap, dataMap, outputMap)` -> throws `JCCWebServiceException` -> `checkException(se)` | `getMessageList` [R], `getStatus` [R] |

**Call Chain Details:**

- **Caller 1 — `cfm()`:** This is the **Capacity Addition Submission Handler**. It processes the capacity addition application submission flow: calls SCs for order content acceptance registration, option service contract ISP information change, sub subscription service contract ISP registration, service IF data transfer, and service order issuance. Then calls `invokeService()` wrapped in a try-catch — if a `JCCWebServiceException` is thrown, it is routed here. The caller is part of the `FUW02701SF` web view logic class, which serves the capacity addition application screen.

- **Caller 2 — `mskm()`:** This is the **Capacity Addition Input Handler**. It follows a similar flow to `cfm()` but includes an additional `JFUCommonRelationCheck.checkCommonRelation()` call for common related checks before `invokeService()`. The caller is part of the same `FUW02701SF` web view logic class, handling the capacity addition input screen.

## 6. Per-Branch Detail Blocks

### Line Reference (Source Lines 947–998)

The method spans lines 947–998 (52 lines of code). Below is the block-by-block analysis.

---

**Block 1** — [EXCEPTION EXTRACTION] `(lines 950-956)`

> Extract error metadata from the caught `JCCWebServiceException`. The exception contains an embedded message result, which contains an array of more-info objects. The first element is always present because the related check always has exactly one error.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `X31CMessageResult msgResult = se.getMessageList()` | Extract the message result list from the web service exception [-> `se.getMessageList()`] |
| 2 | SET | `X31CMessageMoreInfo[] moreInfo = msgResult.getMessageMoreInfoList()` | Extract the message metadata array from the result [-> `msgResult.getMessageMoreInfoList()`] |
| 3 | SET | `X31CMessageMoreInfo info = moreInfo[0]` | Get the first element — related check always has exactly 1 error [-> `moreInfo[0]`] |
| 4 | SET | `String templateid = info.getTemplateId()` | Extract template ID identifying which business operation generated the error |
| 5 | SET | `String itemid = info.getItemId()` | Extract the form field identifier that triggered the error |
| 6 | SET | `String status = info.getStatus()` | Extract the error status category code |
| 7 | SET | `String errFlg = info.getItemCheckErr()` | Extract the detailed error classification flag |

---

**Block 2** — [IF] `(status == JPCModelConstant.RELATION_ERR)` `(line 959)`

> First-level condition: check if this is a **relation error** (status code 1100). Relation errors indicate correlated/system-level errors from the related check mechanism, as opposed to individual field validation errors. Only if the status is a relation error does the method proceed to evaluate specific error conditions. If status does not match, the method falls through to the generic system error fallback (Block 8).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `status == JPCModelConstant.RELATION_ERR` | `[-> JPCModelConstant.RELATION_ERR = "1100"]` Compare error status against relation error code |

**Block 2.1** — [IF] `(templateid == EKK0361C050 && errFlg == ED && itemid == CAPA)` `(line 962)`

> First specific condition: **Contract Completed Error**. This triggers when the Option Service Contract (ISP) Information Change operation (`EKK0361C050`) detects that the contract is already completed while the user attempted to change it. The error originates from the capacity (`capa`) field during a related check.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `templateid == EKK0361C050` | `[-> EKK0361C050 = "EKK0361C050"]` Option Service Contract (ISP) Information Change template |
| 2 | SET | `errFlg == JFUStrConst.RELATION_CHECK_ERR_ED` | `[-> RELATION_CHECK_ERR_ED = "ED"]` Related check error — already contracted |
| 3 | SET | `itemid == CAPA` | `[-> CAPA = "capa"]` Capacity field identifier |
| 4 | CALL | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0103)` | Throw Contract Completed Error [-> `ERROR_CODE_0103 = "0103"`] |

**Block 2.2** — [IF] `(templateid == EKK0361C050 && errFlg == EA && itemid == UPD_DTM_BF)` `(line 967)`

> Second specific condition: **Update Impossibility Error**. This triggers when the Option Service Contract (ISP) Information Change operation detects that the data has been modified by another user since the current user loaded it (stale timestamp). The error originates from the pre-update timestamp (`upd_dtm_bf`) field during a related check.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `templateid == EKK0361C050` | `[-> EKK0361C050 = "EKK0361C050"]` Option Service Contract (ISP) Information Change template |
| 2 | SET | `errFlg == JFUStrConst.RELATION_CHECK_ERR_EA` | `[-> RELATION_CHECK_ERR_EA = "EA"]` Related check error — update impossibility |
| 3 | SET | `itemid == UPD_DTM_BF` | `[-> UPD_DTM_BF = "upd_dtm_bf"]` Pre-update timestamp field identifier |
| 4 | CALL | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0204)` | Throw Update Impossibility Error [-> `ERROR_CODE_0204 = "0204"`] |

**Block 2.3** — [IF] `(templateid == EKK0411D010 && errFlg == EB && itemid == ADD_CAPA)` `(line 972)`

> Third specific condition: **Contract Status Error** (Registration path). This triggers when the Sub Option Service Contract (ISP) Registration operation detects that the contract status is incompatible with registration. The error originates from the additional capacity (`add_capa`) field during a related check.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `templateid == EKK0411D010` | `[-> EKK0411D010 = "EKK0411D010"]` Sub Option Service Contract (ISP) Registration template |
| 2 | SET | `errFlg == JFUStrConst.RELATION_CHECK_ERR_EB` | `[-> RELATION_CHECK_ERR_EB = "EB"]` Related check error — contract status error |
| 3 | SET | `itemid == ADD_CAPA` | `[-> ADD_CAPA = "add_capa"]` Additional capacity field identifier |
| 4 | CALL | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0102)` | Throw Contract Status Error [-> `ERROR_CODE_0102 = "0102"`] |

**Block 2.4** — [IF] `(templateid == EKK0411C010 && errFlg == EL && itemid == SBOP_SVC_KEI_NO)` `(line 978)`

> Fourth specific condition: **Contract Status Error** (Change path). This triggers when the Sub Option Service Contract (ISP) Change operation detects that the contract status is incompatible with the requested change. The error originates from the subscription service line number (`sbop_svc_kei_no`) field during a related check.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `templateid == EKK0411C010` | `[-> EKK0411C010 = "EKK0411C010"]` Sub Option Service Contract (ISP) Change template |
| 2 | SET | `errFlg == JFUStrConst.RELATION_CHECK_ERR_EL` | `[-> RELATION_CHECK_ERR_EL = "EL"]` Related check error — contract status error (change path) |
| 3 | SET | `itemid == SBOP_SVC_KEI_NO` | `[-> SBOP_SVC_KEI_NO = "sbop_svc_kei_no"]` Subscription service line number field identifier |
| 4 | CALL | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0102)` | Throw Contract Status Error [-> `ERROR_CODE_0102 = "0102"`] |

---

**Block 8** — [ELSE — FALLBACK] `(line 985)`

> Catch-all fallback: any error condition not matching the four known patterns above is treated as a **generic system error**. This is the safety net for unexpected or unclassified error scenarios, ensuring the method always returns (by throwing) rather than silently completing.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `throw new JCCBusinessException(JFUStrConst.ERROR_CODE_0002)` | Throw Generic System Error [-> `ERROR_CODE_0002 = "0002"`] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `JCCWebServiceException` | Exception | Web service exception wrapper — thrown by the service layer when a downstream web service call fails. Contains embedded error metadata (template ID, item ID, status, error flag). |
| `X31CMessageResult` | Class | Message result container holding a list of `X31CMessageMoreInfo` objects, each representing a specific error or message with metadata. |
| `X31CMessageMoreInfo` | Class | Detailed message metadata object containing template ID, item ID, status code, and error classification flag. |
| `JCCBusinessException` | Exception | Business-layer exception with a typed error code. Used to propagate specific business errors to the presentation layer. |
| `templateid` | Field | Template identifier — indicates which business operation/screen template generated the error (e.g., contract change, registration, ISP operations). |
| `itemid` | Field | Form item identifier — indicates which form field triggered the error (e.g., capacity, additional capacity, subscription service line number, timestamp). |
| `status` | Field | Error status category code — classifies the broad error category (e.g., relation error = 1100, field-level error). |
| `errFlg` | Field | Error classification flag — detailed error type identifier (e.g., "ED" = already contracted, "EA" = update impossibility, "EB"/"EL" = contract status error). |
| `RELATION_ERR` | Constant | System error category code (1100) — indicates a correlated/related system error rather than an individual field validation error. |
| `EKK0361C050` | Constant | Template ID — Option Service Contract (ISP) Information Change. The business operation for modifying existing option service contract details. |
| `EKK0411D010` | Constant | Template ID — Sub Option Service Contract (ISP) Registration. The business operation for registering a new sub subscription service contract under ISP. |
| `EKK0411C010` | Constant | Template ID — Sub Option Service Contract (ISP) Change. The business operation for modifying an existing sub subscription service contract under ISP. |
| `RELATION_CHECK_ERR_ED` | Constant | Error flag "ED" — indicates the contract is already completed (contract completed error). |
| `RELATION_CHECK_ERR_EA` | Constant | Error flag "EA" — indicates update impossibility due to stale data (the record was modified by another user). |
| `RELATION_CHECK_ERR_EB` | Constant | Error flag "EB" — indicates the contract status is incompatible with the requested registration operation. |
| `RELATION_CHECK_ERR_EL` | Constant | Error flag "EL" — indicates the contract status is incompatible with the requested change operation. |
| `capa` | Constant | Form item ID for the capacity field — represents the current service capacity (bandwidth) for the subscription. |
| `add_capa` | Constant | Form item ID for the additional capacity field — represents the capacity being added during the capacity addition application. |
| `sbop_svc_kei_no` | Constant | Form item ID for the subscription service line number — identifies a specific service line within the subscription. |
| `upd_dtm_bf` | Constant | Form item ID for the pre-update timestamp — stores the timestamp of the last update for optimistic concurrency control. |
| `ERROR_CODE_0103` | Constant | System error code "0103" — Contract Completed Error. The contract has already been finalized and cannot be modified. |
| `ERROR_CODE_0204` | Constant | System error code "0204" — Update Impossibility Error. The record has been modified since the user loaded it (stale data). |
| `ERROR_CODE_0102` | Constant | System error code "0102" — Contract Status Error. The contract status is incompatible with the requested operation. |
| `ERROR_CODE_0002` | Constant | System error code "0002" — Generic System Error. Fallback for unclassified or unexpected error conditions. |
| Option Service Contract | Business term | ISP (Internet Service Provider) option service contract — the contracted internet service package associated with the subscription. |
| Sub Option Service Contract | Business term | A secondary or ancillary option service contract linked under the primary subscription, typically for additional services. |
| ISP | Business term | Internet Service Provider — the class of service for internet connectivity. |
| Web Contract Capacity Addition Application | Business term | The screen/module (`FUW02701SF`) for applying to add bandwidth capacity to an existing web contract. |
| `cfm()` | Method | Capacity Addition Submission Handler — processes the form submission for capacity addition. |
| `mskm()` | Method | Capacity Addition Input Handler — handles input/display for the capacity addition screen. |
