# Business Logic — SCW00401SFLogic.fix() [31 LOC]

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

## 1. Role

### SCW00401SFLogic.fix()

This method implements the **confirmation button press processing** (確定ボタン押下処理) for the VLAN-ID new registration screen (SCW00401). It is the primary write operation handler that commits a telephone-use VLAN order to the backend Business Processing (BP) system. Specifically, it retrieves the service form bean containing the customer's telephone-use VLAN order data, validates the REST item data list (`ESC0021A010CBSMSG1LIST`), maps the data to the SCSV0005 BP input format via `SCSV0005_SCSV0005OPDBMapper`, and invokes the SCSV0005 service component to execute the registration. The method uses function code 3 (`FUNC_CD_3 = "3"`) to signal a new registration operation to the BP. If the BP service returns an error message result, the method sets the error display and returns `false` to keep the user on the current screen. On success, it sets a success message ("VLAN-ID registration") and navigates to the VLAN-ID registration completion screen (SCW00403), returning `true`. This method follows the standard K-Opticom web screen entry-point pattern: it serves as the single write-procedure dispatch point for the VLAN-ID registration confirmation flow, acting as both a data mapper orchestrator and a screen navigation controller.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["fix() Entry"])
    
    START --> INIT["Initialize: paramMap, inputMap, outputMap (HashMap)"]
    INIT --> GETBEAN["Get service form bean: bean = super.getServiceFormBean()"]
    GETBEAN --> CREATEARRAY["Create paramBean array: paramBean[0] = bean"]
    CREATEARRAY --> VALIDATE["Validate REST item data: subbean = bean.getDataBeanArray(ESC0021A010CBSMSG1LIST).getDataBean(0)"]
    VALIDATE --> SETMAP["Set paramMap: TELEGRAM_INFO_USECASE_ID = \"SCSV0005\""]
    SETMAP --> CREITEMAP["Create SCSV0005_SCSV0005OPDBMapper instance"]
    CREITEMAP --> CALLMAPPER["Call setSCSV000501SC(paramBean, inputMap, FUNC_CD_3)"]
    CALLMAPPER --> INVOKE["Call invokeService(paramMap, inputMap, outputMap)"]
    INVOKE --> CHECK_RESULT{"msgResult != null?"}
    CHECK_RESULT -->|true| SETERRMSG["Set error message: JCCWebCommon.setMessageInfo(this, msgResult)"]
    SETERRMSG --> RETFALSE["Return false"]
    CHECK_RESULT -->|false| SETOKMSG["Set success message: EKB0380__I with MSG_REGISTER_VLAN_ID"]
    SETOKMSG --> SETNEXT["Set next screen: SCW00403 / VLAN-ID登録完了画面"]
    SETNEXT --> RETTRUE["Return true"]
    RETFALSE --> END(["End"])
    RETTRUE --> END
```

**CRITICAL — Constant Resolution:**
- `FUNC_CD_3` = `"3"` (JPCModelConstant — Function Code 3, indicates new service registration operation for the BP)
- `EKB0380__I` = `"EKB0380--I"` (JPCOnlineMessageConstant — success message key for "VLAN-ID registration")
- `MSG_REGISTER_VLAN_ID` = `"VLAN-IDの登録"` (VLAN-ID registration — message text parameter for the success message)
- `SCREEN_ID_SCW00403` = `"SCW00403"` (Next screen ID)
- `SCREEN_NAME_SCW00403` = `"VLAN-ID登録完了画面"` (VLAN-ID Registration Completion Screen)
- `ESC0021A010CBSMSG1LIST` = `"電話用VLANオダ一覧"` (Telephone-use VLAN order list — data bean list for VLAN order data)
- `TELEGRAM_INFO_USECASE_ID` = `"SCSV0005"` (BP use-case identifier for telephone-use VLAN order receipt)

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. All input data is read from the service form bean (`X31SDataBeanAccess`) obtained via `super.getServiceFormBean()`, which holds the current screen state and user-entered VLAN order data. |
| - | `super.getServiceFormBean()` (inherited) | `X31SDataBeanAccess` | The service form bean containing the current screen's data. It holds the K-Opticom service contract number, telephone-use VLAN order list (ESC0021A010CBSMsg1List), and other form-bound data submitted by the user from the SCW00401 screen. |
| - | `paramMap` | `HashMap` | Internal parameter map passed to `invokeService`. Contains the `TELEGRAM_INFO_USECASE_ID` key set to `"SCSV0005"` to identify the target BP use-case. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `SCSV0005_SCSV0005OPDBMapper.setSCSV000501SC` | SCSV0005 | BP: Telephone-use VLAN Order Receipt | Maps the service form bean data (service contract number, VLAN order code, request type) to the BP input parameter map for function code 3 (new registration) |
| C | `JCCWebBusinessLogic.invokeService` | SCSV0005 | BP: Telephone-use VLAN Order Receipt | Invokes the SCSV0005 Business Processing service to register the telephone-use VLAN order. Internally dispatches via `wksijInvokeService` and then to `super.invokeService()` which calls the BP layer. |
| - | `JCCWebCommon.setMessageInfo` | - | - | Sets error/success message info on the screen context for display to the user |
| - | `SCW00401SFLogic.setNextScreen` | - | - | Configures the next screen navigation target (SCW00403 — VLAN-ID registration completion screen) |
| R | `X31SDataBeanAccess.getDataBeanArray` | - | - | Retrieves the telephone-use VLAN order list (ESC0021A010CBSMsg1List) from the form bean |
| R | `X31SDataBeanAccess.getDataBean(int)` | - | - | Retrieves the first element (index 0) from the VLAN order list for validation |

**CRUD classification rationale:**
- **C (Create)**: The `invokeService` call to SCSV0005 with `FUNC_CD_3` ("3") is a new service registration. The mapper prepares the BP payload with `vlan_order_cd = JSCStrConstant.VLAN_NEW` and `yokyu_sbt_cd = JSCStrConstant.YOKYU_SBT_NEW` (from `SCSV0005_SCSV0005OPDBMapper.setSCSV000501SC`), confirming this is a create/register operation for the telephone-use VLAN order.
- **R (Read)**: Data bean access methods retrieve data from the form bean for validation and mapping purposes only — no DB queries.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:SCW00401 | `SCW00401SFLogic.fix` (entry point called from screen controller for "fix" / "confirm" button action) | `SCSV0005 [C] BP: Telephone-use VLAN Order Receipt` |

**Notes on callers:**
- The `SCW00401SF` screen (VLAN-ID new registration) dispatches to `fix()` when the user presses the confirmation button (確定ボタン). The screen controller routes the button action to the `SCW00401SFLogic.fix()` method through the X31 web framework's action dispatch mechanism.
- No other screens or batches directly call `SCW00401SFLogic.fix()` — it is specific to the SCW00401 VLAN-ID registration screen.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET / INIT] (L170)

> Initialize local data structures for the service invocation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap()` // Parameter map for invokeService |
| 2 | SET | `inputMap = new HashMap()` // Input map for SCSV0005 BP |
| 3 | SET | `outputMap = new HashMap()` // Output map for SCSV0005 BP |

**Block 2** — [SET] (L172-173)

> Retrieve the service form bean and wrap it into an array for the mapper.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean = super.getServiceFormBean()` // Get the form bean from the X31 framework |
| 2 | SET | `paramBean = {bean}` // Array wrapper for mapper method signature |

**Block 3** — [EXEC] (L176)

> Validate REST (remaining) item data by accessing the telephone-use VLAN order list and retrieving the first element. This acts as a data integrity check — if the list is empty or malformed, this will throw an exception, causing the method to fail.

| # | Type | Code |
|---|------|------|
| 1 | SET | `subbean = paramBean[0].getDataBeanArray(ESC0021A010CBSMSG1LIST).getDataBean(0)` // [-> ESC0021A010CBSMSG1LIST = "電話用VLANオダ一覧"] Retrieves the first VLAN order record from the form |

**Block 4** — [SET] (L179)

> Set the BP use-case identifier in the parameter map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(TELEGRAM_INFO_USECASE_ID, "SCSV0005")` // [-> TELEGRAM_INFO_USECASE_ID identifies the target BP use-case] |

**Block 5** — [SET / EXEC] (L180)

> Create the mapper instance for SCSV0005 data bean-to-BP parameter mapping.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapper = new SCSV0005_SCSV0005OPDBMapper()` // [BP (Telephone-use VLAN Order Receipt) data mapper class] |

**Block 6** — [CALL] (L181)

> Map the form bean data to the BP input map with function code 3 (new registration). The mapper extracts the K-Opticom service contract number, sets the request source application type code to `"2"` (業務 — Business/Work), sets VLAN order code to new, request type code to new, and VLAN server code to `SETSUBI` (設置 — Installation/Setup).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setSCSV000501SC(paramBean, inputMap, FUNC_CD_3)` // [-> FUNC_CD_3 = "3" (New registration function code)] |

**Block 7** — [CALL] (L182)

> Invoke the SCSV0005 Business Processing service to perform the actual telephone-use VLAN order registration. The parent class `JCCWebBusinessLogic.invokeService` internally routes to `wksijInvokeService` and then delegates to the framework's base invoke.

| # | Type | Code |
|---|------|------|
| 1 | SET | `msgResult = invokeService(paramMap, inputMap, outputMap)` // Returns X31CMessageResult from BP |

**Block 8** — [IF] `(msgResult != null)` (L183-187)

> Branch on BP service invocation result. If `msgResult` is non-null, the BP returned an error condition.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JCCWebCommon.setMessageInfo(this, msgResult)` // Set error message info on screen context for display |
| 2 | RETURN | `return false` // Return failure; user stays on SCW00401 screen |

**Block 9** — [ELSE-implicit: `msgResult == null`] (L190-193)

> The BP service succeeded (no error message result). Set the success message and navigate to the completion screen.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JCCWebCommon.setMessageInfo(this, EKB0380__I, new String[]{MSG_REGISTER_VLAN_ID})` // [-> EKB0380__I = "EKB0380--I" (success message key), MSG_REGISTER_VLAN_ID = "VLAN-IDの登録" (VLAN-ID registration)] Sets the success message for display |
| 2 | EXEC | `setNextScreen(SCREEN_ID_SCW00403, SCREEN_NAME_SCW00403)` // [-> SCREEN_ID_SCW00403 = "SCW00403", SCREEN_NAME_SCW00403 = "VLAN-ID登録完了画面"] Navigates to the VLAN-ID registration completion screen |
| 3 | RETURN | `return true` // Return success; screen transition to SCW00403 |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `fix()` | Method | Confirmation button press processing — commits the VLAN order to the backend BP system (確定ボタン押下処理) |
| `ESC0021A010CBSMSG1LIST` | Field | Telephone-use VLAN order list (電話用VLANオダ一覧) — DataBean list containing the VLAN order records displayed on the form |
| `FUNC_CD_3` | Constant | Function code "3" — indicates new service registration operation in the BP system (New Registration mode) |
| `EKB0380__I` | Constant | Success message identifier "EKB0380--I" — standard message key for successful registration completion |
| `MSG_REGISTER_VLAN_ID` | Constant | Message text "VLAN-IDの登録" (VLAN-ID Registration) — parameter passed to the success message template |
| `SCREEN_ID_SCW00403` | Constant | Next screen ID "SCW00403" — VLAN-ID registration completion screen |
| `SCREEN_NAME_SCW00403` | Constant | Screen name "VLAN-ID登録完了画面" (VLAN-ID Registration Completion Screen) |
| SCSV0005 | SC Code | Telephone-use VLAN Order Receipt (電話用VLANオダ受付) — Business Processing service that registers telephone-use VLAN orders to the BP |
| BP | Acronym | Business Processing (業務処理) — Backend processing layer that handles service order registration, update, and cancellation |
| VLAN | Acronym | Virtual Local Area Network — used to isolate telephony traffic on the K-Opticom broadband network |
| K-Opticom | Business term | K-Opticom Co., Ltd. — Japanese broadband ISP providing fiber-optic internet, telephony, and mobile services. Also known as ケー・オプティックコム |
| X31 | Acronym | Fujitsu X31 Web Application Framework — the enterprise web framework used for K-Opticom's customer-facing screens |
| `yokyu_sbt_cd` | Field | Request type code (要求種類コード) — classifies the request as new, change, or cancellation. Set to `YOKYU_SBT_NEW` for new registration |
| `vlan_order_cd` | Field | VLAN order code (VLANオダコード) — classifies the VLAN order type. Set to `VLAN_NEW` for new order |
| `vlan_server_cd` | Field | VLAN server code (VLANサーバーコード) — identifies the VLAN server operation type. Set to `VLAN_SVRCD_SETSUBI` (設置 — Installation) |
| `svc_kei_no` | Field | K-Opticom service contract number (K-Opticomサービス契約番号) — unique identifier for the customer's service contract |
| `yokyu_mt_apl_sbt_cd` | Field | Request source application type code (要求元アプリ種類コード) — identifies the request origin. Set to `YOKYU_SBT_CD_GYOMU` (業務 — Business/Work system) |
| SOD | Acronym | Service Order Data — internal tracking entity for telecom service orders and their workflow state |
| setNextScreen | Method | Screen navigation helper — sets the target screen ID and name for post-processing transition |
| setMessageInfo | Method | Message display helper — sets success/error messages to be displayed on the web screen |
