# Business Logic — ZMW01904SFLogic.addCfm() [78 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.ZMW01904SF.ZMW01904SFLogic` |
| Layer | Controller (Web View Logic — extends `JCCWebBusinessLogic`) |
| Module | `ZMW01904SF` (Package: `eo.web.webview.ZMW01904SF`) |

## 1. Role

### ZMW01904SFLogic.addCfm()

This method implements the **registration confirmation button press processing** (登録確認ボタン押下処理) for the **ENUM switching (ENUM切替) screen** — the business domain of telecom carrier switching for Japanese subscribers. It serves as the central entry point when a user clicks the "Register Confirmation" (登録確認) button on the ZMW01904 screen, which displays a summary of ENUM porting/switching details before final submission.

The method delegates core processing to the **ZMSV0134 BPM service**, an enterprise workflow engine call (via `invokeService`) that handles the business logic for ENUM switching operations. Prior to delegation, it configures the ENUM switch context (`setENUMSWITCHCC`) by setting the function code to `FUNC_CD_2` (processing mode). After the service completes, the method branches based on two decision axes: (1) whether the service returned an error flag (`ERR_FLG`), triggering an error display and re-display of the same screen (ZMW01904); and (2) the **application content flag** (`SINSEI_NAIYO_FLG`), which indicates the specific type of carrier switch — port-out cancellation (5), carrier transfer (6), or third-party number port cancellation (7) — each displaying a distinct contextual message to inform the user what operation is proceeding. On success, the method extracts the selected downstream carrier code from a pull-down list, displays a success confirmation message, and transfers control to screen ZMW01905 for the next step in the ENUM switching workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["addCfm()"])
    START --> GETBEAN["Get common info bean and service form bean"]
    GETBEAN --> INITMAP["Initialize paramMap, dataMap, outputMap"]
    INITMAP --> PARAMPUT["paramMap.put(usecaseId = SV134)"]
    PARAMPUT --> MAPPER["Create ZMSV0134_ZMSV0134OPDBMapper"]
    MAPPER --> ENUMSET["mapper.setENUMSWITCHCC(paramBean, dataMap, FUNC_CD_2)"]
    ENUMSET --> INVOKE["invokeService(paramMap, dataMap, outputMap)"]
    INVOKE --> GETERR["getStringSearch(ZMSV013401CC, outputMap, ERR_FLG)"]
    GETERR --> ERRFLG{Error flag not empty}
    ERRFLG -->|Yes| SETMSG["setMessage(errFlg)"]
    SETMSG --> SETNEXT["Set next screen ID name to ZMW01904"]
    SETNEXT --> TRANSFER["setTransferPageId(ZMW01904 .jsp)"]
    TRANSFER --> RETTRUE1["return true"]
    ERRFLG -->|No| CHECKFLAG{Check SINSEI_NAIYO_FLG}
    CHECKFLAG -->|Flag = 5| PORTOUT["Display Port Out cancellation message"]
    CHECKFLAG -->|Flag = 6| CNGAFITNSK["Display Carrier Transfer message"]
    CHECKFLAG -->|Flag = 7| BANGOPOHI["Display Number Port Cancellation message"]
    CHECKFLAG -->|Default| DISPLAYMSG["Proceed to display"]
    PORTOUT --> DISPLAYMSG
    CNGAFITNSK --> DISPLAYMSG
    BANGOPOHI --> DISPLAYMSG
    DISPLAYMSG --> SETSELCD["Get selected carrier code name from pull-down"]
    SETSELCD --> BEANSET["bean.set DSP_CNGAF_ITNSK_JGS_CD with selected value"]
    BEANSET --> SHOWMSG["Display success message EKB0370_I with ENUM switch"]
    SHOWMSG --> BACKCOLOR["Set message area back color"]
    BACKCOLOR --> SETNEXT2["Set next screen ID name to ZMW01905"]
    SETNEXT2 --> RETTRUE2["return true"]
    RETTRUE1 --> END(["End"])
    RETTRUE2 --> END
```

**CRITICAL — Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|-----------------|
| `JPCModelConstant.FUNC_CD_2` | `"2"` | Processing mode: Add/Edit mode |
| `JZMEnumSwitchConstCC.SINSEI_NAIYO_FLG_5` | `"5"` | Port Out (NTT phone number) cancellation |
| `JZMEnumSwitchConstCC.SINSEI_NAIYO_FLG_6` | `"6"` | Carrier Transfer (NTT phone number) |
| `JZMEnumSwitchConstCC.SINSEI_NAIYO_FLG_7` | `"7"` | Number Port Cancellation (third-party) |
| `MSG_VALUE_ADD` | `{"ENUM切替"}` | Confirmation message value — "ENUM Switch" |
| `JPCOnlineMessageConstant.EKBF960__Q` | Error/warning message key | Contextual notice for specific application content |
| `JPCOnlineMessageConstant.EKB0370__I` | Info message key | Success confirmation message |
| `JZMWebConst.ONE` | `"1"` | Color intensity value for message area background |
| `JZMWebConst.PJP` | `.jsp` | JSP page extension suffix |
| `JZMEnumSwitchConstCC.KEY_SINSEI_NAIYO_FLG` | `"key_sinsei_naiyo_flg"` | Application content flag key (used to read SINSEI_NAIYO_FLG from form bean) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters; it reads all business data from the thread-scoped `X31SDataBeanAccess` form beans and the class-level instance state (e.g., `commonInfoBean`). |

**Instance fields / external state read:**

| No | Source | Field / Accessor | Business Description |
|----|--------|-----------------|---------------------|
| 1 | `getCommonInfoBean()` | `X31SDataBeanAccess commoninfoBean` | Thread-scoped common info bean used to pass next-screen navigation metadata between screens |
| 2 | `getServiceFormBean()` | `X31SDataBeanAccess bean` | The service form bean (`ZMW01904SFBean`) holding the ENUM switch screen's form data, including pull-down selections |
| 3 | `paramBean[0]` (local) | `X31SDataBeanAccess` (reference to `bean`) | Parameter bean array used as input/output to the service invocation layer |
| 4 | `MSG_VALUE_ADD` (class constant) | `String[]` | Static message array holding the single value `{"ENUM切替"}` for success display |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `ZMSV0134_ZMSV0134OPDBMapper.setENUMSWITCHCC` | ZMSV0134 | - | Configures ENUM switch context data in `dataMap`, setting function code `FUNC_CD_2` (processing mode) for the ENUM switch operation |
| - | `ZMW01904SFLogic.invokeService` | ZMSV0134 | ZMSV0134 BPM Flow | Invokes the ZMSV0134 business process (ENUM switching) via the framework's service invocation layer; delegates full processing to the BPM engine |
| R | `ZMW01904SFLogic.getStringSearch` | ZMW01904SF | - | Retrieves the error flag (`ERR_FLG`) from the `outputMap` returned by the service call |
| - | `ZMW01904SFLogic.setMessage` | ZMW01904SF | - | Sets the error message using the error flag as the message key |
| - | `CommonInfoCFConst.NEXT_SCREEN_ID` / `X31SDataBeanAccess.sendMessageString` | CommonInfo | - | Writes the next screen ID (`ZMW01904`) to the common info bean for navigation routing |
| - | `CommonInfoCFConst.NEXT_SCREEN_NAME` / `X31SDataBeanAccess.sendMessageString` | CommonInfo | - | Writes the next screen name (`ZMW01904`) to the common info bean for display context |
| - | `ZMW03701SFLogic.setTransferPageId` | ZMW03701SF | - | Initiates a forced page transfer to `ZMW01904.jsp` when an error occurs |
| R | `JZMWebCommon.getPullDownSelectedValue` | JZMWebCommon | - | Reads the selected downstream carrier code name from the pull-down UI component (used for carrier post-switch data) |
| - | `ZMSV0134_ZMSV0134OPDBMapper.setENUMSWITCHCC` (local set) | ZMSV0134 | - | Sets `DSP_CNGAF_ITNSK_JGS_CD` (display carrier code) on the service form bean with the selected carrier name |
| - | `JZMWebCommon.setMessageInfo` | JZMWebCommon | - | Displays the success info message (`EKB0370__I`) with the "ENUM Switch" message value |
| - | `JZMWebCommon.setMessageAreaBackColor` | JZMWebCommon | - | Sets the message area background color to intensity `"1"` for success highlighting |
| - | `X31SDataBeanAccess.sendMessageString` (NEXT_SCREEN_ID/NAME) | CommonInfo | - | Sets the next screen ID/name (`ZMW01905`) on the common info bean for navigation after successful processing |
| - | `ZMW03701SFLogic.setTransferPageId` | ZMW03701SF | - | Initiates page transfer to the next screen (ZMW01905) |

### Analysis of the ZMSV0134 BPM Flow (called via `invokeService`)

The `invokeService` method delegates to the **ZMSV0134** BPM (Business Process Management) flow, which corresponds to the ENUM switching (ENUM切替) business process. The operation ID is `ZMSV0134OP`, and the operation class is `ZMSV0134OPOperation`, which maps to the process step `ZMSV013401CC`. The SC code for this service component is **ZMSV013401SC**. This is the core ENUM switching service that processes the carrier porting/switching request against backend telecom systems (likely including NTT's number portability infrastructure). The actual DB table interactions (reads and writes) occur within the ZMSV0134 BPM engine — not directly in this method — and involve carrier eligibility checks, number portability status, and service detail record updates.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C/R | `ZMSV0134OPOperation.invokeService` | ZMSV013401SC | (BPM internal — carrier portability tables, service detail records) | Invokes the ZMSV0134 ENUM switching BPM process — handles validation, carrier eligibility checks, and service registration for ENUM porting/switching |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:ZMW01904 | `ZMW01904.jsp` (PAGE_TRANSFER → ADD_CFM part) → `ZMW01904SFLogic.addCfm()` | `invokeService [C/R] ZMSV013401SC (BPM engine)` |

**Caller analysis:** The `addCfm()` method is invoked exclusively from screen **ZMW01904** (ENUM switching confirmation screen). The navigation is configured via `WEBVLCOMMANDMAP_ZMW019040PJP.xml`, where the `PAGE_TRANSFER` event mapped to the `ADD_CFM` part triggers the `addCfm` method. This is the registration confirmation action — the user reviews ENUM switch details on ZMW01904 and clicks "Register Confirmation" to submit the processing request. The method then navigates to screen **ZMW01905** (ZMW019050PJP) on success, or remains on **ZMW01904** on error.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (L321–L353) — Variable initialization and service invocation preparation

> Obtains the common info bean and service form bean, then initializes all data transfer maps and the mapping object for the service call.

| # | Type | Code |
|---|------|------|
| 1 | SET | `commoninfoBean = getCommonInfoBean()` // Get common form bean (共通フォームBeanの取得) |
| 2 | SET | `bean = getServiceFormBean()` // Get service form bean (サービスフォームBeanの内容の取得) |
| 3 | SET | `paramBean = { bean }` // Service form bean data bean access array |
| 4 | SET | `paramMap = new HashMap<String, Object>()` // Use case ID storage map (ユーケースID格納用マップ) |
| 5 | CALL | `paramMap.put(X31CWebConst.TELEGRAM_INFO_USECASE_ID, JZMEnumSwitchConstCC.SV134)` // Set usecase ID to SV134 |
| 6 | SET | `dataMap = new HashMap<String, Object>()` // Mapping map (マッピング用マップ) |
| 7 | SET | `outputMap = new HashMap<String, Object>()` // Service execution result data map (サービス実行結果データ用マップ) |
| 8 | SET | `mapper = new ZMSV0134_ZMSV0134OPDBMapper()` // Instantiate mapping instance (マッピングクラスのインスタンスを生成) |
| 9 | CALL | `mapper.setENUMSWITCHCC(paramBean, dataMap, JPCModelConstant.FUNC_CD_2)` // ENUM switch CC (ENUM切替CC) |

**Block 2** — [CALL] (L355) — Service invocation

> Invokes the ZMSV0134 BPM service to execute the ENUM switching business logic.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `invokeService(paramMap, dataMap, outputMap)` // Service call (サービスの呼び出し) |

**Block 3** — [IF] `(errFlg is not empty)` (L357–L370) — Error handling branch

> If the service returned a non-null error flag, set the error message, configure the navigation back to ZMW01904 (the same screen), and force a page transfer — effectively re-displaying the confirmation screen so the user can correct the issue.

| # | Type | Code |
|---|------|------|
| 1 | SET | `errFlg = getStringSearch("ZMSV013401CC", outputMap, "ERR_FLG")` // Get error flag (エラーフラグの取得) |
| 2 | EXEC | `if (!StringUtils.isEmpty(errFlg))` // Check if error flag is set |
| 3 | CALL | `setMessage(errFlg)` // Set message based on error flag (エラーフラグを元にメッセージを設定) |
| 4 | CALL | `commoninfoBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW01904)` // Set next screen ID to ZMW01904 |
| 5 | CALL | `commoninfoBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_NAME_ZMW01904)` // Set next screen name to ZMW01904 |
| 6 | CALL | `setTransferPageId(JZMScreenConst.SCREEN_ID_ZMW01904 + JZMWebConst.PJP)` // Forced page transfer (強制画面遷移) |
| 7 | RETURN | `return true` |

**Block 4.1** — [ELSE-IF] `(SINSEI_NAIYO_FLG == "5")` (L372–L375) — Port Out cancellation

> When there is no error AND the application content flag is "5" (port-out with NTT phone number), display a contextual notice informing the user about port-out cancellation processing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `SINSEI_NAIYO_FLG_5.equals(paramBean[0].sendMessageString(ZMW01904SFConst.SINSEI_NAIYO_FLG, X31CWebConst.DATABEAN_GET_VALUE))` // Check SINSEI_NAIYO_FLG == "5" (申請内容がポートアウト(NTT電話番号)・消の場合) |
| 2 | SET | `MSG_VALUE = {"ポートアウト"}` // Port out message value |
| 3 | CALL | `JZMWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKBF960__Q, MSG_VALUE)` // Display Port Out notice |

**Block 4.2** — [ELSE-IF] `(SINSEI_NAIYO_FLG == "6")` (L376–L379) — Carrier Transfer

> When flag is "6" (carrier transfer with NTT phone number), display a notice about carrier transfer processing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `SINSEI_NAIYO_FLG_6.equals(paramBean[0].sendMessageString(ZMW01904SFConst.SINSEI_NAIYO_FLG, X31CWebConst.DATABEAN_GET_VALUE))` // Check SINSEI_NAIYO_FLG == "6" (事業者間転移(NTT電話番号)の場合) |
| 2 | SET | `MSG_VALUE = {"事業者間転移"}` // Carrier transfer message value |
| 3 | CALL | `JZMWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKBF960__Q, MSG_VALUE)` // Display carrier transfer notice |

**Block 4.3** — [ELSE-IF] `(SINSEI_NAIYO_FLG == "7")` (L380–L383) — Number Port Cancellation

> When flag is "7" (number port cancellation with third-party receipt), display a notice about number port cancellation.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `SINSEI_NAIYO_FLG_7.equals(paramBean[0].sendMessageString(ZMW01904SFConst.SINSEI_NAIYO_FLG, X31CWebConst.DATABEAN_GET_VALUE))` // Check SINSEI_NAIYO_FLG == "7" (申請内容が番ポ廃止(他社受付)・消の場合) |
| 2 | SET | `MSG_VALUE = {"番ポ廃止"}` // Number port cancellation message value |
| 3 | CALL | `JZMWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKBF960__Q, MSG_VALUE)` // Display number port cancellation notice |

**Block 5** — [SET] (L385–L391) — Post-processing: display preparation

> Regardless of which application content branch was taken (or if none matched), proceed with post-processing: extract the selected downstream carrier name from the pull-down, display a success message, set the next screen to ZMW01905, and return true to proceed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `cangaf_itns_tsjgs_cd_nm = JZMWebCommon.getPullDownSelectedValue(bean, CNGAF_ITNSK_JGS_CD_INFO, CNGAF_ITNSK_JGS_NM_LIST_01, CNGAF_ITNSK_JGS_CD_SEL_01)` // Get selected carrier code name (選択された転移先通信事業者コード名を設定) |
| 2 | CALL | `bean.sendMessageString(ZMW01904SFConst.DSP_CNGAF_ITNSK_JGS_CD, X31CWebConst.DATABEAN_SET_VALUE, cangaf_itns_tsjgs_cd_nm)` // Set display carrier code |
| 3 | CALL | `JZMWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0370__I, MSG_VALUE_ADD)` // Display success message (メッセージの表示) |
| 4 | CALL | `JZMWebCommon.setMessageAreaBackColor(this, JZMWebConst.ONE)` // Set message area back color |
| 5 | CALL | `commoninfoBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_ID_ZMW01905)` // Set next screen ID to ZMW01905 |
| 6 | CALL | `commoninfoBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JZMScreenConst.SCREEN_NAME_ZMW01905)` // Set next screen name to ZMW01905 |
| 7 | RETURN | `return true` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-----------------|
| `SINSEI_NAIYO_FLG` | Field | Application content flag — classifies the type of ENUM switching request submitted by the user |
| `SINSEI_NAIYO_FLG_5` | Constant | Port Out (NTT phone number) cancellation — subscriber is cancelling their NTT phone number as part of the port-out process |
| `SINSEI_NAIYO_FLG_6` | Constant | Carrier Transfer (NTT phone number) — subscriber is transferring their NTT phone number to a new carrier |
| `SINSEI_NAIYO_FLG_7` | Constant | Number Port Cancellation (third-party) — subscriber is cancelling a number port that was being handled by a third-party provider |
| `ERR_FLG` | Field | Error flag returned by the service layer — non-empty value indicates the service execution failed and an error message key is present |
| `ZMSV0134` | Business term | ENUM switching (ENUM切替) service — a BPM-based business process that handles telecom carrier porting/switching operations for Japanese subscribers |
| `ZMSV013401CC` | Service Component | The core processing component within the ZMSV0134 BPM flow — handles ENUM switch validation and service execution |
| ENUM | Business term | ENUM (Electronic Number Mapping) switching — the process of switching a subscriber's telecom carrier while retaining their phone number under Japan's number portability regulations |
| `FUNC_CD_2` | Constant | Function code "2" — indicates add/edit processing mode for the ENUM switch operation |
| `SV134` | Constant | Use case ID "SV134" — identifies the ENUM switching use case for the telegram tracking framework |
| `DSP_CNGAF_ITNSK_JGS_CD` | Field | Display carrier code after switch — the selected downstream carrier code name to show on the confirmation screen |
| `CNGAF_ITNSK_JGS_CD_SEL_01` | Field | Post-switch carrier code selection — the value selected by the user from the carrier pull-down component |
| `CNGAF_ITNSK_JGS_NM_LIST_01` | Field | Post-switch carrier name list — the list of available carrier names for the pull-down |
| `CNGAF_ITNSK_JGS_CD_INFO` | Field | Post-switch carrier code info — the data bean field containing the selected carrier information |
| `ポートアウト` | Field | Port Out — NTT phone number cancellation as part of the carrier switching process |
| `事業者間転移` | Field | Carrier Transfer — transfer of a subscriber line between telecom carriers (NTT phone number) |
| `番ポ廃止` | Field | Number Port Cancellation — cancellation of a number portability request that was being handled by a third-party provider |
| `MSG_VALUE_ADD` | Constant | Static message array containing `{"ENUM切替"}` — used for success confirmation message display |
| `EKB0370__I` | Constant | Info message key — displays the success/confirmation message to the user |
| `EKBF960__Q` | Constant | Warning/inquiry message key — displays contextual notices about the specific type of carrier switch being processed |
| `NEXT_SCREEN_ID` | Constant | Navigation key — the common info field that specifies which screen to display next |
| `NEXT_SCREEN_NAME` | Constant | Navigation key — the common info field that specifies the display name of the next screen |
| ZMW01904 | Screen | ENUM switching confirmation screen — displays the summary of ENUM switch details for user review before submission |
| ZMW01905 | Screen | ENUM switching result screen — the next screen displayed after successful confirmation processing |
| `invokeService` | Method | Framework service invocation — delegates to the BPM engine to execute the ZMSV0134 business process |
| `setENUMSWITCHCC` | Method | ENUM switch configuration — sets up the ENUM switching context data (function code, mode) in the data map for the BPM call |
| `getPullDownSelectedValue` | Method | UI helper — extracts the display name of the carrier selected from a dropdown/pull-down component |
| `setMessageAreaBackColor` | Method | UI formatting — sets the background color intensity of the message display area for visual feedback |
| JSP | Technical | JavaServer Pages — the presentation technology used for screen rendering (`.jsp` extension) |
| `key_sinsei_naiyo_flg` | Field Key | The form bean key used to read/write the application content flag (SINSEI_NAIYO_FLG) from the data bean |
