# Business Logic — KKW00191SFLogic.initServiceFormBean() [120 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00191SF.KKW00191SFLogic` |
| Layer | Service (Controller logic / Business Logic layer) |
| Module | `KKW00191SF` (Package: `eo.web.webview.KKW00191SF`) |

## 1. Role

### KKW00191SFLogic.initServiceFormBean()

This method is the **form data initialization routine** for the **Hikikomi Torikeshi** (Light Modification Cancellation) screen in K-Opticom's contract management system. Its core responsibility is to take pre-populated handover data from a prior screen (screen 04, the light modification cancellation completion flow) and transfer it into the current screen's service form bean so the user sees a fully pre-filled cancellation confirmation page.

The method operates using a **data transfer and composition pattern**: it extracts a list of handover data objects (`CUST_KEI_HKTGI_LIST`), retrieves the first element, and performs a structured field-by-field mapping from the source handover data (fields suffixed with `_04`) to the destination service form bean. For address fields, it performs **address composition** — concatenating individual address components (state/prefecture, city, district, block/number, branch code) into a single full-address string for both the construction site address (KAISEN_ADDR) and the contracting party address (KEISHA_ADDR).

The method has **no conditional branches** — it is a straightforward linear data transfer pipeline. It handles all fields atomically regardless of value, ensuring that every field present in the source handover data is always copied to the destination. Its role in the larger system is as a **screen initialization bridge**: called from `KKW00191SFLogic.actionInit()` to prepare the form state before the cancellation confirmation screen renders.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initServiceFormBean(svcFormBean)"])
    START --> GET_SCREEN["JCCWebCommon.getScreenInfo(this)"]
    GET_SCREEN --> GET_DATA_ARRAY["svcFormBean.getDataBeanArray(CUST_KEI_HKTGI_LIST)"]
    GET_DATA_ARRAY --> GET_FIRST_ELEMENT["cUST_KEI_HKTGI_LIST.getDataBean(0) => hktgElement"]
    GET_FIRST_ELEMENT --> READ_SYSID["hktgElement.sendMessageString(HKTGI_SYSID, GET) => sysidVal"]
    READ_SYSID --> MAP_FIELDS_START["Map fields from hktgElement to svcFormBean"]
    MAP_FIELDS_START --> MAP_SYSID["sendMessage(SYSID, SYSID_04)"]
    MAP_SYSID --> MAP_SVC_NO["sendMessage(SVC_KEI_NO, SVC_KEI_NO_04)"]
    MAP_SVC_NO --> MAP_K_PLACE_STATE["sendMessage(KAISEN_PLACE_STATE_NM, KAISEN_PLACE_STATE_NM_04)"]
    MAP_K_PLACE_STATE --> MAP_K_PLACE_CITY["sendMessage(KAISEN_PLACE_CITY_NM, KAISEN_PLACE_CITY_NM_04)"]
    MAP_K_PLACE_CITY --> MAP_K_PLACE_OAZTSU["sendMessage(KAISEN_PLACE_OAZTSU_NM, KAISEN_PLACE_OAZTSU_NM_04)"]
    MAP_K_PLACE_OAZTSU --> MAP_K_PLACE_AZCHO["sendMessage(KAISEN_PLACE_AZCHO_NM, KAISEN_PLACE_AZCHO_NM_04)"]
    MAP_K_PLACE_AZCHO --> MAP_K_PLACE_BNCHIGO["sendMessage(KAISEN_PLACE_BNCHIGO, KAISEN_PLACE_BNCHIGO_04)"]
    MAP_K_PLACE_BNCHIGO --> MAP_CUST_NM["sendMessage(CUST_NM, CUST_NM_04)"]
    MAP_CUST_NM --> MAP_CUST_KANA["sendMessage(CUST_KANA, CUST_KANA_04)"]
    MAP_CUST_KANA --> MAP_K_KEISHA_STATE["sendMessage(KEISHA_STATE_NM, KEISHA_STATE_NM_04)"]
    MAP_K_KEISHA_STATE --> MAP_K_KEISHA_CITY["sendMessage(KEISHA_CITY_NM, KEISHA_CITY_NM_04)"]
    MAP_K_KEISHA_CITY --> MAP_K_KEISHA_OAZTSU["sendMessage(KEISHA_OAZTSU_NM, KEISHA_OAZTSU_NM_04)"]
    MAP_K_KEISHA_OAZTSU --> MAP_K_KEISHA_AZCHO["sendMessage(KEISHA_AZCHO_NM, KEISHA_AZCHO_NM_04)"]
    MAP_K_KEISHA_AZCHO --> MAP_K_KEISHA_BNCHIGO["sendMessage(KEISHA_BNCHIGO, KEISHA_BNCHIGO_04)"]
    MAP_K_KEISHA_BNCHIGO --> MAP_K_KEISHA_TEL["sendMessage(KEISHA_TELNO, KEISHA_TELNO_04)"]
    MAP_K_KEISHA_TEL --> CONSTRUCT_ADDR_START["Construct KAISEN_ADDR from individual address fields"]
    CONSTRUCT_ADDR_START --> CONSTRUCT_K_ADDR["append KAISEN_PLACE_STATE, CITY, OAZTSU, AZCHO, BNCHIGO => buffer"]
    CONSTRUCT_K_ADDR --> SET_K_ADDR["sendMessage(KAISEN_ADDR, buffer.toString())"]
    SET_K_ADDR --> CONTRACT_ADDR_START["Construct KEISHA_ADDR from individual address fields"]
    CONTRACT_ADDR_START --> CONSTRUCT_C_ADDR["append KEISHA_STATE, CITY, OAZTSU, AZCHO, BNCHIGO => BNCHIGO => buffer"]
    CONSTRUCT_C_ADDR --> SET_C_ADDR["sendMessage(KEISHA_ADDR, buffer.toString())"]
    SET_C_ADDR --> MAP_SHOSA_DSL["sendMessage(SHOSA_DSL_FIN_CD, SHOSA_DSL_FIN_CD_04)"]
    MAP_SHOSA_DSL --> END_NODE(["Return void"])
```

**Processing summary (no conditional branches):**

The method executes a single linear flow:

1. **Screen info initialization** — Calls `JCCWebCommon.getScreenInfo(this)` to fetch the screen context (screen ID, page number, operation type, etc.) for logging and framework bookkeeping.
2. **Handover data retrieval** — Retrieves the `CUST_KEI_HKTGI_LIST` data bean array from `svcFormBean` and extracts the first element (`index 0`) as the source handover data object.
3. **SYSID preservation** — Reads the handover SYSID (`HKTGI_SYSID`) from the handover element and stores it in the instance field `sysidVal`, then transfers `SYSID_04` to `SYSID` in the destination form bean.
4. **Direct field transfers (16 fields)** — Copies each field from the handover data (source key suffixed with `_04`) to the destination service form bean (key without suffix). Fields include service detail number, construction site address components, customer name, customer name (kana), and contracting party address components plus telephone number.
5. **Construction site address composition** — Concatenates the five construction site address components into a single full address string (`KAISEN_ADDR`) using a `StringBuffer`.
6. **Contracting party address composition** — Concatenates the five contracting party address components into a single full address string (`KEISHA_ADDR`) using a fresh `StringBuffer`.
7. **Inspection DSL completion code transfer** — Copies the `SHOSA_DSL_FIN_CD_04` value (inspection DSL completion code) to `SHOSA_DSL_FIN_CD` in the destination form bean (added per IT1-2013-0000148).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcFormBean` | `X31SDataBeanAccess` | The service form data bean for the Hikikomi Torikeshi (Light Modification Cancellation) screen. It holds both the handover data (in the `CUST_KEI_HKTGI_LIST` child array) and the target fields where pre-filled values from a prior screen (screen 04) are copied for display. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `sysidVal` | `String` | Stores the handover SYSID read from the source handover data element (preserved across the field transfer). |

**External state read:**

| Source | Description |
|--------|-------------|
| `JCCWebCommon.getScreenInfo(this)` | Reads screen configuration context (screen ID, operation type, page navigation info) from the web framework. |
| `HKTGI_SYSID` (from `JKKCommonConst`) | The SYSID key for the handover data element — identifies the system ID associated with the handover record from the prior screen. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getScreenInfo` | JCCWebCommon | - | Retrieves screen configuration context (screen ID, page, operation type) for the current web request |
| R | `X31SDataBeanAccess.getDataBeanArray` | X31SDataBeanAccess | - | Retrieves the `CUST_KEI_HKTGI_LIST` data bean array from the service form bean |
| R | `X31SDataBeanAccessArray.getDataBean` | X31SDataBeanAccessArray | - | Retrieves the first element (index 0) of the handover data list |
| R | `X31SDataBeanAccess.sendMessageString` (GET) | X31SDataBeanAccess | - | Reads string values from the handover data element (source fields with `_04` suffix) |
| R | `X31SDataBeanAccess.sendMessageString` (GET) | X31SDataBeanAccess | - | Reads `HKTGI_SYSID` from the handover element |
| W | `X31SDataBeanAccess.sendMessageString` (SET) | X31SDataBeanAccess | - | Writes transferred values into the service form bean fields |
| R | `X31SDataBeanAccess.sendMessageString` (GET) | X31SDataBeanAccess | - | Reads address components for building composite full-address strings |
| W | `X31SDataBeanAccess.sendMessageString` (SET) | X31SDataBeanAccess | - | Writes the composed full-address strings (`KAISEN_ADDR`, `KEISHA_ADDR`) |

**No database or CBS operations are performed** by this method. It is purely an in-memory form bean data transfer and composition operation.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Controller:KKW00191SFLogic.actionInit | `actionInit()` -> `initServiceFormBean(svcFormBean)` | `sendMessageString [W] svcFormBean fields (no DB)` |

**Downstream trace:** This method has no terminal database operations. All `sendMessageString` calls with `DATABEAN_SET_VALUE` write to the in-memory form bean, which is then used to render the Hikikomi Torikeshi (Light Modification Cancellation) confirmation screen.

## 6. Per-Branch Detail Blocks

This method has **no conditional branches** (no if/else, switch, loops, or try-catch). The entire method executes as a single linear block.

### Block 1 — LINEAR (single path) (L305)

> Initializes screen context and retrieves handover data for field transfer.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.getScreenInfo(this);` // Fetches screen configuration context (screen ID, page, op type) |
| 2 | DECL | `X31SDataBeanAccessArray cUST_KEI_HKTGI_LIST;` // Declares handover data list variable |
| 3 | DECL | `X31SDataBeanAccess hktgElement;` // Declares handover data element variable |
| 4 | CALL | `cUST_KEI_HKTGI_LIST = svcFormBean.getDataBeanArray(KKW00191SFConst.CUST_KEI_HKTGI_LIST);` // Retrieves handover data array from svcFormBean |
| 5 | CALL | `hktgElement = cUST_KEI_HKTGI_LIST.getDataBean(0);` // Gets first element (index 0) of handover list |
| 6 | CALL | `sysidVal = hktgElement.sendMessageString(JKKCommonConst.HKTGI_SYSID, X31CWebConst.DATABEAN_GET_VALUE);` // Stores SYSID in instance field |
| 7 | SET | `sendMessage(SYSID, SYSID_04)` // Transfers SYSID from source to destination form bean |
| 8 | SET | `sendMessage(SVC_KEI_NO, SVC_KEI_NO_04)` // Service detail number |
| 9 | SET | `sendMessage(KAISEN_PLACE_STATE_NM, KAISEN_PLACE_STATE_NM_04)` // Construction site prefecture name |
| 10 | SET | `sendMessage(KAISEN_PLACE_CITY_NM, KAISEN_PLACE_CITY_NM_04)` // Construction site city name |
| 11 | SET | `sendMessage(KAISEN_PLACE_OAZTSU_NM, KAISEN_PLACE_OAZTSU_NM_04)` // Construction site district name |
| 12 | SET | `sendMessage(KAISEN_PLACE_AZCHO_NM, KAISEN_PLACE_AZCHO_NM_04)` // Construction site block/cho name |
| 13 | SET | `sendMessage(KAISEN_PLACE_BNCHIGO, KAISEN_PLACE_BNCHIGO_04)` // Construction site branch code |
| 14 | SET | `sendMessage(CUST_NM, CUST_NM_04)` // Customer name |
| 15 | SET | `sendMessage(CUST_KANA, CUST_KANA_04)` // Customer name (kana/pronunciation) |
| 16 | SET | `sendMessage(KEISHA_STATE_NM, KEISHA_STATE_NM_04)` // Contracting party prefecture name |
| 17 | SET | `sendMessage(KEISHA_CITY_NM, KEISHA_CITY_NM_04)` // Contracting party city name |
| 18 | SET | `sendMessage(KEISHA_OAZTSU_NM, KEISHA_OAZTSU_NM_04)` // Contracting party district name |
| 19 | SET | `sendMessage(KEISHA_AZCHO_NM, KEISHA_AZCHO_NM_04)` // Contracting party block/cho name |
| 20 | SET | `sendMessage(KEISHA_BNCHIGO, KEISHA_BNCHIGO_04)` // Contracting party branch code |
| 21 | SET | `sendMessage(KEISHA_TELNO, KEISHA_TELNO_04)` // Contracting party telephone number |

### Block 2 — LINEAR (address composition: construction site) (L373)

> Builds the full construction site address by concatenating individual address components.

| # | Type | Code |
|---|------|------|
| 1 | SET | `buffer = new StringBuffer();` // Creates new string buffer |
| 2 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KAISEN_PLACE_STATE_NM, GET));` // Prefecture |
| 3 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KAISEN_PLACE_CITY_NM, GET));` // City |
| 4 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KAISEN_PLACE_OAZTSU_NM, GET));` // District |
| 5 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KAISEN_PLACE_AZCHO_NM, GET));` // Block/cho |
| 6 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KAISEN_PLACE_BNCHIGO, GET));` // Branch code |
| 7 | SET | `sendMessage(KAISEN_ADDR, buffer.toString());` // Sets composed full construction site address |

### Block 3 — LINEAR (address composition: contracting party) (L384)

> Builds the full contracting party address by concatenating individual address components.

| # | Type | Code |
|---|------|------|
| 1 | SET | `buffer = new StringBuffer();` // Resets buffer (reuses variable) |
| 2 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KEISHA_STATE_NM, GET));` // Prefecture |
| 3 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KEISHA_CITY_NM, GET));` // City |
| 4 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KEISHA_OAZTSU_NM, GET));` // District |
| 5 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KEISHA_AZCHO_NM, GET));` // Block/cho |
| 6 | CALL | `buffer.append(hktgElement.sendMessageString(KKW00191SFConst.KEISHA_BNCHIGO, GET));` // Branch code |
| 7 | SET | `sendMessage(KEISHA_ADDR, buffer.toString());` // Sets composed full contracting party address |

### Block 4 — LINEAR (inspection DSL completion code transfer) (L391)

> Transfers the inspection DSL completion code (added per change request IT1-2013-0000148).

| # | Type | Code |
|---|------|------|
| 1 | SET | `sendMessage(SHOSA_DSL_FIN_CD, SHOSA_DSL_FIN_CD_04);` // Copies inspection DSL completion code from prior screen |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `HKTGI` | Field prefix | Handover data — the transfer of form data from one screen flow to another within the same transaction session |
| `HKTGI_SYSID` | Field | Handover SYSID — the system identifier for the handover record, carried from the prior screen |
| `SYSID` | Field | System ID — the system identifier set in the destination form bean |
| `CUST_KEI_HKTGI_LIST` | Field | Customer detail handover list — the data bean array containing handover data from the prior screen (screen 04) |
| `SVC_KEI_NO` | Field | Service detail number — the unique identifier for a service contract line item |
| `KAISEN` | Field prefix | Construction site — the physical location where telecom equipment/installation work is performed (Kaisen = 工事 = construction/work) |
| `KAISEN_PLACE_STATE_NM` | Field | Construction site prefecture name — the prefecture (state-level) part of the installation address |
| `KAISEN_PLACE_CITY_NM` | Field | Construction site city name — the city part of the installation address |
| `KAISEN_PLACE_OAZTSU_NM` | Field | Construction site district name — the district/cho-me part of the installation address |
| `KAISEN_PLACE_AZCHO_NM` | Field | Construction site block number — the block/cho number part of the installation address |
| `KAISEN_PLACE_BNCHIGO` | Field | Construction site branch code — a code identifying a specific branch or subsection of the address |
| `KAISEN_ADDR` | Field | Construction site full address — composed full address string built by concatenating the five address components |
| `CUST_NM` | Field | Customer name — the account holder's name (kanji/hanzi) |
| `CUST_KANA` | Field | Customer name (kana) — the phonetic reading of the customer's name in hiragana/katakana |
| `KEISHA` | Field prefix | Contracting party — the legal entity or person who signed the service contract (Keisha = 契約者 = contracting party) |
| `KEISHA_STATE_NM` | Field | Contracting party prefecture name — the prefecture part of the contracting party's registered address |
| `KEISHA_CITY_NM` | Field | Contracting party city name — the city part of the contracting party's address |
| `KEISHA_OAZTSU_NM` | Field | Contracting party district name — the district part of the contracting party's address |
| `KEISHA_AZCHO_NM` | Field | Contracting party block number — the block part of the contracting party's address |
| `KEISHA_BNCHIGO` | Field | Contracting party branch code — the branch code of the contracting party's address |
| `KEISHA_TELNO` | Field | Contracting party telephone number — phone number of the contracting party |
| `KEISHA_ADDR` | Field | Contracting party full address — composed full address string built by concatenating the five address components |
| `SHOSA_DSL_FIN_CD` | Field | Inspection DSL completion code — a code indicating the completion status of DSL inspection work (Shosa = 調査 = inspection; DSL = Digital Subscriber Line) |
| `_04` | Field suffix | Screen 04 indicator — denotes that the value originates from screen 04 (the light modification cancellation completion screen) |
| `_CD` | Field suffix | Completion/Finish code — a classification code; `_FIN_CD` specifically indicates a completion status code |
| `Hikikomi Torikeshi` | Business term | Light Modification Cancellation — the business operation of canceling a previously submitted light modification request for a telecom service line |
| `X31SDataBeanAccess` | Technical class | Service form data bean access class — the framework class providing typed get/set operations for form data fields |
| `X31SDataBeanAccessArray` | Technical class | Service form data bean array — a collection wrapper for multiple data bean instances (used for list-type fields) |
| `JCCWebCommon` | Technical class | Web common utility — shared framework utility for screen context management and common web operations |
| `DATABEAN_GET_VALUE` | Technical constant | Operation code to retrieve a value from a data bean field |
| `DATABEAN_SET_VALUE` | Technical constant | Operation code to set a value in a data bean field |
| `JCCWebBusinessLogic` | Technical class | Parent business logic base class — the common business logic framework base for all web screen logic classes |
| `KKW00191SF` | Module prefix | Screen module code — the Hikikomi Torikeshi (Light Modification Cancellation) screen module |
| `JPCOnlineMessageConstant` | Technical class | Online message constant definitions — framework class for predefined screen messages |
| `KKSV0408_KKSV0408OPDBMapper` | Technical class | Screen 0408 database mapper — database access mapper for the prior screen's data operations |
