# Business Logic — FUW02201SFLogic.execute() [85 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW02201SF.FUW02201SFLogic` |
| Layer | Service Logic (webview / Frontend Service Logic) |
| Module | `FUW02201SF` (Package: `eo.web.webview.FUW02201SF`) |

## 1. Role

### FUW02201SFLogic.execute()

This method implements the core business execution flow for a **Mail Welcome Choice Service (FW Service) subscription**, as defined by the file header comment "メールウエルスチェックサービスのビューロジッククラス" (Mail Welcome Check Service View Logic Class). It serves as the primary orchestration point for registering and confirming a new optional mail service contract within the K-Opticom customer management system.

The method follows a **delegation + pipeline pattern**: it first extracts deeply-nested business data beans from the shared form bean (structured in a hierarchical chain: CommonInfo -> WebChangeInfo -> GenCustKeiInfo -> SvcKeiInfo -> SeikyKeiInfo -> SvcKeiUcwkInfo -> OpSvcKeiInfo), then passes those beans through a chain of mapper-based preparatory calls that populate a shared `dataMap` with registration, lookup, and settlement data. Finally, it invokes the backend service layer via `invokeService`, which orchestrates the actual business processing (subscription creation, order issuance, and settlement).

This method handles all optional service types in a **unified pipeline** — mail services, ISP services, and related add-ons are all processed through the same flow without conditional branching on service type. The method acts as a **shared entry point** called by `cfm()` and `mskm()` methods within the same class, serving two different screen contexts (customer-facing and customer self-service modification screens).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute(commoninfoBean, funcCd)"])
    START --> GETBEAN["Get service form bean"]
    GETBEAN --> EXTRACT["Extract nested DataBeans from commoninfoBean"]
    EXTRACT --> SETUP["Generate paramMap and mapper"]
    SETUP --> MAPPER1["setFUSV005801SC - Subscription Content Registration"]
    MAPPER1 --> MAPPER2["setFUSV005802SC - Optional Service Contract ISP Registration"]
    MAPPER2 --> MAPPER3["setFUSV005807SC - Optional Service Contract ISP Lookup"]
    MAPPER3 --> MAPPER4["setFUSV005803SC - Optional Service Contract ISP Lookup Settlement"]
    MAPPER4 --> MAPPER5["setFUSV005804SC - Optional Service Contract ISP Start of Use"]
    MAPPER5 --> MAPPER6["setFUSV005805SC - Progress Registration"]
    MAPPER6 --> MAPPER7["setFUSV005806SC - Subscription Detail Lookup / Follow-up Request"]
    MAPPER7 --> MAPPER8["setFUSV005801CC - Service IF Result Data Transfer"]
    MAPPER8 --> MAPPER9["setFUSV005802CC - Service Order Issuance"]
    MAPPER9 --> MAPPER10["setFUSV005808CC - Security Pack Guidance Flag Judgment"]
    MAPPER10 --> SETSTAT["setOpSvcKeiStatMail - Optional Service Contract State Setup"]
    SETSTAT --> INVOKESERVICE["invokeService(paramMap, dataMap, outputMap)"]
    INVOKESERVICE --> EXCEPTION{"JCCWebServiceException?"}
    EXCEPTION --> |No| RETURN_OK(["Return void normally"])
    EXCEPTION --> |Yes| CHECKEXCEPTION["checkException(se)"]
    CHECKEXCEPTION --> THROW(["Throw exception up the chain"])
    THROW --> END_ERR(["End with error"])
    RETURN_OK --> FINAL(["Return void"])
    END_ERR --> FINAL
```

**Processing summary:** The method executes in a single linear pipeline with no conditional branches:
1. Extract hierarchical bean data from the shared form
2. Prepare paramMap with the usecase ID `USECASE_ID_FUSV0058 = "FUSV0058"`
3. Populate dataMap via 10 mapper calls in strict order
4. Set the optional service contract state for mail
5. Invoke the backend service, catching any service-level exceptions

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commoninfoBean` | `X31SDataBeanAccess` | The shared form bean containing the complete customer contract and service data hierarchy. It holds nested DataBeans for web change info, general customer contract, service contract, billing, service contract details, and optional service contract. This is the central data carrier passed across the entire view logic layer. |
| 2 | `funcCd` | `String` | The functional code (機能コード) that identifies which business operation is being executed (e.g., new subscription, modification, cancellation). It is passed through to all mapper methods to determine the specific action context. |

**Internal state read:**

| Source | Description |
|--------|-------------|
| `super.getServiceFormBean()` | Retrieves the service form bean from the parent class, providing access to the broader service context. |
| `this` (FUW02201SFLogic instance) | The method operates on its own class instance, used as a parameter for `setOpSvcKeiStatMail` and `setFUSV005801CC`. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005801SC` | EKK0011D020 | - | Subscription Content Registration — registers the subscription content data for the mail welcome choice service. |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005802SC` | EKK0411D010 | - | Optional Service Contract (ISP) Registration — registers the optional ISP service contract. |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005807SC` | EKK0411C020 | - | Optional Service Contract (ISP) Lookup — queries ISP contract details for display/validation. |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005803SC` | EKK0411C040 | - | Optional Service Contract (ISP) Lookup Settlement — performs settlement lookup for ISP contract. |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005804SC` | EKK0411C050 | - | Optional Service Contract (ISP) Start of Use — sets the start-of-use date for ISP contract. |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005805SC` | EKK1091D010 | - | Progress Registration — registers the service contract progress/state. |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005806SC` | EKK0021C060 | - | Subscription Detail Lookup / Follow-up Request — retrieves subscription details and handles follow-up requests. |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005801CC` | JFUTransferCC | - | Service IF Result Data Transfer — transfers service IF results between systems. |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005802CC` | JKKHakkoSODCC | - | Service Order Issuance — issues the service order (SOD: Service Order Data). |
| - | `FUSV0058_FUSV0058OPDBMapper.setFUSV005808CC` | Security Pack Guidance Flag Judgment | - | Security Pack Guidance Flag Judgment — determines whether to guide the user about security pack (hardcoded `FUNC_CD_2 = "2"`). |
| - | `JFUWebCommon.setOpSvcKeiStatMail` | JFUWebCommon | - | Sets the optional service contract state for mail services based on the processed data. |
| C/R | `JCCBatCommon.invokeService` | - | - | Invokes the backend service with the populated paramMap and dataMap, triggering the full service registration pipeline. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `FUW02201SFLogic.cfm()` | `cfm()` -> `execute(commoninfoBean, funcCd)` | `checkException` [-], `invokeService` [-], `setOpSvcKeiStatMail` [-], `setFUSV005808CC` [-], `setFUSV005802CC` [-], `setFUSV005801CC` [-], `setFUSV005807SC` [-], `setFUSV005806SC` [-], `setFUSV005805SC` [-], `setFUSV005804SC` [-], `setFUSV005803SC` [-], `setFUSV005802SC` [-], `setFUSV005801SC` [-] |
| 2 | `FUW02201SFLogic.mskm()` | `mskm()` -> `execute(commoninfoBean, funcCd)` | `checkException` [-], `invokeService` [-], `setOpSvcKeiStatMail` [-], `setFUSV005808CC` [-], `setFUSV005802CC` [-], `setFUSV005801CC` [-], `setFUSV005807SC` [-], `setFUSV005806SC` [-], `setFUSV005805SC` [-], `setFUSV005804SC` [-], `setFUSV005803SC` [-], `setFUSV005802SC` [-], `setFUSV005801SC` [-] |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Extract service form bean (L429-431)

> Retrieves the service form bean from the parent class for use in downstream processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean = super.getServiceFormBean()` // Get service form bean (サービスフォームbean) |

**Block 2** — [SET] Extract nested DataBean hierarchy from commoninfoBean (L434-461)

> Unwraps the nested DataBean chain from the shared form bean. Each level represents a business entity: WebChangeInfo (共有フォームBean.WEB変更情報), GenCustKeiInfo (現顧客契約情報), SvcKeiInfo (サービス契約情報), SeikyKeiInfo (請求契約情報), SvcKeiUcwkInfo (サービス契約内訳情報), OpSvcKeiInfo (オプションサービス契約情報).

| # | Type | Code |
|---|------|------|
| 1 | SET | `subBeanArray = commoninfoBean.getDataBeanArray(CommonInfoCFConst.WEB_CHG_INFO)` // Shared form bean WEB change info |
| 2 | SET | `webChgInfoBean = subBeanArray.getDataBean(0)` // First web change info bean |
| 3 | SET | `genCustKeiInfoArray = webChgInfoBean.getDataBeanArray(CommonInfoCFConst.GEN_CUST_KEI_INFO)` // General customer contract info |
| 4 | SET | `genCustKeiInfoBean = genCustKeiInfoArray.getDataBean(0)` // First general customer bean |
| 5 | SET | `svcKeiInfoArray = genCustKeiInfoBean.getDataBeanArray(CommonInfoCFConst.SVC_KEI_INFO)` // Service contract info |
| 6 | SET | `svcKeiInfoBean = svcKeiInfoArray.getDataBean(0)` // First service contract bean |
| 7 | SET | `seikyKeiInfoArray = svcKeiInfoBean.getDataBeanArray(CommonInfoCFConst.SEIKY_KEI_INFO)` // Billing contract info |
| 8 | SET | `seikyKeiInfoBean = seikyKeiInfoArray.getDataBean(0)` // First billing contract bean |
| 9 | SET | `svcKeiUcwkInfoArray = svcKeiInfoBean.getDataBeanArray(CommonInfoCFConst.SVC_KEI_UCWK_INFO)` // Service contract details |
| 10 | SET | `svcKeiUcwkInfoBean = svcKeiUcwkInfoArray.getDataBean(0)` // First details bean |
| 11 | SET | `opSvcKeiInfoArray = svcKeiUcwkInfoBean.getDataBeanArray(CommonInfoCFConst.OP_SVC_KEI_INFO)` // Optional service contract info |
| 12 | SET | `opSvcKeiInfoBean = opSvcKeiInfoArray.getDataBean(0)` // First optional service bean |

**Block 3** — [SET] Generate paramMap and mapper for service invocation (L464-470)

> Prepares the service invocation context. Creates a paramMap with the usecase ID (`USECASE_ID_FUSV0058 = "FUSV0058"`) for the telegram info, instantiates the FUSV0058 mapper, and builds a paramBean array containing the key beans in order.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, String>(16)` // Search result storage map (検索結果格納用マップ) |
| 2 | SET | `paramMap.put(X31CWebConst.TELEGRAM_INFO_USECASE_ID, USECASE_ID_FUSV0058)` // [-> USECASE_ID_FUSV0058 = "FUSV0058"] Service usecase ID |
| 3 | SET | `mapper = new FUSV0058_FUSV0058OPDBMapper()` // Mapper for FUSV0058 operations |
| 4 | SET | `dataMap = new HashMap<String, Object>()` // Shared data map for service calls |
| 5 | SET | `paramBean = {bean, genCustKeiInfoBean, svcKeiInfoBean, opSvcKeiInfoBean, seikyKeiInfoBean}` // Array of 5 key beans |

**Block 4** — [CALL] Mapper preparatory calls — populate dataMap (L473-487)

> Executes 10 sequential mapper calls. Each call writes data to the shared `dataMap` for the service layer. These are preparatory registration and lookup calls — not database operations themselves.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setFUSV005801SC(paramBean, dataMap, funcCd)` // [EKK0011D020] Subscription Content Registration (申込内容承認登録) |
| 2 | CALL | `mapper.setFUSV005802SC(paramBean, dataMap, funcCd)` // [EKK0411D010] Optional Service Contract ISP Registration (サブオプションサービス契約<ISP>登録) |
| 3 | CALL | `mapper.setFUSV005807SC(paramBean, dataMap, funcCd)` // [EKK0411C020] Optional Service Contract ISP Lookup (サブオプションサービス契約<ISP>照会SC) |
| 4 | CALL | `mapper.setFUSV005803SC(paramBean, dataMap, funcCd)` // [EKK0411C040] Optional Service Contract ISP Lookup Settlement (サブオプションサービス契約<ISP>照会結) |
| 5 | CALL | `mapper.setFUSV005804SC(paramBean, dataMap, funcCd)` // [EKK0411C050] Optional Service Contract ISP Start of Use (サブオプションサービス契約<ISP>使用開始) |
| 6 | CALL | `mapper.setFUSV005805SC(paramBean, dataMap, funcCd)` // [EKK1091D010] Progress Registration (進捗登録) |
| 7 | CALL | `mapper.setFUSV005806SC(paramBean, dataMap, funcCd)` // [EKK0021C060] Subscription Detail Lookup / Follow-up Request (申込明細照会・後続業務依頼) |
| 8 | CALL | `mapper.setFUSV005801CC(paramBean, dataMap, funcCd, this)` // [JFUTransferCC] Service IF Result Data Transfer (サービスIF結果データ送) |
| 9 | CALL | `mapper.setFUSV005802CC(paramBean, dataMap, funcCd)` // [JKKHakkoSODCC] Service Order Issuance (サービスオーダ発行) |
| 10 | CALL | `mapper.setFUSV005808CC(paramBean, dataMap, JPCModelConstant.FUNC_CD_2)` // [Security Pack Guidance Flag Judgment] Security pack guidance flag determination CC [-> FUNC_CD_2 = "2"] |

**Block 5** — [CALL] Set optional service contract state for mail (L489)

> Configures the optional service contract state to "mail" status after all mapper processing is complete.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JFUWebCommon.setOpSvcKeiStatMail(this, dataMap)` // Optional service contract state setup (オプションサービス契約ステータス設定) |

**Block 6** — [SET] Create output map (L492)

> Creates the output map to receive results from the service invocation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outputMap = new HashMap<Object, Object>()` // Search result storage map (検索結果格納用マップ) |

**Block 7** — [TRY] Service invocation and exception handling (L493-507)

> Invokes the backend service with the populated data map. The service call executes the full business pipeline. A catch block handles `JCCWebServiceException` by delegating to `checkException` for error classification.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `invokeService(paramMap, dataMap, outputMap)` // Invoke service (サービスの呼び出し) |
| 2 | EXEC | `// mapper.getFUSV005808CC(bean, outputMap);` // DEPRECATED — Security pack guidance flag judgment (2017/04/13 ANK-3149-00-00 del start) |

**Block 7.1** — [CATCH] JCCWebServiceException handler (L504-507)

> Catches web service exceptions thrown by `invokeService` and delegates error handling to `checkException`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `checkException(se)` // Exception judgment processing (例外の判定処理) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `FUW02201SF` | Module | Mail Welcome Choice Service (FW Service) subscription module — handles the registration and processing of mail welcome check services |
| `CFW` | Business term | Mail Welcome Service (メールウエルス) — a mail-based welcome/communication service offered to customers |
| `WEB_CHG_INFO` | Constant | Web change info — the shared form bean key for web modification/change data (共有フォームBean.WEB変更情報) |
| `GEN_CUST_KEI_INFO` | Constant | General customer contract info — the shared form bean key for general customer contract data (共有フォームBean.現顧客契約情報) |
| `SVC_KEI_INFO` | Constant | Service contract info — the shared form bean key for service contract data (共有フォームBean.サービス契約情報) |
| `SEIKY_KEI_INFO` | Constant | Billing contract info — the shared form bean key for billing contract data (共有フォームBean.請求契約情報) |
| `SVC_KEI_UCWK_INFO` | Constant | Service contract details info — the shared form bean key for service contract breakdown data (共有フォームBean.サービス契約内訳情報) |
| `OP_SVC_KEI_INFO` | Constant | Optional service contract info — the shared form bean key for optional service contract data (共有フォームBean.オプションサービス契約情報) |
| `USECASE_ID_FUSV0058` | Constant | Use case identifier "FUSV0058" — identifies the mail welcome choice service use case |
| `funcCd` | Field | Functional code — identifies the business operation type (e.g., new registration, modification) |
| EKK0011D020 | SC Code | Subscription Content Registration SC — registers subscription content approval |
| EKK0411D010 | SC Code | Optional Service Contract ISP Registration SC — registers optional ISP service contracts |
| EKK0411C020 | SC Code | Optional Service Contract ISP Lookup SC — queries ISP contract details |
| EKK0411C040 | SC Code | Optional Service Contract ISP Lookup Settlement SC — performs ISP settlement lookup |
| EKK0411C050 | SC Code | Optional Service Contract ISP Start of Use SC — sets the ISP service start-of-use date |
| EKK1091D010 | SC Code | Progress Registration SC — registers service contract progress status |
| EKK0021C060 | SC Code | Subscription Detail Lookup / Follow-up Request SC — retrieves subscription details |
| JFUTransferCC | CC Code | Service IF Result Data Transfer CC — transfers service interface results between systems |
| JKKHakkoSODCC | CC Code | Service Order Issuance CC — issues Service Order Data (SOD) for the registered service |
| FUSV0058 | Service ID | Mail Welcome Choice Service (FW Service) — the core service being subscribed to |
| SOD | Acronym | Service Order Data — the official service order record issued upon registration |
| ISP | Business term | Internet Service Provider — the optional internet service contract type |
| CC | Acronym | Customer Care / Common Component — shared business logic components in the architecture |
| SC | Acronym | Service Component — the backend service layer components that perform actual business operations |
| FW | Business term | Welcome Service — a customer welcome communication service (FW = File/Welcome) |
| `FUNC_CD_2` | Constant | Functional code "2" — hardcoded code used for security pack guidance flag determination |
| X31SDataBeanAccess | Technical | Shared form DataBean access object — the standard data carrier for passing form data across the view layer |
| X31SDataBeanAccessArray | Technical | Array wrapper for shared form DataBean access objects — enables hierarchical bean navigation |
