# Business Logic — KKW02410SFLogic.setHktgiBean() [80 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02410SF.KKW02410SFLogic` |
| Layer | Controller (webview logic layer) |
| Module | `KKW02410SF` (Package: `eo.web.webview.KKW02410SF`) |

## 1. Role

### KKW02410SFLogic.setHktgiBean()

This method performs DataBean configuration for the **Femto Cell Option Update** screen (KKW02410SF), a business operation within K-Opticom's contract management system responsible for updating femtocell-related service options. Specifically, it transfers customer contract inheritance data from a source DataBean array (`hktgiBean`) into the screen's primary DataBean (`paramBean[0]`) for display and further processing. The method implements a **data transfer/mapping pattern**: it reads a single customer contract inheritance record and an associated list of modification reasons, then populates the screen's DataBean with all relevant fields including operation date, system ID, service contract number, transfer category, and opt-in service contract number. It serves as a **shared utility** within the femtocell option module — called directly from the screen's `actionInit()` entry point during page initialization, ensuring the screen always has pre-populated data to display to the user on first load.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setHktgiBean(paramBean)"])

    START --> GET_OPE_DATE["Get Operation Date: JCCWebCommon.getOpeDate(this, null)"]

    GET_OPE_DATE --> SET_USE_YMD["SET USE_YMD in paramBean[0]"]

    SET_USE_YMD --> GET_HKTGI_LIST["Get Customer Contract Inheritance List from paramBean[0]"]

    GET_HKTGI_LIST --> GET_FIRST_HKTGI["Get First HKTGI Bean from List (index 0)"]

    GET_FIRST_HKTGI --> GET_SYSID["GET SYSID from hktgiBean"]

    GET_SYSID --> SET_SYSID["SET SYSID in paramBean[0]"]

    SET_SYSID --> GET_SVC_KEI_NO["GET SVC_KEI_NO from hktgiBean"]

    GET_SVC_KEI_NO --> SET_SVC_KEI_NO["SET SVC_KEI_NO in paramBean[0]"]

    SET_SVC_KEI_NO --> GET_IDO_DIV["GET IDO_DIV from hktgiBean"]

    GET_IDO_DIV --> SET_IDO_DIV["SET IDO_DIV in paramBean[0]"]

    SET_IDO_DIV --> GET_IDO_RSN_LIST["Get Modification Reason List from paramBean[0]"]

    GET_IDO_RSN_LIST --> GET_IDO_RSN_MEMO["GET IDO_RSN_MEMO from hktgiBean"]

    GET_IDO_RSN_MEMO --> GET_IDO_RSN_CNT["GET Modification Reason Code Count from hktgiBean"]

    GET_IDO_RSN_CNT --> LOOP_START["Initialize Loop: i = 0"]

    LOOP_START --> CHECK_LIMIT{"i < cnt?"}

    CHECK_LIMIT -- Yes --> CHECK_IDO_RSN_BEAN["ido_rsn_list.getCount() - 1 >= i?"]

    CHECK_LIMIT -- No --> END_LOOP["End Loop"]

    CHECK_IDO_RSN_BEAN -- Yes --> GET_EXISTING_BEAN["Get existing ido_rsn_bean at index i"]

    CHECK_IDO_RSN_BEAN -- No --> ADD_NEW_BEAN["Create new ido_rsn_bean via addDataBean()"]

    GET_EXISTING_BEAN --> NULL_CHECK{"ido_rsn_bean == null?"}

    ADD_NEW_BEAN --> NULL_CHECK

    NULL_CHECK -- Yes --> SKIP["Continue to next iteration"]

    NULL_CHECK -- No --> GET_IDO_RSN_CD["GET IDO_RSN_CD from hktgiBean with index i"]

    GET_IDO_RSN_CD --> SET_IDO_RSN_CD["SET IDO_RSN_CD in ido_rsn_bean"]

    SET_IDO_RSN_CD --> SET_IDO_RSN_MEMO["SET IDO_RSN_MEMO in ido_rsn_bean"]

    SET_IDO_RSN_MEMO --> INC_LOOP["Increment i"]

    INC_LOOP --> CHECK_LIMIT

    SKIP --> INC_LOOP

    END_LOOP --> GET_OP_SVC["GET OP_SVC_KEI_NO from hktgiBean"]

    GET_OP_SVC --> SET_OP_SVC["SET OP_SVC_KEI_NO in paramBean[0]"]

    SET_OP_SVC --> GET_TRAN_DIV["GET TRAN_DIV from hktgiBean"]

    GET_TRAN_DIV --> SET_TRAN_DIV["SET TRAN_DIV in paramBean[0]"]

    SET_TRAN_DIV --> GET_MSKM_NO["GET MSKM_NO from hktgiBean"]

    GET_MSKM_NO --> SET_MSKM_NO["SET MSKM_NO in paramBean[0]"]

    SET_MSKM_NO --> GET_MSKM_DTL["GET MSKM_DTL_NO from hktgiBean"]

    GET_MSKM_DTL --> SET_MSKM_DTL["SET MSKM_DTL_NO in paramBean[0]"]

    SET_MSKM_DTL --> END_NODE(["Return / Next"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `X31SDataBeanAccess[]` | The primary screen DataBean array that carries all data to/from the KKW02410SF (Femtocell Option Update) screen. `paramBean[0]` is the root DataBean holding operation date, SYSID, service contract number, transfer category, modification reasons list, opt-in service contract number, processing division, application number, and application detail number. |

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

| Source | Type | Business Description |
|--------|------|---------------------|
| `this` (KKW02410SFLogic instance) | `JCCWebBusinessLogic` | Passed to `JCCWebCommon.getOpeDate()` to retrieve the current operation date from the system context |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getOpeDate` | - | - | Reads the current operation date from the system context |
| R | `X31SDataBeanAccess.getDataBeanArray` | - | - | Retrieves the Customer Contract Inheritance List DataBeanArray from paramBean[0] |
| R | `X31SDataBeanAccessArray.getDataBean` | - | - | Retrieves the first customer contract inheritance bean (index 0) from the list |
| R | `X31SDataBeanAccess.sendMessageString` | - | - | Gets string values (SYSID, SVC_KEI_NO, IDO_DIV, IDO_RSN_MEMO, IDO_RSN_CD, OP_SVC_KEI_NO, TRAN_DIV, MSKM_NO, MSKM_DTL_NO) from the hktgiBean source |
| R | `X31SDataBeanAccess.sendMessage` | - | - | Gets the count of modification reason codes from hktgiBean |
| R | `X31SDataBeanAccessArray.getDataBean` | - | - | Retrieves an existing modification reason bean from the list by index |
| C | `X31SDataBeanAccessArray.addDataBean` | - | - | Creates a new modification reason bean in the list when the list does not yet have an entry at the given index |
| SET | `X31SDataBeanAccessArray.getCount` | - | - | Gets the current count of beans in the modification reason list for conditional check |
| SET | `X31SDataBeanAccess.sendMessageString` | - | - | Sets string values (USE_YMD, SYSID, SVC_KEI_NO, IDO_DIV, IDO_RSN_CD, IDO_RSN_MEMO, OP_SVC_KEI_NO, TRAN_DIV, MSKM_NO, MSKM_DTL_NO) in paramBean[0] or ido_rsn_bean |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method:KKW02410SFLogic.actionInit() | `actionInit()` -> `setHktgiBean(paramBean)` | `paramBean[0].sendMessageString [SET] USE_YMD`, `paramBean[0].sendMessageString [SET] SYSID`, `paramBean[0].sendMessageString [SET] SVC_KEI_NO`, `paramBean[0].sendMessageString [SET] IDO_DIV`, `ido_rsn_bean.sendMessageString [SET] IDO_RSN_CD`, `ido_rsn_bean.sendMessageString [SET] IDO_RSN_MEMO`, `paramBean[0].sendMessageString [SET] OP_SVC_KEI_NO`, `paramBean[0].sendMessageString [SET] TRAN_DIV`, `paramBean[0].sendMessageString [SET] MSKM_NO`, `paramBean[0].sendMessageString [SET] MSKM_DTL_NO` |

**Note:** There are multiple other modules (KKA16801SF, KKA17001SF, KKA14701SF, KKA14901SF, KKA14401SF, KKW02510SF, KKW02532SF, KKW02507SF, KKW00858SF, KKW01034SF) that have their own copies of a `setHktgiBean()` method with the same signature, indicating this is a reusable pattern across multiple screen logic classes. The callers listed above are specific to `KKW02410SFLogic`'s own private `setHktgiBean()` method.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET/EXEC] `(Retrieve and set operation date)` (L233)

> Gets the current operation date from the system and sets it into the primary DataBean.

| # | Type | Code |
|----|------|------|
| 1 | CALL | `use_ymd = JCCWebCommon.getOpeDate(this, null)` // Get operation date [-> JCCWebCommon.getOpeDate] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02410SFConst.USE_YMD, X31CWebConst.DATABEAN_SET_VALUE, use_ymd)` // Set operation date [-> USE_YMD="運用年月日"] |

**Block 2** — [EXEC] `(Retrieve customer contract inheritance list)` (L237)

> Gets the Customer Contract Inheritance List from the primary DataBean and retrieves the first (and only) inheritance record.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `hktgilist = paramBean[0].getDataBeanArray(KKW02410SFConst.CUST_KEI_HKTGI_LIST)` // Get inheritance list [-> CUST_KEI_HKTGI_LIST="顧客契約引継リスト"] |
| 2 | EXEC | `hktgiBean = hktgilist.getDataBean(0)` // Get first inheritance record |

**Block 3** — [IF/ELSE chain — Field copy: SYSID] `(Copy SYSID from source to target)` (L240)

> Extracts the SYSID from the source hktgiBean and sets it into the primary DataBean.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `sysid = hktgiBean.sendMessageString(KKW02410SFConst.SYSID_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get SYSID from source [-> SYSID_01="SYSID"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02410SFConst.SYSID, X31CWebConst.DATABEAN_SET_VALUE, sysid)` // Set SYSID in target [-> SYSID="SYSID"] |

**Block 4** — [IF/ELSE chain — Field copy: SVC_KEI_NO] `(Copy service contract number)` (L244)

> Extracts the service contract number from the source and sets it into the target.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `svc_kei_no = hktgiBean.sendMessageString(KKW02410SFConst.SVC_KEI_NO_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get from source [-> SVC_KEI_NO_01="サービス契約番号"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02410SFConst.SVC_KEI_NO, X31CWebConst.DATABEAN_SET_VALUE, svc_kei_no)` // Set in target [-> SVC_KEI_NO="サービス契約番号"] |

**Block 5** — [IF/ELSE chain — Field copy: IDO_DIV] `(Copy transfer category)` (L248)

> Extracts the transfer/movement category code from the source and sets it into the target.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `ido_div = hktgiBean.sendMessageString(KKW02410SFConst.IDO_DIV_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get from source [-> IDO_DIV_01="異動区分"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02410SFConst.IDO_DIV, X31CWebConst.DATABEAN_SET_VALUE, ido_div)` // Set in target [-> IDO_DIV="異動区分"] |

**Block 6** — [EXEC] `(Retrieve modification reason list)` (L252)

> Gets the Modification Reason List container from the primary DataBean. This list will be populated in the following loop.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `ido_rsn_list = paramBean[0].getDataBeanArray(KKW02410SFConst.IDO_RSN_LIST)` // Get modification reason list [-> IDO_RSN_LIST="異動理由リスト"] |

**Block 7** — [EXEC — nested] `(Extract memo and count for modification reasons)` (L255–L259)

> Gets the shared modification reason memo text and the count of modification reason codes from the source bean. These will be used in the for-loop to populate the target list.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `ido_rsn_memo = hktgiBean.sendMessageString(KKW02410SFConst.IDO_RSN_MEMO_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get memo from source [-> IDO_RSN_MEMO_01="異動理由メモ"] |
| 2 | EXEC | `cnt = (Integer)hktgiBean.sendMessage(KKW02410SFConst.IDO_RSN_CD_01, X31CWebConst.DATABEAN_GET_COUNT)` // Get reason code count [-> IDO_RSN_CD_01="異動理由コード"] |

**Block 8** — [FOR LOOP] `(Iterate over modification reason codes)` (L261–L289)

> Loops through each modification reason code index. For each iteration, it ensures the target list has a bean at that index (creating one if needed), then copies the reason code and shared memo text into the target bean.

| # | Type | Code |
|----|------|------|
| 1 | SET | `for(int i = 0; i < cnt; i++)` // Loop count = cnt (reason code count) |

**Block 8.1** — [IF/ELSE-IF/ELSE chain — Bean existence check] `(Ensure target bean exists at index i)` (L263–L270)

> Checks whether the modification reason list already has a bean at index `i`. If yes, retrieves the existing bean. If no, creates a new one.

| # | Type | Code |
|----|------|------|
| 1 | SET | `ido_rsn_bean = null` // Initialize |
| 2 | IF | `ido_rsn_list.getCount() - 1 >= i` // Does list have enough beans? |
| 3 | EXEC | `ido_rsn_bean = ido_rsn_list.getDataBean(i)` // Get existing bean [-> GET] |
| 4 | ELSE | `ido_rsn_bean = ido_rsn_list.addDataBean()` // Create new bean [-> ADD/C] |

**Block 8.2** — [IF] `(Null guard for bean)` (L272–L275)

> If for some reason the bean is null (edge case), skip this iteration.

| # | Type | Code |
|----|------|------|
| 1 | IF | `ido_rsn_bean == null` |
| 2 | EXEC | `continue` // Skip to next iteration |

**Block 8.3** — [EXEC — nested] `(Copy modification reason code and memo)` (L279–L285)

> Gets the modification reason code at index `i` from the source bean and sets it into the target bean, along with the shared memo text.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `ido_rsn_cd = hktgiBean.sendMessageString(KKW02410SFConst.IDO_RSN_CD_01, X31CWebConst.DATABEAN_GET_VALUE, i)` // Get reason code at index i [-> IDO_RSN_CD_01="異動理由コード"] |
| 2 | SET | `ido_rsn_bean.sendMessageString(KKW02410SFConst.IDO_RSN_CD_02, X31CWebConst.DATABEAN_SET_VALUE, ido_rsn_cd)` // Set reason code in target [-> IDO_RSN_CD_02="異動理由コード"] |
| 3 | SET | `ido_rsn_bean.sendMessageString(KKW02410SFConst.IDO_RSN_MEMO_02, X31CWebConst.DATABEAN_SET_VALUE, ido_rsn_memo)` // Set memo in target [-> IDO_RSN_MEMO_02="異動理由メモ"] |

**Block 9** — [IF/ELSE chain — Field copy: OP_SVC_KEI_NO] `(Copy opt-in service contract number)` (L292)

> Extracts the opt-in service contract number (at index 0) from the source and sets it into the target.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `op_svc_kei_no = hktgiBean.sendMessageString(KKW02410SFConst.OP_SVC_KEI_NO_01, X31CWebConst.DATABEAN_GET_VALUE, 0)` // Get from source [-> OP_SVC_KEI_NO_01="オプションサービス契約番号"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02410SFConst.OP_SVC_KEI_NO, X31CWebConst.DATABEAN_SET_VALUE, op_svc_kei_no)` // Set in target [-> OP_SVC_KEI_NO="オプションサービス契約番号"] |

**Block 10** — [IF/ELSE chain — Field copy: TRAN_DIV] `(Copy processing division)` (L296)

> Extracts the processing division/category from the source and sets it into the target.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `tran_div = hktgiBean.sendMessageString(KKW02410SFConst.TRAN_DIV_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get from source [-> TRAN_DIV_01="処理区分"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02410SFConst.TRAN_DIV, X31CWebConst.DATABEAN_SET_VALUE, tran_div)` // Set in target [-> TRAN_DIV="処理区分"] |

**Block 11** — [IF/ELSE chain — Field copy: MSKM_NO] `(Copy application number)` (L300)

> Extracts the application number from the source and sets it into the target.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `mskm_no = hktgiBean.sendMessageString(KKW02410SFConst.MSKM_NO_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get from source [-> MSKM_NO_01="申請番号"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02410SFConst.MSKM_NO, X31CWebConst.DATABEAN_SET_VALUE, mskm_no)` // Set in target [-> MSKM_NO="申請番号"] |

**Block 12** — [IF/ELSE chain — Field copy: MSKM_DTL_NO] `(Copy application detail number)` (L304)

> Extracts the application detail number from the source and sets it into the target.

| # | Type | Code |
|----|------|------|
| 1 | EXEC | `mskm_dtl_no = hktgiBean.sendMessageString(KKW02410SFConst.MSKM_DTL_NO_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get from source [-> MSKM_DTL_NO_01="申請詳細番号"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02410SFConst.MSKM_DTL_NO, X31CWebConst.DATABEAN_SET_VALUE, mskm_dtl_no)` // Set in target [-> MSKM_DTL_NO="申請詳細番号"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `use_ymd` | Field | Operation date (year/month/day) — the system date used for processing this operation |
| `SYSID` | Field | System ID — internal identifier for the customer contract inheritance record |
| `svc_kei_no` | Field | Service contract number — unique identifier for a service contract line |
| `ido_div` | Field | Transfer/movement category — indicates the type of service change (e.g., transfer, cancellation, renewal) |
| `ido_rsn_cd` | Field | Modification reason code — code specifying why a service modification is being made |
| `ido_rsn_memo` | Field | Modification reason memo — free-text description of the modification reason |
| `op_svc_kei_no` | Field | Opt-in service contract number — identifier for an optional/add-on service contract |
| `tran_div` | Field | Processing division — categorizes the type of processing transaction |
| `mskm_no` | Field | Application number — the main application/reference number for this request |
| `mskm_dtl_no` | Field | Application detail number — the sub-item number within an application |
| `CUST_KEI_HKTGI_LIST` | Field | Customer contract inheritance list — a DataBeanArray carrying inherited contract data from a prior screen or session |
| `IDO_RSN_LIST` | Field | Modification reason list — a DataBeanArray carrying multiple modification reason entries for the service change |
| USE_YMD | Constant | Operation date key — used to store the processing date in the DataBean |
| IDO_DIV | Constant | Transfer category key — field name for the movement/transfer type discriminator |
| TRAN_DIV | Constant | Processing division key — field name for transaction type categorization |
| MSKM_NO | Constant | Application number key — field name for the application reference number |
| MSKM_DTL_NO | Constant | Application detail number key — field name for the application sub-item number |
| JCCWebCommon | Class | Common web utility class — provides shared screen operations including `getOpeDate()` for retrieving the operation date |
| X31SDataBeanAccess | Class | Single DataBean access wrapper — interface for getting/setting string values and counts in a DataBean via `sendMessageString()` and `sendMessage()` |
| X31SDataBeanAccessArray | Class | DataBean array wrapper — manages a list of DataBeans with `getDataBean(index)`, `addDataBean()`, and `getCount()` operations |
| KKW02410SF | Module | Femtocell Option Update screen module — part of K-Opticom's contract management system for handling femtocell-related service option changes |
| 異動 (Ido) | Business term | Transfer/movement — a service change operation where a contract is transferred, moved, or modified |
| 契約引継 (Keiyaku Hikitsuke) | Business term | Contract inheritance — the process of carrying over customer contract data from a previous record/session to a new one |
| 申請 (Shinsei) | Business term | Application — the request or order for a service change, registered with an application number and detail number |
| オプションサービス (Opt-service) | Business term | Optional/add-on service — supplementary services beyond the base service offering (e.g., premium features) |
