# Business Logic — ZMW01904SFLogic.fin() [46 LOC]

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

## 1. Role

### ZMW01904SFLogic.fin()

This method implements the **completed button press processing** (完了ボタン押下処理) — the termination/cleanup handler invoked when a user finishes interacting with screen ZMW01904 (the service detail inquiry screen). Its primary business purpose is twofold:

1. **Re-registration of aging number (エイjoining番号)** — When the application content flag (`SINSEI_NAIYO_FLG`) indicates either application content type **"7" (service suspension/cancellation via third-party receipt - 他社受付・取消)** or **"1" (port-out / NTT telephone number port-out - ポートアウト)** — the method reassigns the aging number from the previous screen transfer key. In these two scenarios, joining data is re-registered and the aging number is expected to change, so the method performs a pass-through operation (引き継ぎ) to preserve continuity of the aging workflow. If the originating screen was ZMW02001 (telephone number information update screen), the aging number is extracted from that screen's session info, updated in the output map, and propagated back to ZMW02001's screen state.

2. **Screen state reset and navigation setup** — Independently of the application content flag, the method cleans the service form bean (resetting all display fields to null), re-fetches initial display data, and configures the next screen ID and name to ZMW01904. This ensures the screen re-renders in its initial state after the completed button action.

The method follows a **delegation pattern**, delegating screen info retrieval to `JCCWebCommon`, bean lifecycle management to internal methods `creanBean` and `getInfoInitData`, and always returns `true` to signal successful completion. It is the **entry-point action handler** for the ZMW01904 screen's completion flow and serves as the final step in the service detail inquiry lifecycle.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["fin"])
    START --> COMMON["getCommonInfoBean"]
    COMMON --> SERVICE["getServiceFormBean"]
    SERVICE --> PARAM["paramBean array with bean"]
    PARAM --> OUTPUT["output HashMap"]
    OUTPUT --> COND1{SINSEI_NAIYO_FLG is 7 or 1}
    COND1 -->|7 or 1| REASSIGN["Set AGING_NO to prev value"]
    REASSIGN --> COND2{BEF_SCREENID is ZMW02001}
    COND2 -->|is ZMW02001| GETSCREEN["JCCWebCommon.getScreenInfo"]
    GETSCREEN --> REMOVE["output.remove AGING_NO"]
    REMOVE --> PUT["output.put AGING_NO"]
    PUT --> SETSCREEN["JZMWebCommon.setScreenInfo"]
    COND2 -->|else| CLEANBEAN
    COND1 -->|else| CLEANBEAN
    SETSCREEN --> CLEANBEAN["creanBean"]
    CLEANBEAN --> GETINIT["getInfoInitData"]
    GETINIT --> SETNEXT1["set NEXT_SCREEN_ID"]
    SETNEXT1 --> SETNEXT2["set NEXT_SCREEN_NAME"]
    SETNEXT2 --> END(["return true"])
```

### Branch descriptions:

- **Branch A (Lines 506–535)**: Application content flag equals **"7" (service suspension/cancellation)** or **"1" (port-out)**. The aging number is re-registered from the previous screen's display key. If the originating screen is ZMW02001, the method retrieves that screen's session info, updates the aging number in the output map, and persists it back.
- **Branch B (Lines 528–538)**: Independent of the application content flag — the bean is cleaned (all display fields nullified), initial data is fetched, and the next screen navigation is configured.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no explicit parameters. It operates on instance-level state inherited from its parent class `JCCWebBusinessLogic`. |
| - | `getCommonInfoBean()` | `X31SDataBeanAccess` | Retrieves the common form bean carrying shared cross-screen data such as next screen ID, next screen name, and session-level context. |
| - | `getServiceFormBean()` | `X31SDataBeanAccess` | Retrieves the service form bean containing the current screen's business data — application content flag, aging number, telephone number info, carrier codes, etc. |
| - | `this` (instance reference) | `JCCWebBusinessLogic` | The current `ZMW01904SFLogic` instance, used as a context parameter for utility methods like `getScreenInfo`, `setScreenInfo`, and `creanBean`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCCWebCommon.getScreenInfo` | JCCWebCommon | - | Retrieves screen session info from ZMW02001 (telephone number update screen) |
| - | `JZMWebCommon.setScreenInfo` | JZMWebCommon | - | Updates screen session info back to ZMW02001 |
| - | `X31SDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Gets/sets data bean string values by key |
| - | `creanBean` | ZMW01904SFLogic | - | Internal method — clears page link info, nullifies all display bean fields, clears data bean arrays |
| - | `getInfoInitData` | ZMW01904SFLogic | - | Internal method — fetches initial display data for the screen |

### Method call analysis:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getCommonInfoBean()` | JCCWebBusinessLogic (parent) | Session context | Reads shared common info bean containing cross-screen data |
| R | `getServiceFormBean()` | JCCWebBusinessLogic (parent) | Session context | Reads the service form bean with current screen's business data |
| - | `sendMessageString(key, DATABEAN_GET_VALUE)` | OneStopDataBeanAccess | Data bean | Retrieves value of `SINSEI_NAIYO_FLG` (application content flag) and `BEF_SCREENID` (previous screen ID) from the data bean |
| - | `sendMessageString(key, DATABEAN_SET_VALUE, value)` | OneStopDataBeanAccess | Data bean | Sets `AGING_NO` (aging number) value back into the data bean |
| R | `JCCWebCommon.getScreenInfo(this, SCREEN_ID_ZMW02001)` | JCCWebCommon | - | Reads the screen session info map from the ZMW02001 telephone number update screen |
| - | `output.remove(AGING_NO)` | HashMap | - | Removes existing aging number from the output map |
| - | `output.put(AGING_NO, value)` | HashMap | - | Inserts the old/sourced aging number back into the output map |
| - | `JZMWebCommon.setScreenInfo(this, SCREEN_ID_ZMW02001, output)` | JZMWebCommon | - | Persists the updated screen info map back to ZMW02001 |
| - | `creanBean(bean, this)` | ZMW01904SFLogic | - | Resets all display bean fields to null, clears page links and data bean arrays |
| - | `getInfoInitData(bean, this, SCREEN_ID_ZMW01904)` | ZMW01904SFLogic | - | Fetches and populates initial display data for screen ZMW01904 |
| - | `commoninfoBean.sendMessageString(NEXT_SCREEN_ID, ...)` | OneStopDataBeanAccess | Session context | Sets the next screen ID to ZMW01904 |
| - | `commoninfoBean.sendMessageString(NEXT_SCREEN_NAME, ...)` | OneStopDataBeanAccess | Session context | Sets the next screen name to the ZMW01904 screen label |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: ZMW01904SFLogic | `ZMW01904SFLogic.fin` (self-referenced via screen action dispatch) | `creanBean [R] display bean fields`, `getInfoInitData [R] initial data` |

**Note:** No external callers (screens/batches) were found that directly invoke `ZMW01904SFLogic.fin()`. This method is typically dispatched internally by the web framework's action routing mechanism — when the user presses the "completed" button on screen ZMW01904, the framework resolves the action to this `fin()` method through the screen-action configuration (e.g., Struts action mapping or equivalent). The `ZMW01904SFChecker` class is associated with this logic class for validation purposes but does not directly call `fin()`.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(L495-504)` Variable initialization and bean retrieval

> Retrieves the common info bean and service form bean, wraps the service bean in an array, and initializes the output HashMap for screen info transfer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `commoninfoBean = getCommonInfoBean()` // Get common form bean |
| 2 | SET | `bean = getServiceFormBean()` // Get service form bean |
| 3 | SET | `paramBean = { bean }` // Wrap bean in array for uniform access |
| 4 | SET | `output = new HashMap<String, Object>()` // HashMap for screen info transfer |

**Block 2** — [IF] `(SINSEI_NAIYO_FLG_7="7" OR SINSEI_NAIYO_FLG_1="1")` `(L506-535)`

> Application content flag check. If the current service request is a **service suspension/cancellation (7)** or a **port-out (1)**, the aging number is re-registered. In these cases, joining data is re-registered and the aging number changes, so a pass-through (引き継ぎ) operation is required.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(SINSEI_NAIYO_FLG, DATABEAN_GET_VALUE)` // Get application content flag |
| 2 | COND | `[SINSEI_NAIYO_FLG_7="7" (service suspension/cancellation)]` |
| 3 | COND | `[SINSEI_NAIYO_FLG_1="1" (port-out / NTT telephone number)]` |
| 4 | EXEC | `paramBean[0].sendMessageString(AGING_NO, DATABEAN_SET_VALUE, get(BEF_DISP_KEY_AGING_NO))` // Reassign aging number from previous screen display key |

**Block 2.1** — [IF] `(BEF_SCREENID = ZMW02001)` `(L519-533)`

> Nested condition: If the originating screen was the **telephone number information update screen** (ZMW02001), the aging number is extracted from that screen's session info, updated, and propagated back. The previous screen's session info is fetched, the aging number is replaced, and the updated info is persisted back to ZMW02001.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(BEF_SCREENID, DATABEAN_GET_VALUE)` // Get previous screen ID |
| 2 | COND | `[JZMScreenConst.SCREEN_ID_ZMW02001="ZMW02001"] (telephone number info update screen)` |
| 3 | CALL | `JCCWebCommon.getScreenInfo(this, SCREEN_ID_ZMW02001)` // Get phone update screen session info |
| 4 | EXEC | `output.remove(ZMW02001SFConst.AGING_NO)` // Remove old aging number from map |
| 5 | EXEC | `output.put(ZMW02001SFConst.AGING_NO, get(BEF_DISP_KEY_AGING_NO))` // Put old aging number back |
| 6 | CALL | `JZMWebCommon.setScreenInfo(this, SCREEN_ID_ZMW02001, output)` // Persist updated screen info |

**Block 3** — [CALL] `(L528)` Bean cleanup

> Regardless of the conditional branch above, all display fields in the service form bean are cleared (set to null), page link info is reset, and data bean arrays are purged. This ensures the screen is in a clean initial state for re-display.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `creanBean(bean, this)` // Initialize all bean items (nullifies display fields, clears page links and list data) |

**Block 4** — [CALL] `(L531)` Initial data fetch

> Fetches the initial display data for screen ZMW01904 and populates the bean with default values.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getInfoInitData(bean, this, JZMScreenConst.SCREEN_ID_ZMW01904)` // Get initial display items |

**Block 5** — [CALL] `(L534-535)` Next screen configuration

> Configures the next screen navigation to point back to ZMW01904 (the same screen), effectively causing a re-render in initial state.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `commoninfoBean.sendMessageString(NEXT_SCREEN_ID, DATABEAN_SET_VALUE, SCREEN_ID_ZMW01904)` // Set next screen ID |
| 2 | EXEC | `commoninfoBean.sendMessageString(NEXT_SCREEN_NAME, DATABEAN_SET_VALUE, SCREEN_NAME_ZMW01904)` // Set next screen name |

**Block 6** — [RETURN] `(L538)`

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // Processing result - successful completion |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `fin` | Method | Completed button press processing — the termination handler executed when the user finalizes their interaction with a screen |
| `SINSEI_NAIYO_FLG` | Field | Application content flag — classifies the type of service request (e.g., new registration, suspension, port-out) |
| `SINSEI_NAIYO_FLG_7` | Constant | Value "7" — represents service suspension/cancellation via third-party receipt (他社受付・取消). In this mode, the customer is canceling service through an external provider, triggering aging number re-registration. |
| `SINSEI_NAIYO_FLG_1` | Constant | Value "1" — represents port-out (porting away from NTT telephone number). In this mode, the customer is porting their phone number out, triggering aging number re-registration. |
| `AGING_NO` | Field | Aging number (エイjoining番号) — a workflow tracking identifier used to manage the lifecycle of service join/porting operations across screens |
| `BEF_DISP_KEY_AGING_NO` | Field | Previous screen display key — aging number — the key used to store/retrieve the aging number from the previous screen's display context |
| `BEF_SCREENID` | Field | Previous screen ID — identifies which screen the user came from, used to determine if special aging number propagation is needed |
| `ZMW02001` | Screen ID | Telephone number information update screen — the screen where users update telephone number details. When accessed from this screen, the aging number must be re-propagated. |
| `ZMW01904` | Screen ID | Service detail inquiry screen — the current screen being terminated. The next screen is set to ZMW01904 to trigger a re-render. |
| `creanBean` | Method | Bean cleanup — resets all display fields to null, clears page link navigation, and purges data bean arrays to restore the bean to a clean initial state |
| `getInfoInitData` | Method | Initial display data retrieval — fetches default values and lookup data to populate the screen on first render or re-render |
| `getCommonInfoBean` | Method | Retrieves the common information bean — a shared data context used across screens for navigation state and session data |
| `getServiceFormBean` | Method | Retrieves the service form data bean — contains the business data specific to the current screen's service context |
| `sendMessageString` | Method | Data bean accessor — gets or sets string values in a data bean by key, using `DATABEAN_GET_VALUE` or `DATABEAN_SET_VALUE` as the operation mode |
| `JCCWebCommon` | Class | Common web utility class — provides shared web-layer operations including screen info retrieval and persistence |
| `JZMWebCommon` | Class | JZM web utility class — provides JZM-specific web operations including screen info management |
| `JCCWebBusinessLogic` | Class | Parent class — base business logic class for all JCC web screen logic classes, providing common methods like `getCommonInfoBean` and `getServiceFormBean` |
| `NEXT_SCREEN_ID` | Field | Next screen ID — a common info field specifying which screen to navigate to after the current processing completes |
| `NEXT_SCREEN_NAME` | Field | Next screen name — a common info field specifying the display name of the next screen for navigation breadcrumbs |
| DATABEAN_GET_VALUE | Constant | Data bean operation mode — retrieve a value from the data bean |
| DATABEAN_SET_VALUE | Constant | Data bean operation mode — set a value in the data bean |
| Port-out | Business term | Port-out (ポートアウト) — the process of porting a telephone number away from NTT to another carrier |
| Service suspension/cancellation | Business term | Service suspension/cancellation (他社受付・取消) — cancellation or suspension of a service subscription through an external/third-party provider |
| Joining (エイjoining番号) | Business term | Aging/Joining number — a workflow identifier that tracks a service join/porting operation across multiple screen interactions and backend processes |
