# Business Logic — KKW03201SFLogic.actionCfm() [54 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW03201SF.KKW03201SFLogic` |
| Layer | Service Logic (Web Service / SF Logic) |
| Module | `KKW03201SF` (Package: `eo.web.webview.KKW03201SF`) |

## 1. Role

### KKW03201SFLogic.actionCfm()

This method is the **confirmation handler** for the "050 Number Issuance Registration" screen (登録画面「登録確認」ボタン押下 — "Registered screen 'Registration Confirmation' button pressed"). It is invoked when a user presses the "Registration Confirmation" (登録確認) button after reviewing their service contract details on the registration screen.

The method orchestrates a three-phase workflow: **data synchronization**, **service execution**, and **confirmation page preparation**. First, it synchronizes critical identifiers (SYSID and Service Contract Number) from the main service form bean into the customer contract sub-bean list, ensuring downstream processing has access to the correct customer context. Second, it delegates the core registration logic to `createOpSvcKei(FUNC_CD_2)`, which executes the 050 Number Issuance Registration Confirmation service through a chain of mapper methods and service components. Third, upon successful service execution, it assembles the service start date display field from year/month/day components, configures navigation to the next screen (KKW03202), and emits a confirmation message (EKB0370--I: "050 number issued").

The method implements a **delegation pattern** — it does not directly manipulate data but orchestrates by calling `createOpSvcKei`, which in turn uses a mapper (`KKSV0101_KKSV0101OPDBMapper`) to populate input maps from form beans before invoking the service layer via `invokeService`. It serves as the **entry point confirmation action** for the 050 Number Issuance registration flow, bridging the registration confirmation screen (KKW03201) to the determination screen (KKW03202).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionCfm()"])
    START --> GET_BEAN["Get ServiceFormBean via getServiceFormBean()"]
    GET_BEAN --> GET_LIST["Retrieve customer list via getDataBeanArray(HKTGI_CUST_KEI_HKTGI_LIST)"]
    GET_LIST --> GET_SUB["Get first customer bean via getDataBean(0)"]
    GET_SUB --> SET_SYSID["Set SYSID between form and subbean"]
    SET_SYSID --> SET_SVC["Set SVC_KEI_NO between form and subbean"]
    SET_SVC --> CALL_CREATE["Call createOpSvcKei(FUNC_CD_2)"]
    CALL_CREATE --> CHECK_RESULT{"createOpSvcKei result?"}
    CHECK_RESULT -->|true| SET_DSP_DATE["Set DSP_USE_STAYMD from year/month/day"]
    SET_DSP_DATE --> SET_COMMON["Set common bean NEXT_SCREEN_ID/NAME to KKW03202"]
    SET_COMMON --> SET_MSG["Call setMessageInfo with EKB0370--I"]
    SET_MSG --> RETURN_TRUE["Return true"]
    CHECK_RESULT -->|false| RETURN_RESULT["Return true (error already handled)"]
```

**Constant Resolutions:**

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `HKTGI_CUST_KEI_HKTGI_LIST` (inherited) | Customer contract succession list key | Field in form bean holding customer contract sub-beans |
| `SYSID` | "ＳＹＳＩＤ" | System ID — unique customer identifier |
| `SVC_KEI_NO` | "サービス契約番号" | Service Contract Number — the service line contract identifier |
| `SVC_KEI_NO_04` | "サービス契約番号" | Service Contract Number (customer sub-bean key) |
| `SYSID_04` | "ＳＹＳＩＤ" | System ID (customer sub-bean key) |
| `DSP_USE_STAYMD` | "表示用利用開始日" | Display-use service start date (formatted output) |
| `USE_STAYMD_YEAR` | "利用開始日（年）" | Service start date — year component |
| `USE_STAYMD_MON` | "利用開始日（月）" | Service start date — month component |
| `USE_STAYMD_DAY` | "利用開始日（日）" | Service start date — day component |
| `FUNC_CD_2` | 2 (JPCModelConstant) | Function code indicating "confirmation" mode (not creation) |
| `NEXT_SCREEN_ID` (CommonInfoCFConst) | "Next screen ID" | Navigation target screen identifier |
| `NEXT_SCREEN_NAME` (CommonInfoCFConst) | "Next screen name" | Navigation target screen name |
| `SCREEN_ID_KKW03202` | KKW03202 | Screen ID for the determination screen (決定画面) |
| `SCREEN_NAME_KKW03202` | KKW03202 screen name | Screen name for the determination screen |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | (none) | — | This method takes no parameters; it operates on the form bean state stored in the parent class hierarchy. |

**Instance fields / external state read:**

| Source | Accessor | Business Description |
|--------|----------|---------------------|
| Parent | `getServiceFormBean()` | Retrieves the service form bean containing all user-entered data for the 050 number registration screen |
| Parent | `getCommonInfoBean()` | Retrieves the shared common info bean used for cross-screen navigation state (next screen ID/name) |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `KKW03201SFLogic.createOpSvcKei` | KKW03201SFLogic | — | Delegates to `createOpSvcKei` with FUNC_CD_2 (confirmation mode) |
| C | `KKW03201SFLogic.set050InfoBean` | KKW03201SFLogic | — | Prepares 050 number info from form bean into param bean (called within createOpSvcKei) |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010101SC` | KKSV010101SC | — | Maps form data to input map — customer/service header data |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010102SC` | KKSV010102SC | — | Maps form data to input map — service detail data |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010103SC` | KKSV010103SC | — | Maps form data to input map |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010104SC` | KKSV010104SC | — | Maps form data to input map |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010105SC` | KKSV010105SC | — | Maps form data to input map |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010106SC` | KKSV010106SC | — | Maps form data to input map |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010107SC` | KKSV010107SC | — | Maps form data to input map |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010108SC` | KKSV010108SC | — | Maps form data to input map |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010109SC` | KKSV010109SC | — | Maps form data to input map (IT barrier KK1-0113 support) |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010110SC` | KKSV010110SC | — | Maps form data to input map (IT barrier KK1-0113 support) |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010111SC` | KKSV010111SC | — | Maps form data to input map |
| C | `KKSV0101_KKSV0101OPDBMapper.setKKSV010112CC` | KKSV010112CC | — | Maps form data to input map via CC (component) layer (KAD-2012-00000087) |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010112SC` | KKSV010112SC | — | Maps form data to input map via SC layer |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010113SC` | KKSV010113SC | — | Maps form data to input map (FUNC_CD_2) |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010114SC` | KKSV010114SC | — | Maps form data to input map (optional, commented ADD) |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010116SC` | KKSV010116SC | — | Maps form data to input map (IT1-2014-0000028) |
| R | `KKSV0101_KKSV0101OPDBMapper.setKKSV010117SC` | KKSV010117SC | — | Maps form data to input map (OM-2015-0000564) |
| C | `KKW03201SFLogic.invokeService` | — | — | Invokes the service layer with assembled input/output maps |
| C | `KKW03201SFLogic.setErrorMessageInfo` | — | — | Checks for and processes error messages from service output (OM-2015-0000564) |
| C | `JKCWebCommon.setMessageInfo` | JKCWebCommon | — | Sets confirmation info message "050 Number Issued" (EKB0370--I) |
| R | `OneStopDataBeanAccess.getDataBeanArray` | OneStopDataBeanAccess | — | Reads customer contract list from form bean |
| R | `OneStopDataBeanAccess.getDataBean` | OneStopDataBeanAccess | — | Reads specific sub-bean from customer list |
| C | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | — | Sets/gets values on data beans (SYSID, SVC_KEI_NO, date fields, next screen info) |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW03201 (Registration Confirmation screen) | `KKW03201SFController.actionCfm` -> `KKW03201SFLogic.actionCfm` | `createOpSvcKei [C] KKSV0101 SC chain` |
| 2 | Screen:KKSV0101 (Mapper layer — downstream) | `KKW03201SFLogic.actionCfm` -> `createOpSvcKei` -> `KKSV0101OPDBMapper` -> `invokeService` | `setKKSV010101SC [C] Customer/Service header` |
| 3 | Screen:KKSV0101 (Mapper layer — downstream) | Same as #2, terminal path | `setKKSV010102SC through setKKSV010117SC [R/C] Service item data` |

**Notes:**
- `KKW03201SFLogic` is invoked from the web controller/framework that routes to the `actionCfm()` action method.
- The downstream service chain (KKSV0101 OPDBMapper) maps 17 sets of service items (01–17) from the form bean to input maps before calling `invokeService`, which dispatches to the backend service components.
- The 050 number issuance registration confirmation creates a service contract line item with an issued 050 number and transitions to the determination screen (KKW03202).

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] `Get ServiceFormBean` (L593)

> Retrieve the service form bean that holds all user-entered registration data for the 050 number issuance process.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X31SDataBeanAccess svcFormBean = super.getServiceFormBean();` // Get ServiceFormBean access class

**Block 2** — [EXEC] `Retrieve customer list` (L595)

> Fetch the customer contract succession list from the form bean to access the customer context (SYSID, service number).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X31SDataBeanAccessArray custList = svcFormBean.getDataBeanArray(JKKCommonConst.HKTGI_CUST_KEI_HKTGI_LIST);` // Retrieve customer list by condition [-> HKTGI_CUST_KEI_HKTGI_LIST = customer contract succession list key] |

**Block 3** — [EXEC] `Get first customer sub-bean` (L596)

> Obtain the first (and typically only) customer sub-bean from the customer list to read/write customer identifiers.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X31SDataBeanAccess subbean = custList.getDataBean(0);` // Get first customer bean |

**Block 4** — [EXEC] `Set SYSID to sub-bean` (L597–599)

> Transfer the SYSID from the main form bean to the customer sub-bean so the service layer can identify the correct customer.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.SYSID, X31CWebConst.DATABEAN_SET_VALUE, subbean.sendMessageString(KKW03201SFConst.SYSID_04, X31CWebConst.DATABEAN_GET_VALUE));` // Set SYSID = "ＳＹＳＩＤ" from form to sub-bean SYSID_04 key |

**Block 5** — [EXEC] `Set SVC_KEI_NO to sub-bean` (L602–605)

> Transfer the Service Contract Number from the main form bean to the customer sub-bean for service line identification.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.SVC_KEI_NO, X31CWebConst.DATABEAN_SET_VALUE, subbean.sendMessageString(KKW03201SFConst.SVC_KEI_NO_04, X31CWebConst.DATABEAN_GET_VALUE));` // Set SVC_KEI_NO = "サービス契約番号" from form to sub-bean [20130219 ST2-2013-0000698 ADD] |

**Block 6** — [CALL] `Execute registration confirmation service` (L608)

> Delegate the core 050 Number Issuance Registration Confirmation service execution. `FUNC_CD_2` indicates "confirmation mode" (as opposed to FUNC_CD_1 for initial screen display). The `createOpSvcKei` method prepares form data via `set050InfoBean`, populates 17 sets of input maps through the KKSV0101 mapper, and invokes the service chain.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `boolean exeResult = createOpSvcKei(JPCModelConstant.FUNC_CD_2);` // Execute registration confirmation service [FUNC_CD_2 = confirmation mode] |

**Block 7** — [IF-ELSE] `Check createOpSvcKei result` (L609)

> Conditional branch based on whether the service execution succeeded. If successful, prepare the confirmation display; if failed, skip display setup (errors are handled internally by `createOpSvcKei` and `setErrorMessageInfo`).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (exeResult)` { // Registration confirmation service execution result |

**Block 7.1** — [EXEC] `Set display service start date` (L612–621)

> Concatenate year/month/day components into a formatted date string (YYYY/MM/DD) and store in the DSP_USE_STAYMD field for display on the confirmation page.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svcFormBean.sendMessageString(KKW03201SFConst.DSP_USE_STAYMD, X31CWebConst.DATABEAN_SET_VALUE, svcFormBean.sendMessageString(KKW03201SFConst.USE_STAYMD_YEAR, X31CWebConst.DATABEAN_GET_VALUE) + "/" + svcFormBean.sendMessageString(KKW03201SFConst.USE_STAYMD_MON, X31CWebConst.DATABEAN_GET_VALUE) + "/" + svcFormBean.sendMessageString(KKW03201SFConst.USE_STAYMD_DAY, X31CWebConst.DATABEAN_GET_VALUE));` // Set display date as "YYYY/MM/DD" from year + "/" + month + "/" + day |

**Block 7.2** — [EXEC] `Set common form bean for navigation` (L624–630)

> Configure the shared common info bean with the next screen identifier (KKW03202), enabling the framework to redirect to the determination screen after this confirmation completes.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X31SDataBeanAccess commonBean = super.getCommonInfoBean();` // Get shared common bean |
| 2 | EXEC | `commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JKKScreenConst.SCREEN_ID_KKW03202);` // Set next screen ID = KKW03202 |
| 3 | EXEC | `commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JKKScreenConst.SCREEN_NAME_KKW03202);` // Set next screen name = KKW03202 |

**Block 7.3** — [CALL] `Set confirmation message` (L633–634)

> Display an information message to the user confirming that the 050 number has been issued. Message ID EKB0370--I with parameter "050番号発行の登録" (050 Number Issuance Registration).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `String[] str = { "０５０番号発行の登録" };` // Confirmation message parameter array [English: "050 Number Issuance Registration"] |
| 2 | CALL | `JCCWebCommon.setMessageInfo(this, "EKB0370--I", str);` // Display confirmation message EKB0370--I |

**Block 8** — [RETURN] `Return success` (L636)

> Always returns `true` indicating normal completion. Errors during `createOpSvcKei` are handled internally (error messages are set via `setErrorMessageInfo`) and do not cause this method to return `false`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Normal end: true, Abnormal end: false |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `actionCfm` | Method | Registration Confirmation action — handles the "Registration Confirmation" (登録確認) button press on the 050 number issuance registration screen |
| `createOpSvcKei` | Method | Create Optional Service Detail — core service registration logic that prepares and invokes the 050 number issuance confirmation service |
| `FUNC_CD_2` | Constant | Function Code 2 — confirmation mode indicator (as opposed to FUNC_CD_1 for screen initialization) |
| `HKTGI_CUST_KEI_HKTGI_LIST` | Field | Customer contract succession list — DataBean array holding customer contract context records |
| `SYSID` | Field | System ID — unique identifier for the customer/residential account |
| `SVC_KEI_NO` | Field | Service Contract Number — identifies a service line item within a customer account |
| `DSP_USE_STAYMD` | Field | Display-use service start date — formatted date for screen display (YYYY/MM/DD) |
| `USE_STAYMD_YEAR` / `_MON` / `_DAY` | Fields | Service start date — year / month / day components, extracted individually and concatenated |
| `NEXT_SCREEN_ID` | Field | Next screen identifier — navigation target for the framework |
| `KKW03202` | Screen | Determination screen (決定画面) — the screen displayed after confirmation, where the user finalizes the registration |
| `KKSV0101` | Screen / Mapper | Service registration screen (KKSV0101) — the underlying service item configuration screen that 050 number issuance relies on; its OPDBMapper populates 17 sets of service item data |
| `EKB0370--I` | Message ID | Confirmation information message — displayed to user upon successful 050 number issuance registration ("050番号発行の登録") |
| 050 Number | Business term | 050 Number — Japan's unified VoIP phone number prefix (050-XXXX-XXXX), enabling business VoIP service registration |
| Optional Service (オプションサービス) | Business term | Optional service — add-on/ancillary telecom services registered under a customer's main contract (OP_SVC_CD_050 = "B029") |
| `set050InfoBean` | Method | Prepares 050 number registration data from the form bean into the parameter structure for service invocation |
| `invokeService` | Method | Invokes the backend service layer with prepared input/output maps, dispatching to the appropriate SC (Service Component) chain |
| `JCCWebCommon.setMessageInfo` | Method | Sets an information message for display to the user on the web screen |
| OneStopDataBeanAccess | Framework class | Data bean access utility that provides getDataBeanArray, getDataBean, and sendMessageString for form bean data manipulation |
| Service Contract | Business entity | A service line item within a customer account, tracking service details, pricing, start dates, and status |
| Customer Contract Succession | Business concept | The relationship/linkage between customer accounts (e.g., parent-child or succession scenarios) |
