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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02101SF.FUW02101SFLogic` |
| Layer | Service / Frontend Logic (Controller-tier business logic within the webview module) |
| Module | `FUW02101SF` (Package: `eo.web.webview.FUW02101SF`) |

## 1. Role

### FUW02101SFLogic.checkException()

This method is the **central exception classification and routing handler** for the FUW02101SF (Internet Service / ISP Subscription and Change) screen. It receives a `JCCWebServiceException` thrown from downstream web service calls and inspects the embedded error metadata to determine the exact business nature of the failure. The method implements a **discriminator/routing pattern**: it extracts four fields from the exception's message chain (`templateid`, `itemid`, `status`, `errFlg`) and dispatches to one of five outcome branches, each mapping to a specific `JCCBusinessException` with a distinct error code.

The method handles **relationship-type errors** (`RELATION_ERR = 1100`) across four distinct business scenarios:

- **Option Service Contract (ISP) — Completed Contract Error**: When an option service contract change operation encounters a "contract already completed" state on a capacity item, it throws ERROR_CODE_0103.
- **Option Service Contract (ISP) — Update-not-possible Error**: When a template mismatch is detected on the update-time-before item, it throws ERROR_CODE_0204, indicating a concurrency or stale-data condition.
- **Subscription Service Contract (ISP) — Registration — Contract State Error**: When a new ISP subscription registration fails on an add-capacity validation, it throws ERROR_CODE_0102.
- **Subscription Service Contract (ISP) — Change — Contract State Error**: When an existing ISP subscription change fails on the service detail number validation, it throws ERROR_CODE_0102.

Any error that does not match these four specific relationship-error combinations falls through to a **generic system error** (ERROR_CODE_0002), serving as a safety net that ensures no unclassified exception silently passes through. This method is called from `cfm()` and `mskm()` within the same class, acting as a shared exception normalization layer for all web service interactions on the FUW02101SF screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["checkException(JCCWebServiceException se)"])

    START --> GET_MSG["Get messageList from se"]
    GET_MSG --> GET_MORE_INFO["Get MessageMoreInfo array from msgResult"]
    GET_MORE_INFO --> GET_INFO["Get moreInfo[0] as X31CMessageMoreInfo info"]
    GET_INFO --> EXTRACT_FIELDS["Extract templateid, itemid, status, errFlg from info"]

    EXTRACT_FIELDS --> CHECK_RELATION["status == RELATION_ERR (1100) ?"]

    CHECK_RELATION -->|Yes| HANDLE_RELATION["Handle relationship errors"]
    CHECK_RELATION -->|No| FALL_THROUGH["Fall through to generic error"]

    HANDLE_RELATION --> CHECK_TEMPLATE1["templateid == EKK0361C050 AND errFlg == EB AND itemid == capa ?"]
    CHECK_TEMPLATE1 -->|Yes| THROW_0103["Throw JCCBusinessException ERROR_CODE_0103 (Contract completed error)"]
    CHECK_TEMPLATE1 -->|No| CHECK_TEMPLATE2["templateid == EKK0361C050 AND errFlg == EA AND itemid == upd_dtm_bf ?"]
    CHECK_TEMPLATE2 -->|Yes| THROW_0204["Throw JCCBusinessException ERROR_CODE_0204 (Update-not-possible error)"]
    CHECK_TEMPLATE2 -->|No| CHECK_TEMPLATE3["templateid == EKK0411D010 AND errFlg == EA AND itemid == add_capa ?"]
    CHECK_TEMPLATE3 -->|Yes| THROW_0102_1["Throw JCCBusinessException ERROR_CODE_0102 (Contract state error)"]
    CHECK_TEMPLATE3 -->|No| CHECK_TEMPLATE4["templateid == EKK0411C010 AND errFlg == EJ AND itemid == sbop_svc_kei_no ?"]
    CHECK_TEMPLATE4 -->|Yes| THROW_0102_2["Throw JCCBusinessException ERROR_CODE_0102 (Contract state error)"]
    CHECK_TEMPLATE4 -->|No| FALL_THROUGH

    THROW_0103 --> END_NODE(["End / Exception propagated"])
    THROW_0204 --> END_NODE
    THROW_0102_1 --> END_NODE
    THROW_0102_2 --> END_NODE

    FALL_THROUGH --> THROW_GENERIC["Throw JCCBusinessException ERROR_CODE_0002 (Generic system error)"]
    THROW_GENERIC --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `se` | `JCCWebServiceException` | A web service exception returned from a downstream service call on the FUW02101SF (ISP subscription/change) screen. It carries a structured error payload: a message list containing more-info entries with fields like `templateid` (the originating SC/template), `itemid` (the field that failed validation), `status` (the error classification code), and `errFlg` (the relation error flag). This exception is the vehicle through which business rules — contract state, concurrency, and capacity checks — are communicated back to the screen layer. |

No instance fields or external state are read by this method. All data comes from the `se` parameter.

## 4. CRUD Operations / Called Services

This method does not directly invoke any service components (SC) or data access methods. It only reads from the `JCCWebServiceException` parameter and throws new exceptions. All terminal operations (the underlying `getStatus` calls reported by the code analysis graph) originate from the **callers** of this method (`cfm()` and `mskm()`), which invoke downstream SCs before reaching `checkException()`. The method itself performs **zero CRUD operations** — it is a pure error-routings layer.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebServiceException.getMessageList` | - | - | Reads the structured error message list embedded in the exception (no database access, in-memory retrieval) |
| R | `X31CMessageResult.getMessageMoreInfoList` | - | - | Reads the more-info metadata array from the message result (no database access, in-memory retrieval) |
| R | `X31CMessageMoreInfo.getTemplateId` | - | - | Reads the template/service identifier from the error metadata (in-memory retrieval) |
| R | `X31CMessageMoreInfo.getItemId` | - | - | Reads the field/item identifier that triggered the error (in-memory retrieval) |
| R | `X31CMessageMoreInfo.getStatus` | - | - | Reads the error status code to classify the error type (in-memory retrieval) |
| R | `X31CMessageMoreInfo.getItemCheckErr` | - | - | Reads the relation-check error flag (EB, EA, EJ, etc.) (in-memory retrieval) |

The terminal operations ultimately reached through the callers are:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCKPmpScParamHenshu.getStatus` | JCKPmpScParamHenshu | - | Reads parameter status (called by caller `cfm()`) |
| R | `JCNBPCommon.getStatus` | JCNBPCommon | - | Reads common status (called by caller `mskm()`) |
| R | `JCNDslScParamHenshu.getStatus` | JCNDslScParamHenshu | - | Reads DSL parameter status |
| R | `JFUBaseUtil.getStatus` | JFUBase | - | Reads base utility status |
| R | `JKKCashPostGetStatusCC.getStatus` | JKKCashPostGetStatusCC | - | Reads cash post status |

## 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: `getStatus` [R], `getStatus` [R], `getStatus` [R], `getStatus` [R], `getStatus` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `FUW02101SFLogic.cfm()` | `cfm()` -> `checkException(se)` | `getStatus` [R] (from downstream SC calls in `cfm()`) |
| 2 | `FUW02101SFLogic.mskm()` | `mskm()` -> `checkException(se)` | `getStatus` [R] (from downstream SC calls in `mskm()`) |

Both callers are logic methods within the same `FUW02101SFLogic` class. They invoke downstream web services (SCs) that may throw `JCCWebServiceException`, and then delegate to `checkException()` to classify and re-throw as domain-specific `JCCBusinessException` values.

## 6. Per-Branch Detail Blocks

### Block 1 — EXTRACT (L886-L894)

> Extract error metadata from the exception. The javadoc states "例外の判定処理" (Exception determination processing). The inline comments "例外情報を取得" (Get exception information) and "関連チェックは必ずエラーが1つのため0番目から取得する" (Related checks always have exactly 1 error, so retrieve from index 0) indicate the moreInfo array is expected to contain exactly one entry.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `se.getMessageList()` |
| 2 | CALL | `msgResult.getMessageMoreInfoList()` |
| 3 | SET | `moreInfo[0]` -> `info` // [-> "Index 0 selected; related checks always have exactly 1 error"] |
| 4 | CALL | `info.getTemplateId()` |
| 5 | CALL | `info.getItemId()` |
| 6 | CALL | `info.getStatus()` |
| 7 | CALL | `info.getItemCheckErr()` |

### Block 2 — IF (L896) `[RELATION_ERR="1100"]`

> "例外を判定" (Determine exception) — "業務エラー" (Business error) — "関連チェック" (Related check) — "エラーを判定" (Determine error) — "システムエラー" (System error). This block routes errors that have been pre-classified as relation errors (status code 1100).

| # | Type | Code |
|---|------|------|
| 1 | SET | `JPCModelConstant.RELATION_ERR = 1100` // [-> RELATION_ERR = "1100"] |
| 2 | COND | `status.equals(String.valueOf(1100))` |
| 3 | IF-TRUE | Enter Block 2.1 through Block 2.4 |
| 4 | IF-FALSE | Fall through to Block 3 (generic error) |

#### Block 2.1 — IF (L898) `[EKK0361C050="EKK0361C050"]` [`RELATION_CHECK_ERR_EB="EB""] `[CAPA="capa"]`

> "オプション契約上限定チェック" (Option contract upper-limit check) — "システムエラーをthrow（契約済エラー）" (Throw system error — contract completed error). This is the option service contract (ISP) information change scenario where a capacity item has already been contracted.

| # | Type | Code |
|---|------|------|
| 1 | COND | `EKK0361C050.equals(templateid)` // [-> EKK0361C050 = "EKK0361C050" — Option Service Contract <ISP> Info Change] |
| 2 | COND | `JFUStrConst.RELATION_CHECK_ERR_EB.equals(errFlg)` // [-> RELATION_CHECK_ERR_EB = "EB"] |
| 3 | COND | `CAPA.equals(itemid)` // [-> CAPA = "capa" — Capacity item] |
| 4 | THROW | `new JCCBusinessException(JFUStrConst.ERROR_CODE_0103)` // [-> "Contract completed error"] |

#### Block 2.2 — IF (L904) `[EKK0361C050="EKK0361C050"]` [`RELATION_CHECK_ERR_EA="EA""] `[UPD_DTM_BF="upd_dtm_bf"]`

> "タイムスタンプチェック" (Timestamp check) — "システムエラーをthrow（更新不可エラー）" (Throw system error — update-not-possible error). This is the option service contract (ISP) information change scenario where a timestamp mismatch indicates the data has been modified by another transaction.

| # | Type | Code |
|---|------|------|
| 1 | COND | `EKK0361C050.equals(templateid)` // [-> EKK0361C050 = "EKK0361C050" — Option Service Contract <ISP> Info Change] |
| 2 | COND | `JFUStrConst.RELATION_CHECK_ERR_EA.equals(errFlg)` // [-> RELATION_CHECK_ERR_EA = "EA"] |
| 3 | COND | `UPD_DTM_BF.equals(itemid)` // [-> UPD_DTM_BF = "upd_dtm_bf" — Update-time-before item] |
| 4 | THROW | `new JCCBusinessException(JFUStrConst.ERROR_CODE_0204)` // [-> "Update-not-possible error"] |

#### Block 2.3 — IF (L910) `[EKK0411D010="EKK0411D010"]` [`RELATION_CHECK_ERR_EA="EA""] `[ADD_CAPA="add_capa"]`

> "サブオプションサービス契約<ISP>登録 — 契約単位チェック" (Subscription Service Contract <ISP> Registration — Contract-unit check) — "システムエラーをthrow（契約状態エラー）" (Throw system error — contract state error). This covers the new ISP subscription registration path where an add-capacity item fails contract state validation.

| # | Type | Code |
|---|------|------|
| 1 | COND | `EKK0411D010.equals(templateid)` // [-> EKK0411D010 = "EKK0411D010" — Subscription Service Contract <ISP> Registration] |
| 2 | COND | `JFUStrConst.RELATION_CHECK_ERR_EA.equals(errFlg)` // [-> RELATION_CHECK_ERR_EA = "EA"] |
| 3 | COND | `ADD_CAPA.equals(itemid)` // [-> ADD_CAPA = "add_capa" — Add-capacity item] |
| 4 | THROW | `new JCCBusinessException(JFUStrConst.ERROR_CODE_0102)` // [-> "Contract state error"] |

#### Block 2.4 — IF (L916) `[EKK0411C010="EKK0411C010"]` [`RELATION_CHECK_ERR_EJ="EJ""] `[SBOP_SVC_KEI_NO="sbop_svc_kei_no"]`

> "サブオプションサービス契約<ISP>変更 — 契約単位チェック" (Subscription Service Contract <ISP> Change — Contract-unit check) — "システムエラーをthrow（契約状態エラー）" (Throw system error — contract state error). This covers the ISP subscription change path where the service detail number fails contract state validation.

| # | Type | Code |
|---|------|------|
| 1 | COND | `EKK0411C010.equals(templateid)` // [-> EKK0411C010 = "EKK0411C010" — Subscription Service Contract <ISP> Change] |
| 2 | COND | `JFUStrConst.RELATION_CHECK_ERR_EJ.equals(errFlg)` // [-> RELATION_CHECK_ERR_EJ = "EJ"] |
| 3 | COND | `SBOP_SVC_KEI_NO.equals(itemid)` // [-> SBOP_SVC_KEI_NO = "sbop_svc_kei_no" — Subscription Service Detail Number] |
| 4 | THROW | `new JCCBusinessException(JFUStrConst.ERROR_CODE_0102)` // [-> "Contract state error"] |

### Block 3 — FALL-THROUGH (L922)

> "上記以外の場合システムエラーをスロー" (Throw system error for cases other than the above). Any error that does not match the four specific relationship-error patterns is escalated as a generic system error.

| # | Type | Code |
|---|------|------|
| 1 | THROW | `new JCCBusinessException(JFUStrConst.ERROR_CODE_0002)` // [-> "Generic system error — catch-all for unclassified errors"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `templateid` | Field | Template identifier — indicates which SC/template generated the error (e.g., EKK0361C050 for option service contract info change) |
| `itemid` | Field | Item identifier — the specific data field or item that failed validation (e.g., "capa" for capacity, "upd_dtm_bf" for update-time-before) |
| `status` | Field | Error status code — classifies the error category; `1100` indicates a relationship/constraint error between entities |
| `errFlg` | Field | Error flag — relation-check error code indicating the specific error type (e.g., "EB" for contract-completed, "EA" for update-not-possible/concurrency, "EJ" for contract state) |
| `RELATION_ERR` | Constant | Relation error status code = 1100; indicates a business constraint violation between related entities |
| `RELATION_CHECK_ERR_EA` | Constant | Relation check error flag "EA" — indicates update-not-possible or contract state error |
| `RELATION_CHECK_ERR_EB` | Constant | Relation check error flag "EB" — indicates contract-completed error (service already contracted) |
| `RELATION_CHECK_ERR_EJ` | Constant | Relation check error flag "EJ" — indicates contract state error on subscription service detail number |
| `EKK0361C050` | Constant | Error judgment template: Option Service Contract (ISP) Information Change |
| `EKK0411D010` | Constant | Error judgment template: Subscription Service Contract (ISP) Registration |
| `EKK0411C010` | Constant | Error judgment template: Subscription Service Contract (ISP) Change |
| `CAPA` | Constant | Error judgment item: "capa" — the capacity field on option services |
| `ADD_CAPA` | Constant | Error judgment item: "add_capa" — the add-capacity field on subscription service contracts |
| `UPD_DTM_BF` | Constant | Error judgment item: "upd_dtm_bf" — the update-time-before field used for concurrency/timestamp checks |
| `SBOP_SVC_KEI_NO` | Constant | Error judgment item: "sbop_svc_kei_no" — the Subscription Business Option Service Detail Number |
| ERROR_CODE_0102 | Constant | Contract state error — the service is in a state that does not permit the requested operation |
| ERROR_CODE_0103 | Constant | Contract completed error — the service contract has already been finalized/completed |
| ERROR_CODE_0204 | Constant | Update-not-possible error — the record has been modified by another transaction (concurrency conflict) |
| ERROR_CODE_0002 | Constant | Generic system error — catch-all for any error not matched by the four specific patterns above |
| JCCWebServiceException | Class | Web service exception wrapper carrying structured error metadata (message list, more-info) from downstream SCs |
| JCCBusinessException | Class | Application-level business exception used to convey domain-specific errors to the screen layer |
| X31CMessageResult | Class | Message result container holding the error message list from a web service response |
| X31CMessageMoreInfo | Class | Detailed error metadata entry containing templateid, itemid, status, and error flag |
| FUW02101SF | Module | Internet Service (ISP) subscription and change screen module |
| ISP | Business term | Internet Service Provider — broadband internet subscription service |
| Option Service | Business term | Optional add-on services attached to a base ISP subscription (e.g., extra capacity) |
| Subscription Service | Business term | Core ISP subscription contract (new registration or change of existing contract) |
| Contract-unit check | Business term | Validation that verifies the contract state of a service before allowing registration or modification |
