# Business Logic — SCW00401SFLogic.complete() [13 LOC]

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

## 1. Role

### SCW00401SFLogic.complete()

This method implements the **"Complete Button Press Processing"** (完了ボタン押下処理) for the **VLAN-ID New Registration Screen** (VLAN-ID新規登録画面). It serves as the terminal cleanup handler for the VLAN-ID registration workflow (SCW00401). When a user clicks the "Complete" button after reviewing or modifying VLAN-ID service orders, this method resets the session state by clearing screen-specific data bean keys (`KEY_SVC_KEI_NO` and `KEY_SVC_KEI_NO_HOJI`), invokes the data bean clearing routine (`clearDatabean()`), and initiates a screen transition back to the initial VLAN-ID registration screen (SCW00401). The method follows a **teardown-and-redisplay** pattern — it does not perform any data persistence, database CRUD operations, or service component calls. Its sole purpose is to prepare a clean slate for the next registration session by purging stale session data and navigating the user back to the entry point screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["complete()"])
    RETRIEVE["Get X31SDataBeanAccess via super.getServiceFormBean()"]
    CLEAR1["Clear KEY_SVC_KEI_NO (KXXF Service Contract Number)"]
    CLEAR2["Clear KEY_SVC_KEI_NO_HOJI (KXXF Service Contract Number Retention)"]
    CLEAR_DB["Call clearDatabean() - clear data bean array"]
    NAVIGATE["Set next screen to SCW00401 (VLAN-ID New Registration Screen)"]
    RET_TRUE["Return true"]
    END_NODE(["End - screen transition"])

    START --> RETRIEVE
    RETRIEVE --> CLEAR1
    CLEAR1 --> CLEAR2
    CLEAR2 --> CLEAR_DB
    CLEAR_DB --> NAVIGATE
    NAVIGATE --> RET_TRUE
    RET_TRUE --> END_NODE
```

**Processing Summary:**

1. **Retrieve Form Bean** — Obtains the `X31SDataBeanAccess` instance from the parent class (`super.getServiceFormBean()`), which serves as the session data exchange layer.
2. **Clear Service Contract Number** — Sets `KEY_SVC_KEI_NO` ("KXXF Service Contract Number") to an empty string, discarding the previously entered contract number from the session.
3. **Clear Retention Key** — Sets `KEY_SVC_KEI_NO_HOJI` ("KXXF Service Contract Number Retention") to an empty string, clearing the session retention flag.
4. **Clear Data Bean** — Calls `clearDatabean()`, which clears and reinitializes the `ESC0021A010CBSMSG1LIST` ("Telephone VLAN Order List") array data bean by clearing the array, adding an empty element, and ensuring clean state.
5. **Navigate to Initial Screen** — Calls `setNextScreen()` with `SCREEN_ID_SCW00401` ("SCW00401") and `SCREEN_NAME_SCW00401` ("VLAN-ID New Registration Screen") to transition the user back to the entry screen.
6. **Return Success** — Returns `true` to indicate the operation completed without errors.

**Design Pattern:** This method implements a **Facade / Cleanup Pattern** — it provides a single entry point that orchestrates a sequence of state-reset operations and navigation, encapsulating the full teardown logic behind one simple call.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. All state is derived from the instance-level form bean (`X31SDataBeanAccess`), which is accessed via the inherited `super.getServiceFormBean()` method. |

**Instance fields / external state read by this method:**

| Source | Description |
|--------|-------------|
| `super.getServiceFormBean()` | Returns the `X31SDataBeanAccess` form bean instance, which holds the current screen session data including service contract numbers, data bean arrays, and navigation state. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X31SDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Calls `sendMessageString` to set a data bean key to an empty string (session state clearing) |
| - | `SCW00401SFLogic.clearDatabean` | SCW00401SFLogic | - | Calls `clearDatabean` to clear and reinitialize data bean arrays |
| - | `SCW00401SFLogic.setNextScreen` | SCW00401SFLogic | - | Calls `setNextScreen` to set the next navigation target screen |

**CRUD Classification Note:** This method performs **no database CRUD operations** (no C/R/U/D). It is a pure **session state cleanup and screen navigation** method. All operations are performed against the in-memory data bean access layer and navigation state.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen: SCW00401 | `SCW00401SFLogic.complete()` | (none — no downstream DB calls) |

**Note:** The `complete()` method is invoked from the **SCW00401SF** screen logic itself when the user clicks the "Complete" button on the VLAN-ID New Registration Screen. It does not appear to be called by any external screen, batch, or CBS. No other caller references to `SCW00401SFLogic.complete()` were found in the codebase.

## 6. Per-Branch Detail Blocks

The `complete()` method has **no conditional branches** (no if/else, switch, or loops). It executes a linear sequence of 6 processing steps.

**Block 1** — [SEQUENCE] (L216)

> Retrieve the form bean from the parent class to access session data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `X31SDataBeanAccess bean = super.getServiceFormBean()` |

**Block 2** — [SEQUENCE] (L220)

> Clear the "KXXF Service Contract Number" key from the session, setting it to empty string. This ensures the previous contract number does not persist into the next registration session.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `bean.sendMessageString(KEY_SVC_KEI_NO, DATABEAN_SET_VALUE, "")` |

- `KEY_SVC_KEI_NO` → "KXXF Service Contract Number" (session key for the service contract number)
- `DATABEAN_SET_VALUE` → constant indicating this call sets a data bean value

**Block 3** — [SEQUENCE] (L221)

> Clear the "KXXF Service Contract Number Retention" key from the session. This retention flag prevents stale retention state from leaking between sessions.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `bean.sendMessageString(KEY_SVC_KEI_NO_HOJI, DATABEAN_SET_VALUE, "")` |

- `KEY_SVC_KEI_NO_HOJI` → "KXXF Service Contract Number Retention" (session key for retention flag)
- `DATABEAN_SET_VALUE` → constant indicating this call sets a data bean value

**Block 4** — [SEQUENCE] (L224)

> Clear the data bean array contents. Japanese comment: "データビーンクリア" (Clear Data Bean). This ensures all form data from the previous session is purged.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `clearDatabean()` |

- Calls the private method `clearDatabean()` which:
  - Clears the `ESC0021A010CBSMSG1LIST` ("Telephone VLAN Order List") array
  - Adds a fresh empty data bean element to reinitialize the array

**Block 5** — [SEQUENCE] (L227)

> Navigate back to the initial VLAN-ID new registration screen. Japanese comment: "初期画面へ遷移" (Transition to initial screen). This provides a seamless user experience — after completing a registration session, the user is returned to the clean entry screen.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setNextScreen(SCREEN_ID_SCW00401, SCREEN_NAME_SCW00401)` |

- `SCREEN_ID_SCW00401` → "SCW00401" (VLAN-ID New Registration Screen ID)
- `SCREEN_NAME_SCW00401` → "VLAN-ID新規登録画面" (VLAN-ID New Registration Screen name)

**Block 6** — [RETURN] (L228)

> Return success indicator to the caller (typically the screen controller).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `SCW00401SF` | Module | VLAN-ID New Registration Screen module — handles VLAN-ID setup for telephone services |
| `complete()` | Method | Complete button press processing — teardown and return-to-entry-point handler |
| `KEY_SVC_KEI_NO` | Field | KXXF Service Contract Number — the internal contract number identifying a K-Opticom service contract line item |
| `KEY_SVC_KEI_NO_HOJI` | Field | KXXF Service Contract Number Retention — session flag that retains the service contract number across page transitions |
| `ESC0021A010CBSMSG1LIST` | Field | Telephone VLAN Order List — data bean array containing VLAN-ID order records displayed on the screen |
| `SCREEN_ID_SCW00401` | Constant | Screen identifier "SCW00401" — VLAN-ID New Registration Screen |
| `SCREEN_NAME_SCW00401` | Constant | Screen display name "VLAN-ID新規登録画面" — VLAN-ID New Registration Screen |
| VLAN-ID | Business term | Virtual LAN Identifier — network segmentation identifier assigned to a service line for isolation |
| X31SDataBeanAccess | Technical | K-Opticom's session data bean access layer — manages screen-to-business logic data exchange |
| JCCWebBusinessLogic | Technical | Base web business logic class — provides shared methods like `getServiceFormBean()`, `setNextScreen()`, `clearDatabean()` |
| KXXF | Acronym | K-Opticom External Fax (service type) — service contract number prefix for KXXF contract lines |
| DATABEAN_SET_VALUE | Constant | Data bean operation code indicating a "set" (write) operation on the data bean |
