# Business Logic — KKW00810SFLogic.doRegistFixedIPAddressOption() [96 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00810SF.KKW00810SFLogic` |
| Layer | Controller / Service Logic (webview layer — handles screen-to-service orchestration) |
| Module | `KKW00810SF` (Package: `eo.web.webview.KKW00810SF`) |

## 1. Role

### KKW00810SFLogic.doRegistFixedIPAddressOption()

This method orchestrates the **registration of a fixed global IP address option** for a customer's broadband/telecom service contract. Its business name, derived from the javadoc `KKSV0023 固定グローバルＩＰアドレス情報登録サービス呼出処理`, translates to "Fixed Global IP Address Information Registration Service Call Processing." The method prepares the service form bean, configures the data mapping pipeline, invokes the backend service for the fixed IP address option registration, and then retrieves the assigned order number and progress tracking number upon successful completion. 

It acts as a **delegating orchestration method** — it does not contain the core business logic of fixed IP registration itself, but instead wires together the data bean access layer, the DB mapper for SC code invocation, and the service invocation infrastructure (`JCCBatCommon.invokeService`). When the `func_code` parameter equals `FUNC_CODE_1` (the discount change variant), it additionally processes discount-related auto-application messages and publishes them as session messages for display on the screen.

The design pattern employed is a **single-entry orchestrator with a conditional message branch**. All data mapping (pre-service) is performed through the `KKSV0023_KKSV0023OPDBMapper` methods, which read existing state and prepare data. The actual service is invoked once via `invokeService`, then the method reads back the assigned registration identifiers via `getKKSV002304SC` and `getKKSV002310SC`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["doRegistFixedIPAddressOption(func_code)"])
    
    START --> GETBEAN["Get X31SDataBeanAccess svcFormBean"]
    GETBEAN --> CONFIG["configServiceFormBean(svcFormBean)"]
    CONFIG --> INITMAPS["Initialize paramMap, inputMap, outputMap (HashMap)"]
    INITMAPS --> SETPARAM["Set SVC_ID_KKSV0023 and OP_ID_KKSV0023OP in paramMap"]
    SETPARAM --> SETBEAN["Set paramBean array with svcFormBean"]
    SETBEAN --> CREATEMAPPER["Create KKSV0023_KKSV0023OPDBMapper mapper"]
    CREATEMAPPER --> CALLCC["setJKKGlobalIpAddCfmCC(paramBean, inputMap, func_code)"]
    CALLCC --> INVOKESVC["invokeService(paramMap, inputMap, outputMap)"]
    INVOKESVC --> GET04["mapper.getKKSV002304SC - get registered order number"]
    GET04 --> GET10["mapper.getKKSV002310SC - get registered progress number"]
    GET10 --> CHECKFUNC{"JKKCommonConst.FUNC_CODE_1 equals func_code?"}
    
    CHECKFUNC -->|TRUE| DISCOUNT_BRANCH["Discount change message handling block"]
    CHECKFUNC -->|FALSE| END_NODE["Return / Next"]
    
    DISCOUNT_BRANCH --> CHECK_NULL{"outputMap contains WrisvcAutoAplyCC?"}
    CHECK_NULL -->|TRUE| GET_WARISVC["Extract warisvcMap from outputMap"]
    CHECK_NULL -->|FALSE| SET_NULL["warisvcMap = null"]
    GET_WARISVC --> MSG_CHECK{"warisvcMap != null?"}
    SET_NULL --> MSG_CHECK
    MSG_CHECK -->|TRUE| GET_MSG["Extract msgList from warisvcMap"]
    MSG_CHECK -->|FALSE| SET_MSG_NULL["msgList = null"]
    GET_MSG --> SETSESSION["JKKSetSessionMessage.setSessionMessage(this, msgList)"]
    SET_MSG_NULL --> SETSESSION
    SETSESSION --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `func_code` | `String` | Function code that identifies the specific screen operation context. It serves as a discriminator for variant processing: when set to `FUNC_CODE_1` (`[-> JKKCommonConst.FUNC_CODE_1="1"]`), the method processes discount-related service messages (discount change modification messaging variant). Otherwise, it proceeds with the standard fixed IP address registration flow without message handling. |

**Instance fields / external state used:**
| No | Field | Type | Business Description |
|----|-------|------|---------------------|
| 1 | `this` (current instance) | `KKW00810SFLogic` | The logic class instance; passed as context to `JKKSetSessionMessage.setSessionMessage` so session messages can be attached to the current user's HTTP session. |
| 2 | `super.getServiceFormBean()` | `X31SDataBeanAccess` | Retrieves the current screen's data bean from the parent class's bean access infrastructure, containing all form data bound to the KKSV0023 screen. |
| 3 | `SVC_ID_KKSV0023` | `String` constant | Service ID identifying the KKSV0023 service (fixed IP address option registration). |
| 4 | `OP_ID_KKSV0023OP` | `String` constant | Operation ID identifying the KKSV0023 operation (registration operation). |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `KKW00810SFLogic.configServiceFormBean` | - | - | Configures the service form bean with current screen data; preparatory step for service invocation |
| R | `KKSV0023_KKSV0023OPDBMapper.setJKKGlobalIpAddCfmCC` | KKKSV0023JKKGlobalIpAddCfmCC | Fixed IP address confirmation entity | Calls the global IP address addition confirmation component to map and prepare fixed IP address data before service invocation |
| - | `JCCBatCommon.invokeService` | - | - | Invokes the backend service pipeline with paramMap (service/operation IDs) and inputMap (data); the core service execution mechanism that routes to the SC/CBS chain |
| R | `KKSV0023_KKSV0023OPDBMapper.getKKSV002304SC` | KKSV002304SC | SOD (Service Order Data) / order registration table | Retrieves the registered order number assigned by the backend service; used to confirm what order ID was created |
| R | `KKSV0023_KKSV0023OPDBMapper.getKKSV002310SC` | KKSV002310SC | Progress tracking entity | Retrieves the registered progress/tracking number for the service registration; used for customer-facing status reference |
| - | `JKKSetSessionMessage.setSessionMessage` | - | HttpSession | Sets discount-related auto-application messages into the user's session for display on the confirmation screen |

**How to classify:**
- **R** (Read-back): `getKKSV002304SC` and `getKKSV002310SC` are post-service read-back operations. After the service is invoked and the fixed IP address registration is completed, these methods retrieve the identifiers (order number and progress number) that were assigned during registration so they can be returned to the screen.
- **SET/Preparation**: `setJKKGlobalIpAddCfmCC` maps the fixed IP address confirmation data from the form bean into the input map — it's a data preparation/mapping step, not a CRUD operation.
- **Invoke**: `invokeService` is a service dispatch mechanism (not directly creatable/readable). It triggers the full SC/CBS chain that performs the actual database create operation for the fixed IP address registration.
- **Message**: `setSessionMessage` stores user-facing notification messages (e.g., discount auto-application results) into the HTTP session.

**Note on commented-out mapper calls:** The codebase contains many commented-out `mapper.setKKSV0023XXSC` calls (lines ~450-485) for legacy service contract mappings, ISP contract mappings, advance application mappings, etc. These were part of the original pre-service data mapping pipeline but have been disabled (v7.00 MOD comment block). The only active mapper call in the current code is `setJKKGlobalIpAddCfmCC`.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKW00810SFLogic.action_Cfm()` | `action_Cfm()` -> `doRegistFixedIPAddressOption(func_code)` | `getKKSV002304SC [R] Order Number`, `getKKSV002310SC [R] Progress Number`, `setSessionMessage [-] Discount Message` |
| 2 | `KKW00810SFLogic.action_Fix()` | `action_Fix()` -> `doRegistFixedIPAddressOption(func_code)` | `getKKSV002304SC [R] Order Number`, `getKKSV002310SC [R] Progress Number`, `setSessionMessage [-] Discount Message` |

**Terminal operations summary from this method:**
- `setSessionMessage` [-] — Session message storage (discount change messages)
- `getKKSV002310SC` [R] — Progress number retrieval
- `getKKSV002304SC` [R] — Order number retrieval
- `invokeService` [-] — Backend service dispatch (triggers actual fixed IP address registration)
- `setJKKGlobalIpAddCfmCC` [-] — Global IP address confirmation data mapping
- `configServiceFormBean` [-] — Service form bean configuration

## 6. Per-Branch Detail Blocks

### Block 1 — PROCESSING `(method body, no outer condition)` (L423)

> Extracts the service form bean, configures it, sets up parameters, invokes the service pipeline, retrieves registration identifiers, and optionally handles discount messages.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `X31SDataBeanAccess svcFormBean = super.getServiceFormBean()` // Retrieve the screen's data bean from the parent bean access infrastructure |
| 2 | CALL | `configServiceFormBean(svcFormBean)` // Edit/configure the pre-update service form bean [-> configServiceFormBean (KKW00810SFLogic.java)] |
| 3 | SET | `HashMap<String, Object> paramMap = new HashMap<String, Object>()` // Service invocation parameter container |
| 4 | SET | `HashMap<String, Object> inputMap = new HashMap<String, Object>()` // Input data map for SC code mapping |
| 5 | SET | `HashMap<String, Object> outputMap = new HashMap<String, Object>()` // Output data map from service invocation |
| 6 | SET | `paramMap.put(X31CWebConst.TELEGRAM_INFO_USECASE_ID, SVC_ID_KKSV0023)` // Set service ID for KKSV0023 fixed IP registration [-> SVC_ID_KKSV0023 (constant in KKW00810SFLogic)] |
| 7 | SET | `paramMap.put(X31CWebConst.TELEGRAM_INFO_OPERATION_ID, OP_ID_KKSV0023OP)` // Set operation ID for the registration operation [-> OP_ID_KKSV0023OP (constant in KKW00810SFLogic)] |
| 8 | SET | `X31SDataBeanAccess[] paramBean = {svcFormBean}` // Wrap bean in array for mapper method signatures |
| 9 | SET | `KKSV0023_KKSV0023OPDBMapper mapper = new KKSV0023_KKSV0023OPDBMapper()` // Create the DB mapper instance for SC code orchestration |
| 10 | CALL | `inputMap = mapper.setJKKGlobalIpAddCfmCC(paramBean, inputMap, func_code)` // Map fixed IP address addition confirmation data [-> setJKKGlobalIpAddCfmCC (KKSV0023_KKSV0023OPDBMapper.java)] |
| 11 | CALL | `invokeService(paramMap, inputMap, outputMap)` // Invoke the backend service pipeline with service ID, operation ID, and data |
| 12 | CALL | `mapper.getKKSV002304SC(paramBean, outputMap)` // Retrieve the registered order number from service output [-> getKKSV002304SC (KKSV0023_KKSV0023OPDBMapper.java)] |
| 13 | CALL | `mapper.getKKSV002310SC(paramBean, outputMap)` // Retrieve the registered progress number from service output [-> getKKSV002310SC (KKSV0023_KKSV0023OPDBMapper.java)] |
| 14 | IF | Conditional discount message handling — see Block 1.1 below |

### Block 1.1 — IF `(JKKCommonConst.FUNC_CODE_1.equals(func_code))` `[FUNC_CODE_1="1"]` (L~500)

> When `func_code` is `FUNC_CODE_1`, this branch handles discount-related auto-application service messages. This is a discount change modification messaging variant — it extracts any messages generated by the discount auto-application component (`WrisvcAutoAplyCC`) and publishes them as session messages for the user to see on the confirmation screen.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ArrayList<HashMap<String, Object>> msgList = null` // Initialize message list for discount change messages |
| 2 | SET | `HashMap<String, Object> warisvcMap = null` // Initialize discount auto-application result map |
| 3 | IF | Check if outputMap contains WrisvcAutoAplyCC — see Block 1.1.1 |

#### Block 1.1.1 — IF `(outputMap.containsKey("WrisvcAutoAplyCC"))` (L~503)

> Checks whether the discount auto-application component produced output data in the service response.

| # | Type | Code |
|---|------|------|
| 1 | SET | `warisvcMap = (HashMap<String, Object>)outputMap.get("WrisvcAutoAplyCC")` // Cast and extract the discount auto-application result map |

#### Block 1.1.2 — IF `(warisvcMap != null)` (L~506)

> Verifies the extracted discount auto-application map is non-null before accessing its contents.

| # | Type | Code |
|---|------|------|
| 1 | SET | `msgList = (ArrayList<HashMap<String, Object>>)warisvcMap.get("msg_list")` // Extract the message list from the discount auto-application result |

#### Block 1.1.3 — EXEC `JKKSetSessionMessage.setSessionMessage(this, msgList)` (L~512)

> Sets the discount change messages into the user's HTTP session so they can be displayed on the confirmation screen. This is the terminal operation of the discount change messaging variant.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JKKSetSessionMessage.setSessionMessage(this, msgList)` // Register discount-related messages in session [-> setSessionMessage (JKKSetSessionMessage.java)] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `func_code` | Field | Function code — identifies the specific screen operation context; determines whether discount change message processing is active |
| `paramBean` | Field | Service form bean array — data container holding the screen's bound form data, passed to mapper methods for data mapping |
| `inputMap` | Field | Input parameter map — holds data being prepared for the service invocation SC codes |
| `outputMap` | Field | Output parameter map — holds data returned from the backend service invocation, including assigned IDs and component results |
| `paramMap` | Field | Service invocation parameter map — holds the service ID and operation ID used to route the service call |
| SVC_ID_KKSV0023 | Constant | Service ID for KKSV0023 — identifies the fixed global IP address information registration service in the service routing infrastructure |
| OP_ID_KKSV0023OP | Constant | Operation ID for KKSV0023OP — identifies the registration operation within the KKSV0023 service |
| setJKKGlobalIpAddCfmCC | Method | Global IP Address Addition Confirmation Component — maps and prepares fixed IP address confirmation data for the service invocation |
| getKKSV002304SC | Method | KKSV0023 Order Registration Service Component — retrieves the order number assigned after fixed IP address registration |
| getKKSV002310SC | Method | KKSV0023 Progress Registration Service Component — retrieves the progress/tracking number assigned after fixed IP address registration |
| invokeService | Method | Backend service invocation — delegates to JCCBatCommon.invokeService to trigger the full SC/CBS execution chain for the fixed IP address registration |
| WrisvcAutoAplyCC | Component | Discount Auto-Application Component — handles automatic application of discount services to customer contracts; produces messages for the confirmation screen |
| JKKCommonConst.FUNC_CODE_1 | Constant | Function code "1" — the discount change modification variant indicator; when func_code equals this value, discount message handling is activated |
| setSessionMessage | Method | Session message setter — stores messages in the user's HTTP session for display on the confirmation screen after service completion |
| X31SDataBeanAccess | Class | Service screen data bean access — base class providing access to screen-bound form data and the bean access infrastructure |
| configServiceFormBean | Method | Service form bean configurer — prepares and edits the service form bean data before service invocation |
| KKSV0023 | Screen | Fixed Global IP Address Information Registration screen — the business screen where customers register or modify fixed IP address options for their broadband service |
| FIXED GLOBAL IP ADDRESS | Business term | A static public IP address assigned to a customer's broadband connection, as opposed to a dynamically assigned address |
| DISCOUNT CHANGE MODIFICATION | Business term | A variant of the registration operation where pricing/discount changes are applied; triggers additional message handling for auto-applied discount services |
| SOD | Acronym | Service Order Data — the backend entity representing a service order/registration record in the telecom fulfillment system |
